texts
sequence
tags
sequence
[ "Is it possible to see what other apps are on an unjailbroken iPhone?", "Any way to do this: I would like to see what other apps are installed on a user's iPhone. I would think not but I'm positive that somebody would know better than me.\n\nIf not, can you access on desktop via iTunes? \n\nThanks!" ]
[ "iphone", "ios", "ios5" ]
[ "Placing a DIV multiple times and with random position", "I need to place a div (actually a small image of a cloud) at random positions (as a background). The background should hence have multiple small clouds placed everywhere on the page as a \"realistic sky background\".\n\nLater on I would try to apply a parallax scroll plugin on those divs .\n\nThanks!" ]
[ "jquery", "random", "background", "frontend" ]
[ "How to schedule a powershell script for automating wack process through windows scheduler?", "I am able to execute the below command from PowerShell prompt and command prompt, but I am unable to schedule it using windows scheduler.\n\npowershell script code:\n\nappcert.exe test -apptype metrostyle -packagefullname abc_somename -reportoutputpath C:\\result.xml\n\n\nappcert.exe is a Microsoft provided exe for performing certification test on my Windows 8 application. I did the following:\n\n\nI am making a file ABC.ps1 with code:\n\nappcert.exe test -apptype metrostyle -packagefullname abc_somename -reportoutputpath C:\\result.xml\n\nI create a batch file PQR.bat with this code:\n\npowershell -command \"& 'PathOfABC\\ABC.ps1' \"\n\nI am scheduling it through Windows scheduler.\n\n\nWhile creating task under actions tab, I choose following details:\n\n\nAction: Start a program\nProgram/Script: Path to the batch file\nStart in: Path of the folder containing the batch file\n\n\nAnd I schedule it to run every 15 mins. The Task completes, but I do not see any result.xml in my C drive. Can you point me how can I schedule this batch file to execute every 15 mins?" ]
[ "powershell", "scripting", "batch-file", "scheduler" ]
[ "Iterating batch values and routing them depending on values contained", "I'm trying to move an entire batch on a route depending on what values it contains. But as much as I try I'm not able to move the entire batch\n\nI've already tried to split it, but this way objects move one by one, and my DB rollback system is not able to work properly this way so I have to check object values and then move them all together.\n\nfrom(origin())\n .bean(getParser()) //getting batch of objects\n .choice()\n .when(body().method(\"doesBatchContainErrors\").isEqualTo(false))\n .log(\"Batch doesn't contain errors\")\n .bean(saveOnDB())\n .otherwise()\n .to(Channels.ERRORS_AGGREGATOR) //sending for aggregation with previous batches\n .end()\n\n\nprivate boolean doesBatchContainErrors(ArrayList<CustomItemImporter> batchList){\n for (int i = 0; i < batchList.size(); i++){\n if(batchList.get(i).getState().equals(\"ERROR\")){\n return true;\n }\n }\n return false;\n}\n\n\nI don't care if I have to use a java method (like the one I wrote down) or a specific camel function, I just need to to check the getState() method inside every object of the batch(which are inside the bean) and if it returns true, then get the entire batch to ERRORS_AGGREGATOR.\n\nUpdate 26/08/2019\n\nHere's how I solved it. \n\nfrom(getSaveChannel())\n .bean(getParser()) //getting batch of objects\n .split(body()).stopOnException()\n .choice()\n .when(body().method(\"getImportState\").isEqualTo(\"ERROR\"))\n .to(Channels.ERRORS_AGGREGATOR)\n .end() //end choice\n .end() //end split\n .bean(saveOnDB()) // -> in here i split again and set up an empty return if getImportState is equal to \"ERROR\"\n .end()\n\n\n\nIt's not moving the entire batch, but it filters errors to the aggregator and filters them again when I save on DB" ]
[ "java", "apache-camel" ]
[ "How to make expandable and collapsable by click with Javascript", "Please suggest me how to make expandable and collapsable with (+ and -) by a click with the following javascript. so if i click on pen it will expand and again click on pen it will collapse. And all these this needs to be done with JavaScript not with Jquery. \n\nTake a look at my Fiddle.\n\nvar dataSource = ({\n \"Pen\": ({\n \"Cello\": ({\n \"C1\": ({}),\n \"C2\": ({})\n }),\n \"Parker\": ({\n \"P1\": ({}),\n \"P2\": ({})\n })\n })\n }),\n traverseObject = function (obj) {\n var ul = document.createElement(\"ul\"),\n li;\n for (var prop in obj) {\n li = document.createElement(\"li\");\n li.appendChild(document.createTextNode(prop));\n if (typeof obj\\[prop\\] == \"object\" && Object.keys(obj\\[prop\\]).length) {\n li.appendChild(traverseObject(obj\\[prop\\]));\n }\n ul.appendChild(li);\n }\n return ul;\n };\n\n\n window.onload = function () {\n document.getElementById(\"list\").appendChild(traverseObject(dataSource));\n }" ]
[ "javascript", "jquery", "html", "list" ]
[ "Failed to run AzureAD Module PowerShell commands inside windows container", "I am trying to run AzureAD Module PowerShell commands inside windows container but due its dependency with \"IEFRAME.DLL\" its throwing error \n\nI also tried by copying dll inside container to windows system folder but it still complains \n\nIs there any workaround or hack available to get it work inside windows container?" ]
[ "powershell", "docker", "azure-active-directory" ]
[ "How to Convert a CSV to a SQL Table WITHOUT 'Bulk Insert'", "I have a requirement to insert a CSV file into SQL, but am not permitted to use the Bulk Insert function...\n\nThe CSV file contains thousands of lines, each of which contain 3 fields I.e\n\nJohn, Smith, 23\n\nAnd I would like to pass this into a SQL table (MSSQL2008) WITHOUT calling the 'Bulk Insert' function. The table would be the same structure as the CSV I.e it would contain 3 columns and a row for each line in the CSV.\n\nDoes anyone know if this is at all possible?" ]
[ "sql", "sql-server", "tsql", "csv", "insert" ]
[ "Why is Arraylist. sublist() not mapping onto user-Defined data type arraylist?", "import java.io.*;\nimport java.util.*;\npublic class Cards\n{\n private int value;\n private char suit;\n public Cards()\n {\n value = 0;\n suit = '0';\n }\n private void setValue (int value)\n {\n this.value = value ;\n }\n private void setSuit (char suit)\n {\n this.suit = suit;\n }\n public int getValue ()\n {\n return value;\n }\n public char getSuit ()\n {\n return suit;\n }\n public Cards[] dealCards(int userCount)\n {\n int n = (userCount * 2)+5;\n ArrayList <Cards> pack = new ArrayList<>(52);\n for (int i=0;i<13;i++)\n {\n Cards card = new Cards ();\n for (int j=0;j<4;j++)\n {\n card.setValue (i+1);\n switch (j)\n {\n case 0: card.setSuit('C');\n break;\n case 1: card.setSuit('D');\n break;\n case 2: card.setSuit('H');\n break;\n case 3: card.setSuit('S');\n break;\n ;\n }\n pack.add(card);\n }\n }\n Collections.shuffle(pack);\n pack = pack.sublist(0,n);\n return pack;\n }\n public static void main(String[] args) \n {\n int userCount = 2;\n Cards newTable[]= new Cards[(userCount*2)+5];\n newTable.dealCards(userCount);\n for(int i=0;i<(userCount *2)+5;i++)\n {\n System.out.println(newTable[i].getValue() + newTable[i].getSuit() );\n }\n }\n}\n\n\nThe above code is supposed to deal a set no of unique cards. But when compiling there seems to be certain errors:\n\n1 - the line where pack = pack.sublist(0,n)\nCannot find symbol error arises.\n\n2 - arraylist cannot be converted to Cards [] when returning \n\n3 - newTable. dealCards(userCount) seems to throw cannot find symbol error to. \nIs there a way to resolve these error without changing the code too much!?\n\nEdit : after changing sublist to subList another error seemed to arise that it cannot convert list to arraylist.\nCan we store the list in a array!? Instead of and arraylist." ]
[ "java", "arraylist", "collections" ]
[ "Why isn't my sound file getting copied to?", "so i wrote a code that creates two sound files, gives some details and explores them, but I'm having difficulty with a part thats meant to create a third sound file with length of the longer of the first two sound files and the sampling rate of both (they have the same sr). The function is meant to take the value of the samples of all indices of the first two sound files, add them together, and copy them into the third sound file. I thought I had it, but when i explore the third file it comes up blank.\n\ndef sound():\n a = pickAFile()\n b = pickAFile()\n\n sound1 = makeSound(a)\n sound2 = makeSound(b)\n\n sr1 = getSamplingRate(sound1)\n sr2 = getSamplingRate(sound2)\n\n printNow(sr1)\n printNow(sr2)\n\n play(sound1)\n play(sound2)\n\n explore(sound1)\n explore(sound2)\n\n if sr1 == sr2:\n printNow('Sampling Rate 1: %d \\nSampling Rate 2: %d' % (sr1, sr2))\n else:\n printNow('Sampling Rates are not equal.')\n c=getLength(sound1)\n d=getLength(sound2)\n printNow('sound1: %d, sound2: %d' % (c, d))\n sound3 = Sound(getLength(sound2), int(sr1))\n\n for index in range(0, getLength(sound1)): \n value = getSampleValueAt(sound1, index)\n\n for index in range(0, getLength(sound2)):\n value2 = getSampleValueAt(sound2, index)\n\n for index in range(0, getLength(sound3)): \n setSampleValueAt(sound3, index, value+value2)\n\n play(sound3)\n explore(sound3)" ]
[ "file", "indexing", "audio" ]
[ "jquery virtual keyboard shuffle", "I have tried virtual keyboard shuffle by referring the given url \n\n[1]: https://mottie.github.io/Keyboard/docs/scramble.html. Here keyboard has shuffled on every click while opening.But it has to shuffle on click of any numbers.Pls see the below code and suggest me where i made a mistake.\n\n$('#hex').keyboard({\n openOn : null,\n stayOpen : true,\n lockInput: true,\n layout: 'custom',\n customLayout: {\n 'normal' : [\n\n '1 2 3 4 ',\n '5 6 7 8',\n '9 0 {bksp}',\n '{a} {c} '\n ]\n },\n maxLength : 20,\n restrictInput : true, // Prevent keys not in the displayed keyboard from being typed in\n // include lower case characters (added v1.25.7)\n restrictInclude : 'a b c d e f',\n useCombos : false, // don't want A+E to become a ligature\n acceptValid: true,\n validate: function(keyboard, value, isClosing){\n // only make valid if input is 6 characters in length\n return value.length === 20;\n }\n});\n\n$('#hex').click(function(){\n var kb = $('#hex').getkeyboard();\n\n if ( kb.isOpen ) {\n\n kb.close();\n } else {\n kb.reveal();\n\n }\n});\n\n $('#hex') .keyboard()\n .addScramble({\n byRow : false, // randomize by row, otherwise randomize all keys\n randomizeOnce : false, // if false, randomize every time the keyboard opens\n\n\n }); \n\n\nBy this code the numbers are shuffled while the virtual keyboard has opened. But i need to shuffle the numbers on each and every click numbers by opening." ]
[ "jquery", "virtual-keyboard" ]
[ "change color by text in css3", "i came across the following code. this code should automatically change the color of the text by specific word or other characters. the code does not work for me, is really supposed to work or is it not true\n\n#text [all \"(\" ] {\n color: blue;\n}\n\n\nThe code is at the bottom of this page." ]
[ "css" ]
[ "jquery mobile footer text vertical alignment", "I'm trying to align text with image in footer area. But it seems that the text will either go top (vertical-align:top) or go right down to the bottom (vertical-align:middle), just not in the middle that I want it to be.\n\n <div data-role=\"footer\">\n <div class=\"ui-grid-b\">\n <div class=\"ui-block-a\"><img src=\"img/13-target.png\">\n <label style=\"vertical-align:middle;\">Overview</label>\n </div>\n .........\n </div><!-- /grid-b -->\n </div>" ]
[ "jquery-mobile", "alignment", "vertical-alignment" ]
[ "Import database MySQL File-Per-Table Tablespaces to Same Server", "Is necessary copy a database within a single server. Was chosen way to \"File-Per-Table Tablespaces to Another Server\" as it is the fastest for large databases.\n\nThe official documentation states that the database name must be the same on the source server and the destination server. \n\nWhat if the source server and the destination server - this is one and the same server?\n\nIs there any way in order to be able to copy the database files from one database to another within a server quickly. \n\nOr somehow a way to get \"File-Per-Table Tablespaces to Another Server\" to ignore the name of the database?\n\nInfo server: OS: MS Windows Server 2008\nMySQL Server: MySQL 5.5 or MariaDB\nTables Type: InnoDB (if MariaDB - InnoDB plugin)\n\n\nPortability Considerations for .ibd Files\nWhen you move or copy .ibd files, the database directory name must be the same on the source and destination systems. The table definition stored in the InnoDB shared tablespace includes the database name. The transaction IDs and log sequence numbers stored in the tablespace files also differ between databases." ]
[ "mysql", "innodb", "mysqldump", "mysql-backup" ]
[ "Quoting issue while echoing a html part from php to jquery", "In my php file I am echoing back an html response to my jQuery function.\nDue some wrong quoting that I am applying data is no being passed through onclick event\n\necho \" <div class='img-x' id='img-x-\".$newdata['id'].\"' ><span onclick='test('\".$newdata['id'].\"','\".$newdata['image_path'].\"');' class='icon-remove'></span></div> <img src='http://localhost/corridor/uploads/\".$actual_image_name.\"' class='img_prvw' id='img-x-\".$newdata['id'].\"' />\";\n\n\nin html it shows like this\n\n<span onclick=\"test(\" 164','13906347455190.jpg');' class=\"icon-remove\"></span>\n\n\nWhere am I doing it wrong?" ]
[ "php", "jquery", "html" ]
[ "returning a class type from an array", "iv'e got a class here, called Classrooms, in my getTopStudent method, it's saying that my variable \"topStudent\" hasn't been initialized, something i'm missing?, not everything is explained in the videos in my AP java course\n\npublic class Classroom\n{\n Student[] students;\n int numStudentsAdded;\n\n public Classroom(int numStudents)\n {\n students = new Student[numStudents];\n numStudentsAdded = 0;\n }\n\n public Student getTopStudent()\n {\n Student topStudent;\n for(int i = 1; i < students.length; i++)\n {\n\n if(students[i].getAverageScore() > students[i - 1].getAverageScore())\n {\n topStudent = students[i];\n }\n else\n {\n topStudent = students[i - 1];\n }\n\n }\n return topStudent;\n }\n\n public void addStudent(Student s)\n {\n students[numStudentsAdded] = s;\n numStudentsAdded++;\n }\n\n public void printStudents()\n {\n for(int i = 0; i < numStudentsAdded; i++)\n {\n System.out.println(students[i]);\n }\n }\n}\n\n\nmy student class is all working, nothing should be wrong with it, don't think it will be required to solve this.\n\ntester:\n\npublic class ClassroomTester extends ConsoleProgram\n{\n public void run()\n {\n Classroom c = new Classroom(2);\n\n Student ada = new Student(\"Ada\", \"Lovelace\", 12);\n ada.addExamScore(44);\n ada.addExamScore(65);\n ada.addExamScore(77);\n\n Student alan = new Student(\"Alan\", \"Turing\", 11);\n alan.addExamScore(38);\n alan.addExamScore(24);\n alan.addExamScore(31);\n\n // add students to classroom\n c.addStudent(ada);\n c.addStudent(alan);\n c.printStudents();\n\n Student topStudent = c.getTopStudent();\n System.out.println(topStudent);\n }\n}" ]
[ "java" ]
[ "How to play .m3u8 file streaming url with AudioStreamer?", "I have an iOS streaming app, that is integrated with AudioStreamer. It works fine for my streaming urls. But suddenly thay have change the streaming url into .m3u8 format. How can I use AudioStreamer for .m3u8 file url?\n\nI cant use MPMoviePlayer because I want to show some buffering before load the stream. It can easily done with the AudioStreamer. How can I use AudioStreamer to play an .m3u8 file?\n\nThank you" ]
[ "ios", "audio-streaming", "audiostreamer" ]
[ "Is it possible to exclude grails plugin from production environment?", "I would like to use certain plugin in development environment, but would like to exclude this plugin from production and from generated war. What is the easiest way to accomplish this?" ]
[ "grails", "development-environment", "production-environment", "grails-plugin" ]
[ "WPF Xceed Toolkit can not enter text", "when I use any of the UpDown controls from Xceed, I can't get them to accept text as I type. I've tried enabling AllowTextInput and using the PreviewTextInput function but the event doesn't fire. I can copy and paste numbers in there but nothing happens when I type.\n\nAny ideas? I'm using Xceed 2.6.0, DotNet 4.5.2\n\nThanks" ]
[ "wpf", "xceed" ]
[ "React Redux middleware's #store.dispatch(action) vs #next(action)", "I'm learning about react redux middleware from the docs and want to know what he means by \"the action will actually travel the whole middleware chain again?\" Does that mean the store.dispatch(action) will have the final dispatch that is returned at the end of the middleware, whereas next(action) will only point to the dispatch at a certain point of the middleware function?\n\n\n It does a bit of trickery to make sure that if you call\n store.dispatch(action) from your middleware instead of next(action),\n the action will actually travel the whole middleware chain again,\n including the current middleware. This is useful for asynchronous\n middleware, as we have seen previously." ]
[ "javascript", "reactjs", "redux", "middleware", "react-redux" ]
[ "How to make scss styles not disappear after reload of node.js application loading?", "How to make scss styles not disappear after reloading the download of node.js application (layout on pug)? That is, at the first load, the styles are loaded, but after 2 and 3 they disappear. If someone had such a problem, tell me what could be the problem and where to dig?" ]
[ "node.js", "sass", "pug" ]
[ "Android MediaPlayer does not loop when its data source is from url", "I am using MediaPlayer in my app. I am following the following tutorial\n\nhttp://blog.lemberg.co.uk/surface-view-playing-video\n\nHere's part of the code\n\nSurface surface = new Surface(surfaceTexture);\n\ntry {\n mMediaPlayer = new MediaPlayer();\n mMediaPlayer.setDataSource(getApplicationContext(), Uri.parse(FILE_URL));\n mMediaPlayer.setSurface(surface);\n mMediaPlayer.setLooping(true);\n\n mMediaPlayer.prepareAsync();\n\n // Play video when the media source is ready for playback.\n mMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {\n @Override\n public void onPrepared(MediaPlayer mediaPlayer) {\n mediaPlayer.start();\n }\n });\n\n} catch (IllegalArgumentException e) {\n Log.d(TAG, e.getMessage());\n} catch (SecurityException e) {\n Log.d(TAG, e.getMessage());\n} catch (IllegalStateException e) {\n Log.d(TAG, e.getMessage());\n} catch (IOException e) {\n Log.d(TAG, e.getMessage());\n}\n\n\nEverything works fine except the video does not loop. When I set the data source a file from assets it loops just fine. But when I stream the video from URL it does not loop. \n\nThanks" ]
[ "android", "loops", "android-mediaplayer", "android-videoview" ]
[ "jQuery: Is it possible to assign a DOM element to a variable for later use?", "I'm working on a project that is using jQuery, which I'm much more familiar with Mootools.\n\nI'll start with my code first.\n\nvar customNamespace = {\n status: 'closed',\n popup: $('#popup'),\n\n showPopup: function() {\n // ... \n }\n}\n\n$(document).ready(function(){\n console.log($('#popup'));\n console.log(customNamespace.popup);\n console.log($(customNamespace.popup));\n\n $('#popup').fadeIn('slow');\n (customNamespace.popup).fadeIn('slow');\n $(customNamespace.popup).fadeIn('slow');\n});\n\n\nMy goal is to not have jQuery traverse the DOM everytime I want to do something with the #popup div, so I wanted to save it to a variable to use it throughout my script.\n\nWhen the page loads, the console prints out the object 3 times as I would expect, so I assumed that for each method, the fadeIn would just work. But it doesn't, only\n\n$('#popup').fadeIn('slow');\n\n\nActually fades in the div.\n\nEven if I remove my namespace hash, and just save the object to a global variable, and do a \n\nvar globalVariable = $('#popup');\n.\n.\n.\nglobalVariable.fadeIn('slow');\n\n\nAlso does not work as I thought it would. Can jQuery do what I am trying to do?" ]
[ "javascript", "jquery" ]
[ "How to get Ragel EOF actions working", "I'm working with Ragel to evaluate FSAs, and I want to embed a user action that runs whenever my machine finishes testing the input. I need this action to run regardless of whether or not the machine ends in an accepting state or not. I have this modified example taken from the Ragel guide that illustrates what I'm going for:\n\n#include <string.h>\n#include <stdio.h>\n\n%%{\n machine foo;\n main := ( 'foo' | 'bar' ) 0 @{ res = 1; } $/{ finished = 1; };\n}%%\n%% write data;\nint main( int argc, char **argv ) {\n int cs, res = 0, finished = 0;\n if ( argc > 1 ) {\n char *p = argv[1];\n char *pe = p + strlen(p) + 1;\n char* eof = pe;\n %% write init;\n %% write exec;\n }\n\n printf(\"result = %i\\n\", res );\n printf(\"finished = %i\\n\", finished);\n\n return 0;\n}\n\n\nMy goal for this example is for res to be 1 when the input is either 'foo' or 'bar', while finished is 1 no matter the input. I can't get this to work though - finished seems to be 1 when res is 1, and 0 when res is 0.\n\nAny help would be awesome." ]
[ "c", "finite-automata", "state-machine", "ragel" ]
[ "Jquery plugins within AJAX loaded content", "I'm using Django, the tabs described afterwards are loaded with render_to_response and the html response is set on the success method of the AJAX call. \n\nProcess: \n\n\nI have my page with tabs. In order to avoid loading all tabs, they're loaded dynamically (with AJAX)\nThis main page have its custom javascript file\nIn a loaded div, when clicking a button, I have a pluggin, fancytree, which is called on a div. Both tabs have their own custom javascript plus the one of the main page described in the first point. \n\n\nHere's a diagram which, I hope, will help you to understand : \n\nmybase.html\n ---> mybase.js\n\n ------- AJAX Loaded -------> mytab1.html <-------------\n --> mytab1.js -------| (*1)\n\n ------- AJAX Loaded -------> mytab2.html\n --> mytab2.js\n\n ------- AJAX Loaded -------> mytabn.html\n --> mytabn.js\n\n\n(*1) : In mytab1.js, I have a portion of code which use the pluggin fancytree formatted\nas a JSON string.\n\nie : \n\nbase.js : \n$('document').ready(function(){\n $('#someTab').on('click',function(){\n $(this).html(loadSomeAjax());\n });\n});\n\nmytab1.html : \n<div id='my_fancy_tree'> // Some JSON here </div>\n\nmytab1.js : \n$('document').on('ready ajaxComplete',function(){\n $('#my_fancy_tree').fancytree({ // params here });\n});\n\n\nMy question is very simple, how to make the pluggin fancytree works ? I tried various things, read a lot of docs but unfortunately, never figured out how to do." ]
[ "javascript", "jquery", "html", "ajax", "django" ]
[ "Filter by least value in Netsuite", "Can we able to filter by least value in net-suite, I tried CASE WHEN MIN({custrecord_carr_cus_base_fld})<>{custrecord_carr_cus_base_fld} THEN 1 ELSE 0 END Its not Working." ]
[ "netsuite", "suitescript" ]
[ "How to get full data using aqueduct and socket?", "My flutter app connects to a socket via https and I am using aqueduct to get secure data. the socket data is full length string such as;\n\n2_7#a_b_c_d_e_f_g#h_i_j_k_l_m_n#\n\nI convert the data to json and my json data looks like:\n \"{data:2_7#a_b_c_d_e_f_g#h_i_j_k_l_m_n#}\"\n\nand sent to flutter app. the 2_7# means I have 2 rows and 7 column.\nThe original server socket data 152_7# which means I have 152 rows with 7 column. \n\nwhen I try to get this data (152_7#) using socket in aqueduct I get only 12 rows or sometimes 25 rows.\n\nIf the server data short I get all of them, but can get big string data.\n\nmy question is how to get full data using aqueduct and socket?\n\nimport 'package:aqueduct/aqueduct.dart';\nimport 'package:ntmsapi/ntmsapi.dart';\n\nSocket socket;\nString _reply;\nvar _secureResponse;\nvar _errorData;\n\nclass NtmsApiController extends Controller {\n\n @override\n Future<RequestOrResponse> handle(Request request) async {\n try {\n String _xRequestValue = \"\";\n _reply = \"\";\n _errorData = \"Server_Error\";\n\n if (request.path.remainingPath != null) {\n _xRequestValue = request.path.remainingPath;\n\n // returns a string like 152 row with 11 column\n socket = await Socket.connect('192.168.xxx.xxx’, 8080); \n socket.write('$_xRequestValue\\r\\n');\n\n socket.handleError((data) {\n _secureResponse = \"$_errorData\";\n });\n\n await for (var data in socket) {\n // _cant get all the data from reply, reply shows about 25 row data\n _reply = new String.fromCharCodes(data).trim();\n _secureResponse = \"$_reply\";\n\n socket.close();\n socket.destroy();\n } \n } else {\n _secureResponse = \"$_errorData\";\n }\n } catch (e) {\n _secureResponse = \"$_errorData\";\n }\n\n return new Response.ok(\"$_secureResponse\")\n ..contentType = ContentType.json;\n }\n}" ]
[ "socket.io", "dart", "flutter", "aqueduct" ]
[ "The importance of design in a spring app", "I've been taking a look into using the spring framework for my java apps.\n\nIt is such a different way of looking at programming in general, i'm talking about DI and AOP!\n\nThe level of breaking the fundamental parts up into reusable components to me seems like a lot of work up front(in the design process). Im questioning the part of when I'll know its ready to get coding(this might just be in experience)\n\nGuess I am looking at some tips? Where should you begin? It seems it has to be perfectly designed from the get go to avoid this tightly coupling scenario that seems so common amongst other applications I have worked with(not necessarily made them myself) When will I know its time to shoot my load and code?\n\nPlease don't tag this is a subjective or something I just want some honest and decent advice from the community.\n\nThanks in advance!" ]
[ "java", "spring", "dependency-injection", "aop" ]
[ "Why does this for each loop not work?", "I have this code that does not work: \n\nPanel[] panelArr = new Panel[5];\n\nfor (Panel p:panelArr) {\n p = new Panel();\n}\nLabel lblName = new Label(\"Name:\");\npanelArr[0].add(lblName);\n\n\nIt comes up with the error:\n\nException in thread \"AWT-EventQueue-0\" java.lang.NullPointerException\n at GUIVehicles$NewSportsCarDialog.<init>(GUIVehicles.java:65)\n\n\nHowever if I replace the for-each loop with this for loop it works.\n\nfor (int i = 0; i < 5; i++) {\n panelArr[i] = new Panel();\n}\n\n\nAs far as I can tell looking through the documentation for the for each loop both for loops should be equivalent. Clearly this is not the case and I was wondering why?" ]
[ "java", "loops", "for-loop", "foreach" ]
[ "How to create a new environment variable in UNIX....?", "How to create a new environment variable in unix and use it in a program??????" ]
[ "unix", "environment-variables" ]
[ "Ensure thread safety without lock statement in C#", "I am trying to understand multi-threading and I have the following code and I need to ensure thread safety (typically without using lock statement) by getting the final result 10,000,000, but if you run the following code multiple time in VS you get different values close to 10,000,000 but never reaches it, so I need to fix this code without using lock statement.\nusing System;\nusing System.Threading;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n private static int _counter = 0;\n private static void DoCount()\n {\n for (int i = 0; i < 100000; i++)\n {\n _counter++;\n }\n }\n\n static void Main(string[] args)\n {\n int threadsCount = 100;\n Thread[] threads = new Thread[threadsCount];\n\n //Allocate threads\n for (int i = 0; i < threadsCount; i++)\n threads[i] = new Thread(DoCount);\n\n //Start threads\n for (int i = 0; i < threadsCount; i++)\n threads[i].Start();\n\n //Wait for threads to finish\n for (int i = 0; i < threadsCount; i++)\n threads[i].Join();\n\n //Print counter\n Console.WriteLine("Counter is: {0}", _counter);\n Console.ReadLine();\n }\n }\n}\n\nappreciate your help." ]
[ "c#", "multithreading", "thread-safety" ]
[ "High chart php, line not plotting, no error,", "this is the chart code. I am using highchart php to do that. But it is not plotting any line.\nEven i am not getting any error\nI am not able to resolve this issue . Might be any one can suggest some for what i am doing wrong.\n\n chart1 = new Highcharts.Chart({\n \"chart\": {\n \"renderTo\": \"container\",\n \"type\": \"line\",\n \"marginRight\": 130,\n \"marginBottom\": 25\n },\n \"title\": {\n \"text\": \"Nos \",\n \"x\": -10\n },\n \"subtitle\": {\n \"text\": \"Source:MyPromo \",\n \"x\": -10\n },\n \"xAxis\": {\n \"categories\": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]\n },\n \"yAxis\": {\n \"title\": {\n \"text\": \"Series\"\n },\n \"tickInterval\": 200,\n \"plotLines\": [{\n \"value\": 0,\n \"width\": 1,\n \"color\": \"#808080\"\n }]\n },\n \"legend\": {\n \"layout\": \"vertical\",\n \"align\": \"right\",\n \"verticalAlign\": \"top\",\n \"x\": -10,\n \"y\": 100,\n \"borderWidth\": 0\n },\n \"series\": [{\n \"name\": \"-1\",\n \"data\": [\"24\", \"6\", \"39\", \"180\", \"146\", \"1551\", \"4869\", \"2169\", \"1561\", \"737\", \"1252\", \"572\", \"646\", \"605\", \"651\", \"397\", \"657\", \"360\", \"422\", \"465\", \"2718\", \"2493\", \"159\"]\n },\n {\n \"name\": \"1\",\n \"data\": [\"37\", \"11\", \"76\", \"97\", \"150\", \"2206\", \"4946\", \"2271\", \"867\", \"482\", \"1021\", \"487\", \"292\", \"329\", \"286\", \"319\", \"473\", \"272\", \"368\", \"340\", \"1584\", \"1595\", \"178\"]\n },\n {\n \"name\": \"2\",\n \"data\": [\"34\", \"16\", \"60\", \"89\", \"124\", \"1180\", \"2949\", \"1383\", \"680\", \"528\", \"839\", \"352\", \"269\", \"281\", \"258\", \"295\", \"565\", \"244\", \"313\", \"219\", \"277\", \"399\", \"93\"]\n },\n {\n \"name\": \"3\",\n \"data\": [\"55\", \"1\", \"32\", \"3\", \"83\", \"476\", \"1058\", \"489\", \"285\", \"228\", \"370\", \"93\", \"97\", \"127\", \"145\", \"140\", \"322\", \"132\", \"222\", \"92\", \"114\", \"187\", \"9\"]\n },\n {\n \"name\": \"4\",\n \"data\": [\"4\", \"0\", \"44\", \"3\", \"60\", \"582\", \"1167\", \"604\", \"333\", \"305\", \"350\", \"144\", \"82\", \"113\", \"94\", \"128\", \"184\", \"116\", \"190\", \"118\", \"190\", \"126\", \"9\"]\n },\n {\n \"name\": \"5\",\n \"data\": [\"0\", \"0\", \"31\", \"15\", \"37\", \"408\", \"923\", \"373\", \"302\", \"212\", \"312\", \"99\", \"71\", \"107\", \"192\", \"145\", \"245\", \"221\", \"120\", \"95\", \"75\", \"209\", \"9\"]\n },\n {\n \"name\": \"1\",\n \"data\": [\"37\", \"11\", \"76\", \"97\", \"150\", \"2206\", \"4946\", \"2271\", \"867\", \"482\", \"1021\", \"487\", \"292\", \"329\", \"286\", \"319\", \"473\", \"272\", \"368\", \"340\", \"1584\", \"1595\", \"178\"]\n },\n {\n \"name\": \"6\",\n \"data\": [\"0\", \"2\", \"17\", \"7\", \"36\", \"241\", \"824\", \"337\", \"193\", \"109\", \"267\", \"60\", \"89\", \"56\", \"32\", \"98\", \"59\", \"95\", \"108\", \"114\", \"59\", \"111\", \"10\"]\n },\n {\n \"name\": \"7\",\n \"data\": [\"0\", \"0\", \"21\", \"3\", \"27\", \"156\", \"393\", \"172\", \"115\", \"71\", \"135\", \"33\", \"20\", \"25\", \"15\", \"44\", \"44\", \"22\", \"61\", \"29\", \"48\", \"59\", \"12\"]\n },\n {\n \"name\": \"8\",\n \"data\": [\"0\", \"0\", \"21\", \"10\", \"17\", \"184\", \"411\", \"205\", \"126\", \"91\", \"185\", \"35\", \"14\", \"26\", \"19\", \"79\", \"59\", \"34\", \"68\", \"20\", \"47\", \"71\", \"9\"]\n },\n {\n \"name\": \"9\",\n \"data\": [\"0\", \"0\", \"19\", \"1\", \"24\", \"211\", \"788\", \"366\", \"235\", \"233\", \"308\", \"47\", \"66\", \"41\", \"20\", \"67\", \"77\", \"67\", \"86\", \"43\", \"64\", \"60\", \"6\"]\n },\n {\n \"name\": \"99\",\n \"data\": \"0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0\"\n }],\n \"tooltip\": {\n \"formatter\": function () {\n return '<b>' + this.series.name + '</b><br/>' + this.x + ': ' + this.y + ' Series';\n }\n }\n});\n\n\nThanks in advance!" ]
[ "php", "highcharts" ]
[ "How can I use array values in WHERE clauses?", "I'm trying to figure out how to use a array variable with a where clause.\n\nwhen I echo $deader, I get 23,25,43,56,31,24,64,34,ect.. these are id numbers i want Updated\n\n$sql = mysql_query(\"UPDATE users SET dead='DEAD' WHERE userID ='(\".$deader.\")' \");\n\n\nThe Array$deader has multiple values of id numbers, it only works and updates the first id# in the $deader Array.\n\nI'm reading that Implode is what I need, but don't know how to get it into a functional format." ]
[ "php", "mysql", "phpmyadmin" ]
[ "Cross subdomain ajax longpolling", "I am creating a notifications script that check a database for changes and returns then in a javascript custom popup.\n\nI have successfully made the jquery ajax loading and processing script, and php long polling page.\nall this worked great aside from the fact the long lasting request prevented any other ajax loaded content from working. I found that the way to stop this was to move it onto a different subdomain.\nhowever this causes issues with the js \"Same Origin Policy\", all the possible ways of doing this seem to not work with long connection speeds or the other option php proxy defeats the whole point in seperate domains.\n\nDoes anyone have any ideas how to do this, or any help at all.\n\nThanks\n\nOli" ]
[ "php", "javascript", "jquery", "ajax", "long-polling" ]
[ "Makefile: return first two characters of a string", "Given a string in a Makefile, is it possible to extract the first two characters of an unknown string using Makefile syntax (without using shell calls)?\n\nfor instance,\n\nVAR := UnKnown\nVAR_TERSE = $(call get_first_two_chars, $(VAR))\n\ndefine get_first_two_char\n...\nendef" ]
[ "string", "parsing", "makefile" ]
[ "Way to set source port of TCP socket in node.js", "I need to create TCP socket with specific source (local) port. For example, socket from my PC (192.168.1.2:7777) to server (192.168.1.3:7778). Why i see now is that node.js allows only random source port.\nWhat is the way to do this?" ]
[ "node.js", "sockets", "tcp", "tcpsocket" ]
[ "How to get the result csv file in between the test run during performance testing using Jmeter?", "I am using Jmeter Version 4. For example I am running test for four hours, And during the test run, I want the result file for the test ran from 2nd to 3rd hour.Is it possible to get the result file like that?\nI know that we can get the result file from starting to 3rd hour.But I want from 2nd to 3rd hour.\nCan I get that.Please suggest?" ]
[ "jmeter", "performance-testing" ]
[ "Multer new version, undefined uploaded images file", "When i uploaded an Image with multer middle ware, i got undefined file image. In other words, i cannot get the name or the file extension from the file i uploaded. I don't know if it is the error from multer.\nHere is my js file:\n\n\r\n\r\nvar express = require('express');\r\nvar multer = require('multer');\r\nvar upload = multer({dest:'uploads/'});\r\nvar router = express.Router();\r\n\r\nrouter.post('/register', upload.single('profile'), function(req, res, next){\r\n\r\n\r\nif(req.file){\r\n console.log(\"Uploading files\");\r\n //get all Properties of the files object\r\n\r\n var profileImageOriginalName = req.file.profile.originalname;\r\n var profileImageName = req.file.profile.name;\r\n var profileImageMime = req.file.profile.mimetype;\r\n var profileImagePath = req.file.profile.path;\r\n var profileImageExt = req.file.profile.extension;\r\n var profileImageSize = req.file.profile.size;\r\n}\r\n\r\n\r\n\n\nAnd here is my html form file in jade format:\n\n\r\n\r\ninput.form-control(name = 'profile', type = 'file')\r\n\r\n\r\n\n\nThe Type Error : Cannot Read the originalname of undefined" ]
[ "javascript", "node.js", "express" ]
[ "JavaScript onload not recognized in extended html python flask", "I use a basic.html in my flask application which loads all needed ressources like footer navbar etc., all my other html sites extend this basic.html\n\nIn my main.js I created a simple function:\n\nfunction fun() {\n alert(\"we have fun\");\n}\n\n\nI load my files like this in the basic.html:\n\n<script type=text/javascript src=\"{{ url_for('static', filename='js/jquery.min.js') }}\"></script>\n\n<script type=text/javascript src=\"{{ url_for('static', filename='js/bootstrap.js') }}\"></script>\n\n<script type=text/javascript src=\"{{ url_for('static', filename='js/main.js') }}\"></script>\n\n\nNow I want to use this function in my page.html which extends the basic.html:\n\n{% extends \"basic.html\" %} \n\n{% block content %}\n\n<div class = \"container\" onload=\"fun()\">\n<p> Test </p>\n</div>\n\n{% endblock %}\n\n\nSadly nothing happens, but if I use the onload=\"fun()\" in the basic.html itself it works.\n\nSo how do I resolve this? \n\nThis is a very simplified version of one of my previous question, due to the fact that I am sitting on this since 4 hours I think I know what causes the issue but I cant solve it and all solutions I found do not work.\n\nHere is my previous question:\nquestion\n\nI think that onload=\"fun()\" is called before jQuery is even load or my main.js but I am still not 100% sure if this causes the error and I cant find a solution" ]
[ "javascript", "jquery", "python", "html", "flask" ]
[ "Multiple Symfony-DoctrineGuardPlugins in one Database?", "I wrote a Symfony 1.4 (Doctrine) Website consisting of 2 frontends and 2 backends. So all is neatly packed in 2 SF-Projects - anyways all the apps use the same (MySQL-)database. This is not a problem at all until it comes to the point of logging in different users. \n\nBackend 1 can only be accessed from the intra-net, so here's just a few users (admins) to manage. Backend 2 can be accessed from the extra-net and should manage the frontend-users, too. \n\nBasically I want to split this two Projects in 2 different sets of user-tables - but within one Database.\n\nI use the sfDoctrineGuardPlugin to secure the first app and I'm not sure how to manage securing the second one without interfering the 1st." ]
[ "php", "symfony1", "symfony-1.4", "sfdoctrineguard" ]
[ "Nested exception is java.lang.IllegalStateException: Can't configure antMatchers after anyRequest", "I am trying this code but get this exception:nested exception is:\n\njava.lang.IllegalStateException: Can't configure antMatchers after anyRequest.\n\nJava code\npackage com.cris.cms.config;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;\nimport org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;\nimport org.springframework.security.config.annotation.web.builders.HttpSecurity;\nimport org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;\nimport org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;\nimport org.springframework.security.core.userdetails.UserDetailsService;\nimport org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;\n\n@Configuration\n@EnableWebSecurity\n@EnableGlobalMethodSecurity(prePostEnabled = true)\npublic class SecurityConfig extends WebSecurityConfigurerAdapter {\n @Autowired\n private UserDetailsService userDetailsService;\n @Override\n protected void configure(AuthenticationManagerBuilder auth) throws Exception {\n auth.userDetailsService(userDetailsService).passwordEncoder(encodePWD());\n }\n @Override\n protected void configure(HttpSecurity http) throws Exception {\nhttp.csrf().disable(); http.authorizeRequests().antMatchers("/rest/**").authenticated().anyRequest().permitAll().and()\n.authorizeRequests().antMatchers("/secure/**").authenticated().anyRequest().hasAnyRole("ADMIN").and()\n .formLogin().permitAll();\n }\n @Bean\n public BCryptPasswordEncoder encodePWD() {\n return new BCryptPasswordEncoder();\n\n }\n}" ]
[ "spring-boot", "spring-security" ]
[ "spring boot war deployment url with api gateway", "I am using spring boot version 1.5.10.RELEASE.\nI have developed on service using spring boot and used Eureka service register, Zuul API Gateway.\nMy applications pom file application name is \"TestApplication\"\n\n<build>\n <finalName>TestApplication</finalName>\n <plugins>\n <plugin>\n <groupId>org.springframework.boot</groupId>\n <artifactId>spring-boot-maven-plugin</artifactId>\n </plugin>\n </plugins>\n</build>\n\n\nAnd tomcat deployed war name is \"testservice.war\".\n\nSo when I access the URL of application using API Gateway it is formed like below\n\nhttp://localhost:8080/ApiGateway/testapplication/testservice/swagger-ui.html\n\n\nformat: zuul api gateway context/ applicationname/contextname\n\nI want to avoid context name (testservice) in the url and access with eureka registered name only like below:\n\nhttp://localhost:8080/ApiGateway/testservice/swagger-ui.html" ]
[ "spring", "spring-boot", "url", "netflix-zuul", "netflix-eureka" ]
[ "Missing the point: Laravel 5 environment setup", "So, for my application I see 4 types of environments it can run under:\n\n\nLocal on my machine\nLocal on my VM where I am using Homestead\nStaging\nProduction\n\n\nEach environment differs in the database connectivity (type of DB, connectivity to the DB credentials, etc).\n\nIn my bootstrap/start.php I have set up this:\n\n$env = $app->detectEnvironment(array(\n 'local' => array('localhost'),\n 'localStaging' => array('mylocalStage.dev'),\n 'staging' => array('myapp-stage.com'),\n 'production' => array('myapp.com'),\n));\n\n\nHow do I enforce those settings? where do I set up that when I'm on 'local' I will use some local settings? Currently when I use \n\nphp artisan env \n\non my root application folder I get:\n\nCurrent application environment: production\n\nwhy isn't it picking up I'm 'local'?" ]
[ "php", "laravel", "laravel-5" ]
[ "Google Apps Script - Spreadsheet run script onEdit?", "I have a script that I use in my spreadsheet. It is at cell B2 and it takes an argument like so =myfunction(A2:A12). Internally the function gets info from a large range of cells.\n\nNothing seems to work. I tried adding it to\nScripts > Resources > Current Project Triggers > On edit\nScripts > Resources > Current Project Triggers > On open\n\nHow can I have this function update the result with every document edit?" ]
[ "google-apps-script", "google-docs", "google-drive-api" ]
[ "How to properly perform host or dig command in python", "I want to process host or dig commands using python to check if a domain is blacklisted. I use these\n\nsurbl_result = os.system(host_str + \".multi.surbl.org\")\n#this works like performing a terminal command which is host johnnydeppsource.com.multi.surbl.org\n\n\nIt returns a response which is an integer 0 (which means it is listed in the blacklist) or 256(it is not listed)\n\nif surbl_result == 0: #blacklisted in surbl\n black_list = True\n\n\nbut sometimes, the host command fails and gives a serve fail response\n\nHost johnnydeppsource.com.multi.surbl.org not found: 2(SERVFAIL)\n\n\nAnd this returns a zero value permitting it to add the new domain even if it is blacklisted.. Are there other ways to perform this kind of thing? This is contained in my django 1.6 application. Any leads will help.." ]
[ "python", "django", "ubuntu", "network-programming", "blacklist" ]
[ "Which browsers support a http 303 response?", "After reading about redirects, it seems in the majority of cases I should use a 303 see here. So I was wondering if all browsers will support a 303 response, for both normal requests and ajax requests?" ]
[ "http", "browser" ]
[ "Pythonic way to yield alternate lines of a textfile", "I have a textfile as below and I want to either yield the odd/even lines:\n\nthis is a blah \n I don't care,\nwhatever foo bar\nahaha\n\n\nI have tried checking for the odd/even-ness of the enumerate index but what is the pythonic way to do yield alternate lines in a textfile? I've tried:\n\ntext = \"this is a blah \\n I don't care,\\nwhatever foo bar\\nahaha\"\nwith open('test.txt', 'w') as fout:\n for i in text.split('\\n'):\n print>>fout, i\n\ndef yield_alt(infile, option='odd'):\n with open(infile,'r') as fin:\n for i,j in enumerate(fin):\n if option=='odd':\n if i+1 & 0x1:\n yield j\n elif option=='even':\n if i & 0x1:\n yield j\n\nfor i in yield_alt('test.txt'):\n print i\n\n\n[out]:\n\nthis is a blah \n\nwhatever foo bar\n\n\nLastly, what does i & 0x1 mean? I know it checks for even int, is there other ways of checking for even integers?" ]
[ "python", "io", "text-files", "yield" ]
[ "gems not found even though they are installed", "I am an absolute beginner when it comes to Ruby - I just follow a step by step tutorial to install OpenProject.\n\nRight now I have problems with the following line of command:\n\nRAILS_ENV=production bundle exec rake db:create\n\n\nIt returns \n\n\n Could not find rake-11.3.0 in any of the sources\n\n\nWhen I check the ruby version with \"ruby -v\" it prints\n\n\n ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]\n\n\nNow, when I check for rake:\n\ngem list | grep rake\n\n\nthe output is:\n\n\n rake (12.0.0)\n\n\n... so why is it complaining that it could not find rake-11.3.0 even tough version 12 is installed?\n\nThanks!" ]
[ "ruby-on-rails", "ruby", "openproject" ]
[ "rtsp cv2.VideoCapture onvif camera Nonmatching transport and -215:Assertion failed size and width > 0", "Am I missing something in trying to get frames from my ip camera over a network. The solution did not work at "Nonmatching transport in server reply" when cv2.VideoCapture rtsp onvif camera, how to fix? did not work for me.\nIs there something missing in what I am doing?\nBackground information:\n\nOS Win 7 64-bit\nPython - using both IDLE and DOS/cmd version, v3.8.5 - to show the error codes.\nOpen cv - version 3.4.4\nRouter, with address 192.168.1.1\nWireless adapter with address 192.168.1.100\n\nSchematic diagram:\nIP Camera -> RJ45 into wireless router (192.168.1.1) -> air -> PC's wireless adapter (192.168.1.100) -> python computer program trying to decode the program.\nNOTE again: I can use other applications but cannot use opencv.\nWhere my IPCamera works:\nMy camera does communicate with other applications such as VLC player\nVideo stream from the IPCamera can be played back the rstp stream via VLC player (3.0.11 Vetinari) and Media Player Classic (1.9.8.21) which uses FFMPEG and EVEN my android v5.1.1 smart phone.\nSo there is no problem is receiving rstp streams from the IP Camera from other applications.\nNote that VLC in python can be used as in the following code:\nimport vlc\nplayer = vlc.MediaPlayer('rtsp://user:[email protected]:554/onvif1')\nplayer.play()\nplayer.stop()\n\nNote: user and pword are found at the bottom of the camera.\nBUT I want to use opencv so as to extract the bytes from the 'frame'.\nCode to replicate the problem:\nimport numpy as np\nimport cv2, os\n\n#It does not matter which of the following os.environ assignments worked\nos.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transport;udp"\n#os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transport;0"\n#os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transport;tcp"\n#os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "dummy"\n\n# The url3 has been successfully used in VLC player and Media Player Classic Home. \n# BUT here the program stops \nurl3 = "rtsp://user:[email protected]:554/onvif1"\n\n#cap = cv2.VideoCapture(url3)\ncap = cv2.VideoCapture(url3,cv2.CAP_FFMPEG)\nwhile(True):\n ret, frame = cap.read()\n #print(frame)\n cv2.imshow('frame',frame)\n if cv2.waitKey(1) & 0xFF == ord('q'):\n break\ncap.release()\ncv2.destroyAllWindows()\n\nThere are two kinds of error messages when you run in both IDLE and the DOS/cmd line\nIn the IDLE program you get the -215:assertion error, while in\nIn IDLE:\nTraceback (most recent call last):\n File "<stdin>", line 4, in <module>/\ncv2.error: OpenCV(4.4.0) C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pip-req-build-9d\n_dfo3_\\opencv\\modules\\highgui\\src\\window.cpp:376: error: (-215:Assertion failed)\n size.width>0 && size.height>0 in function 'cv::imshow'\n\nIn the DOS/cmd window:\nPython 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AM\nD64)] on win32\nType "help", "copyright", "credits" or "license" for more information.\n>>> import numpy as np, cv2, os\n>>> os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transport;0"\n>>> url3 = "rtsp://user:[email protected]:554/onvif1"\n>>> cap = cv2.VideoCapture(url3, cv2.CAP_FFMPEG)\n[rtsp @ 000000000050df80] Nonmatching transport in server reply\n\nFurther remarks:\nThe program above stops after VideoCapture is instantiated as demonstrated by the DOS/cmd running and the insertion of the following code after instantiating VideoCapture in IDLE:\ncap = cv2.VideoCapture(url3,cv2.CAP_FFMPEG)\ncap.isOpened()\nFalse\n\nPlease assist, thank you,\nAnthony of Sydney" ]
[ "python", "opencv", "rtsp" ]
[ "Why aren't Rails model attributes accessible using symbols instead of strings?", "I need to compare some Rails (2.3.11) model attribute values before and after a database update, so I start by finding my record and saving the existing attribute values in a hash, as follows:\n\nid = params[:id]\nwork_effort = WorkEffort.find(id)\n\nancestor_rollup_fields = {\n :scheduled_completion_date => work_effort.scheduled_completion_date\n}\n\nwork_effort.update_attributes(params.except(:controller, :action))\n#etcetera\n\n\nNote I am adhering to the \"best practice\" of using a symbol for a hash key.\n\nThen I have a method that takes the model and the hash to determine possible additional steps to take if the values from the hash and the model attributes don't match. To determine this I tried to get at the model attribute value in an each loop but I was getting nil at first:\n\ndef rollup_ancestor_updates(work_effort, ancestor_rollup_fields)\n ancestor_rollup_fields.each do |key, value|\n model_val = work_effort.attributes[key] #nil\n #etcetera\n\n\nIn debugging the above I noticed that hard-coding a string as a key: \n\nwork_effort.attribute['scheduled_completion_date']\n\n\nReturned the desired value. So then in my each block I tried the following and it worked:\n\nmodel_val = work_effort.attributes[key.to_s]\n\n\nIs there a different way to do this? To me, with just 3 months Ruby/Rails experience, it's confusing to use symbols as hash keys as is the prescribed best practice, but then have to call .to_s on the symbol to get at a model attribute. Has anybody else experienced this, worked around this, been confused by this too? Thanks in advance" ]
[ "ruby-on-rails", "ruby", "model", "attributes", "symbols" ]
[ "sigaction's signal handler not called in child process", "I've a program, which installs a signal handler for SIGSEGV. In signal handler ( I try to catch crash ) I restart my application.\n\nBut when my application is resurrected it doesn't handle SIGSEGV anymore.\n\nHere's an example:\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <signal.h>\n#include <unistd.h>\n\nconst char * app = 0;\n\nvoid sig_handler(int signo)\n{\n puts(\"sig_handler\");\n\n const pid_t p = fork();\n\n if (p == 0)\n {\n printf(\"Running app %s\\n\", app);\n execl(app, 0);\n }\n\n exit(1);\n}\n\n\nint main(int argc, char** argv)\n{\n app = argv[0];\n\n struct sigaction act;\n sigemptyset(&act.sa_mask);\n\n act.sa_handler = sig_handler;\n act.sa_flags = 0;\n\n const int status = sigaction(SIGSEGV, &act, 0) == 0; \n printf(\"signaction = %d\\n\", status);\n\n sleep(5);\n\n int* a = 0;\n int b = *a;\n\n return 0;\n}\n\n\nwhat I get in output is:\n\n./signals \nsignaction = 1\nsig_handler\nRunning app ./signals\nsignaction = 1\n\n\nSo I can see sighandler was set in right way, but resurrected app simply crashed silently. \n\nWhat am I missing?" ]
[ "c", "linux", "signals", "sigaction" ]
[ "I want to use sklearn.decomposition.PCA for a complex value matrix", "I want to use ACP for a complex value matrix , but it doesn't work (complex data not supported ) ! what can i do ?\nIs there any other code that works for complex value matrices ?\nenter image description heremy matrix shape is (1400,100)" ]
[ "computer-vision", "data-science" ]
[ "C++ map::find & map::at performance difference", "I was grading some exercises and at a specific program although the algorithm seemed correct it would be too slow (and I mean too slow). The program was accessing a map using map::at (introduced in C++11). With a minimum change of replacing at with find (and fixing the syntax) the same program would be really fast (compared to the original version).\n\nLooking at cplusplus.com both methods claim to have the same complexity and I couldn't see why one would be different from the other (other than API reason, not throwing an exception, etc).\n\nThen I saw that the description in the section about data races is different. But I don't fully understand the implications. Is my assumption that map::at is thread safe (whereas map::find is not) and thus incurring some runtime penalties correct?\n\nhttp://www.cplusplus.com/reference/map/map/at/\n\nhttp://www.cplusplus.com/reference/map/map/find/\n\nEdit\n\nBoth are in a loop called 10.000.000 times. No optimization flags. Just g++ foo.cpp. Here is the diff (arrayX are vectors, m is a map)\n\n< auto t = m.find(array1.at(i));\n< auto t2 = t->second.find(array2.at(i));\n< y = t->second.size();\n< cout << array.at(i) << \"[\" << t2->second << \" of \" << y << \"]\" << endl;\n---\n> auto t = m.at(array1.at(i));\n> x = t.at(array2.at(i));\n> y = m.at(array1.at(i)).size();\n> cout << array.at(i) << \"[\" << x << \" of \" << y << \"]\" << endl;" ]
[ "c++11", "thread-safety", "stdmap" ]
[ "How to change this REGEX so it does NOT remove the colons :", "I have a new Date().toISOString() that returns something like this\n\n2020-06-04T13:34:18.052Z\n\n\nI need to go from there to 20200604-13:34:18.052 (if possible with nanosecond precision, else millisecond is ok, this is secondary)\n\nI have this regex\n\nnew Date().toISOString().replace(/[^\\d\\.]/g,'').replace(/(^\\d{8})/,'$1-')\n\n\nWhich is similar to what I need, but is removing the colons too, so I get\n\n20200604-133418.051" ]
[ "javascript", "regex" ]
[ "Opening a connection within Task.Factory.StartNew", "Hello I am getting an error on the objConn.Open():\n\n\n A first chance exception of type\n 'System.Threading.ThreadAbortException' occurred in System.Data.dll\n\n\nAdditional information: Thread was being aborted.\n\nTask.Factory.StartNew(() =>\n{\n using (SqlConnection objConn = new SqlConnection(Options.GetConnectionString()))\n {\n objConn.Open();\n SqlCommand comm = new SqlCommand(Options.SqlText, objConn);\n SqlDataReader reader = comm.ExecuteReader();\n }\n});\n\n\nAny ideas why I am getting this error? I can't seem to figure it out" ]
[ "c#", "task", "sqlconnection" ]
[ "How can i use EditText to get a parameter in doInbackGround (AsyncTask)?", "I want to use 3 edit texts to get (id, name, family) in my URL. I have already made a Rest web service and now I want to use socket in my Android app. Below is my code which keeps getting an error. What did I miss?\n\npublic class MainActivity extends AppCompatActivity {\n\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n }\n public void ok (View view){\n Havij havij = new Havij();\n havij.execute();\n }\n public class Havij extends AsyncTask{\n String name=\"\";\n @Override\n protected Object doInBackground(Object[] objects) {\n\n String str1 = (String) objects[0];\n String str2 = (String) objects[1];\n String str3 = (String) objects[2];\n try {\n URL url =new URL(\"http://192.168.1.100:8083/rest/pm/rp?id=&name=&family=\"+str1+str2+str3);\n URLConnection urlConnection = url.openConnection();\n InputStream inputStream = urlConnection.getInputStream();\n int ascii = inputStream.read();\n String json = \"\";\n while (ascii !=-1){\n json += (char) ascii;\n ascii = inputStream.read();\n }\n inputStream.close();\n JSONArray jsonArray = (JSONArray) new JSONParser().parse(json);\n for (Object o : jsonArray) {\n JSONObject jsonObject = (JSONObject) o;\n name =name+jsonObject.get(\"name\")+ \" \";\n }\n }\n catch (MalformedURLException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n } catch (ParseException e) {\n e.printStackTrace();\n }\n return name;\n }\n\n @Override\n protected void onPostExecute(Object o) {\n EditText editText1 = (EditText) findViewById(R.id.editText1);\n EditText editText2 = (EditText) findViewById(R.id.editText2);\n EditText editText3 = (EditText) findViewById(R.id.editText3);\n execute(editText1.getText().toString(),editText2.getText().toString(),editText3.getText().toString());\n }\n }\n}" ]
[ "android", "android-asynctask" ]
[ "How to write to and parse STDIN/STDOUT/temporary buffer?", "First I don't know if I talk about STDIN out STDOUT, but this is what I want to achieve :\n\nThere's a program that export database from distant server and send output as gzipped content.\nI want to unzip the content, parse it.\nIf it's OK then import it, otherwise send an error message. I don't want to write to any temporary file on disk so I want to handle things directly from STD\n\nsomeExportCommand > /dev/stdin #seems not work\n#I want to write a message here\necho \"Export database done\"\ncat /dev/stdin > gunzip > /dev/stdin\necho \"Unzip done\"\n\nif [[ \"$mycontentReadFromSTDIN\" =* \"password error\" ]]; then\n echo \"error\"\n exit 1\nfi\n\n#I want to echo that we begin impor\"\necho \"Import begin\"\ncat /dev/stdin | mysql -u root db\n#I want to echo that import finished\necho \"Import finish\"\n\n\nThe challenge here is not to write to a physical file. It's easier if it's the case but I want to do the hard way. Is it possible and how?" ]
[ "bash", "shell" ]
[ "Dropping last record with autoincrementing primary key", "Suppose you have a database with an auto-incrementing primary key and 25 records (PK goes from 1 to 25). Delete the record whose PK=25; PK values will now go from 1-24. Finally add a new record. Its PK value will be 25. \n\nThis would be quite problematic if other tables used the value 25 as a foreign key. They would would be linked to an erroneous record.\n\nHow is this issue customarily addressed?" ]
[ "sql", "sqlite" ]
[ "UITableView Dynamic Row Height Without Using AutoLayout", "I am supporting iOS 7 and I am not using autolayout. Is there a way I can have dynamic height for cell labels doing it this way?\n\nThanks\n\nEDIT:\n\nHere is the code I am using to define a dynamic height in iOS 7, it seems I can get it kinda working with auto layout but it cuts off the last cell at the bottom, it is weird.\n\nfunc tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {\n var cell = offScreenCells.objectForKey(\"gcc\") as? GalleryCommentCell\n if cell == nil {\n cell = commentsTable.dequeueReusableCellWithIdentifier(\"GalleryCommentCustomCell\") as? GalleryCommentCell\n offScreenCells.setObject(cell!, forKey: \"gcc\")\n }\n\n let comment :GalleryCommentInfo = commentResults[indexPath.row]\n\n setCellCommentInfo(cell!, data: comment)\n\n cell!.bounds = CGRectMake(0, 0, CGRectGetWidth(commentsTable.bounds), CGRectGetHeight(cell!.bounds))\n\n cell!.setNeedsLayout()\n cell!.layoutIfNeeded()\n\n let height = cell!.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).height\n return height + 1\n}\n\nfunc setCellCommentInfo(cell :GalleryCommentCell, data :GalleryCommentInfo) { \n cell.commentDate.text = data.galleryCommentDate\n\n cell.comment.text = data.galleryComment\n}" ]
[ "uitableview", "ios7" ]
[ "Cannot write a file in java", "I am trying to print something in a file by using java, and here is the code\n\n//open a file\npublic void openFileTwo(String file){\n try{\n y = new Scanner(new File(file));\n }catch(Exception e){\n System.out.println(\"Failed to find the file\");\n }\n}\n\n//here im trying to get a word and also bigram and store them in an array\npublic void readArticles(String file,ArrayList<String> storage) throws IOException{\n openFileTwo(file);\n while(y.hasNext()){\n\n String a = y.next(); \n a = a.replaceAll(\"[^A-Za-z0-9]\", \"\"); \n a = a.toLowerCase();\n\n storage.add(a);\n\n }\n closeFile();\n storage.removeAll(Arrays.asList(null,\"\"));\n int size = storage.size();\n for(int i = 0; i < size; i++){\n if(i != size-1){\n storage.add(storage.get(i)+\" \"+storage.get(i+1));\n }\n }\n //writeFile(storage, \"D:/skripsi/perlengkapan/test.txt\");\n}\n\n\nthen, i want to run it\n\nFileWriter f0 = new FileWriter(\"D:/skripsi/perlengkapan/tfidf.txt\");\nString newLine = System.getProperty(\"line.separator\");\n\n//i call the readArticles method\nf0.write(a +newLine);\nreadArticles(c,store);\n\n\nit just wont run as long as i put the readArticles method on it, could anyone help me?\n\nthanks in advance" ]
[ "java", "file-io" ]
[ "Strange Behavior with UITapGestureRecognizer", "I implemented a SnackBar / Toast Message in Swift 4 which allows the developer to set the following display duration (enum) and with the following behaviour:\n\n\n.long / .short: Timer gets fired and dismisses the SnackBar OR the user taps the view and it also dismisses\n.constant: No Timer, only TapGesture to dismiss\n\n\nNow in the first case (.long / .short) the SnackBar reacts as expected. Either the Timer fires or the user taps and the view gets dismissed. \n\nIn the second case (.constant) - where there is no timer - the Tap gesture is not recognised and the view doesn't get dismissed\n\nhere are the three functions:\n\n private func defineDismissMode(){\n switch self.message.duration {\n case .short, .long:\n self.setTimer()\n case .constant:\n self.setTapGesture()\n }\n }\n\n private func setTimer(){\n guard self.timer == nil else {return}\n self.timer = Timer.scheduledTimer(timeInterval: self.message.duration.rawValue, target: self, selector: #selector(self.dismissSnackBar), userInfo: nil, repeats: false)\n self.setTapGesture()\n }\n\n private func setTapGesture() {\n self.tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.dismissSnackBar))\n self.snackView.addGestureRecognizer(self.tapGestureRecognizer!)\n }\n\n @objc private func dismissSnackBar(){\n ...\n }\n\n\nAnyone a clue why when setTapGesture() is called after setTimer() it works and a tap triggers self.dismissSnackBar , but when called without setTimer() the UITapGestureRecognizer is not triggered?\n\nNote: Yes I checked that case: .constant -> setTapGesture() gets called" ]
[ "ios", "swift", "uitapgesturerecognizer" ]
[ "fadeIn(); box-element with jQuery and CSS3", "I have an issue with jQuery and showing a element that I would like to show as a box..\n-webkit-box / -moz-box etc\n\nBUT. If I use the fadeIn function in jQuery it fades into a block-element? \nI guess this is a common issue but I couldn't find anything that will help me.\n\nAny tips?\n\nCSS\n\n.page-wrapper {\nmin-height: 100%;\n\ndisplay: -webkit-box;\n-webkit-box-align: center;\n-webkit-box-pack: center;\n-webkit-box-orient: vertical;\n\ndisplay: -moz-box;\n-moz-box-align: center;\n-moz-box-pack: center;\n-moz-box-orient: vertical;\n}\n#open-menu {\nposition: fixed;\ncolor: #fff;\ntop: 0px;\nleft: 0px;\nfont-size: 2em;\npadding: 5px;\n}\n#page-wrapper-menu {\nposition: fixed;\nwidth: 100%;\nbackground-color: rgba(0, 0, 0, 0.9);\ncolor: #fff;\ntext-align: center;\noverflow: hidden;\ndisplay: none;\n}\n\n\njQuery-code\n\n$('#open-menu').click(function(){\n $('#page-wrapper-menu').fadeIn();\n});\n$('#page-wrapper-menu').click(function(){\n $('#page-wrapper-menu').fadeOut();\n});" ]
[ "javascript", "jquery", "html", "css" ]
[ "SimpleModal not working in IE7", "So, I've got SimpleModal working like I want it to except in IE7.\n\nWhat's the problem? It just doesn't show up at all.\n\nI have two types of modals going on.\n\nFirst one: \n\n$('.calendar-button').click(function (e) {\n $('.calendar-container').modal({\n overlayClose: true,\n });\n return false;\n });\n\n\nSecond one: \n\n$('.tv-list li a').click(function (e) {\n e.preventDefault();\n $('#info-' + this.id).modal(\n {onOpen: function (dialog) {\n dialog.overlay.fadeIn('fast', function () {\n dialog.container.slideDown('fast', function () {\n dialog.data.fadeIn('fast');\n });\n });\n },\n overlayClose: true,\n });\n return false;\n});\n\n\nAnd none of these seems to be working. For both of windows that, should, be popping up i have the same basic style of \n\ndisplay:none;\n\n\nBut, none of these work in IE7. Any thoughts? All of them are in the document ready thingy." ]
[ "jquery", "internet-explorer", "modal-dialog", "simplemodal" ]
[ "Using send with a method that accepts a block", "I'm trying to accomplish this piece of metaprogramming in ruby\n\nmy_array = 1..10\nmethod = :each\n\nmy_array.send(method) {|num| puts num }\n\n\nwhich does not work. Does anybody know how to pass in the block dynamically? I have already tried:\n\nmy_array.send(:each, lambda{|num| puts num })\nmy_array.send(:each, Proc.new{|num| puts num })\n\n\nbut nothing worked. Thanks!" ]
[ "ruby" ]
[ "AI Platform Training Job exited with a non-zero status of 1. Termination reason: Error", "My Tensorflow training job is exiting with a non-zero status of 1 and is not giving any helpful error messages. The traceback looks like it's hidden [...] and the link provided is similar. Here's what the logs are outputting:\n\nI have checked the service account which has a role as Cloud ML Service Agent which has permissions for logging.logEntries.create. The description of the Cloud ML Service agent also states:\n\nCloud ML service agent can act as log writer, Cloud Storage admin, Artifact Registry Reader, BigQuery writer, and service account access token creator.\n\nSo i'm assuming that it has permissions to write logs to the logger... My question is how do i troubleshoot why my job is failing with this?" ]
[ "tensorflow", "google-cloud-ml", "gcp-ai-platform-training", "google-ai-platform" ]
[ "How to do word count on pandas dataframe", "I know this is may be silly, but every research I've done for this question is led to more complex questions, I still can't figure out the basics, I just want to count the frequency of words\n\nHere's my data\n\nid descriptions\n1 I love you\n2 I love you too\n\n\nHere's my expected output\n\nid descriptions word count\n1 I love you 3\n2 I love you too 4" ]
[ "python", "pandas" ]
[ "16-Bit addition of 2n Scaled Integer", "When I going to implement 16-Bit addition of 2n Scaled Integer from autosar specification. I didn't get what is a, b and c values in these. \n\nI am going to implement 16-Bit addition of 2n Scaled Integer from autosar specification for mfx modules. in which I get in 8.6.4.1 16-Bit Addition of 2n Scaled Integer in which they specify \na Radix point position of the first fixed point operand. Must be a constant expression.\nb Radix point position of the second fixed point operand. Must be a constant expression.\nc Radix point position of the fixed point result. Must be a constant expression. \n\nValid range: 0 ≤ |a - b| ≤ 15\n(c - b) ≤ 15, (a - c) ≤ 15, a ≥ b\n(c - a) ≤ 15, (b - c) ≤ 15, a < b \n\nBut I don't understand How will I get the range value for c.\n\nfor below condition \n\n #include \"stdio.h\"\n void main()\n {\n if(a > =b)\n C = 2^(c-a) * [x + (y * 2^(a-b))]\n else\n\n C = 2^(c-b) * [(x * 2^(b-a)) + y].\n }\n\n\nWhat will be the ans if x =10, y=10, and a=20, b=10, and c= 100;" ]
[ "c", "math", "autosar" ]
[ "Iterate through part of string in python to remove it from textfile", "I have a textfile which numbers certain situations like this: \n\n*********** # 1 ************** \n\nTextline I want to keep\n\nAnother line I want to keep\n\nI tried iterating through it because it goes all the way to 570 situations.\n\nI tried it like this and it will remove the first *********** # 1 **************\n\nwith open(r\"C:\\Users\\Serto\\PycharmProjects\\MVCOPY\\jeroen.txt\", \"r\") as f:\n lines = f.readlines()\nwith open(r\"C:\\Users\\Serto\\PycharmProjects\\MVCOPY\\jeroen.txt\", \"w\") as f:\n #getal = 1\n for line in lines:\n getal = 1\n if line.strip(\"\\n\") != \"*********** # \"+str(getal)+\" **************\":\n print(line)\n f.write(line)\n getal += 1\n\n\nBut somehow I can't get getal to add one everytime. It will only delete the first one.\n\nI am expecting to remove all the \"*********** # \"+str(getal)+\" **************\" but it only removes the first" ]
[ "python", "string", "loops", "text-files" ]
[ "c# implicit conversion from base class", "I have a collection class like this:\n\npublic class SomeDataCollection : List<ISomeData>\n{\n // some method ...\n}\n\n\nbut I can't do this:\n\nSomeDataCollection someDatas = new List<ISomeData>();\n\n\n\n Cannot implicitly convert type List<ISomeData> to SomeDataCollection. An explicit conversion exists (are you missing a cast?)\n\n\nso I try to create an implicit coverter inside SomeDataCollection collection class:\n\npublic static implicit operator SomeDataCollection(List<ISomeData> l)\n{\n var someDatas = new SomeDataCollection();\n someDatas.AddRange(l);\n return someDatas;\n}\n\n\nbut it said that I can't create such converter:\n\n\n SomeDataCollection.implicit operator SomeDataCollection(List<ISomeData>): user-defined conversions to or from a base class are not allowed\n\n\nAnd when I cast it like this:\n\nSomeDataCollection someDatas = (SomeDataCollection)new List<ISomeData>();\n\n\nit throws an error that said:\n\n\n System.InvalidCastException: Unable to cast object of type List<ISomeData> to type SomeDataCollection.\n\n\nHow can I do this:\n\nSomeDataCollection someDatas = new List<ISomeData>();\n\n\nwithout getting an error? Please help. Thanks in advance." ]
[ "c#", ".net-4.0", "implicit-conversion" ]
[ "Can't change zoom in iOS on javascript", "I have website 1000x820\nIt's not a real website, don't ask me about responsive web design.\n\nviewport:\n\n<meta name=\"viewport\" content=\"target-densitydpi=device-dpi, width=1000px, user-scalable=no\">\n\n\nThen on Iphone SE with iOS 10.\nAdd to Home Screen.\n\nLaunch the application with 1000px width and it view very good with both orientation and we can change it. Of course we can't zoom.\nFocus an input and type text. While nothing zoom. Unfocus the input or change an orientation and our scale will be broken. We can't change it.\n\n$('meta[name=viewport]').remove();\n$('head').append('<meta name=\"viewport\" content=\"target-densitydpi=device-dpi, width=1000px, user-scalable=no\">' );\n\n\nIt didn't help me.\nPerversion with fonts too.\n\nI've one bad idea. Trace changes of viewport and refresh the page." ]
[ "javascript", "html", "ios", "css", "web" ]
[ "vectorization of matlab for-loop", "I am looking for proper vectorization of following matlab function to eliminate for-loop and gain speed by multithreading.\n\nsize(A) = N-by-N, where 30 <= N <= 60\n\n1e4 <= numIter <= 1e6\n\nfunction val=permApproxStochSquare(A,numIter)\n%// A ... input square non-negative matrix\n%// numIter ... number of interations\n\nN=size(A,1);\n\nalpha=zeros(numIter,1);\nfor curIter=1:numIter\n U=randn(N,N);\n B=U.*sqrt(A);\n alpha(curIter)=det(B)^2;\nend\n\nval=mean(alpha);\nend" ]
[ "matlab", "matrix", "vectorization", "determinants" ]
[ "iOS to web server via POST - string gets cut off?", "I'm trying to send a serialized object to a web server from my iOS app and generally it all works. I have tried sending a huge string and it comes out on the server just fine. But when I send a serialized object to the server, the string gets cut off. I have logged the string from my app - it's all there. I tried writing the same string to a file on my web server and it's cut off in the most weird way.\n\nWhat could be the reason? I suspect this has something to do with the encoding. Here is how I send the data to the server:\n\n+ (void)postRequestWithData:(id)data toURL:(NSURL *)url {\n // Prepare data\n NSData *postData = [NSJSONSerialization dataWithJSONObject:data options:NSJSONWritingPrettyPrinted error:nil];\n NSString *postDataString = [[NSString alloc] initWithData:postData encoding:NSUTF8StringEncoding];\n NSString *requestString = [NSString stringWithFormat:@\"sales=%@\", postDataString];\n NSString *postLength = [NSString stringWithFormat:@\"%d\", [requestString length]];\n\n // Make the request\n NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];\n [request setURL:url];\n [request setHTTPMethod:@\"POST\"];\n [request setValue:postLength forHTTPHeaderField:@\"Content-Length\"];\n [request setValue:@\"application/x-www-form-urlencoded\" forHTTPHeaderField:@\"Content-Type\"];\n [request setHTTPBody:[requestString dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]];\n NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];\n\n // Error reporting\n if (!connection) {\n NSLog(@\"Could not make a connection!\");\n }\n}\n\n\nWhere (id)data is an array of dictionaries. \n\nHere is how I handle it in the server:\n\n<?php\n $sales = $_POST['sales'];\n $myFile = \"testFile.txt\";\n $fh = fopen($myFile, 'w') or die(\"can't open file\");\n fwrite($fh, $sales);\n fclose($fh);\n?>" ]
[ "ios", "json", "post" ]
[ "Pygmalion transformation: using \"#define DLL\" as replacement for \"extern \"C\" __declspec(dllexport)\"", "Is there a way to use a svelte #define to transform the unsightly \"\"extern \\\"C\\\" __declspec(dllexport)\" into a single, enchanting term \"DLL\".\nThat is:\n\n#define DLL \"extern \"C\" __declspec(dllexport)\"\n\n\nThe problem, of course, is the embedded quote marks around the C." ]
[ "c", "c-preprocessor", "declspec" ]
[ "static function with no prototype (AIX compiler allowed, gcc doesn't)", "I'm attempting to port a large set of modules from AIX to Linux. Unfortunately, the AIX xlc compiler allowed you to define a static function and use it prior to the definition with no prototype. Not good, but at least you get the proper static scope. In any case, the code is there, and I can't get it to compile on Linux without explicitly adding a static prototype.\n\nSo, is there any way to inhibit the \"static declaration follows non-static declaration\" error in gcc (or make it a warning instead of a hard error), or do I have to edit each of these modules to add prototypes wherever they're missing? As I understand it, this is a case where the standard behavior is undefined - so it's kind of nasty if gcc wouldn't allow you a way to relax its internal standard to allow for code that compiles elsewhere, no...?" ]
[ "gcc", "static", "prototype", "aix" ]
[ "How to rerun a program in Python IDLE within the shell?", "How do i rerun a program in IDLE shell without having to go back to the saved code and pressing F5 over and over every time I want to execute it? is there any shortcuts or hotkeys that could be pressed while in the shell?\nfor example i have a simple program that prints a typed message:\nmessage = input('Enter message: ')\nprint(message)\n\nonce i run this simple program, i give the input, the program prints input and the program ends. Now, say i want to give a different input, i'd have to leave the shell and go back to the saved code and press F5 again. but if there was a hotkey that could be pressed while in the shell that would rerun the program, that would be awesome." ]
[ "python", "keyboard-shortcuts", "python-idle", "hotkeys" ]
[ "flip div is not working properly in Chrome", "I am facing a problem regarding use of flip div with the help of css in Google Chrome.\nReference site is here.\n\nIt's working properly on Mozilla but it's problematic on some versions of Chrome.\nLeft side image is working properly but right side image is not working properly.\n\nImage example is \n\n\n\nYou can also check the image to see the exact problem.\n\nThanks" ]
[ "html", "css" ]
[ "TypeConverterMarkupExtension error on setting ImageSource of UserControl", "I'm trying to embed an Image into a User Control. I see many posts about this topic, and I tried a lot of combination, but I cannot get it to work.\n\n<UserControl x:Class=\"AudioBoxController.AudioBoxItem\"\n x:Name=\"AudioBoxItemControl\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \n xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\" \n mc:Ignorable=\"d\" Width=\"200\" Height=\"250\">\n <Grid>\n\n <Image Name=\"image\" Margin=\"10\" VerticalAlignment=\"Center\" \n Source=\"{Binding Path=ImageSource, Mode=OneWay}\"/>\n\n </Grid>\n</UserControl>\n\n\nIn code behind I have create a DP for the Image:\n\npublic partial class AudioBoxItem : UserControl\n{\n public AudioBoxItem()\n {\n InitializeComponent();\n DataContext = this;\n }\n\n public static DependencyProperty SourceProperty =\n DependencyProperty.Register(\"ImageSource\", typeof(ImageSource), typeof(AudioBoxItem));\n\n public ImageSource ImageSource\n {\n get { return (ImageSource)GetValue(SourceProperty); }\n set { SetValue(SourceProperty, value); }\n }\n}\n\n\nNow, in the window I use it:\n\n<local:AudioBoxItem x:Name=\"ctrlMike\" \n Grid.Column=\"0\" \n VerticalAlignment=\"Center\" \n ImageSource=\"/AudioBoxController;component/Images/Speakers.png\"/>\n\n\nAt design time I correctly see the image, instead, when I run I get the error:\n\nA first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll\n\nAdditional information: 'An exception was thrown when the specification of a value of\n'System.Windows.Baml2006.TypeConverterMarkupExtension'.' line number '19' e line position '60'.\n\n\nWhere I'm wrong?\n\nEDIT\n\nI changed the source image from \"Embedded Resource\" to \"Content\" and I use the relative path:\n\n<local:AudioBoxItem x:Name=\"ctrlMike\" \n Grid.Column=\"0\" \n VerticalAlignment=\"Center\" \n ImageSource=\"Images/Speakers.png\"/>\n\n\nIn this way it works...so, which syntax I have to use if the image is an \"embedded Resource\"?" ]
[ "c#", "wpf", "user-controls", "dependency-properties" ]
[ "File not found inside \"/storage/emulated/0/Pictures/\"", "I am accessing a file from \n\"/storage/emulated/0/Pictures/1565704523555.jpg\". When I check if the file exists it tells me that the file was not found.\nI have given all run-time permissions.\n\nWhen I list all files from \"/storage/emulated/0/Pictures/\" I can see the file in that directory.\n\nWhenever I use \"Environment.getExternalStorageDirectory().toString()+/Pictures\"\nI can access all the files from this folders and it shows that the file exists.\n\nI am trying this on an emulator." ]
[ "java", "android", "android-studio" ]
[ "How do I implement the refresh button in the menu bar to refresh the all of the combo box items in their original state?", "Importing libraries. \n\nfrom PySide2 import QtWidgets,QtCore,QtGui\nfrom UI import main\n\n\nThis is my class which is inheriting and have a constructor\n\nclass MyQtApp(main.Ui_MainWindow,QtWidgets.QMainWindow):\n def __init__(self):\n super(MyQtApp,self).__init__() \n self.setupUi(self)\n window size\n self.showNormal() \n self.submit_pb.clicked.connect(self.fill_box)\n self.Menu()\n\n\nThis fill_box is for the combo box, and I have three combo boxes \nmodel_cb, size_cb and color_cb\nAnd the zeroth index is just an empty string for all of them\n\n def fill_box(self):\n model = self.model_cb.currentText()\n color = self.model_cb.currentText()\n size = self.size_cb.currentText()\n none = \"\"\n check = True\n if model is none:\n QtWidgets.QMessageBox.about(self,\"Name Required\",\"Please enter the Name!\")\n check = False\n return\n if color is none:\n QtWidgets.QMessageBox.about(self,\"Color Required\",\"Please enter the Color!\")\n check = False\n return\n if size is none:\n QtWidgets.QMessageBox.about(self,\"Size Required\",\"Please Enter the Size!\") \n check = False\n return\n if check:\n QtWidgets.QMessageBox.about(self, \"Done\",\"Submitted\")\n\n\nThis Menu function is for the menu bar options what happens if someone click close. I have only two options here 1)close which works fine and 2) Refresh which does not work.\n\n def Menu(self):\n self.actionClose.triggered.connect(self.close)\n self.actionRefresh.triggered.connect(self.fill_box1)\n\n def fill_box1(self):\n #If I do this It will reset all the boxes to its original empty \n #strings but then I would not have all the methods in the class \n #to add the functionality.\n\n self.setupUi(self)\n\nif __name__ == '__main__':\n app = QtWidgets.QApplication() \n qt_app = MyQtApp()\n qt_app.show()\n app.exec_()" ]
[ "python", "pyside", "qt-designer" ]
[ "d3 area chart filling below x asis", "I am trying to draw area graph but it is filling below x axis. In below code I have used y0(yScale(0)) as I have seen in many examples and also I tried to give y0(height) it is not giving me correct output. I want area to be filled only above x axis if y axis values are +ve and if y axis values are -ve then area is going above max tick of y axis.\nconst D3Node = require('d3-node');\n\ngetGraphString: (data,yAxisTickFormat) => {\n const d3n = new D3Node() // initializes D3 with container element\n const d3 = d3n.d3;\n\n let margin = { top: 20, right: 30, bottom: 20, left: 40 },\n width = 275,\n height = 200;\n\n let svg = d3n.createSVG(width, height+margin.top+margin.bottom);\n let xScale = d3.scaleTime().range([margin.left, width - margin.right])\n .domain(d3.extent(data, function (d) { return d.date })), \n yScale = d3.scaleLinear().range([height - margin.top, margin.bottom])\n .domain(d3.extent(data, function (d) { return d.value }));\n \n svg.append('g').attr("class", "xAxis")\n .attr("transform", "translate(0," + (height - margin.bottom) + ")") //The transforms are SVG transforms\n .call(d3.axisBottom(xScale).ticks(d3.timeYear).tickFormat(d3.timeFormat('%Y')))\n .selectAll("text")\n .style("text-anchor","end")\n .attr("dx", "-.9em")\n .attr("dy", ".50em")\n .attr("transform","rotate(-45)")\n\n svg.append("g") //We create an SVG Group Element to hold all the elements that the axis function produces.\n .attr("transform", "translate(" + (margin.left) + ",0)")\n .attr("class","yAxis")\n .call(d3.axisLeft(yScale).ticks(4).tickFormat(d3.format(yAxisTickFormat)))\n .selectAll("text")\n .style("text-anchor","end")\n .attr("dy", "0.32em")\n .attr("dx", "-0.4em")\n\n let lineFunc = d3.line().x(function (obj) { return xScale(obj.date) })\n .y(function (obj) { return yScale(obj.value) })\n svg.append("path")\n .attr("d", lineFunc(data))\n .attr("stroke", '#002046')\n .attr("stroke-width", 3)\n .attr("fill", "none");\n \n let area = d3.area()\n .curve(d3.curveLinear)\n .x(function (d) { return xScale(d.date); })\n .y0(yScale(0))\n .y1(function (d) { return yScale(d.value); });\n\n svg.append("path")\n .style("fill", "#002046")\n .attr("d", area(data));\n return d3n.svgString();\n }\n let data =[ { date: 2019-01-01T00:00:00.000Z, value: 0.6330419130189774 },\n { date: 2018-01-01T00:00:00.000Z, value: 0.6266752649582236 },\n { date: 2017-01-01T00:00:00.000Z, value: 0.6403446517126394 },\n { date: 2016-01-01T00:00:00.000Z, value: 0.6432956408788177 } ];\ngetGraphString(data,'.0%');" ]
[ "d3.js" ]
[ "Correct variable on server gets passed as an incorrect variable to client via socket.io", "I am attempting to pass a variable from the server to the client via socket.io. I'm saving data to MongoDB and using Mongoose. The goal is to save some data from the client into the database, then pass the _id of that just-saved document back to the client. Here's what I have so far:\n\nServer\n\nclient.on('savesnail', function (data) {\n console.log('save snail: ' + data.name);\n var snail = new Snail(data);\n snail.save(function (err, snail) {\n if (err) {console.log('err: ' + err)} // TODO handle the error\n var snailID = snail._id;\n console.log('saved snail ID ' + snailID);\n client.emit('setSnailID', snailID);\n var conditions = {_id: data.ownerID},\n update = {$set: {newUser: false}}\n\n User.update(conditions,update,function(err){});\n console.log('user updated');\n });\n\n});\n\n\nClient\n\nsaveSnail: function(snail) {\n // Core stats\n var data = {};\n data.ownerID = ig.game.sessionUserID;\n data.inDb = true;\n data.name = snail.name;\n // etc..\n\n console.log('saving snail');\n this.socket.emit(\"savesnail\", data);\n this.socket.once('setSnailID', function(snailid) {\n snail.snailID = snailid;\n console.log('snail ID set: ' + snailid);\n }); \n}\n\n\nIn the server console, each 'saved snail ID' appears unique and correct, as it should. However, after it emits to 'setSnailID' and I print the same variable to the client console, the ID turns out to be identical with every emit. \n\nConsole output example\n\nAs an example let's pretend the _ids are single digit numbers. Right now I am calling saveSnail() on the client four times, once for each of the four snails that are initiated. In the server console I would see:\n\nsaved snail ID 1\nsaved snail ID 2\nsaved snail ID 3\nsaved snail ID 4\n\n\n...but when emitting each _id to the client, in the client console I see:\n\nsnail ID set: 1\nsnail ID set: 1\nsnail ID set: 1\nsnail ID set: 1\n\n\nI should note that if I change this.socket.once in the client to this.socket.on, the client console gets four instances of each ID, so then it starts to print:\n\nsnail ID set: 1\nsnail ID set: 1\nsnail ID set: 1\nsnail ID set: 1\nsnail ID set: 2\nsnail ID set: 2\nsnail ID set: 2\nsnail ID set: 2\n// etc\n\n\n...resulting in 16 lines in total - 4 for each ID\n\nI've only recently started playing around with node.js and think I'm misunderstanding something very basic here. How can I pass the correct, unique _id that MongoDb assigns to each new entry back to the client?" ]
[ "javascript", "node.js", "mongodb", "socket.io", "mongoose" ]
[ "Replace NAs using mutate_at by row mean", "I'm trying to replace NA values in several columns by the mean value of all these columns. The mean value is suppose to be calculated by row.\n\nI've tried this code but the NAs don't get replaced:\n\nID Price1 Price2 Price3 Price4\n1 2.1 3 4 NA\n2 2 3 4.5 NA\n3 2 NA 4 NA\n4 NA 3 4 NA\n\nprice_cols <- c(\"Price1\", \"Price2\", \"Price3\", \"Price4\")\ndata %>%\n mutate_at(price_cols, funs(if_else(is.na(.), mean(price_cols, na.rm = TRUE), as.double(.))))\n\n\nI've also tried adding rowwise() to the piping chain but still nothing. I know it has to do with the code not really taking the mean across rows but I don't know how to change it so it does. Help!" ]
[ "r", "dplyr" ]
[ "Set a value to @Html.EditorFor and keep it's datepicker function", "I'm facing a problem.\nWill now try to explain all step-by-step.\nMy Task\nI'm creating a quite simple app for myself to organize work tasks.\nThe problem\nI need to have a kind of DatePicker for a Due Date. I've searched through internet for a solution and end up on using @Html.EditorFor for this, as I'm not acquainted with JQuery and other stuff that provides custom pickers. Generally, it works fine to me, except one thing - when a Model has an existing date, this field doesn't show it.\nAs I've discovered, @Html.EditorFor has different behavior in different browsers, so the target browser is Chrome.\nThe code\nModel:\n [Required]\n [Display(Name = "Due Date")]\n [DataType(DataType.Date)]\n [DisplayFormat(DataFormatString = "{0:dd'/'MM'/'yyyy}", ApplyFormatInEditMode = true)]\n public DateTime DueDate { get; set; }\n\nView:\n <div class="form-group">\n @Html.LabelFor(e => e.DueDate)<p/>\n @if (Model == null)\n {\n @Html.EditorFor(e => e.DueDate, new { @class = "form-control", @Value = DateTime.Now })\n }\n else\n {\n @Html.EditorFor(e => e.DueDate, new { @class = "form-control", @Value = Model.DueDate })\n }\n @Html.ValidationMessageFor(e => e.DueDate, null, new { @class = "text-danger" })\n </div>\n\nController:\n public ActionResult Record(int? id)\n {\n var rec = _context.TaskEntries.FirstOrDefault(r => r.Id == id);\n return rec == null ? View() : View(rec);\n }\n\nIt looks Ok on the main page with a list of tasks (blurred the stuff you won't need):\n\nBut when I open a record - date is not displayed:\n\nWhat I've tried\nLooked through this and this, tried to replace [DataType(DataType.Date)] with [DataType(DataType.DateTime)]. It worked in sense of showing the date in field, but picker disappeared.\nWould appreciate any assistance on my question or directions to any kind of manual for total newbies in order to understand and use custom pickers." ]
[ "c#", "asp.net-mvc", "razor" ]
[ "Prevent client repeatedly sending requests", "I have a spring controller and request mapped method.\n\n@RequestMapping(value = { \"/doSomething.do\" })\npublic ModelAndView emailToNonBelievers(){\n .....\n // do something which takes lot of time \n\n // send response..\n return modelAndView;\n\n}\n\n\nThis method takes very long time, about an hour.(It is for Admin, not users. And Admin doesn't need to wait an hour. Just fire and forget, that's ok. And this is not a batch job)\n\nBut I found that client send requests repeatedly with 3 minutes interval(observed 6 times and I stopeed Spring service). \n\nI guess because client didn't get any response from server. \n\nIf my guess is right, server should response sort of \"Your request is accepted, just shut up and wait!!\" . \n\nBut how to send response(200 ok) before jobs finished in Spring?\n\nOr am I missing something?" ]
[ "spring", "header" ]
[ "Mysql Count per column", "I have the following query:\n\nSELECT a.feeder_id, b.feeder_pr\nFROM authors_article_feeders a\nLEFT JOIN feeders b ON b.id = a.feeder_id\nWHERE website_id =1\nLIMIT 0 , 30\n\n\nwhich results in:\n\nfeeder_id feeder_pr\n18 2\n18 2\n18 2\n18 2\n32 6\n\n\nWhat I need is to modify the above query so that it will manipulate this data so that the result would end up with a count of each feeder_pr, so in this case the result would be:\n\nfeeder_pr count\n2 4\n6 1\n\n\nAny assistance is appreciated. If you have time please describe your solution so that I can learn from it while I'm at it.\n\nEverything I've tried has ended in inaccurate results, usually with just one row instead of the expected 2." ]
[ "mysql", "count" ]
[ "Timeout Notification Node Dilemna - Need a workaround", "I am a Newbie to WMB and We have a requirement for Kicking Off a Msg Flow at 10 P.M each night. \n\nAfter alot of Googling, I have suggested 2 ways to them - \n1. Use a CronJob to put a msg on the Input Q to start the flow. \n2. Use Timeout Notification node. \n\nThey have declined option 1 saying that IBM doesn't support cron jobs anymore, so we can't put that on the server. \n\nFor option 2, they are still fine but I have a question - Today i deploy the flow at the exact same time when I want it to et triggered after 24 Hrs but what happens when the Server is rebooted or the Flow is Stopped and started. \nWill the timer also start again from that moment and If Yes is there any Workaround this problem of rebooting or restarting that can be followed, so the flow is kicked off on the exact same time at 10 P.M irrespective even if it was redeployed or something like that. \n\nWe also have TWS in our environment, But I could not find any Integration documents or scenarios of TWS integration with IIB, Could you kindly give your valuable advices or comments - How can I reach to an efficient solution. \n\nThanks\n\nSumit" ]
[ "ibm-mq", "ibm-integration-bus" ]
[ ".Net public key file (.pke) to OpenSSL PEM", "We are trying to read in a public key file into our Delphi application so that we can use it for encrypting some data using OpenSSL. We are stuck at trying to populate the pRSA structure in libeay32.pas.\n\nBasically we have read the modulus and exponent out of the pke file, base 64 decoded them and stored the decoded value in a buffer of type Byte. \n\nFrom what we can tell these now need to be converted into a BIGNUM structure. Libeay32 provides a function BN_bin2bn function which accepts a pointer an output a pBIGNUM.\n\nThe question is, can we pass the modulus and exponent buffers directly to BN_bin2bn or do they first need to be converted to a format compatible with the BN_bin2bn function?\n\nWe are using Delphi 2007." ]
[ "delphi", "encryption", "openssl", "bignum" ]
[ "Pandas dataframe: No numeric data to plot", "I have a table stored in a database in MySQL.\nI fetched the results using MySQL connector and copied it to DataFrame. There are no problems till that.\nNow as I'm taking the results from MySQL, they are in the form of strings, so I've converted the strings to int for the values of CONFIRMED_CASES, and leave the STATE_NAME as str.\nNow I want to plot it in a bar graph, with Numeric data as CONFIRMED_CASES and state names as STATE_NAME but it shows me this error:\nTraceback (most recent call last):\n File "c:\\Users\\intel\\Desktop\\Covid Tracker\\get_sql_data.py", line 66, in <module>\n fd.get_graph()\n File "c:\\Users\\intel\\Desktop\\Covid Tracker\\get_sql_data.py", line 59, in get_graph\n ax = df.plot(y='STATE_NAME', x='CONFIRMED_CASES',\n ...\n raise TypeError("no numeric data to plot")\nTypeError: no numeric data to plot\n\nHere's my code:\nfrom operator import index\nfrom sqlalchemy import create_engine\nimport mysql.connector\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nmydb = mysql.connector.connect(\n host="localhost",\n user="abhay",\n password="1234",\n database="covid_db"\n)\n\nmycursor = mydb.cursor()\n\n\nclass fetch_data():\n def __init__(self):\n ...\n\n def get_data(self, cmd):\n ...\n\n def get_graph(self):\n mydb = mysql.connector.connect(\n host="localhost",\n user="abhay",\n password="1234",\n database="covid_db"\n )\n\n mycursor = mydb.cursor(buffered=True)\n\n mycursor.execute(\n "select CONFIRMED_CASES from india;")\n query = mycursor.fetchall()\n\n # the data was like 10,000 so I removed the ',' and converted it to int\n query = [int(x[0].replace(',', '')) for x in query]\n print(query)\n\n query2 = mycursor.execute(\n "select STATE_NAME from india;")\n query2 = mycursor.fetchall()\n\n # this is the query for state name and i kept it as str only...\n query2 = [x[0] for x in query2]\n print(query2)\n\n df = pd.DataFrame({\n 'CONFIRMED_CASES': [query],\n 'STATE_NAME': [query2],\n })\n\n # it gives me the error here...\n ax = df.plot(y='STATE_NAME', x='CONFIRMED_CASES',\n kind='bar')\n\n ax.ticklabel_format(style='plain', axis='y')\n plt.show()\n\n\nfd = fetch_data()\nfd.get_graph()\n\n\nI don't know why there is no numeric value. I set it to int, but still..." ]
[ "python", "python-3.x", "pandas", "dataframe", "matplotlib" ]
[ "URL validation should not accept empty string in the beginning", "I am trying to validate a URL. It should not contain a space in the beginning and in between. It should throw an error alert if we don't enter a complete URL. For example, if input is www.google, it should throw the following exception:\n\n\n 'Please enter a complete URL'\n\n\nCan someone help me out with this?\n\nThank you" ]
[ "javascript", "jquery", "regex" ]
[ "Error cannot invoke initializer for type 'Range' with an argument list of type '(Range)'", "Why do I get the error, Cannot invoke initializer for type 'Range<_>' with an argument list of type '(Range)'\n\nextension String {\n\n subscript (i: Int) -> Character {\n if self.isEmpty {\n return Character(\"\")\n }\n\n if i > self.characters.count {\n return Character(\"\")\n }\n\n return self[self.index(self.startIndex, offsetBy: i)]\n }\n\n subscript (i: Int) -> String {\n if self.isEmpty {\n return \"\"\n }\n\n if i > self.characters.count {\n return \"\"\n }\n\n return String(self[i] as Character)\n }\n\n subscript (r: Range<Int>) -> String {\n let start = self.index(self.startIndex, offsetBy: r.lowerBound)\n let end = self.index(start, offsetBy: r.upperBound - r.lowerBound)\n return self[Range(start ..< end)]\n }\n\n}" ]
[ "swift" ]
[ "Exposing Entity Framework Entities as properties on ViewModel for MVVM Databinding", "If I expose my EF 4 Model objects (EF4 entities) as properties on my ViewModel am I \"breaking\" MVVM ? \n\nDo I have to duplicate each Model class as some sort of DTO and expose those DTOs from the ViewModel ?\n\nI understand the theoretical value of having the View \"not know\" about the Model, but the reality is that (if I don't expose the Model to the View via the ViewModel) I'd have to have some classes that have the same properties as the Model classes to bind to. Then, in the ViewModel, I'd have to scrape the properties of those DTO-ish objects to update appropriate EF Entities (Model).\n\nThis seems like a lot of extra code to write and maintain. If I expose the Entities as properties on my ViewModel (and bind to that), I can still use Commands (i.e. for saving or deleting) that have their code/logic in the ViewModel and enabled/disabled state set via binding to ViewModel properties.\n\nIf you are wondering: \"What's the big deal with having to write one or two DTO's for your ViewModel ?\" You are thinking too small.\n\nI have an application with 75+ SQL Tables (and therefore 75+ EF4 entities). I don't fancy the idea of having to write and maintain 75+ DTOs. Now I could possibly use T4 to generate DTOs for all my entities and even have it generate partial classes so that I can \"customize\" these generated DTOs without losing the customizations if I have to regenerate.\nStill, I need to feel it is \"worth it\" to do all that... and I'm not sure about that yet.\n\nThoughts ?" ]
[ "entity-framework", "data-binding", "mvvm" ]
[ "Displaying multiple data in react native", "I am pretty new to react native. I am currently grabbing data from my node.js and trying to show all the data I grabbed into my View. In react.js, i did \n\ndocumnet.getElementById.append().\n\nWhat is the best way to do it in react native?\n\nmy code looks something like this\n\nclass GlobalRankings extends Component{\n constructor(){\n super();\n this.state = {\n }\n this.getGlobalRankings();\n }\n\n getGlobalRankings(){\n var request = new Request(checkEnvPort(process.env.NODE_ENV) + '/api/global_rankings', {\n method: 'GET',\n headers: new Headers({ 'Content-Type' : 'application/json', 'Accept': 'application/json' })\n });\n fetch(request).then((response) => {\n response.json().then((data) => {\n console.log(data);\n for (var i in data.value){\n console.log(data.value[i]); //where i grab my data\n }\n });\n }).catch(function(err){\n console.log(err);\n })\n}\n\n render(){\n return(\n <View style={styles.container}>\n// want my data to be here\n </View>\n )\n }\n}\n\n\nThanks for all the help" ]
[ "react-native" ]
[ "Bitbucket git delete files", "i started using bitbucket + git + symfony2. And i got the problem. At the beginning i created new symfony2 project. Uploaded it to bitbucket server. But later, i delete local directory, created new symfony2 project with the same name and make some changes. Finally, my home version and bitbucket versions are different. But when i am trying to index and commit local files(git add . ; git status; git commit 'testing'), git tells that \"no changes added to commit (use \"git add\" and/or \"git commit -a\")\". I don't know what i am doing wrong.\nI think git mentioning another directory or something like this\nBut, i have an idea: to empty bitbucket repo, and reupload local files(But i can't delete bitbucket current repo - only empty). So, i don't know how to do it\n\nUpd:I am using ubuntu 13.10" ]
[ "git", "symfony", "bitbucket" ]
[ "android threadid=1: stuck on threadid=29, giving up", "I have problem with my app. its shutting down when i'm trying to start new activity. In logcat i receive this error:\n\nthreadid=1: stuck on threadid=29, giving up\nFatal signal 16 (SIGSTKFLT) at 0x00003591 (code=-6), thread 13797 (Thread-1600)\n\n\nim putting my code here\n\nimport com.google.android.gms.ads.AdListener;\nimport com.google.android.gms.ads.AdRequest;\nimport com.google.android.gms.ads.InterstitialAd;\n\nimport android.app.Activity;\nimport android.content.Intent;\nimport android.graphics.Color;\nimport android.os.Bundle;\nimport android.view.View;\nimport android.view.Window;\nimport android.view.View.OnClickListener;\nimport android.widget.Button;\nimport android.widget.TextView;\n\npublic class Sklep extends Activity{\n\n\nInterstitialAd mInterstitialAd; // tutaj\n\n\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n setContentView(R.layout.activity_sklep); \n\n\n\n final Intent intent = new Intent(this, Main.class);\n\n mInterstitialAd = new InterstitialAd(this);\n mInterstitialAd.setAdUnitId(\"ca-app-pub-2868941535761925/2313045696\");\n requestNewInterstitial();\n\n mInterstitialAd.setAdListener(new AdListener() {\n public void onAdClosed() {\n requestNewInterstitial();\n startActivity(intent);\n finish();\n }\n });\n\n\n...\nand this is place when application is shutting down:\ni tried to start new activity without intersitial ad, but it was still finishing app. \n\n bback.setOnClickListener(new OnClickListener() \n {\n\n @Override\n public void onClick(View v) {\n\n if (mInterstitialAd.isLoaded()) {\n mInterstitialAd.show();\n }\n else{\n\n startActivity(intent);\n finish();\n }\n\n\n }\n\n\n });" ]
[ "android", "surfaceview" ]
[ "XDebug / Apache / PHP / Eclipse skips breakpoints", "I'm having problems with XDebug.\n\nConfiguration as follows:\n\n\nWindows 7 64bit \nPHP 5.4.6 Thread Safe 32 bit \nApache 2.4 Thread Safe \nEclipse PDT 3.0.2\n\n\nThe problem is that xdebug_break() calls are not working, and breakpoints entered through Eclipse also don't function. I can see that the extension is working, as it appears as a module in phpinfo(). When I call an uncallable method, XDebug outputs the relevant error messages.\n\nI've modified Eclipse's web server path mapping, to no avail.\n\nHere is my php.ini config:\n\nzend_extension = c:/php/php_xdebug-2.2.1-5.4-vc9.dll\nxdebug.remote_enable = 1\nxdebug.remote_host = localhost\nxdebug.remote_port = 8080\nxdebug.remote_mode = req\n\n\nAny help would be kindly appreciated..." ]
[ "php", "xdebug" ]
[ "Filling html tables from a table link in previous page", "I have some drop down lists that contain values and when the user selects the serial number and hits submit, it posts to Display.php and the tables on that page successfully fill with the values from the database. I've now added a table on the page with the dropdowns that creates a table filled with all entries from the database.\n\nThe table populates correctly, and there is a 'View' Hyperlink at the end. I want this to open Display.PHP also, but I want the tables on that page to fill from the database corresponding to the 'View' link selected, rather than the submit button. When I run the following code with the isset($_POST) line (from Display.php) and use the dropdown and Submit button option, it populates the tables with the record attached to the serial number from the drop down. \n\nBut when I comment that out and use the isset($_REQUEST) line, I just get a blank Display.php page except for my successful connection message. Is there an issue somewhere with the way I'm calling the request?\n\ndashboard.php\n\n<body>\n\n<?php include 'connectionDB.php';\n$query1 = \"SELECT * FROM staging;\";\n$result1 = mysqli_query($connect,$query1);?>\n\n<div class=\"dashboardTable\">\n<table style=\"border: 1px solid black;\">\n<tr>\n <th>Work Order Packet</th>\n <th>Work Order Number</th>\n <th>Date</th>\n <th>Utility</th>\n <th>Service Name</th>\n <th>Address</th>\n <th>Serial No.</th>\n</tr>\n\n<?php\n while($row = mysqli_fetch_array($result1)){\n?>\n<tr>\n <td><? echo $row['workOrderPacket'];?> </td>\n <td><? echo $row['workOrderNum'];?> </td>\n <td><? echo $row['date'];?> </td>\n <td><? echo $row['utility'];?> </td>\n <td><? echo $row['serviceName'];?> </td>\n <td><? echo $row['address'];?> </td>\n <td><? echo $row['serialNumber'];?> </td>\n <td><a href=\"Display.php?serialNumber=<? echo $row['serialNumber'];? >\">view</a></td>\n</tr>\n<?}?>\n</table>\n</div>\n</body>\n\n\nDisplay.php\n\n<?php\nif(isset($_GET['serialNumber'])) \n{\n\n$query1 = \"SELECT * FROM staging WHERE stageID = \".$_REQUEST['serialNumber'].\";\";\n$result1 = mysqli_query($connect,$query1);\n\nwhile($row = mysqli_fetch_array($result1)){\n?>\n\n////////HTML Tables here" ]
[ "php", "html", "mysqli", "html-table", "href" ]
[ "ARIMA models: Estimating parameters using bootstrapping", "I am trying to estimate parameters in my ARIMA model using bootstrap (the residuals don't follow normal distribution).\n\narima(log(msft.bf),order=c(8,1,1),fixed=c(0,NA,0,0,0,0,0,NA,NA))->m1\nmsft.cond.norm<-arima.boot(m1,B=1000,is.normal = F,cond.boot = F)\n\n\nThe function arima.boot() keeps running but gives no outputs. \nI expect the outputs just like the results in https://rdrr.io/cran/TSA/man/arima.boot.html. The data used in the tutorial is very simple.\n\nI am modeling with the dataset about stock price of Mircosoft. You can find the data from https://www.kaggle.com/szrlee/stock-time-series-20050101-to-20171231\n\nI tried to decrease number of bootstrap replicates(paramter 'B' in the function) but still no return values. Mabye my data or model is too complicated ? Actually I don't understand bootstrap very well.\n\nPlease suggest proper way." ]
[ "r", "time-series", "arima", "statistics-bootstrap" ]
[ "How to read materialized view created in kafka through java code", "I have created a materialized view in kafka stream, I am unable to find java code snippet to read materialized view. \n\nCould anyone suggest the code to read a materialized view and create a HashMap (assuming key is String and value is Long).\n\nOne sample snippet to create kafka materialized view \"queryable-store-name\" is:\n\nStreamsBuilder builder = new StreamsBuilder();\n KTable<Integer, Integer> table = builder.table(\n \"topicName\",\n Materialized.as(\"queryable-store-name\"));" ]
[ "apache-kafka", "apache-kafka-streams" ]
[ "Looking to convert a json file into a csv file using Golang", "I am trying to take the data in the \"carrier.json\" file and create a CSV file using Go with the information. However, I am receiving the follow error/notice\n\n./carrier_json.go:53:48: obj.APIVersion undefined (type Json has no field or method APIVersion)\n./carrier_json.go:53:69: obj.CarrierSid undefined (type Json has no field or method CarrierSid)\n./carrier_json.go:53:85: obj.AccountSid undefined (type Json has no field or method AccountSid)\n./carrierlookup.go:12:6: main redeclared in this block\n previous declaration at ./carrier_json.go:31:6\n\n\nI have searched online for several hours and any help would be much appreciated. Note, I am not very technical. \n\nThe \"carrier.json\" has the following,\n\n{\n \"Message360\": {\n \"ResponseStatus\": 1,\n \"Carrier\": {\n \"ApiVersion\": \"3\",\n \"CarrierSid\": \"c7e57a2a-92d7-0430\",\n \"AccountSid\": \"2f4ce81a-f08d-04e1\",\n \"PhoneNumber\": \"+19499999999\",\n \"Network\": \"Cellco Partnership dba Verizon Wireless - CA\",\n \"Wireless\": \"true\",\n \"ZipCode\": \"92604\",\n \"City\": \"Irvine\",\n \"Price\": \"0.0003\",\n \"Status\": \"success\",\n \"DateCreated\": \"2017-10-13 18:44:32\"\n }\n }\n}\n\n\nI have a go file called carrier_json.go that has the following information.\n\npackage main\n\nimport (\n \"encoding/csv\"\n \"encoding/json\"\n \"fmt\"\n \"io/ioutil\"\n \"os\"\n \"strconv\"\n)\n\ntype Json struct {\n Message360 struct {\n ResponseStatus int `json:\"ResponseStatus\"`\n Carrier struct {\n APIVersion string `json:\"ApiVersion\"`\n CarrierSid string `json:\"CarrierSid\"`\n AccountSid string `json:\"AccountSid\"`\n PhoneNumber string `json:\"PhoneNumber\"`\n Network string `json:\"Network\"`\n Wireless string `json:\"Wireless\"`\n ZipCode string `json:\"ZipCode\"`\n City string `json:\"City\"`\n Price string `json:\"Price\"`\n Status string `json:\"Status\"`\n DateCreated string `json:\"DateCreated\"`\n } `json:\"Carrier\"`\n } `json:\"Message360\"`\n}\n\nfunc main() {\n // reading data from JSON File\n data, err := ioutil.ReadFile(\"carrier.json\")\n if err != nil {\n fmt.Println(err)\n }\n // Unmarshal JSON data\n var d []Json\n err = json.Unmarshal([]byte(data), &d)\n if err != nil {\n fmt.Println(err)\n }\n // Create a csv file\n f, err := os.Create(\"./carrier.csv\")\n if err != nil {\n fmt.Println(err)\n }\n defer f.Close()\n // Write Unmarshaled json data to CSV file\n w := csv.NewWriter(f)\n for _, obj := range d {\n var record []string\n record = append(record, strconv.FormatInt(obj.APIVersion, 10), obj.CarrierSid, obj.AccountSid)\n w.Write(record)\n record = nil\n }\n w.Flush()\n}" ]
[ "json", "go" ]
[ "Mysql UNION as a subquery with an alias field", "I have a UNION query as bellow (I have simplified my working query so it is easier to read) :\nSELECT count(*) FROM \n(SELECT DISTINCT `tableA`.`Store Name` FROM `tableA` UNION SELECT DISTINCT `tableB`.`Store Name` FROM `tableB`) t\n\nThis works fine and results in a single number with column name COUNT(*)\nI want to get this value as another column in another query so I do :\nSELECT DISTINCT `tableC`.`id as PID,\n(SELECT count(*) from (SELECT DISTINCT `tableA`.`Store Name` FROM `tableA` UNION SELECT DISTINCT `tableB`.`Store Name` FROM `tableB`) t) AS noofstores\nWHERE\n.....;\n\nBut it wont work! What am I doing wrong? This is part of a bigger query, and all the other subqueries work fine when I do\n,\n(SELECT .... ) AS column_name\n,\n\nSorry for poor error description. Update :\nThis is my full query :\nSELECT DISTINCT\n`tableC`.`id` as PID,\n(SELECT count(*) \nfrom \n(SELECT DISTINCT `tableA`.`Store Name` FROM `tableA` WHERE `tableA`.`id` = PID \n union \n SELECT DISTINCT `tableB`.`Store Name` FROM `tableB` WHERE `tableB`.`id` = PID) t) AS mycolumn_name\n FROM \n `tableC`\n\nLooks like I had the union right and all, but the problem is the PID I am reffering to in the union :\n1054 - Unknown column 'PID' in 'where clause'\nSo how do I solve this?" ]
[ "mysql", "subquery", "union" ]
[ "Only use text-indent on wrapped lines", "How can I apply the text-indent only to lines that are wrapped (have a line break)?\n\nRight now, it looks like this:\n\n Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\neirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\nvoluptua. At vero eos et accusam et justo duo dolores et ea rebum.\n\n Lorem ipsum dolor sit amet.\n\n\nBut I want it to look like this:\n\n Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\neirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\nvoluptua. At vero eos et accusam et justo duo dolores et ea rebum.\n\nLorem ipsum dolor sit amet.\n\n\nIs that possible using CSS 3? My text-indent is set to text-indent: 20px" ]
[ "html", "css" ]