texts
sequence | tags
sequence |
---|---|
[
"Constructing TypeTags of higher-kinded types",
"Given a simple parametrized type like class LK[A], I can write\n\n// or simpler def tagLK[A: TypeTag] = typeTag[LK[A]]\ndef tagLK[A](implicit tA: TypeTag[A]) = typeTag[LK[A]]\n\ntagLK[Int] == typeTag[LK[Int]] // true\n\n\nNow I'd like to write an analogue for class HK[F[_], A]:\n\ndef tagHK[F[_], A](implicit ???) = typeTag[HK[F, A]] \n// or some other implementation?\n\ntagHK[Option, Int] == typeTag[HK[Option, Int]]\n\n\nIs this possible? I've tried\n\ndef tagHK[F[_], A](implicit tF: TypeTag[F[_]], tA: TypeTag[A]) = typeTag[HK[F, A]]\n\ndef tagHK[F[_], A](implicit tF: TypeTag[F], tA: TypeTag[A]) = typeTag[HK[F, A]]\n\n\nbut neither works for the obvious reasons (in the first case F[_] is the existential type instead of the higher-kinded one, in the second TypeTag[F] doesn't compile).\n\nI suspect the answer is \"it's impossible\", but would be very happy if it isn't.\n\nEDIT: we currently use WeakTypeTags as follows (slightly simplified):\n\ntrait Element[A] {\n val tag: WeakTypeTag[A]\n // other irrelevant methods\n}\n\n// e.g.\ndef seqElement[A: Element]: Element[Seq[A]] = new Element[Seq[A]] {\n val tag = {\n implicit val tA = implicitly[Element[A]].tag\n weakTypeTag[Seq[A]]\n }\n}\n\ntrait Container[F[_]] {\n def lift[A: Element]: Element[F[A]]\n\n // note that the bound is always satisfied, but we pass the \n // tag explicitly when this is used\n def tag[A: WeakTypeTag]: WeakTypeTag[F[A]]\n}\n\nval seqContainer: Container[Seq] = new Container[Seq] {\n def lift[A: Element] = seqElement[A]\n}\n\n\nAll of this works fine if we replace WeakTypeTag with TypeTag. Unfortunately, this doesn't:\n\nclass Free[F[_]: Container, A: Element]\n\ndef freeElement[F[_]: Container, A: Element] {\n val tag = {\n implicit val tA = implicitly[Element[A]].tag\n // we need to get something like TypeTag[F] here\n // which could be obtained from the implicit Container[F]\n typeTag[Free[F, A]]\n }\n}"
] | [
"scala",
"higher-kinded-types",
"scala-reflect"
] |
[
"Compress video in android using using MediaCodec",
"I am working on a project where i need to compress the video uploaded before sending it to server. I found similar questions like this (Compress Videos using android MediaCodec api) where turorial he mentioned redirects to an invalid page( https://software.intel.com/en-us/articles/intel-inde-media-pack-for-android-tutorials). Other similar questions are redirecting to some libraries like silicompress. \n\nIs there a simple way to achieve video compression using MediaCodec in android. A simple function where i can input \"file url\" and get the \"video bytes data\" as output in java?"
] | [
"android",
"compression",
"decode",
"encode",
"android-mediacodec"
] |
[
"Randomly generate numbers based on given probabilities R",
"I need help creating a for loop to fill in a 5X5 table using R. Each row will be one observation without replacement. The number range is 1:75, and respectively I have probabilities for each of these numbers. So how would I go about creating a random number generating code that takes into account the specific probability for each number?"
] | [
"r",
"random",
"random-sample"
] |
[
"Prevent MySQL Duplicate Insert",
"I have a mysql table with a auto incremented key. I need a way to only insert into that table if the table does not contain the row I am inserting. INSERT IGNORE and INSERT ON DUPLICATE KEY UPDATE won't work because the auto incremented key will cause the row to always be different. What is another way I can insert the following line only if there is no duplicate row? Thanks.\n\nINSERT INTO TableName (column1, column2, column3) VALUES (\"value1\", \"value2\", \"value3\");"
] | [
"mysql"
] |
[
"WPF - Adding a Tooltip to a GridViewColumn with DisplayMemberBinding",
"I have a TextBlock inside a GridViewColumn that requires a DisplayMemberBinding. The TextBlock is completely unaccounted for as DisplayMemberBinding takes precedence over CellTemplate. However, the Textblock has a ToolTip that I'd like to be displayed that's specific to the column itself. I was able to move most Style settings outside the CellTemplate as they are generic for all columns, but the ToolTip cannot be taken outside as it requires a binding and is unique to each column.\n\nHere is one of the columns. Everything within the GridViewColumn.CellTemplate tags is removable due to the DisplayMemberBinding taking precedence.\n\n <GridViewColumn Header=\"Templates\"\n Width=\"200\" \n DisplayMemberBinding=\"{Binding Path=Name}>\n <GridViewColumn.CellTemplate> \n <DataTemplate DataType=\"{x:Type request:ModelDocument}\">\n <TextBlock ToolTip=\"{Binding Name}\"/>\n </DataTemplate>\n </GridViewColumn.CellTemplate>\n </GridViewColumn>\n\n\nThe way I've done other Style properties is as follows. This was done before the GridView (the GridView is a child of the ListView):\n\n <ListView.Resources>\n <Style TargetType=\"TextBlock\">\n <Setter Property=\"TextTrimming\" Value=\"CharacterEllipsis\" />\n <Setter Property=\"TextWrapping\" Value=\"NoWrap\"/>\n <Setter Property=\"FontFamily\" Value=\"Segue UI Light\" />\n <Setter Property=\"FontSize\" Value=\"13\" />\n </Style>\n </ListView.Resources>\n\n\nHow can I add a unique ToolTip to each column without removing the DisplayMemberBinding?"
] | [
"c#",
"wpf",
"xaml"
] |
[
"Android Studio - UNEXPECTED TOP-LEVEL EXCEPTION: on importing a eclipse project",
"I have imported a project in Android Studio. I am attempting to run the code but the app fails with the following errors, not sure what the problem is.\n\nThese are the libraries i am using.\n\ncompile 'com.android.support:appcompat-v7:21.0.3'\n\ncompile 'com.google.android.gms:play-services:+'\ncompile files('libs/android-async-http-1.4.6.jar')\ncompile files('libs/android-query-full.0.26.8.jar')\ncompile files('libs/android-viewbadger.jar')\ncompile files('libs/Android-WebRequest.jar')\ncompile files('libs/AndroidSwipeLayout-v1.1.6.jar')\ncompile files('libs/google-api-client-1.20.0.jar')\n\ncompile files('libs/google-api-services-bigquery-v2-rev200-1.20.0.jar')\ncompile files('libs/google-http-client-1.20.0.jar')\ncompile files('libs/google-http-client-jackson2-1.20.0.jar')\ncompile files('libs/google-oauth-client-1.20.0.jar')\ncompile files('libs/jackson-core-2.1.3.jar')\ncompile files('libs/libGoogleAnalyticsServices.jar')\ncompile files('libs/nineoldandroids-2.4.0.jar')\ncompile files('libs/Parse-1.9.2.jar')\n\ncompile files('libs/YouTubeAndroidPlayerApi.jar')\ncompile 'com.facebook.android:facebook-android-sdk:4.1.0'\ncompile files('libs/com-crashlytics-sdk-android_answers-classes.jar')\ncompile files('libs/com-crashlytics-sdk-android_beta-classes.jar')\ncompile files('libs/com-crashlytics-sdk-android_crashlytics-classes.jar')\ncompile files('libs/io-fabric-sdk-android_fabric-classes.jar')\n\n\nand error i am getting is\n\nError:Execution failed for task ':app:dexDebug'.\ncom.android.ide.common.internal.LoggedErrorException: Failed to run command:\n C:\\Users\\ch-e01062\\AppData\\Local\\Android\\android-sdk\\build-tools\\23.0.0-preview\\dx.bat --dex --no-optimize --output C:\\Users\\ch-e01062\\Downloads\\FreeB2\\app\\build\\intermediates\\dex\\debug --input-list=C:\\Users\\ch-e01062\\Downloads\\FreeB2\\app\\build\\intermediates\\tmp\\dex\\debug\\inputList.txt\nError Code:\n 2\nOutput:\n UNEXPECTED TOP-LEVEL EXCEPTION:\n com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/analytics/internal/Command$1;\n at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)\n at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)\n at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)\n at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)\n at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)\n at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)\n at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)\n at com.android.dx.command.dexer.Main.run(Main.java:277)\n at com.android.dx.command.dexer.Main.main(Main.java:245)\n at com.android.dx.command.Main.main(Main.java:106)\n\n\ni have tried many available solutions but nothing is working.Any help will be appreciated."
] | [
"android"
] |
[
"How to insert values into an MYSQL-Table by using Select-Statements",
"Okay, This one is pretty simmilar to my last one, but I don't get it...!\n\nI am trying the following:\n\nInsert into table b\n (Select column_1 from table_a where ID = 1),\n (Select column_2 from table_a where ID = 1),\n 0,\n (Select column_3 from table_a where ID = 1);\n\n\nBut I always get a syntax-error...!\nI think it's quite logical what I'm trying to do.\n\nGreetz from Germany and thx for your answers!"
] | [
"sql",
"mysql",
"database",
"insert"
] |
[
"How to get color from Assets.xcassets?",
"I've created Color Set in Assets.xcassets, you can see it in screenshot below\n\n\n\nAnd my question is \n\nHow to get this color in code ?"
] | [
"objective-c",
"swift",
"assets",
"xcode9",
"uicolor"
] |
[
"String Enum custom class vs Enum with attributes C#",
"After investigating I concluded what string Enum with attributes is too slow and inconvenient for my purposes.\n\nSo my question - is my implementation normal or way redundant and dangerous?=)\n\npublic class StringEnum<TChildType> where TChildType: StringEnum<TChildType>, new()\n{ \n private readonly Type childType;\n private string _value;\n private readonly HashSet<string> members;\n\n public string Value\n {\n get { return _value; }\n set\n {\n if (!Contains(value))\n {\n throw new NotImplementedException(String.Format(\"Value '{0}' wasnt found in Enum\", value));\n }\n _value = value;\n }\n }\n\n public IEnumerable<string> Values\n {\n get { return members; }\n }\n public bool Contains(string value)\n {\n return members.Contains(value);\n }\n\n public static IEnumerable<string> GetValues()\n {\n return Service.GetGenericConstProperties<string>(typeof(TChildType));\n }\n\n public StringEnum()\n {\n childType = typeof(TChildType);\n members = Service.GetGenericStaticProperties<string>(childType).ToHashSet();\n if (members.Count < 2) throw new Exception(\"Fill Enum!\"); \n }\n\n public static implicit operator StringEnum<TChildType>(string str)\n {\n return new TChildType { Value = str };\n }\n\n public static implicit operator string(StringEnum<TChildType> source)\n {\n return source != null ? source.Value : null;\n }\n }\n\n\nEnum Example:\n\npublic class PrinterType : StringEnum<PrinterType>\n{\n public const string CommonPrinter = \"... ...\";\n .....\n}\n\n\nHow to use:\n\npublic class MyPrinter\n{\n public StringEnum<PrinterType> PrintType = PrinterType.CommonPrinter;\n}\n\n var list = PrinterType.GetValues().ToList();\n var e = new MyPrinter();\n var q = e.PrintType;\n if (e.PrintType == PrinterType.Ярлыков)\n ...\n if (e.PrintType.Contains(\"jh\"))\n\n\nor even like backing Field:\n\n private StringEnum<PrinterType> _type;\n public string Type {... return _type... }"
] | [
"c#",
"string",
"generics",
"enums"
] |
[
"arangosh cannot connect to endpoint when endpoint is 0.0.0.0",
"I have arangodb running on a centos root server, initially with default endpoint 127.0.0.1:8529. With this initial setup, I can easily connect via arangosh (running on the same server). \n\nIn order to access my arangodb as a web service from anywhere, I changed arangod.conf to endpoint 0.0.0.0:8425 and the arangosh.conf endpoint accordingly. From then on, I can access the web interface from anywhere without a problem but arangosh unfortunately refuses to connect on the server itself. The error message simply states \"cannot connect\". \n\nHow can I get the shell working again?"
] | [
"shell",
"arangodb"
] |
[
"Child Process exits abruptly while executing in node.js",
"So I have been working on a project and it requires me to convert the office files into PDFs and subsequently images. I've written and integrated everything into one single node.js script, but for some reason the script keeps on bypassing the synchronous child process creation. Here is the code:\n\n down.download(parsed_url);\n var f_name=obj.doc;\n var ext=f_name.slice(f_name.length-4);\n var w_path=\"C:\\\\Users\\\\Akshay\\\\Desktop\\\\conv_Scripts\\\\word_pdf.ps1\";\n var e_path=\"C:\\\\Users\\\\Akshay\\\\Desktop\\\\conv_Scripts\\\\excel_pdf.ps1\";\n var p_path=\"C:\\\\Users\\\\Akshay\\\\Desktop\\\\conv_Scripts\\\\power_pdf.ps1\";\n var file_name=f_name.slice(0,f_name.length-5);\n console.log(ext);\n console.log(f_name);\n console.log(file_name);\n\n if(ext===\"docx\"){\n word.wordpdf(w_path); \n\n } \n\n else if(ext===\"xlsx\"){\n excel.excelpdf(e_path);}\n else if(ext===\"pptx\"){\n ppt.pptpdf(p_path);\n console.log(\"Done converting to PD\");\n }\n else if(ext==\".pdf\"){\n img.img(f_name);\n\n }\n else{\n console.log(\"Can't convert to PDF\");\n }\n\ncrawlpdf.crawlpdf(file_name,function(collect){\n collect.forEach(function(col){\n img.img(col);\n console.log('Done!');\n\n\n });\n\n\nthe wordpdf,excelpdf and pptpdf functions are same in their structure. I'll write down the wordpdf module's code here:\n\nvar spawn=require('child_process').spawnSync,\n child;\n\nexports.wordpdf=function(filepath){\n child=spawn(\"powershell.exe\",[filepath]);\n\n\n};\n\n\nThe trouble is that when I execute the script,it shows me \"Done converting to PD\" (since the downloaded file was a ppt) but I do not find any pdf of the downloaded file .The .ps1 scripts in the path are already tested and there is no issue with them. If you could shed some light it would be really a massive help to me. \n\nThanks."
] | [
"node.js",
"synchronous",
"child-process"
] |
[
"Is there anything wrong with creating AutoMappper mappings in the view model static constructor?",
"Well? For example, I often do this:\n\npublic class PersonEditModel: MappedViewModel<Person>\n{\n static PersonEditModel()\n {\n Mapper.CreateMap<Person, PersonEditModel>().Bidirectional();\n }\n [HiddenInput(DisplayValue = false)]\n public int Id { get; set; }\n public string Name { get; set; }\n public LanguageCompetencyIndexModel Languages { get; set; }\n}\n\n\nI have a little helper stashed in my core set of MVC add-ins:\n\npublic static void Bidirectional<TSource, TDestination>(this IMappingExpression<TSource, TDestination> expression)\n{\n Mapper.CreateMap<TDestination, TSource>();\n}\n\n\nIt saves creating a second mapping and is great for simple capture/display scenarios.\n\nNow, instead of creating maps elsewhere, at App_Start or somewhere, I can put this view model in a library and use it anywhere, without having to remember to add a mapping for it."
] | [
"asp.net-mvc",
"asp.net-mvc-4",
"automapper"
] |
[
"Symfony3 - Phone Number",
"I know there are many ways to save a phone number in a DB but for some reason I decided to save it as 3 separate fields. Area Code, Exchange and Last4 (US number). What I am now trying to do is when I display this number in a form to the user I want it to be in one field instead of the 3 separate fields. I would probably like to reformat it in the xxx-xxx-xxxx format but I want that field to also be able to accept numerous types of formats in case the user enters it different. Ie. 1-xxx-xxx-xxxx or xxxxxxxxxx or 1xxxxxxxxxx or (xxx)xxx-xxxx and other variations. I'm just looking for some direction on where to start with this? Should I be looking at using a DataTransformer? or can this all be done somehow in validations? Don't know if this makes any difference but the number is in a OneToMany relationship with \"Users\" and I built my form using the FormCollection instructions (http://symfony.com/doc/current/cookbook/form/form_collections.html). \n\nAgain my biggest question right now is how do I get the 3 fields merged into one for the user to see in the form and then what do I use to split it back up and persist it to the database?"
] | [
"symfony"
] |
[
"PythonGTK - Can't write special characters into database",
"I wrote the following program that writes into a sqlite3 table:\nhttps://www.adrive.com/public/sJZKt3/program.py\nIt works fine except when trying to save language specific characters, for example:\nÄä,ß, ç\nWhen trying to insert into the table I get following error message:\n\nSQL Error\nYou must not use 8-bit bytestrings unless you use a text_factory that\ncan interpret 8-bit bytestrings (like text_factory = str). It is\nhighly recommended that you instead just switch your application to\nUnicode strings.\n\nHow can I fix that?"
] | [
"python",
"python-2.7",
"sqlite",
"pygtk"
] |
[
"Comparing array with db column mysql",
"I have the following query\n\n<?php \n$returnedproducts = explode(',',$result['Product']); \n$get = $db->prepare(\"SELECT * FROM Products WHERE Id IN (' . implode(\",\", :returned) . ')'\");\n$get->bindParam(':returned', $returnedproducts);\n$get->execute(); \n$results = $get ->fetchAll(); \n?>\n\n\nProduct in the database is stored like 1,2,3,4\n\nHowever I am getting an error PDO::prepare() expects parameter 2 to be array\n\nHow can I adapt my returned variable products to achieve this"
] | [
"php",
"mysql"
] |
[
"Folium HeatMap isn't coloring correctly",
"I have a bunch of points the US and I want to see a heatmap. The problem is the precision of the points is \"too good\", so everything has an amount of 1.0 and no two points are actually equal. 95% of my points are in Portland, but the map doesn't show that at all.\n\n\n\nWhat parameters in HeatMap do I need to change so Portland would be so much more red/dark/whatever than the other cities? \n\nimport pandas as pd\nimport folium\nfrom folium.plugins import HeatMap\n\ndef main():\n with open(sys.argv[1], 'r') as file: map_data = pd.read_csv(file)\n map_data = map_data[['Latitude','Longitude']].astype('float').dropna()\n\n hmap = folium.Map(location=startingLocation, zoom_start=5)\n\n hm_wide = HeatMap( list(zip(map_data.Latitude.values, \n map_data.Longitude.values)),\n min_opacity=0.02,\n radius=1, \n blur=1,\n max_zoom=5)\n\n hmap.add_child(hm_wide)\n hmap.save(os.path.join('.', 'heatmap.html'))\n\n\nAnd my data looks like this:\n\n Latitude,Longitude\n 36.20687609941977,-115.24184692135688\n 45.71099938280254,-122.62603536120108\n 45.57399590606743,-122.59763015879912\n 47.822566746145846,-122.3430923114917\n 49.24992508600481,-123.11913651236131"
] | [
"heatmap",
"folium"
] |
[
"button display on fixed header",
"I am using bootstrap fixed hear. I would like to add a button for logout. When i added ,it is warping in second line. Is there anaywa we can move it to the same line of fixed hear but right most corner ?\n\nHere is fiddle DEMO\n\n<!-- Fixed navbar -->\n <div class=\"navbar navbar-default navbar-fixed-top\">\n <div class=\"container\">\n <div class=\"navbar-header\">\n <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-collapse\">\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n </button> \n </div>\n <div class=\"collapse navbar-collapse\">\n <ul class=\"nav navbar-nav\">\n <li class=\"active\"><a href=\"#\">Home</a></li>\n <li><a href=\"#about\">About</a></li>\n <li><a href=\"#contact\">Contact</a></li>\n <li class=\"dropdown\">\n <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">Dropdown <b class=\"caret\"></b></a>\n <ul class=\"dropdown-menu\">\n <li><a href=\"#\">Action</a></li>\n <li><a href=\"#\">Another action</a></li>\n <li><a href=\"#\">Something else here</a></li>\n <li class=\"divider\"></li>\n <li class=\"dropdown-header\">Nav header</li>\n <li><a href=\"#\">Separated link</a></li>\n <li><a href=\"#\">One more separated link</a></li>\n </ul>\n </li>\n </ul>\n </div><!--/.nav-collapse -->\n <button type=\"button\" class=\"btn btn-info col-md-1 col-md-offset-10\">Log Out</button> \n </div> \n </div>"
] | [
"twitter-bootstrap",
"twitter-bootstrap-3"
] |
[
"how define a image in listview android?",
"I have a layout with this code:\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n style=\"@style/fundo\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"fill_parent\"\n android:orientation=\"vertical\" >\n\n<TextView\n android:id=\"@+id/consoleListaSimples\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"/>\n\n<ListView\n android:id=\"@+id/listaSimples\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\">\n</ListView>\n\n</LinearLayout>\n\n\nand for which item from the list a have this xml:\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\nandroid:layout_width=\"fill_parent\"\nandroid:layout_height=\"fill_parent\" android:background=\"@drawable/bk_principal_small\">\n\n<LinearLayout\n android:id=\"@+id/linearLayout2\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\">\n\n <LinearLayout\n android:id=\"@+id/linearLayout1\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\" >\n\n <ImageView\n android:id=\"@+id/imagemStatus\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:src=\"@drawable/green\"/>\n\n <TextView\n android:id=\"@+id/texto1\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:text=\"@string/padrao\" />\n </LinearLayout>\n\n</LinearLayout>\n\n</RelativeLayout>\n\n\nand to create the itens I create a SimpleAdapter that I insert the data using the method ListAdapterCreater\n\nthis.adapter = new ListAdapterCreater(list.getContext(),itensList,\nR.layout.list_simple_item,new String[] {\"text\",\"image\"},\n new int[]{R.id.texto1,R.id.imagemStatus});\n\n\nto set the text works pretty, but doesn`t work for the image.\nwhat have to be the value of image? or what should I change to works?"
] | [
"android",
"image",
"listview"
] |
[
"asp.net MVC automatic sending mail every day (without windows service)",
"I am searching for the best way to create a automatic mail system which fires every day (e.g. 00:00:00) and sends a list of mails.\n\nWhich is the best option to perform this task without slow down my application or harm to the server.\n\nI don't want to use windows service to achieve this task. because i am using a shared windows hosting and they don't allow me to run it on the server\n\nThank you."
] | [
"c#",
"asp.net",
"asp.net-mvc",
"email"
] |
[
"Running load() within Skylark macro",
"If your project depends on TensorFlow it is recommended that you add...\n\nload(\"//tensorflow:workspace.bzl\", \"tf_workspace\")\ntf_workspace()\n\n...to your WORKSPACE file, which will load all of TF's dependencies.\n\nHowever, if you look at TensorFlow's workspace.bzl file...\nhttps://github.com/tensorflow/tensorflow/blob/master/tensorflow/workspace.bzl\n\nyou can see that it depends on rules from @io_bazel_rules_closure. This means you also have to define this @io_bazel_rules_closure rule in your WORKSPACE file and keep it in sync with TensorFlow, even if you don't need it anywhere else in your project.\n\nIs there a way to add the load() command somehow/somewhere into the tf_workspace() macro?\n\nThanks!"
] | [
"tensorflow",
"bazel"
] |
[
"vue 2 v-if, computed, firebase",
"I have a component in a tab :\n\n<md-tabs>\n <md-tab v-for=\"event in events\" :key=\"event.uid\" :md-label=\"event.title\">\n <subscribe :eventKey=\"event['.key']\"></subscribe>\n </md-tab>\n</md-tabs>\n\n\nI would like this component to be display just if my condition is true (so i think a v-if is ok)\nI try to put the v-if in my subscribe component like this :\n\n<template v-if=\"sub\">\n ...\n</template>\n\n\nwith a computed like this : \n\ncomputed: {\n sub: function () {\n let currentUser = firebaseApp.auth().currentUser\n let path = 'events/' + this._props.eventKey + '/subscriber'\n firebaseDB.ref(path).once('value', snapshot => {\n console.log(_.some(snapshot.val(), {'id': currentUser.uid}))\n return _.some(snapshot.val(), {'id': currentUser.uid})\n })\n }\n}\n\n\nBut it doesn't work :(\nMy console.log in return me some true and some false from my firebase database but the component still here.\n\nI try inside the template, with a methods, i try in the parents but it is never work.\n\nWhat is wrong with my code ?"
] | [
"javascript",
"vuejs2"
] |
[
"Delayed_Jobs will not refresh",
"I had previously a mailer set up to send me emails to all user accounts. But now I'm trying to debug it. So I gutted it out completely and it still sends emails to me. \n\nI have absolutely no reasoning or understanding as to why. Insanity! :D\n\ncontroller\n\ndef org_blast_send\n Delayed::Job.enqueue OrgBlast.new(params[:subject], params[:editor1])\n redirect_to org_blast_admin_email_blast_path\nend\n\n\norg_blast.rb\n\nclass OrgBlast < Struct.new(:subject, :editor1)\n def perform\n # You see? There is absolute nothing here but it still sends an email.\n # However, if I rename this file, the website fails looking for it.\n end\nend\n\n\nnotifier.rb\n\ndef org_blast(org, subject, message)\n subject subject\n from NOTIFIER_EMAIL\n recipients org.users.first.email\n sent_on Time.zone.now\n body :user => org.users.first.first_name + ' ' + org.users.first.last_name, :message => message\n content_type \"text/html\"\nend"
] | [
"ruby-on-rails",
"ruby",
"debugging",
"caching",
"actionmailer"
] |
[
"ANTLR4: How to control class hierarchy?",
"How to configure ANTLR4 to not generate a parent class?\n\nGiven grammar MyGrammar\n\nstatement: 'do' | 'check';\n\n\nANTLR4 generates\n\nclass MyGrammar {\n class StatementContext {}\n}\n\n\nSince ANTLR4 generates a parent class for all XXXContext classes, this class name must be used in any usages as well. So I must write\n\nMyGrammar.StatementContext node = ...;\n\n\nand cannot simply write\n\nNodeContext node = ...;\n\n\nThis is big enough of a deal, as it will pollute my code with extra characters that don't add any readability. As such, it downgrades readability, thus comprehensibility and debuggability, et cetera.\n\nSo, how can I make the grammar MyGrammar\n\nstatement: 'do' | 'check';\n\n\nhave ANTLR4 generate\n\nclass StatementContext {} // look ma: no parent MyGrammar class!"
] | [
"java",
"antlr"
] |
[
"Preview window functionality similar to StackOverflow tags",
"I am trying to create an item preview(quickview) using javascript that changes it's orientation depending on the mouse position. I would like to have a functionality similar to the one existing in stackoverflow:\n\nWhen an item is at the bottom of the page the preview window should change it's orientation(when the page is scrolled or browser window is resized). Currently it is shown below or above the cursor but it is not related to the actual cursor position(not related to the screen or browser window size). I am new to javascript and would appreciate any help.\n\nHere is the code I am using as a starting point:\n\nfunction AssignPosition(d) {\n\nif(self.pageYOffset) {\n rX = self.pageXOffset;\n rY = self.pageYOffset;\n }\nelse if(document.documentElement && document.documentElement.scrollTop) {\n rX = document.documentElement.scrollLeft;\n rY = document.documentElement.scrollTop;\n }\nelse if(document.body && document.body.scrollTop) {\n rX = document.body.scrollLeft;\n rY = document.body.scrollTop;\n }\nif(document.all) {\n cX += rX; \n cY += rY;\n }\n\nvar divHeight = d.style.height.replace(/px/, \"\");\ndivHeight = parseInt(divHeight);\nif (cY < divHeight * 3 ) {\n d.style.left = (cX+50) + \"px\";\n d.style.top = (cY-10) + \"px\";\n }\n\nelse {\n cY = cY - divHeight;\n d.style.left = (cX+50) + \"px\";\n d.style.top = (cY-10) + \"px\";\n }\n\n\n}"
] | [
"javascript",
"preview"
] |
[
"Get the roles associated with a asp.net page",
"I'm developing a web site and on the web.sitemap i define which roles can access a certain page, is it possible to know on the page which are the role associated to then on the web.sitemap"
] | [
"asp.net"
] |
[
"CentOS 7 pg_ctl: could not access directory \"/var/lib/pgsql/data\": Permission denied",
"PostgreSQL 10.6 and CentOS 7\n\npg_ctl status\npg_ctl: could not access directory \"/var/lib/pgsql/data\": Permission denied`\n\n\nWouldn't pg_ctl have access to this, given /var/lib/pgsql/data has ownership postgres:postgres? \n\ndrwx------ 3 postgres postgres 94 Nov 14 06:43 pgsql\n\n\nHow can I fix this without creating a vulnerability? Why is this throwing an error?\n\nAdditional info (edit):\n\nsu - postgres\ncd /var/lib\n/var/lib/pgsql: drwx------ 3 postgres postgres 94 Nov 14 06:43 pgsql\n/var/lib/pgsql/10: drwx------ 4 postgres postgres 33 Nov 14 06:38 10\n/var/lib/pgsql/10/data: drwx------ 20 postgres postgres 4096 Nov 15 03:47 data"
] | [
"postgresql",
"centos7",
"pg-ctl"
] |
[
"JSON StringEnumConverter Not Working",
"I have a class contains an enum property and using newtonsoft.json serilaizer I am serializing an instance of it .\nI want the output of serializing this property to be the string value of the property,so I used StringEnumConverter\nbut the output was like this \n\n** without converter :\n \"FailOrPassProperty\":1\n\n** with converter :\n \"FailOrPassProperty\":\"1\"\n\nSo using the converter it seems like it is getting the ToString() of the integer \n\nI have tried this solution but it didn't work:\nJSON serialization of enum as string\n\nNote: I cannot use attribute decoration due to business rules."
] | [
"c#",
"json",
"enums"
] |
[
"Add criteria coefficients to Neo4j SDN method/Cypher query",
"I need to introduce criteria coefficients to the following SDN repository method with a Neo4j Cypher query:\n\n@Query(\"MATCH ... ->(c) WHERE id(c) IN {criteriaIds} WITH ... vg.avgVotesWeight as weight RETURN sum(weight) as weight\")\nList<WeightedDecision> getChildDecisions(@Param(\"decisionId\") Long decisionId, @Param(\"criteriaIds\") List<Long> criteriaIds);\n\n\nin order to implement something like this:\n\nMATCH ... ->(c) \nWHERE id(c) IN {criteriaIds} \nWITH ... (vg.avgVotesWeight * cCoefficient) as weight \nRETURN sum(weight) as weight\n\n\nwhere cCoefficient is a coefficient for a certain criterion in criteriaIds list. So, together with a criteriaIds list I'd like to pass into the query a list of criteria coefficients.\n\nСoefficients are not mandatory. For example one of the criteria from criteriaIds list can have coefficient but another one - no.\n\nRight now I don't know how to pass these coefficient parameters(for all or for some criteria in criteriaIds list) to my method and bind it to a query. \n\nIs it possible with Neo4j/SDN/Cypher ? If so, please show an example.\n\nUPDATED\n\nAfter Michael's recommendations I got it working with a following syntax:\n\n.... (vg.avgVotesWeight * (CASE WHEN c IS NOT NULL THEN coalesce({coefficients}[''+id(c)], 1.0) ELSE 1.0 END)) as weight ....\n\n\n\nI need to check that c is not null so I'm using CASE statement\nI need to cast long id(c) to String ''+id(c) otherwise it fails with a following exception:\n\nnested exception is org.neo4j.cypher.CypherTypeException: Expected 138 to be a java.lang.String, but it was a java.lang.Long\n\n\nAlso, I have to pass Map<String, Double> coefficients instead of Map<Long, Double> coefficients into my SDN method.\n\nIs any way to optimize this approach ? For example avoid type casting or/and implement null pointer validation in a more elegant way ?"
] | [
"neo4j",
"cypher",
"spring-data-neo4j"
] |
[
"Find shortest path between list of nodes in single query Neo4j",
"I have two lists\n\n['avia', 'paul', 'tom']\n\n['james','bond']\n\n\nI am tring to find the shortes path between\n\navia -> james\npaul -> james\ntom -> james\navia -> bond\npaul -> bond\ntom -> bond\n\n\ni create the query with in two loops and query neo4j every time\nso multiple calls are being made to neo4j. is ther a way to creat this in one stored procedure and make only one call to neo4j. sample query is like below\n\nmatch p = allShortestPaths((a{name:'avia'})-[*..2]-(b {name:'james'})) return p"
] | [
"neo4j",
"cypher",
"py2neo"
] |
[
"How to select after put in Saga?",
"Component\n\nimport * as React from 'react';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { action_creators } from './redux';\n\nclass App extends React.PureComponent {\n render() {\n return [\n <div>{this.props.number}</div>,\n <button type=\"button\" onClick={() => this.props.set_number_async({ number:10 })}>increase_number_async</button>\n ]\n }\n}\n\nfunction map_state_to_props(state) {\n return {\n number: state.number;\n }\n}\n\nfunction map_dispatch_to_props(dispatch) {\n return bindActionCreators({\n set_number_async: action_creators.get_action_of_set_number_async\n }, dispatch);\n}\n\nexport default connect(map_state_to_props, map_dispatch_to_props)(App);\n\n\nRedux\n\nimport { Action, createAction, handleActions } from 'redux-actions';\nimport { delay } from 'redux-saga';\nimport { all, put, select, takeEvery } from 'redux-saga/effects';\n\nexport const action_creators = {\n get_action_of_set_number: createAction<{ number:number }>('set_number'),\n get_action_of_set_number_async: createAction<{ number:number }>('set_number_async'),\n get_action_of_set_number_async2: createAction<{ number: number }>('set_number_async2')\n};\n\nconst state = {\n number: 0\n}\n\nfunction* set_number_async(action: Action<{ number:number }>) {\n let state = yield select((state) => state.number);\n\n console.log('first', state); // 0\n\n yield delay(1000);\n yield put(action_creators.get_action_of_set_number_async2(action.payload!));\n\n state = yield select((state) => state.number);\n\n console.log('second', state); // 0\n}\n\nfunction* set_number_async2(action: Action<{ number: number }>) {\n yield put(action_creators.get_action_of_set_number(action.payload!));\n}\n\nexport function* saga() {\n yield all([\n takeEvery('set_number_async', set_number_async),\n takeEvery('set_number_async2', set_number_async2)\n ]);\n}\n\nexport default handleActions({\n set_number: (state, action) => {\n const new_number = action.payload!.number;\n return { ...state, number:new_number };\n }\n}, state);\n\n\nexample\n\nI expected that 10 was printed by second console.log() when I click a button, but 0 was printed.\n\nWhat did I do worng? I tried to find it out in a tutorial, but I didn't get a solution.\n\nI want to know how to re-select new state dispatched.\n\nplease could you help me? Thansk for reading. :)"
] | [
"reactjs",
"redux",
"redux-saga"
] |
[
"Access Device's Native Calendar In Phonegap Android?",
"How can i add an event to android device's calendar in phonegap?\nI want to implement this functionality in Android Version >= 2.3\nPlugins available are not working properly, Please provide solution."
] | [
"javascript",
"android",
"cordova"
] |
[
"Add a dropdown menu using Tkinter",
"I'm creating a menu using Tkinter and I'm trying to add a recent file option to the menu which leads to a dropdown menu when hovered over. An example of this is shown below: \n\n\nAs you can see in the dropdown menu, there is an option to hover over an arrow which leads to another dropdown menu. This is what I'm trying to replicate using Tkinter. Any help would be appreciated :)"
] | [
"python-2.7",
"tkinter"
] |
[
"Unity-How do I make a Temporary Power-up?",
"I'm making an overhead shooter game, and I made it so when the player touches a certain object, their fire rate increases. How can I make it so the power up wears off after a few seconds?\n\npublic class PlayerPickups : MonoBehaviour {\n\nPlayerHealth playerHealth;\n\npublic float RFBoostValue=0.005f;\n\nGameObject player;\n\nvoid Awake()\n {\n player = GameObject.FindGameObjectWithTag(\"Player\");\n playerHealth = player.GetComponent<PlayerHealth>();\n }\n\nprivate void OnTriggerEnter(Collider other)\n{ \n\n if (other.tag == \"Rapid Fire Pickup\")\n {\n Destroy(other.gameObject);\n PlayerShooting.timeBetweenBullets -= RFBoostValue;\n }\n}\n\n\n}"
] | [
"c#",
"unity3d"
] |
[
"as3 declaring a GLOBAL variable - in TIMELINE / outside of CLASS",
"I am looking to declare a GLOBAL VAR in the main time line. \n\nThen I need to access that GLOBAL VAR from another externally loaded SWF's. \n\nQUESTIONS:\n\nHow do I create the global var in the main timeline?\n\nHow do I access that var in externally loaded swf files?"
] | [
"actionscript-3",
"flash",
"scope",
"global-variables",
"global"
] |
[
"Java program to generate a unique and random six alpha numeric code",
"I need to generate a reservation code of 6 alpha numeric characters, that is random and unique in java.\n\nTried using UUID.randomuuid().toString(), However the id is too long and the requirement demands that it should only be 6 characters.\n\nWhat approaches are possible to achieve this?\n\nJust to clarify, (Since this question is getting marked as duplicate).\nThe other solutions I've found are simply generating random characters, which is not enough in this case. I need to reasonably ensure that a random code is not generated again."
] | [
"java",
"encryption",
"uuid"
] |
[
"Null Reference Exception trying to add blank row to Telerik RadGrid",
"Can someone please tell me why I keep getting a NULL reference exception when trying to perform the add below? This only happens when the ObservableCollection is empty at the beginning. If there is data in the collection from the start it works fine.\n\nLoad ObservableCollection and set collection ViewSource:\n\nprivate void LoadCodeSets()\n{\n this.codeSetData = new ObservableCollection<CodeSet>();\n\n var query = from c in context.CodeSets\n where c.LogicallyDeleted == 0\n orderby c.CodeSetID ascending\n select c;\n\n foreach (CodeSet c in query)\n {\n this.codeSetData.Add(c);\n this.codeSetView = (ListCollectionView)CollectionViewSource.GetDefaultView(codeSetData);\n this.codeSetRadGridView.ItemsSource = this.codeSetView;\n }\n}\n\n\nAdd New Record to Empty Data Grid\n\nprivate void Add_CodeSet_Click(object sender, RoutedEventArgs e)\n{\n try\n {\n bool doesCodeSetExist = false;\n\n if (codeSetView == null)\n {\n\n codeSetView.AddNewItem(new CodeSet());\n }\n else\n {\n foreach (CodeSet cs in codeSetView)\n {\n if (cs.CodeSetID == 0)\n {\n doesCodeSetExist = true;\n this.lblMessages.Foreground = Brushes.Red;\n this.lblMessages.FontWeight = System.Windows.FontWeights.ExtraBold;\n this.lblMessages.Content = \"Please fill in new user form and click Save User.\";\n this.lblMessages.Visibility = Visibility.Visible;\n }\n }\n if (!doesCodeSetExist)\n {\n CodeSet newCodeSet = new CodeSet();\n codeSetView.AddNewItem(newCodeSet);\n }\n }\n }\n catch (Exception ex)\n {\n Error.LogError(ex);\n }\n}"
] | [
"c#",
"wpf",
"observablecollection",
"radgridview",
"listcollectionview"
] |
[
"GIT getting 2 branches from another machine onto mine",
"I'm new to git so I'm setting up a git workflow to get the hang of it and I'm not sure how to get a branch on another machine onto mine, I've got 2 branches on my desktop:\n\nmaster\nrelease-0.1\n\n\nThe remote has these 2 branches too:\n\nmaster\nrelease-0.1\n\n\nThen there's my laptop which has an old copy of master that needs to be deleted, and 2 other branches not on either remote or my desktop:\n\nmaster (deleting)\nnew-feature-a\nnew-feature-b\n\n\nI'm new to git so I'm not really sure what I should do, I want to work on new-feature-a on my desktop now and only work on new-feature-b on the laptop. Should I push new-feature-a to origin/new-feature-a then pull it to the desktop? Then once the feature is complete push it to the release-0.1 branch then merge it into master?\n\n\nShould I keep a copy of master locally?"
] | [
"git"
] |
[
"How to get the navigation bar when the tabbar controller is clicked?",
"I have an application in which I am trying to dynamically switch the tabbar tab through the code. The tab switches properly. When I click on any tab the didSelectController method of the tab is called and my problem is when I click on any tab the tab on which I am performing switching of views, its navigation bar disappears and its tabbar image and title also disappears.\n\nThis is my code. In the appdelegate:\n\n- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {\n NSString *clockswitch = [[NSUserDefaults standardUserDefaults]objectForKey:@\"clock\"];\n UIViewController *desiredController = nil;\n if ([clockswitch isEqualToString:@\"digital\"]) {\n desiredController = [[DigitalClockViewController alloc] initWithNibName:@\"DigitalClockViewController\" bundle:nil ];\n\n\n }\n else {\n desiredController = [[AnalogClockViewController alloc]initWithNibName:@\"AnalogClockViewController\" bundle:nil];\n\n\n }\n NSMutableArray *controllersCopy = [self.tabBarController.viewControllers mutableCopy];\n [controllersCopy replaceObjectAtIndex:0 withObject:desiredController];\n self.tabBarController.viewControllers = controllersCopy;\n\n}"
] | [
"iphone",
"objective-c"
] |
[
"cakephp reuse the encryption/decryption code in more than one model",
"I am new to cakephp. Currently I have encryption code in beforeSave() and decryption code in beforeFind() of a model file. I want to reuse the same encryption/decryption codes in another model file. Which is the best method to reuse the codes?"
] | [
"cakephp",
"encryption"
] |
[
"Localized country names",
"Where can I get the country names in all languages? I need these to localize an application."
] | [
"localization",
"internationalization"
] |
[
"How do I escape single quotes in variables in a Solr DataImportHandler?",
"I have a DataImportHandler for importing data from a SQL database. The root entity, Foo has many Bars. The Bar table uses Foo.Name as its foreign key. Some Foo names have single quotes in them--such as STW's.\n\nThe import query for the Bar entity is something like:\n\nselect name from Bar where Foo_Name = ${Foo.Name} \n\n\nHowever, when Foo.Name contains a single quote the import fails with a SQL exception of Incorrect syntax near 's.\n\nI've tried wrapping the parameter with escapeSql(${Foo.Name}) but it doesn't appear to be called--the sql being executed is where Foo_Name = 'escapeSql(STW's)'\n\nHow do I properly escape the Foo.Name to avoid issues when they contain single-quotes?"
] | [
"solr",
"dataimporthandler"
] |
[
"Google Maps Directions API using REST with Groovy",
"@Grab('com.github.groovy-wslite:groovy-wslite:1.1.2')\nimport wslite.rest.*\n\nString key = 'my-key'\ndef client = new RESTClient('https://maps.googleapis.com/maps/api/directions/')\ndef response = client.get(path: 'xml',\nquery: [\n origin: 'Disneyland',\n destination: 'Universal Studios Hollywood',\n sensor: 'false',\n mode: 'driving',\n key: 'my-key'\n ])\n\nprintln response.DirectionsResponse.status\nprintln response.DirectionsResponse.summary\n\n\nI'm trying to use the Google API directions using REST with Groovy but I can't seem to print from response.DirectionsResponse. It would either output null or an error. Am I missing something? I tried searching everywhere for an answer but I can't find one."
] | [
"api",
"rest",
"groovy"
] |
[
"How to trigger or send intent continously (without on button click)",
"I am tryiny to update my edittext in UI. I have a service from where I send a intent by clicking a button and update in the UI. Everything works fine. But I would like to send intent without button click.\n\nWhat I tried was to put my Intent in a method and call it oncreate in service but even then it been just called once. \n\npublic class myService extends service {\n onCreate{\n sendMessage();\n}\n\n private void sendMessage(){\n Intent intent = new Intent(\"com.example.app.SEND\");\n intent.putExtra(\"KEY\", (String) Number);\n sendBroadcast(intent);\n}\n\n\nWhen I do like this, I just send empty string which is not useful. And even then just once.\n\nCan I send intent continously ? So that It updates my UI once it receives input ? Any possible way to do it ?\n\nI would like to send intent every 5 seconds."
] | [
"java",
"android",
"android-intent"
] |
[
"Observable triggers TSLint 'property does not exist'",
"I have this block of code here:\n\nthis._auth.getToken().flatMap(token => {\n return this._http.post(\"/authenticate\");\n}).flatMap(res => {\n let headers = new Headers();\n headers.append(\"Content-Type\", \"application/json\");\n headers.append(\"Authorization\", res.json().Token);\n return this._http.get(this.endpoints[endpoint], {headers: headers});\n});\n\n\nhttp.get and http.post return an Observable<Response> which contains a .json method\n\nHowever flatMap returns an Observable<Any> which doesn't contain the .json method.\n\nIt works correctly, but TSlint complains with:\n\n\n Property 'json' does not exist on type '{}'.at line 32 col 49\n\n\nAm I doing something wrong? Is this expected? It's not a big deal but maybe it's a symptom of bigger issues in the code."
] | [
"typescript",
"angular",
"observable",
"rxjs",
"tslint"
] |
[
"Update TimeZone when changed in iOS app",
"In my application, the user can set the TimeZone at the time of sign up. If the user moves to some other TimeZone, then the TimeZone of the device is different from the TimeZone of the user profile.\n\nHow can I update TimeZone in the user profile?"
] | [
"ios",
"nstimezone"
] |
[
"What is the reason for using (if false !== ...)",
"The question says it all! I have noticed this statement a lot:\n\nif (false !== some_expression)\n\n\nInstead of \n\nif(some_expression !== false)\n\n\nIs there a reason to use the first statement style over the second?"
] | [
"php"
] |
[
"Rails 3 - Calendar Date Select Gem - Disable Field Input",
"Using gem 'calendar_date_select', :git => 'git://github.com/paneq/calendar_date_select.git' in my Gemfile. \n\nIs there an option for disabling the user from keying in the date, forcing them to use the popup calendar? For some reason, if they key in the date by hand, the wrong date is stored. \n\nHere it is on my form:\n\n<%= f.calendar_date_select \"invoice_date\", :index => '1', :time => false, :size => 12 %>\n\n\nThanks in advance!"
] | [
"ruby-on-rails-3"
] |
[
"How to print invoices with their payments odoo",
"i want to print report that contains invoices with their payment filtred by date_payment but i don't find any relation to payment please help me\n\nThanks"
] | [
"python-2.7",
"odoo-8",
"qweb"
] |
[
"post request body is null in retrofit kotlin but the response code is okay(200) plus data is stored in that post request",
"**This is API endpoint where i am sending a json object through post request ** \n\npackage com.example.samplegayar\nimport com.google.gson.JsonObject\nimport org.json.JSONObject\nimport retrofit2.Call\nimport retrofit2.http.*\n\ninterface ApiEndpoints {\n @Headers(\"Content-Type: application/json\")\n @POST(\"/api/user-profile/\")\n fun getProfileInfo(@Body jsonObject: JsonObject): Call<ProfileInfo>\n}\n\n\nMy activity file goes here\n\noverride fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n setContentView(R.layout.activity_profile_)\n val request = ServiceBuilder.buildService(ApiEndpoints::class.java)\n val payerReg = JsonObject()\n payerReg.addProperty(\"user_email\", \"[email protected]\")\n payerReg.addProperty(\"streamer_email\", \"[email protected]\")\n\n val call = request.getProfileInfo(payerReg)\n\n call.enqueue(object : Callback<ProfileInfo>{\n\n override fun onResponse(call: Call<ProfileInfo>, response: Response<ProfileInfo>) {\n Log.d(\"response\",response.body().toString())\n Log.d(\"response\",response.code().toString())\n Log.d(\"response\",response.raw().toString())\n\n if (response.isSuccessful) {\n Log.d(\"response\",\"you got success mate\")\n Log.d(\"response\", response.body().toString())\n }\n }\n\n override fun onFailure(call: Call<ProfileInfo>, t: Throwable) {\n Toast.makeText(this@ProfileActivity, \"${t.message}\", Toast.LENGTH_SHORT).show()\n Log.d(\"failure\",\"you are a loser mate\")\n }\n })\n}\n\n\nhere is my retrofit service code\n\npackage com.example.samplegayar\n\nimport okhttp3.OkHttpClient\nimport retrofit2.Retrofit\nimport retrofit2.converter.gson.GsonConverterFactory\n\nobject ServiceBuilder {\n private val client = OkHttpClient.Builder().build()\n private val retrofit = Retrofit.Builder()\n .baseUrl(\"https://dev.gayar.net/\")\n .addConverterFactory(GsonConverterFactory.create())\n .client(client)\n .build()\n\n fun<T> buildService(service: Class<T>): T{\n return retrofit.create(service)\n }\n}"
] | [
"android",
"kotlin",
"retrofit2"
] |
[
"PHP - Request Error (invalid request)",
"A while ago I created a fairly simple CMS using the CodeIgniter framework for a customer.\nOver the last couple of months I have had three different users contact me saying they sometimes get an error when they try an submit data. I have had no reports from other users. The error is:\n\n\n Request Error (invalid request)\n Your request could not be processed. Request could not be handled\n This could be caused by a misconfiguration, or possibly a malformed request.\n For assistance, contact your network support team.\n\n\nI cannot recreate the error on my computer in any web browser. I have tried searching for the same error, but haven't found anything useful. I don't even know if it's a PHP error or browser error (I'm guessing browser).\n\nThe customer is using IE7. Users who had the problem and have since upgraded to IE8 are now reporting no problems.\n\nI would like to know what could be causing this error and if it is something that I can fix or if it is definitely a problem at their end. I have asked users experiencing this problem to try a different browser or try to recreate it at home, but none have come back to me about this, yet.\n\nAny suggestions?"
] | [
"php",
"codeigniter",
"internet-explorer-7"
] |
[
"Using jQuery to create parallel html structures",
"Is there a way to easily have parallel html structures using jQuery? For example:\n\n<li class=\"ul-1\"> list 1 </li>\n<li class=\"ul-2\"> list 2 </li>\n<li class=\"ul-3\"> list 3 </li>\n\n<div class=\"div-1\"> div 1 </div>\n<div class=\"div-2\"> div 2 </div>\n<div class=\"div-3\"> div 3 </div>\n\n\nPutting the div's inside the ul's isn't an option for me, they need to remain separate. I want to do something like $('.ul-2').show(), and also have it show $('.div-2). Is there a way to do this without getting a list of classes and parsing the class names?"
] | [
"javascript",
"jquery",
"html"
] |
[
"rebase in progress. Cannot commit. How to proceed or stop (abort)?",
"When I run: \n\ngit status\n\n\nI see this:\n\nrebase in progress; onto 9c168a5\nYou are currently rebasing branch 'master' on '9c168a5'.\n(all conflicts fixed: run \"git rebase --continue\")\nnothing to commit, working directory clean\n\n\nWhen I do: \n\nls `git rev-parse --git-dir` | grep rebase || echo no rebase\n\n\nI see: rebase-apply\n\nI can't commit to origin. \n\ngit branch\n\n\nShows:\n\n* (no branch, rebasing master)\n develop\n master\n\n\nI'm stuck. I don't know what to do? Does it really take this long to rebase? git rebase --continue doesn't do anything. I don't have anything in git status.. I'm just waiting for the rebase. What can I do?\n\nUDATE:\nThis is the output of: git rebase --continue\n\nApplying: no message\nNo changes - did you forget to use 'git add'?\nIf there is nothing left to stage, chances are that something else\nalready introduced the same changes; you might want to skip this patch.\n\nWhen you have resolved this problem, run \"git rebase --continue\".\nIf you prefer to skip this patch, run \"git rebase --skip\" instead.\nTo check out the original branch and stop rebasing, run \"git rebase --abort\".\n\n\ngit add . has nothing."
] | [
"git",
"git-rebase"
] |
[
"Why this single quotes and braces in output in python?",
"I am using ipython notebook in ubantu version 16.04 and I run this code,\n\nword = 'Rushiraj'\nlength = 0\nfor char in 'rushiraj':\n length = length + 1\nprint('There are', length,'character')\n\n\nI get this output:\n('There are', 8, 'character')\n\nWhat is the reason for this single quotes and round braces in output ?It should not be there !"
] | [
"python",
"python-3.x",
"loops",
"python-2.x"
] |
[
"How to send a user to a particular URL using a form in Django",
"I'd like users to be able to select from a form a user and then be directed to individual/user_slug. Currently, I am redirecting to individual?slug=user_slug. I cant figure out if I need to change something with the HTML form, url mapping, or the view itself. Any help or guidance would be appreciated!\nHTML form\n <form action="individual" method="get">\n <label for="slug">Choose a person:</label>\n <select id="slug" name="slug">\n <option value="person_a_slug">Person A</option>\n <option value="person_b_slug">Person B</option>\n <option value="person_c_slug">Person C</option>\n </select>\n <input type="submit">\n </form>\n\nurls.py\nurlpatterns = [\n path('individual/<slug:slug>', IndividualView.as_view(), name = 'individual'),\n path('', HomePageView.as_view(), name='home'),\n]\n\nviews.py\nclass HomePageView(ListView): \n model = Person\n template_name = 'home.html'\n\n\nclass IndividualView(DetailView):\n model = Person\n template_name = 'individual.html'\n\nmodels.py\nclass Person(models.Model):\n name = models.CharField(max_length=200)\n\n description = models.TextField()\n\n slug = models.SlugField(null=True, unique=True)\n\n photo = models.URLField(null=True)\n\n def get_absolute_url(self):\n return reverse('individual', kwargs={'slug': self.slug})"
] | [
"django",
"django-forms",
"get"
] |
[
"CakePHP 3 to Progressive Web App Back-End",
"I have a web application that is set up in CakePHP 3 WAMP environment. I would like to set it up as a Progressive Web App. So have the existing Model/ Controller act as an API that is exposed to a PWA framework like Angular, (P)React, Vue.js. Where can I find a clear guide/ tutorial on what steps to take to turn my existing application into a functioning backend API? \n\nAny tips from someone who has done this?"
] | [
"angular",
"reactjs",
"vue.js",
"cakephp",
"progressive-web-apps"
] |
[
"Rails 3.1: testing \"DELETE 'destroy'\" in controller and route specs",
"I'm testing an app that uses Sorcery for authentication. I have a sessions controller which handles user signin / signout with tests to go along with the actions. I understand that a destroy action usually takes an id as a parameter, but it's unnecessary with a signout feature.\n\nroutes.rb\n\nresources :sessions\n\n# match \"/signout\", :to => \"sessions#destroy\"\n\n\nsessions_controller_spec.rb\n\ndescribe \"DELETE 'destroy'\" do\n it \"should log the user out\" do\n login_user(Factory(:user))\n delete :destroy\n controller.current_user.should be_nil\n controller.should_not be_signed_in\n end \nend\n\n\nsession_routes_spec.rb\n\nit \"should route DELETE /sessions to sessions#destroy\" do\n { :delete => \"/sessions\" }.should route_to(\n :controller => \"sessions\",\n :action => \"destroy\"\n )\nend\n\n\nBoth of the above tests fail because the route expects an id. Is there a way to get rid of this necessity? I know I could just use the named \"signout_path\" route, but I am just curious if I can still use session_path, :method => :delete without passing it an id.\n\nWhat's really shocking to me is if I uncomment the match \"/signout\" the controller spec passes (however, the route spec does not). How does the match line cause the controller spec to pass?"
] | [
"ruby-on-rails-3",
"rspec"
] |
[
"C++ using proccesing power/time while console loading bar",
"I'm currently new to programming and don't know, how to let the program process while the loading bar is running.\nI wanted to display the loading bar and check, wether the program is finished processing. If not, then the processing bar should simply begin to fill again.\n\nMy code now is just showing the loading bar once and begins to process after that. This is pretty useless.\n\nI researched on Google and here on stack overflow, but i only got the loading bar from that, not the useful integration in my program.\n\nI just need a simple way to check, wether there would be an output besides the loading bar and i need to run the rest of the program at the same time as the loading bar, just to save time.\n\n#include <iostream>\n#include <windows.h>\n#include <unistd.h>\n#include <string>\n#include <thread>\n\nusing namespace std;\n\nstatic void loading(){\n system(\"Color 0A\");\n cout<<\"\\t\\n\\n\";\n char a=177, b=219;\n cout<<\"\\t\";\n for (int i=0;i<=50;i++)\n cout<<a;\n cout<<\"\\r\";\n cout<<\"\\t\";\n for (int i=0;i<=50;i++){\n cout<<b;\n for (int j=0;j<=2e7;j++);\n }\n cout << \"\\n\\n\";\n}\n\nint main(){\n\n//ProjectEuler Problem___\n\n loading();\n\n int j=0;\n do{\n j++;\n }while(j<=1e9); //just an example to see when it is processing\n\n cout << \"hi\" << endl;\n\n return 0;\n}\n\n\nI'm grateful for any help."
] | [
"c++",
"progress-bar",
"loading"
] |
[
"How should I declare multiple function pointers if I am using multithreads?",
"For instance if I'm using a class like this:\n\nclass Class\n{\n static int f(int a, int b, int c) { return a + b + c; }\n int(*A)(int, int, int);\n int(*B)(int, int, int);\n Class() { A = f; B = f; }\n};\n\n\nI was told that static function will make a silly error if function A and B runs simultaneously, but I think there is no other special way to define those function pointers. Does it really make problems in multithread programmings? If it does, how should I change the code to prevent such accidents?\n\nIn short, if A and B runs simultaneously then will there be a different return value which is not expected?"
] | [
"c++",
"multithreading",
"function"
] |
[
"Implementing producer consumer in Java",
"This is an implementation of producer consumer pattern for a homework. What's wrong with the below implementation. I have googled for various implementations, but I am not able to understand what went wrong in mine.\n\nI have a shared queue\nI synchronize the producer and consumer on the same lock\n\nImplementation\nShared Queue:\n class SharedQueue{\n public static Queue<Integer> queue = new LinkedList<Integer>();\n }\n\nProducer Thread :\n//The producer thread\nclass Producer implements Runnable{\n public void run()\n {\n synchronized (SharedQueue.queue)\n {\n if(SharedQueue.queue.size() >=5)\n {\n try {\n SharedQueue.queue.wait();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n Random r = new Random();\n\n int x = r.nextInt(10);\n System.out.println("Inside Producer" + x);\n\n SharedQueue.queue.offer(x);\n\n\n SharedQueue.queue.notify();\n\n }\n }\n}\n\nConsumer Thread:\nclass Consumer implements Runnable{\n public void run()\n {\n synchronized (SharedQueue.queue)\n {\n if(SharedQueue.queue.size() == 0)\n {\n try {\n SharedQueue.queue.wait();\n } catch (InterruptedException e) {\n e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.\n }\n }\n\n int k = SharedQueue.queue.remove();\n\n System.out.println("Inside consumer" + k);\n }\n }\n}\n\nThe Main program\npublic class ProducerConsumerTest {\n\n public static void main(String[] args)\n {\n \n Thread p = new Thread(new Producer());\n Thread q = new Thread(new Consumer());\n\n p.start();\n q.start();\n\n }\n}"
] | [
"java",
"multithreading",
"concurrency",
"producer-consumer"
] |
[
"How to disable a form button unless user starts typing something in a text field in Ruby on Rails?",
"I have a Rails which:\n\n\nshows a blank text field if debit value is 0\nit shows the debit value in the text field if the debit value is non-zero\n\n\n<%= form_for(@debit, remote: true, html: { id: 'match_form' }) do |f| %>\n <% if @debit.match_id == 0 %>\n <%= f.text_field :match_id, value: '', style: \"width:82px\" %>\n <% else %>\n <%= f.text_field :match_id, style: \"width:82px\" %>\n <% end %>\n <br/><br/>\n <%= f.submit 'Save', class: 'btn btn-primary', style: \"width:38px;padding:0px\" %>\n <%= button_tag 'Cancel', class: 'btn btn-secondary', id: 'match_cancel', style: \"width:52px;padding:0px\" %>\n<% end%>\n\n\nThere's a submit and cancel button shown below the text field (as shown in the code above).\n\nWhen debit value is 0, the text field is blank. Now, when the text field is blank, I would like the submit button to be disabled. I would like the same to ne enabled as soon as the user starts typing some value.\n\nHow can I achieve this? Please help!"
] | [
"ruby-on-rails"
] |
[
"how to load the photos and videos to Iphone Simulator 4.0",
"Is there any way to load the photos and videos into the IPhone Simulator 4.0. \n\nBest Regards,\nMohammed Sadiq."
] | [
"iphone"
] |
[
"Join and process two lines from top command output",
"I would like to join and process the two lines coming out of the top command:\n\nshell> top -p 1 -b -d 1 | egrep '^top|^Cpu'\ntop - 15:17:45 up 736 days, 4:32, 3 users, load average: 0.06, 0.03, 0.00\nCpu(s): 0.7% us, 0.8% sy, 0.0% ni, 97.1% id, 1.3% wa, 0.0% hi, 0.0% si\n\n\nWhen trying to use awk and sed commands, I run into trouble - no output is produced. What commands would I use to get the output to look like this:\n\nTime: 15:17:45 Cpu(s): 0.7% us, 0.8% sy, 0.0% ni, 97.1% id, 1.3% wa, 0.0% hi, 0.0% si\n\n\nHere is a piece of code that could be useful:\n\nshell> echo 'top - 15:17:45 up 736 days, 4:32, 3 users, load average: 0.06, 0.03, 0.00' | awk -F' up' '/^top/ {print \"Time: \" $1}' | sed 's/top - //'\nTime: 15:17:45"
] | [
"linux",
"bash",
"sed",
"awk",
"top-command"
] |
[
"Specifying file to process to Perl one-liner",
"I was given a Perl one-liner. It has the following form:\n\nperl -pe'...'\n\n\nHow do I specify the file to process to the program?"
] | [
"perl"
] |
[
"excel sumproduct with condition and subfunction",
"I use this function in LibreOffice, and I want to use this table in Excel too, but didn't work:\n\nSUMPRODUCT(YEAR('m1'!$A$2:$A$5000)=2011;WEEKNUM('m1'!$A$2:$A$5000;2)=24;WEEKDAY('m1'!$A$2:$A$5000;2)=3;'m1'!$K$2:$K$5000)\n\n\nIn A column of m1 sheet if have date values:\n\n2013.06.29 15:40:00\n2013.06.21 18:35:00\netc.\n\n\nI got #VALUE! error.\n\nIf I try only the part it work with:\n\n=SUMPRODUCT(--(YEAR('m1'!$A$2:$A$5000)=2013))\n=SUMPRODUCT(--(WEEKDAY('m1'!$A$2:$A$5000)=5))\n\n\nbut doesn't work:\n\n=SUMPRODUCT(--(WEEKNUM('m1'!$A$2:$A$5000)=26))\n\n\nfor only on value it works:\n\n=SUMPRODUCT(--(WEEKNUM('m1'!A10)=26))\n\n\nbut for array don't:\n\n**=SUMPRODUCT(--(WEEKNUM('m1'!A10:A15)=26))**\n\n\nWhat is the problem with:\n\nSUMPRODUCT(--(WEEKNUM('m1'!A10:A15)=26))"
] | [
"excel",
"excel-formula"
] |
[
"Python: attempting to open serial caused IOError: [Errno 6] Device not configured",
"I trying to open two serial ports in Python with the following code:\n\nfor i in range(0, 2):\n if platform.system() == \"Darwin\":\n pos = 2+i\n else:\n pos = i\n port = serial.Serial(current_ports[pos], BAUD_RATE, timeout=TIMEOUT)\n time.sleep(1.516)\n port.write('#')\n time.sleep(1.516)\n out = ''\n print \"Reading MAC Address....\"\n while port.inWaiting() > 0:\n out += port.read(1)\n print out\n if out == '04:E9:E5:00:EC:51':\n led_port = port\n elif out == '04:E9:E5:01:0C:E0':\n matrix_port = port \n\n\nSometimes the ports open successfully, sometimes they don't. When they don't, I get this error message:\n\nReading MAC Address....\nTraceback (most recent call last):\n File \"animation.py\", line 227, in <module>\n main()\n File \"animation.py\", line 208, in main\n led_port, matrix_port = get_ports()\n File\n\"/Users/collinschupman/Documents/FutureCities/MurmurWall/Onsite/Raspi/helper_functions.py\", line 41, in get_ports\nwhile port.inWaiting() > 0:\n File \"/Library/Python/2.7/site-packages/serial/serialposix.py\", line 449, in inWaiting\n s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)\nIOError: [Errno 6] Device not configured\n\n\nAs you can see, it gets to the inWaiting() call and then throws this error. \n\nFor a little reference, the code is sending a message to a couple Arduinos so they can be identified by their MAC addresses. \n\nIs there anything blatantly incorrect I'm doing Python-side which would cause this setup to fail once and a while? I'd say this code works 50% of the time right now.\n\nThanks,\n\nCollin"
] | [
"python",
"serial-port",
"arduino"
] |
[
"Shiny app automate Hive query and email result after done",
"I am trying to build a shiny app which accepts input file from user, do a few hive queries against that input file and then send an email with the query result to the user with the output as attachment. \n\nQuesiton1: The shiny server doesn't belong to the hadoop cluster and I am wondering will RHIVE package work in this case? \n\nQuestion2: Regardless of RHIVE will be used or not, after I send the query to HIVE, how can I be notified when the query finishes? Usually, I manually do those kind of work in Cloudera Manager and come back after 1 or 2 hours of running queries. \n\nI am kind of automating this process using R/Python/bash. If the connection to HIVE has to be done in Python/bash, I will try to call the Python and bash script in my shiny app to automate this process."
] | [
"python",
"r",
"bash",
"hive",
"shiny"
] |
[
"Can't update programs because of Code Blocks",
"I'm using Linux "Ubuntu"\nWhen I'm trying to update any program like Discord or Blender, I'm facing this problem:\nError while installing package: trying to overwrite '/usr/include/codeblocks/Alignment.h', which is also in package codeblocks-headers 20.03\nHow can I solve it? \nThanks in advance"
] | [
"linux",
"discord",
"codeblocks",
"updates",
"blender"
] |
[
"Undefined reference when using Irrlicht library",
"I'm trying to compile the very first code given by Irrlicht library website.\n\nAs said in the title, I get an undefined reference. I'm using 8.2 netbeans IDE.\n\nThis is what I've done so far : Installed Irrlicht library from the Linux repository (I'm using Ubuntu 18.04). Using these command lines : sudo apt-get install libirrlicht1.8 libirrlicht1.8-dbg libirrlicht-dev libirrlicht-doc\n\nIn the \"project properties\", I've added the include directory, as well as the include headers (e.g all the files contained in /usr/include/irrlicht. Also, in the \"Additional Options\" (the linker part, I guess ?) , I've seen online that I should add -lIrrlicht command line, and it still got me the undefined reference.\n\nI've tried also the following command line : -L /usr/include/irrlicht -lIrrlicht, still got me the undefined reference.\n\nNote : I'm not able to make any update. Talking about irrlicht, it seems that I have 363 packages outdated. Could the problem be from there ?\n\nHere is the minimum code to see if the Irrlicht library is correctly found by the compiler and correctly linked to the project : \n\n#include <cstdlib>\n#include <iostream>\n#include <irrlicht.h>\n\nusing namespace std;\nusing namespace irr;\nusing namespace core;\n\nint main(int argc, char** argv) {\n\n IrrlichtDevice *device=createDevice(video::EDT_SOFTWARE, dimension2d<u32>(640,480),16,false,false,false,0);\n return 0;\n}\n\n\nWhen compiling, here is what the compiler is prompting : \n\ncd '/home/liam/NetBeansProjects/test'\n/usr/bin/make -f Makefile CONF=Debug\n\"/usr/bin/make\" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf\nmake[1] : on entre dans le répertoire « /home/liam/NetBeansProjects/test »\n\"/usr/bin/make\" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux/test\nmake[2] : on entre dans le répertoire « /home/liam/NetBeansProjects/test »\nmkdir -p dist/Debug/GNU-Linux\ng++ -lIrrlicht -o dist/Debug/GNU-Linux/test build/Debug/GNU-Linux/main.o \nbuild/Debug/GNU-Linux/main.o : Dans la fonction « main » :\n/home/liam/NetBeansProjects/test/main.cpp:26 : référence indéfinie vers « createDevice »\ncollect2: error: ld returned 1 exit status\nnbproject/Makefile-Debug.mk:62: recipe for target 'dist/Debug/GNU-Linux/test' failed\nmake[2]: *** [dist/Debug/GNU-Linux/test] Error 1\nmake[2] : on quitte le répertoire « /home/liam/NetBeansProjects/test »\nnbproject/Makefile-Debug.mk:59: recipe for target '.build-conf' failed\nmake[1]: *** [.build-conf] Error 2\nmake[1] : on quitte le répertoire « /home/liam/NetBeansProjects/test »\nnbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed\nmake: *** [.build-impl] Error 2\n\nBUILD FAILED (exit value 2, total time: 1s)\n\n\nI see that I have the following error : \"référence indéfinie vers << createDevice >>\" which means \"undefined reference to << createDevice >> \". So it seems that the problem comes from the command line written in the linker. What command line(s) does the linker expects ?"
] | [
"c++",
"netbeans",
"linker",
"undefined",
"undefined-reference"
] |
[
"Extract image id with Jsoup",
"I am trying to extract a specific captcha image id using api Jsoup, the html image tag is like : \n\n<img id=\"wlspispHIPBimg03256465465dsd5456\" style=\"display: inline; width: 200px; height: 100px;\" aria-hidden=\"true\" src=\"https://users/hip/data/rnd=435cb60d0a6b63ef4\">\n\nThis is my code to obtain the attribute id=\"wlspispHIPBimg03256465465dsd5456\": \n\ndoc = Jsoup.connect(\"http://go.microsoft.com/fwlink/?LinkID=614866&clcid\")\n .timeout(0).get();\n\nElements images = doc.select(\"img[src~=(?i)]\");\nfor (Element image : images) {\n System.out.println(image.attr(\"id\"));\n}\n\n\nThe problem is that i can't get the id of captcha image"
] | [
"java",
"web-scraping",
"jsoup"
] |
[
"RxSwift and AlertAction",
"I have the Tableview with UIAlertAction. When I press a cell, a pop-up appears and then I can decide which operation to perform. During the Ok operation (button click) I want to observe the data of the cell and receive it in the ViewModel. But there are problems.\nWhen I press for the first time there is no value and if I just click a cell the data is still sending to the ViewModel. If I click more UIAlertAction popu-ups the sending data is increasing. For example: First click - nothing, second click - value 1, third click value 1, 1, 1 and so on.\nHow to start observing cells from the first click of the UIAlertAction pop-up and how to get only on example of the data?\nViewController:\nfunc bindTableView() {\n viewModel.stationItems.bind(to: addTableView.rx.items(cellIdentifier: "addCell", cellType: AddTableViewCell.self)) { (row, item, cell)\n in\n cell.cellAdd = item\n }.disposed(by: disposeBag)\n \n addTableView.rx.modelSelected(StationItem.self)\n .subscribe(onNext: { item in\n\n let alert = UIAlertController(title: "Add Station", message: "Do you want to add a station to your favorites?", preferredStyle: .alert)\n let ok = UIAlertAction(title: "Ok", style: .default, handler: { action in\n self.addTableView.rx.modelSelected(StationItem.self)\n .bind(to: self.viewModel.stationItem)\n .disposed(by: self.disposeBag)\n self.viewModel.addStationItem()\n })\n alert.addAction(ok)\n let cancel = UIAlertAction(title: "Cancel", style: .default, handler: { action in\n })\n alert.addAction(cancel)\n DispatchQueue.main.async(execute: {\n self.present(alert, animated: true)\n })\n }).disposed(by: disposeBag)\n \n viewModel.fetchStations()\n}\n\nViewModel:\n let stationItem = PublishSubject<StationItem>()\n\n func addStationItem() {\n stationItem.subscribe(onNext: {(data) in\n print("Data: \\(data)")\n \n })\n .disposed(by: disposeBag)\n \n print("ADD:")\n \n}"
] | [
"swift",
"rx-swift",
"uialertaction"
] |
[
"Trying to create this css ribbon. Struggling with the curve of the ribbon",
"I've tried to create this css shape (ribbon) using border radius but I'm unable to do so, the curve I'm able to get isn't exactly matching the div's curve in the image. \n\nbackground: #008712;\n width: 89px;\n height: 22px;\n box-shadow: #d0dae0;\n background-color: #008712;\n border-bottom-left-radius: 70px;\n}\n\n\nIf I get this curve right that solves the problem, I would like avoid svgs if possible."
] | [
"html",
"css",
"css-transforms",
"css-shapes"
] |
[
"Tracing GET/POST calls",
"is there a way to trace all the calls made by a web page when loading it? Say for example I went in a video watching site, I would like to trace all the GET calls recursively until I find an mp4/flv file. I know a way to do that would be to follow the URLs recursively, but this solution is not always suitable and quite limitative( say there's a few thousand links, or the links are in a file which can't be read). Is there a way to do this? Ideally, the implementation could be in python, but PHP as well as C is fine too"
] | [
"php",
"python",
"html",
"networking"
] |
[
"Query if Azure Cloud Service Staging slot is provisioned with VMs",
"I want to create an Azure Powershell Function that sends an alert if the staging slot of a Cloud Service is provisioned with VMs.\n\nI tried using Get-AzureDeployment but it seems this doesn't work with .Net core and I can't seem to create a .Net Framework Function App.\n\nI also tried az resource list but it doesn't seem to give me information on the status of the deployment"
] | [
"azure",
"azure-functions",
"azure-cloud-services"
] |
[
"OpenERP RFID Terminal Module Error",
"After installing RFID Terminal module successfully on a fresh database of OpenERP 7 to pull attendance logs from a ZKTeco DS100 machine, I tried to add a user in the module (to link IDs on the machine with Employee IDs in OpenERP). I get the error:\n\n File \"C:\\Program Files (x86)\\OpenERP 7.0-20130610-231029\\Server\\server\\openerp\\addons\\hr_attendance_terminal\\hr_attendance_terminal.py\", line 230, in create_terminal_users\n UnboundLocalError: local variable 's' referenced before assignment\n\n\nThe code block:\n\ndef create_terminal_users(self, cr, uid, automatic=False, use_new_cursor=False, context=None):\n if context is None:\n context = {}\n\n terminal_ids = self.pool.get('hr.attendance.terminal').search(cr, uid, [])\n\n for t_id in terminal_ids:\n terminal = self.pool.get('hr.attendance.terminal').browse(cr, uid, t_id, context=context)\n #print \"CREATE USER ON Terminal: %s | %s\" % (terminal.tnr, terminal.ip)\n\n TerminalNr = terminal.tnr # zweistelling in Hex \n host = terminal.ip # Terminaladresse\n\n port = 8000 # Terminaldatenport\n STX = '\\x02' # Startbit\n ETX = '\\x03' # Stopbit\n\n emp_ids = self.pool.get('hr.employee').search(cr, uid, [('rfid_key', '!=', '')])\n if emp_ids:\n\n #Verbindung herstellen\n s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)\n try:\n s.connect((host,port))\n except socket.error, msg:\n print 'Socket Error: %s' % msg\n break\n\n for emp_id in emp_ids:\n employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)\n\n s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)\n rfid_key = employee.rfid_key\n employee_name = employee.name\n pin = '0000'\n pinabfrage = '0' # bei 1 wird pin abgefragt\n infotext1 = ' ' # 16 Zeichen Infotext\n infotext2 = employee_name.center(16) # 16 Zeichen Infotext\n infotext3 = ' ' # 16 Zeichen Infotext\n infotext4 = ' ' # 16 Zeichen Infotext\n\n #Paket / Telegram erstellen\n #Schema: <STX>SS<Kommando><Daten><BCC><ETX>\n\n bccstring = self.create_bcc(TerminalNr + 'SPSTA' + rfid_key + pin + pinabfrage + infotext1 + infotext2 + infotext3 + infotext4)\n message = STX + TerminalNr + 'SPSTA' + rfid_key + pin + pinabfrage + infotext1 + infotext2 + infotext3 + infotext4 + bccstring + ETX\n #print \"Employee: %s\" % employee.name\n #Paket / Telegram senden\n try:\n s.sendall(message)\n except socket.error, msg:\n print 'Socket Error: %s' % msg\n break\n while 1:\n reply = s.recv(8192)\n if str(reply) != '':\n r_message = re.sub(r'\\x02|\\x03','',str(reply))\n r_terminal = r_message[0:2]\n if r_message[2:7] == 'SPSTA':\n #print \"Stammsatz gespeichert!\"\n break\n\n s.close()\n return True\n\n\nNotes:\n\n\nThe module installed normally eventhough it was built for OERP 6.\nMade minor changes to match OERP 7 import functions.\nPython 2.7"
] | [
"python-2.7",
"openerp"
] |
[
"NotificationCompat doesn't contains InboxStyle",
"I'm developing an android application using support v4 api and ActionBarSherlock library.\n\nI need to show a list of events inside an notification. The android developer site shows an example using the NotificationCompat.InboxStyle, however, my support v4 api appears not to have this class. I'm using the newest version (rev. 18).\n\nAnyone already had this problem?"
] | [
"android",
"android-notifications"
] |
[
"Make a channel app Windows Phone 7.1",
"I'm new to Windows Phone 7.1. So I have an idea for my app that will follow, update information from a server. Example:\n\n\nI have some information: activities that are going on, so I would like to share to people in my club.\nA member of club will have an app contain 1 button (called \"Activity\"): when he clicks the button, he will receive what activities are going on now.\n\n\nMy question is: how to update information of activities to server and how to receive it (using HTTPRequest or anything else? )\n\nSorry, my English is bad."
] | [
"c#",
"windows-phone-7"
] |
[
"Is there a way to get the scopes of a function from outside the function - JS",
"While using chrome devtools console on a web page, searching for how I would access local variables from within a function, I realized that you can view scopes when manually inspecting a function in an object.\n\nI accessed the function with getEventListeners(window).load[2] which returned\n\n▼{listener: ƒ, useCapture: false, passive: false, once: false, type: \"load\"}\n\n ►listener: ƒ ()\n once: false\n passive: false\n type: \"load\"\n useCapture: false\n ►__proto__: Object\n\nwhen I clicked on the listener function, it showed an object\n►[[Scopes]]: Scopes[3]\n\nThe scopes object gave a list of all the variables that were used in the function (which was what I was looking for). However, I can only access these manually. There is nothing like getEventListeners(window).load[2].listener.Scopes \n\nIs there any sort of function or method that will return these variables automatically. Such as:\n\nvar foo = getEventListeners(window).load[2].listener.Scopes[0]\n\nThanks"
] | [
"javascript",
"google-chrome-devtools"
] |
[
"Problems occur with my Runnable JAR but work fine in Eclipse",
"I am working on an auto-clicker on Eclipse. I've currently coded it so it can click at certain times in between two specified intervals of time.\n\nWhen I run the program on Eclipse, it will work perfectly fine. The mouse will remain where I left it, and it will click in between the correct intervals.\n\nHowever, when I export the program as a Runnable JAR it will not work. When I hit \"START\" on my program and it begins clicking, I will move my mouse. The problem is that when I hit \"START\" my mouse will jump back to where I pressed the \"START\" button.\n\nMy goal is to have the mouse remain where it is and just click. Does anyone know why this mysterious mouse movement occurs? Any help would be appreciated.\n\nI have tried:\n\n\nExtract required libraries into generated JAR. \nPackage required libraries into generate JAR\nCopy required libraries into a sub-folder next to the generated JAR\n\nClickerThread(int startTime, int endTime) throws AWTException {\nClickerThread.startTime = startTime;\nClickerThread.endTime = endTime;\nClickerThread.robot = new Robot();\n}\n\n@Override\npublic synchronized void run() {\n\nif (!running) {\n running = true;\n}\n\nwhile (running) {\n WirbRandomClicker.panel.setBackground(new Color(0, 255, 0));\n System.out.println(\"Clicking.\");\n random_delay = getRandomDelay();\n WirbRandomClicker.txtClickSpeed.setText((random_delay + 10)\n + \" milliseconds\\n\");\n robot.mousePress(InputEvent.BUTTON1_MASK);\n robot.delay(random_delay);\n robot.mouseRelease(InputEvent.BUTTON1_MASK);\n\n}\n}"
] | [
"java",
"eclipse",
"user-interface",
"jar",
"mouseevent"
] |
[
"Importing CSS in one component is adding CSS affect to other Components. How and Why?",
"I am from Angular Background and as far as I know. Each component has its own beauty and till we import a CSS file inside itthose CSS classes should not be applied even if we add to HTML Elements to the component in case we have not added or imported any CSS files for classes used inside this new/2nd component. \n\nWhat I did in React was made 2 components - Home1.js and Home2.js. When I am importing a css file named Home.css to Home1 Component and NOT to Home2.js component - How in the world is those CSS classes affect being applied even too Home2 Component. This is sheer absurd.\n\nThat's why I am importing someFile.css **specifically** to the component where I want its affect to be there. This provided a kind of encapsulation affect, which I am seeing is failing. Now, someone can explain me how in the world, wherever I am not importing someFile.css, there also the classes are having affect? \n\nHome1.js \n\nimport React, { Component } from 'react';\nimport './home.css';\n\nclass Home1 extends Component {\n\n render() {\n return (\n <div>\n <div className=\"red\">1...</div>\n <div className=\"green\">2...</div>\n <button>click</button>\n </div>\n )\n\n }\n}\n\nexport default Home1;\n\n\nHome2.js\n\nimport React, {useState} from 'react';\n\nconst Home2 = () => {\n\n return (\n\n <div>\n <div className=\"red\">1..</div>\n <div className=\"green\">2...</div>\n <button>click</button>\n </div>\n )\n\n}\n\nexport default Home2;\n\n\nResult:"
] | [
"javascript",
"reactjs",
"ecmascript-6"
] |
[
"How can I replace the summing in numpy matrix multiplication with concatenation in a new dimension?",
"For each location in the result matrix, instead of storing the dot product of the corresponding row and column in the argument matrices, I would like like to store the element wise product, which will be a vector extending into a third dimension.\n\nOne idea would be to convert the argument matrices to vectors with vector entries, and then take their outer product, but I'm not sure how to do this either.\n\nEDIT:\n\nI figured it out before I saw there was a reply. Here is my solution:\n\ndef newdot(A, B):\n A = A.reshape((1,) + A.shape)\n B = B.reshape((1,) + B.shape)\n\n A = A.transpose(2, 1, 0)\n B = B.transpose(1, 0, 2)\n\n return A * B\n\n\nWhat I am doing is taking apart each row and column pair that will have their outer product taken, and forming two lists of them, which then get their contents matrix multiplied together in parallel."
] | [
"numpy",
"3d",
"concatenation",
"matrix-multiplication",
"operation"
] |
[
"webpack build: Class extends value undefined",
"I have 3 files, which look like this:\n\nutil/index.ts\n\nexport * from './Vector2'\nexport * from './Sprite'\nexport * from './GameObject'\nexport * from './Component'\n\n\nutil/Component.ts\n\nexport interface ComponentType<T extends Component> {\n new(gameObject: GameObject): T;\n}\n\nexport class Component { }\n\n\ncomponents/Rigidbody.ts\n\nimport { Component } from '../util'\nexport class Rigidbody extends Component { }\n\n\nEverything works fine in the editor, and when the code compiles into javascript. However, when I run the code in the browser, I get the error:\n\n\n Uncaught TypeError: Class extends value undefined is not a constructor or null\n\n\nWhich is referring to export class Rigidbody extends Component\n\nIf I change my import to import the Component file instead of the index file it works:\n\nimport { Component } from '../util/Component'\n\n\nI also have a Transform file that imports the Component file, and that one does the same thing.\n\nIs there something I am doing wrong or is it the way I am building it with webpack?\n\nHere is my webpack file:\n\nconst path = require('path')\n\nmodule.exports = {\n entry: './src/index.ts',\n devtool: 'inline-source-map',\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 alias: {\n PIXI: path.join(__dirname, 'node_modules/pixi.js/lib/index.js')\n }\n },\n output: {\n libraryTarget: 'var',\n library: 'phoenix',\n filename: 'phoenix.js',\n path: path.resolve(__dirname, 'dist')\n }\n};"
] | [
"javascript",
"typescript",
"webpack"
] |
[
"A strange print function bug",
"I'm working on a InterviewStreet problem https://www.interviewstreet.com/challenges/dashboard/#problem/4fcf919f11817, the algorithm is correct but I still get several wrong answers, after several hours I find the problem is related with a print function:\n\nvoid printHalf(int64_t x) {\n if (x % 2 == 0)\n printf(\"%lld\\n\", x / 2L);\n else\n printf(\"%lld.5\\n\", x / 2L);\n}\n\n\nThis function takes a 64-bit integer, and print its half. If I change this function to the following code, my solution works on all test cases:\n\nvoid printHalf(int64_t x) {\n if (x % 2 == 0)\n printf(\"%lld\\n\", x / 2L);\n else\n printf(\"%.1f\\n\", x / 2.0);\n}\n\n\nIt looks a little weird to me, since in my opinion the two functions have the same results."
] | [
"c++"
] |
[
"Correctly Mapping Bidirectional Entities with One Entity Having EmbeddedId",
"What do I have wrong with my mapping?\nI have an entity:\nAccount\n@Id\n@Column(name = "ACC_CD")\nprivate String code;\n\n@OneToMany(mappedBy = "account")\[email protected]\nprivate List<Item> items;\n\nItem has an compound key and refers back to Account:\nItem\n@JsonIgnore\n@EmbeddedId\nprivate ItemKey itemKey;\n \n@MapsId("accountCode")\n@ManyToOne(fetch = FetchType.LAZY)\n@JoinColumn(foreignKey = @ForeignKey(name="ACC_CD"), referencedColumnName = "ACC_CD", name = "ACC_CD")\nprivate Account account;\n\n@MapsId("vendorId")\n@ManyToOne(fetch = FetchType.LAZY)\n@JoinColumn(foreignKey = @ForeignKey(name="VEN_ID"), referencedColumnName = "VEN_ID", name = "VEN_ID")\nprivate Vendor vendor; \n\nItemKey is annotated with @Embeddable\nItemKey\nprivate static final long serialVersionUID = -3333188512497829179L;\n\n@Column(name = "ACC_CD")\nprivate String accountCode;\n\n@Column(name = "VEN_ID")\nprivate Long vendorId;\n\nBut when I query an account, I get no items even though the database has items for the account. I.e., using\npublic interface AccountRepository extends ReadOnlyRepository<Account, String> { }\naccountRepo.findById("A123") returns an account with code A123 and an empty items list.\nWhat do I have wrong with my mapping?\nThe DB tables looks like this:\nTable Account:\nACC_CD varchar(25) PK\n\nTable Item:\nACC_CD varchar(25) PK, FK to Account.ACC_CD\nVEN_ID bigint PK, FK to Vendor.VEN_ID\n\nNote: I can see the query to the item table when setting the logging level as:\nlogging:\n level:\n com.example: debug\n org.hibernate.SQL: debug\n org.hibernate.type: trace\n\nI can even see it extracting all the values for the item key. But properties for item are not extracted (say for example if I added name property on Item it would not be extracted). I'm not sure why the data is not mapped to items property in Account.\nUpdate\nI'm querying a read-only 3rd party DB. The Account, Item, and Vendor tables have hundreds of columns. To further explore this issue, I created a test database that mirrored the "real" database except it only had the columns as specified in my entities.\nI ran the identical code against both databases. Lo and behold...\nTest DB\nItems is populated!!!! I see only one query in response to accountRepo.findById("A123").get().getItems().\n3rd party DB\nItems is empty. I see same query repeated two times in response to the same call. It looks like it tries one query with A123 and another with a123. After the first query, I see the following log statement not present with the test DB:\n2020-12-17 17:31:55.162 TRACE 18344 --- [nio-8080-exec-1] org.hibernate.type.CollectionType : Created collection wrapper: [com.example.Account.positions#A123]\n\nThen, I see another query that joins items and vendors.\nBoth databases are SQL server. My test DB is version 13.0 and the 3rd party DB is 12.0. Why would that explain the issue?\nUpdate 2\nOK... I figured it out. The 3rd party database stores the account code in lower case (e.g. a123). For some reason that causes two queries to be issued one for A123 which returns results and another for a123 which returns the same result. Then, I get an empty items. However, if I query for a123, then only one query is issued for a123 which gives me items.\nNow, only two questions remain:\n\nWhy is hibernate issuing a second query if the case doesn't match?\nWhy is an empty collection being returned for items when the case doesn't match?"
] | [
"sql-server",
"hibernate",
"jpa",
"jdbc",
"spring-data-jpa"
] |
[
"can i use wcf rest service in my asp.net 3.5 web application",
"I heard that rest services are moved from wcf to asp.net web api frame work.\n\nOur web application is built on vs 2010 (asp.Net 3.5) .So still i can use wcf rest services in my web application?\n\nPlease suggest some alternatives if it is not possible."
] | [
"asp.net",
"wcf",
"rest"
] |
[
"How to use swift in xamarin iOS",
"I am trying to make use of an swift based iOS Framework in xamarin.iOS\n\nBut after some research, I found that xamarin doesn't support swift language using Embedding Mono too.\n\nHow can I make use of Framework in Xamarin.iOS ?"
] | [
"c#",
"swift",
"xamarin",
"xamarin.ios",
"frameworks"
] |
[
"ColorBox HTML page Size Not Right",
"I use ColorBox Jquery plugin to open a HTML file.\nI use iframe attribute to open the HTMl page.\nBut the HTML page only occupies a part of the ColorBox and not the entire part.\n\nThe Code is\n\n$(\".iframe\").colorbox({iframe:true, width:500, height:500 , overlayClose:true }); \n });\n\n\nHTML code is\n\n<div id='container'>\n<div id=\"sign1\" class=\"sign\" style=\"background-image:url('images/log.jpg'); position:absolute; width:1440px; height:25px;\">\n</div>\n<div id='text11' class='text'><font color='white'><a class='iframe' href=\"hello.html\"> Sign Up </div></font>\n</div>\n\n\nHere is the Image\n\n![preview]http://i.imgur.com/6nOx5Mp.jpg"
] | [
"javascript",
"jquery",
"html",
"colorbox"
] |
[
"CakePHP Upgrade via Rector, functions with input type array declaration",
"I'm trying to use rector (https://github.com/rectorphp/rector) for the first time to upgrade my CakePHP application. I'm working in a local development environment first. \n\nI've hit a bit of a headache. For example purposes I created the following simple php class: \n\n<?php\n\nclass test {\n public function init( array $data) {\n return $data;\n }\n}\n\n\nI run the following command:\n\nvendor/bin/rector process src/Model/Table/test.php --level cakephp35 --dry-run\n\n\nI receive the following error:\n\nClass array was not found while trying to analyse it - autoloading is probably \nnot configured properly.\n\n\nThe issue is with the \"array\" type declaration for the input variable in the function. I remove it, the code passes the rector test. \n\nI've googled around and can't find anything, which makes me think I missed something incredibly simple. Any help?"
] | [
"cakephp-3.5",
"phpstan"
] |
[
"Worklight 6.1.0.2 app on Server 6.1.0.1",
"Does anybody know whether Worklight version 6.1.0.2 which has support for iOS also requires a server upgrade? Or will it work on Server 6.1.0.1 as well?"
] | [
"ibm-mobilefirst",
"worklight-studio",
"worklight-server"
] |
[
"Property 'map' does not exist on type '{}' rxjs6",
"Please view the following code: \n\nimport { Component } from '@angular/core';\nimport { AngularFirestore, AngularFirestoreCollection } from 'angularfire2/firestore';\nimport { Observable} from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { StudentsInfo } from '../studentInfo';\n\n@Component({\n selector: 'app-delete-student',\n templateUrl: './delete-student.component.html',\n styleUrls: ['./delete-student.component.css']\n})\n\nexport class DeleteStudentComponent {\n\npublic itemsCollection: AngularFirestoreCollection<StudentsInfo>;\npublic items: Observable<StudentsInfo[]>;\n\nconstructor(private db: AngularFirestore) {\n\nthis.itemsCollection = this.db.collection<StudentsInfo>('/Stud_Info');\n//this.items = this.itemsCollection.valueChanges();\n\n // .snapshotChanges() returns a DocumentChangeAction[], which contains\n // a lot of information about \"what happened\" with each change. If you want to\n // get the data and the id use the map operator.\n this.items = this.itemsCollection.snapshotChanges().pipe(\n map(changes => changes.map(a => {\n const data = a.payload.doc.data() as StudentsInfo;\n const id = a.payload.doc.id;\n return { id, ...data}\n })\n ));\n}\n\n // Deleting a Student from Firestore\n public deleteStudent(docId:string) {\n this.itemsCollection.doc(docId).delete();\n }\n}\n\n\nProblem: Property 'map' does not exist on type '{}'.\n\nI have followed this documentation of angularfire2. \nI have done everything according to the documentation needed and the according to the latest rxjs6 release.\n\nThe final angular application Runs fine but while doing ng build --prod --aot this error occurs."
] | [
"firebase",
"rxjs",
"google-cloud-firestore",
"angularfire",
"angular6"
] |
[
"Weird issue with parameter validation on usage of interface implementation",
"So basically I'm not sure if this is a PhpStorm issue parsing my code or if its a weird quirk of PHP and interfaces but basically I have the following interface\n\n<?php\n\nnamespace App\\Contracts;\n\n/**\n * Interface IFileSource\n * @package App\\Contracts\n */\ninterface IFileSource\n{\n public function getFilesByPattern(string $filePattern) : array;\n}\n\n\n\nwith the following implementation\n\n<?php\n\nnamespace App\\Sources;\n\nuse App\\Contracts\\IFileService;\nuse App\\Services\\File\\FileService;\n\n/**\n * Class FileSource\n * @package App\\Sources\n */\nclass FileSource implements IFileSource\n{\n /**\n * @var FileService\n */\n private $fileService;\n\n public function __construct (IFileService $fileService)\n {\n $this->fileService = $fileService;\n }\n\n\n /**\n * @param string $filePattern\n * @return File[]\n * NOTE THIS ASSUMES FILESYSTEM\n */\n public function getFilesByPattern (string $filePattern) : array\n {\n $filesDetails = $this->fileService->getFilesByPattern($filePattern);\n return [];\n }\n}\n\n\nand the usage\n\n<?php\n\nnamespace App\\Console\\Commands;\n\nuse App\\Contracts\\IFileSource;\nuse App\\Sources\\FileSource;\n\nclass ImportXML extends Command\n{\n\n /**\n * @var FileSource\n */\n protected $fileSource;\n\n public function __construct (IFileSource $fileSource)\n {\n parent::__construct();\n $this->fileSource = $fileSource;\n }\n\n public function handle () : void\n { \n $filePattern = 'APATTERN';\n $files = $this->fileSource->getFilesByPattern($filePattern)\n }\n}\n\n\nMy question relates to the usage of this implementation.\n\nSo the following is a valid usage:\n\n$filePattern = 'APATTERN';\n$this->fileSource->getFilesByPattern(filePattern)\n\n\nBut for some reason the following is also seen as a valid usage?\n\n$filePattern = 'APATTERN';\n$this->fileSource->getFilesByPattern(filePattern,filePattern,filePattern,filePattern,filePattern,filePattern,filePattern)\n\n\nWhy does it not care that i am not conforming to my implementation?"
] | [
"php",
"laravel",
"interface",
"phpstorm"
] |
[
"How to shift density?",
"I am trying to \"correct\" the results of the model with the insitu data.\nI measure the tempreture at a point and I look at the same point the model output.\n\nI have two data frames, one for insitu data and another for model data.\nHere is an exemple of 2 densities, and I want to shift the model density to insitu density. \nIs it possible to do that?\n\ninsitu <- data.frame(Temp = rnorm(500, 6, 2))\nmodel <- data.frame(Temp = rnorm(500, 7, 2.5))\ninsitu$mesure <- \"insitu\"\nmodel$mesure <- \"model\"\nallData <- rbind(insitu, model)\nggplot(allData, aes(Temp, fill=mesure)) + geom_density(alpha = 0.2)"
] | [
"r",
"probability-density"
] |
[
"Adding form values to a table with backbone and handlebars",
"The scenario is to add the values entered in form fields into a table on click of Add button. I am new to this both and not sure how data binding works.\n\nMy initial html is \n\n<table class=\"table table-bordered\">\n <thead>\n <tr>\n <th>Model</th>\n <th>Brand</th>\n <th>Year</th>\n <th>Action</th>\n </tr>\n <tr>\n <td><input class=\"form-control\" id=\"modelname\"></td>\n <td><input class=\"form-control\" id=\"brandname\"></td>\n <td><input class=\"form-control\" id=\"yearname\"></td>\n <td><button class=\"btn btn-primary add\">Add</button></td>\n </tr>\n\n </thead>\n <tbody class=\"product-list\">\n\n </tbody>\n </table>\n </div>\n\n <script type=\"text/x-handlebars-template\" id=\"product-template\">\n {{#each []}}\n <tr>\n <td>{{ model }}</td>\n <td>{{ brand }}</td>\n <td>{{ year }}</td>\n <td><div class=\"btn btn-primary\">Edit</div>&nbsp;<div class=\"btn btn-danger\">Delete</div></td>\n </tr>\n {{/each}}\n\n </script>\n\n\nI messed up in js for purpose of using handlebars as \n\nvar Product=Backbone.Model.extend({\n model:'',\n brand:'',\n year:''\n});\n\nvar ProductCollection=Backbone.Collection.extend({\n model:Product\n});\n\n var modelname= document.getElementById('modelname').value;\n var brandname=document.getElementById('brandname').value;\n var yearname= document.getElementById('yearname').value;\nvar ProductView = Backbone.View.extend({\n\n el: '.product-list',\n tagName: 'tr',\n events:{\n \"click .add\": \"create\"\n },\n initialize:function(){\n this.render();\n },\n render:function()\n {\n var source=$('#product-template').html();\n var template=Handlebars.compile(source);\n var html=template(this.products.toJSON());\n },\n create: function(e){\n var product=new Product({\n model:modelname,\n brand:brandname,\n year:yearname\n })\n console.log(product.toJSON);\n products.add(product);\n modelname=\"\";\n yearname=\"\";\n brandname=\"\";\n }\n\n });\n var products=new ProductCollection();\n\n\nShare me an idea how to proceed. I don't get an error and at the same time, nothing happens! I am very new to backbone. Please tolerate blunders."
] | [
"backbone.js",
"handlebars.js"
] |
[
"Automation for Mobile Web Site by Testcomplete 10",
"I am trying to automate mobile web site, so i am using virtual browser in Testcomplete 10. But i couldnot able to map any child object from parent.\nI can take main page screenshot only. Below steps i had done,\n\n1) opend www.google.com by using virtual browser with Apple ipad or any other\n\n2) took screenshot for main page, Name Mapping path : Aliases.browser.BrowserWindow.Chrome_RenderWidgetHostHWND\n\n3) Trying to map Google search textbox, but could not map that child objects from parent(\"Chrome_RenderWidgetHostHWND\").\n\nCan any one confirm possible solution for this?"
] | [
"testing",
"testcomplete"
] |
[
"Event Kit calendar doesn't show up in iCal",
"I am creating a local calendar using Event Kit and saving the calendar. When I go to Apples Calendar App and view my calendar it does not appear. The weird thing is that it works on my iPhone 5, but not on my iPhone 6. I receive no errors in the debugger. Does anyone have any idea above this?"
] | [
"ios",
"calendar",
"eventkit"
] |
[
"Getting \"Aborted because 0 is not accepted\" and full page reload with react-hot-loader",
"I am trying to set up webpack hot reloading with react-hot-loader. It mostly seems to be working. I am using webpack in an existing rails app.\n\nBut it isn't hot-reloading. It is simply triggering a reload every time my react code is changed. The error messages I get are:\n\n[HMR] Cannot apply update. Need to do a full reload! - dev-server.js:18\n[HMR] Error: Aborted because 0 is not accepted - dev-server.js:19\n at hotApply (http://localhost:8080/assets/webpack/bundle.js?body=1:380:31)\n at hotUpdateDownloaded (http://localhost:8080/assets/webpack/bundle.js?body=1:293:13)\n at hotAddUpdateChunk (http://localhost:8080/assets/webpack/bundle.js?body=1:273:13)\n at webpackHotUpdateCallback (http://localhost:8080/assets/webpack/bundle.js?body=1:5:12)\n at http://localhost:8080/assets/webpack0.bd89931b2fa8e2901794.hot-update.js:1:1\n\nNavigated to http://lvh.me:3000/react_page\n\n\nHere is my webpack.hot.config.js settings:\n\nvar path = require('path');\nvar webpack = require('webpack');\n\nvar config = module.exports = {\n\n // Set 'context' for Rails Asset Pipeline\n context: __dirname,\n\n entry: {\n App: [\n 'webpack-dev-server/client?http://localhost:8080/', // WebpackDevServer host and port\n 'webpack/hot/only-dev-server', // \"only\" prevents reload on syntax errors\n './app/frontend/javascripts/app.js' // Your appʼs entry point\n ],\n vendor: ['jquery', 'react', 'react-dom', 'react-redux', 'redux','redux-thunk']\n },\n\n devtool: 'inline-source-map',\n\n // Require the webpack and react-hot-loader plugins\n plugins: [\n //new webpack.HotModuleReplacementPlugin(),\n new webpack.optimize.CommonsChunkPlugin(\n {\n name: 'vendor',\n chunks: [''],\n filename: 'vendor.js',\n minChunks: Infinity\n }),\n new webpack.NoErrorsPlugin(),\n new webpack.ProvidePlugin({\n $: 'jquery',\n jQuery: 'jquery',\n 'window.jquery': 'jquery'\n })\n ],\n module: {\n loaders: [\n {\n test: /\\.jsx?$/,\n exclude: /node_modules/,\n loaders: [\n 'react-hot',\n 'babel?presets[]=es2015&presets[]=react'\n ],\n cacheDirectory: true\n }\n ]\n },\n output: {\n path: path.join(__dirname, 'app', 'assets', 'javascripts', 'webpack'), // Save to Rails Asset Pipeline\n filename: 'bundle.js', // Will output App_wp_bundle.js\n publicPath: 'http://localhost:8080/assets/webpack',\n\n //publicPath: 'http://localhost:8080/assets/webpack' // Required for webpack-dev-server\n },\n resolve: {\n extensions: ['', '.js', '.jsx'],\n modulesDirectories: ['node_modules'],\n },\n\n};\n\n\nAnd I run the code with \n\nwebpack-dev-server -d --config webpack.hot.config.js --hot --inline\n\n\nThe rails development environment serves the webpack files outside the application asset pipeline via the webpack-dev-server because of the following setting in my development.rb file.\n\nconfig.action_controller.asset_host = Proc.new { |source|\n if source =~ /webpack\\/bundle\\.js$/i\n \"http://localhost:8080\"\n end\n}\n\n\nI have been trying to get this working for hours. Any help would be appreciated. \n\nThanks guys!"
] | [
"javascript",
"ruby-on-rails",
"reactjs",
"webpack",
"react-hot-loader"
] |
[
"XSLFile to select Third tag of XML",
"I need Solution for below Task\n\nXML\n\n <core:ReferenceCoded Description=\"SERTA BUSINESS CARDS\"></core:ReferenceCoded>\n <core:ReferenceCoded Description=\"XM:107008\"></core:ReferenceCoded>\n <core:ReferenceCoded Description=\"J ALMANZA\"></core:ReferenceCoded>\n <core:ReferenceCoded Description=\"847 857 0049\"></core:ReferenceCoded>\n\n\nXSL\n\n<xsl:template match=\"abc:BaseItemReference/core:ListOfItemReferences/core:ReferenceCoded\"> \n\n <xsl:element name=\"TAG_LINE\"> \n <xsl:value-of select=\"@Description\" /> \n </xsl:element> \n\n </xsl:template>\n\n\nThe output XML File is \n\n< TAG_LINE>SERTA BUSINESS CARDS</TAG_LINE>\n < TAG_LINE>XM:107008</TAG_LINE>\n < TAG_LINE>J ALMANZA</TAG_LINE>\n < TAG_LINE>847 857 0049</TAG_LINE>\n\n\nI need output of third Line. Please Suggest on changing the XSL file Code to fetch data in the Format\n\n<TAG_LINE>J ALMANZA</TAG_LINE>"
] | [
"xml",
"xslt",
"xslt-2.0"
] |
[
"Restriction that limits entry to 1 per one unique value in other column",
"I'm using MS Access 2013 to build a small database for occupancy data entry at a local group of libraries and need to build in some restrictions.\n\nDatabase Structure/Relationship\nI want to add in a restriction that limits the entry per one unique location to one per day (to avoid duplicate entry).\n\nIt would be nice that when a duplicate is added, a message shows which entry(s) is already in place so this one can be edited when necessary \n\nHope someone can help as I'm quite new to MS Access :)"
] | [
"ms-access"
] |
[
"How to set different height and width of cells at one row collectionview",
"I want to achieve this:\nIdeal\n\nBut this is what I get so far:\nnow\n\nThis is the code I have now:\n\nextension Profile_PhotosUpload: UICollectionViewDelegateFlowLayout{\n\nfunc collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {\n let bigSize = CGSize(width: 180.0, height: 180.0)\n let smallSize = CGSize(width: 70, height: 70)\n if indexPath.row == 0{\n return bigSize\n }else{\n return smallSize\n }\n}\n// Horizontal Space\nfunc collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {\n return 5\n}\n// Vertical Space\nfunc collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {\n return 10\n}\n\nfunc collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {\n return UIEdgeInsets(top: -60, left: 0, bottom: 0, right: 0)\n}\n\n\n}\n\nPlease someone help."
] | [
"ios",
"swift",
"uicollectionview"
] |
[
"Latency when loading html content with FOSJsRoutingBundle and Ajax (route parameter {id})",
"I am using FOSjSrouting in my symfony2.7 project.\n\nI have this html.twig view code:\n\n<table>\n<!--table header code ...etc... -->\n <tbody>\n {% for currentData in arrayData %}\n <tr>\n <td>{{ currentData.first_name}}</td>\n <td>{{ currentData.last_name}}</td>\n <td>{{ currentData.order}}</td>\n <td>{{ currentData.category}}</td>\n <td>{{ currentData.location}}</td>\n <td>{{ currentData.price}}</td>\n <td>\n <a><button class=\"btn btn-info btn-xs showDetail\" href=\"{{ path('detailsData', {'idData': currentData.idData }) }}\">Show Detail</button></a> <!-- to open dialog tag through Ajax for each lines -->\n <a href=\"{{ path('editData', {'idData': currentData.idData }) }}\"><button class=\"btn btn-warning btn-xs\">Edit</button></a>\n </td>\n </tr>\n {% endfor %}\n </tbody>\n</table>\n\n<!-- the dialog window to load detail content -->\n<dialog id=\"window\"></dialog>\n\n<!-- javascript to open and close dialog window -->\n<script>\n (function() {\n var dialog = document.getElementById('window');\n var showButtons = document.getElementsByClassName('showDetail');\n var showDialog = function() {\n console.log(this);\n dialog.show();\n dialog.load(Routing.generate('detailsData', {'idData': currentData.idData }) }})\n };\n var i, len = showButtons.length;\n for(i = 0; i < len; ++i) {\n showButtons[i].onclick = showDialog;\n }\n document.getElementById('exit').onclick = function() {\n dialog.close();\n };\n })();\n</script>\n\n\nAs you can see, foreach data I want to display, I have a detail button. This detail button refers to another page which displays linked data to the current data I clicked on.\n\nThis the route for the detail view (respecting the FOSjSrouting needs):\n\ndetailData:\n pattern: /manage/order/detail/{idData}\n defaults: { _controller: MySpaceMyBundle:MyController:detailData }\n requirements:\n methods: GET\n options:\n expose: true\n\n\nThe purpose is to load via Ajax, jQuery, FOSjSrouting the linked datas in the dialog tag with the id=\"window\" to the currentData.idData.\n\nBut when I click on the detail button, I have this error (in my browser console):\n\n\n Uncaught ReferenceError: currentData is not defined\n\n\nI understand that I need to take care about the {id} parameter of my route.\n\nHow can I load the page that the detail button refers to and displays the right linked data through ajax with my current script (at the end of my html code)?\n\n\n\nEDIT\n\nI add this code in javascript at the end of my script tag in my html.twig view, it allows me to display the datas I want in my dialog tag:\n\n$('.showDetail').click(function() {\n $.ajax({\n 'url': Routing.generate('detailsData', {'idData': $(this).val()}),\n 'cache' : false,\n 'success': function(loadDetail) {\n $('#window').html(loadDetail);\n }\n });\n });\n\n\nThe problem occured is that I have a latency to display the dialog tag, and just before displaying the current data I want, the last one I clicked on are displaying before for a few second, and then my current data I want is display later.\n\nMaybe It's a cache problem?\n\nMoreover, the first time I click on the detailButton, the dialog is displaying empty, then after (latency), the data are displaying.\n\nHow can I fix these problems?"
] | [
"javascript",
"jquery",
"ajax",
"performance",
"latency"
] |
[
"How can I increase the font size using jquery?",
"I am trying:\n\n $('a[data-text=\"size-bigger\"]').click(function ()\n {\n a=$('span');\n b=$('span').css('font-size');\n a.css('font-size', b+1);\n }\n );\n\n\nI had it working fine for just directly setting the size. Now I am trying to make it relative based on the previous size, i.e. \"zoomable\" - click the link and the spans increase in size, but it has no effect, what might be wrong ?"
] | [
"javascript",
"jquery"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.