{"id":"3247246","title":"Integrate War-Plugin for m2eclipse into Eclipse Project","body":"\u003cp\u003eI set up a small web project with JSF and Maven. Now I want to deploy on a Tomcat server. Is there a possibility to automate that like a button in Eclipse that automatically deploys the project to Tomcat?\u003c/p\u003e\n\n\u003cp\u003eI read about a the \u003ca href=\"http://maven.apache.org/plugins/maven-war-plugin/\" rel=\"nofollow noreferrer\"\u003eMaven War Plugin\u003c/a\u003e but I couldn't find a tutorial how to integrate that into my process (eclipse/m2eclipse).\u003c/p\u003e\n\n\u003cp\u003eCan you link me to help or try to explain it. Thanks.\u003c/p\u003e","accepted_answer_id":"3247526","answer_count":"2","comment_count":"0","creation_date":"2010-07-14 14:39:48.053 UTC","last_activity_date":"2010-07-14 16:02:19.683 UTC","last_edit_date":"2010-07-14 15:56:37.803 UTC","last_editor_display_name":"","last_editor_user_id":"70604","owner_display_name":"","owner_user_id":"389430","post_type_id":"1","score":"2","tags":"eclipse|maven-2|tomcat|m2eclipse","view_count":"1653"} {"id":"40270764","title":"phantomjs-node page.evaulate seems to hang","body":"\u003cp\u003eI have an implementation of 'waitfor' with phantomjs-node and it seems that the \u003ccode\u003esitepage.evaluate\u003c/code\u003e has a big lag compared to when it should evaluate true. You'll see below that I'm logging out the content value and the content logs with what should evaluate as true, but this doesn't seem to occur for a good 10 seconds or so after the fact.\u003c/p\u003e\n\n\u003cp\u003eAny idea what would cause this delay or if there's a better way to evaluate?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003elet Promise = require('bluebird');\nlet phantom = require('phantom');\nlet sitepage;\nlet phInstance;\n\nphantom.create()\n .then(instance =\u0026gt; {\n phInstance = instance;\n return instance.createPage();\n })\n .then(page =\u0026gt; {\n sitepage = page;\n return page.open('https://thepiratebay.org/search/game/0/99/0');\n })\n .then(status =\u0026gt; {\n\n return waitUntil(function() {\n\n //This returns the correct content after a short period, while the evaluate ends up taking maybe 10s longer, after this content should evaluate true.\n sitepage.property('content').then(content =\u0026gt; {\n console.log(content);\n });\n\n return sitepage.evaluate(function() {\n return document.getElementById('searchResult');\n });\n\n }).then(function() {\n return sitepage.property('content');\n }).catch(Promise.TimeoutError, function(e) {\n sitepage.close();\n phInstance.exit();\n });\n\n })\n .then(content =\u0026gt; {\n console.log('content');\n console.log(content);\n sitepage.close();\n phInstance.exit();\n })\n .catch(error =\u0026gt; {\n console.log(error);\n phInstance.exit();\n });\n\n\nvar waitUntil = (asyncTest) =\u0026gt; {\n return new Promise(function(resolve, reject) {\n function wait() {\n console.log('--waiting--');\n asyncTest().then(function(value) {\n if (value) {\n console.log('resolve');\n resolve();\n } else {\n setTimeout(wait, 500);\n }\n }).catch(function(e) {\n console.log('Error found. Rejecting.', e);\n reject();\n });\n }\n wait();\n });\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-10-26 19:35:00.537 UTC","last_activity_date":"2016-11-02 20:05:09.143 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"245076","post_type_id":"1","score":"0","tags":"node.js|phantomjs","view_count":"35"} {"id":"27532383","title":"Dynamic operations can only be performed in homogenous AppDomain","body":"\u003cp\u003eI'm working with an API that requires:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;trust level=\"Full\" legacyCasModel=\"true\"/\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eto be set in my web.config file in order to work. This works without a problem in VS 2010, but when I use VS 2013 I get an error stating that dynamic operations can only be performed in homogeneous AppDomain. The project is targeting .NET framework 4.0 and is an asp.net MVC project.\u003c/p\u003e\n\n\u003cp\u003eI tried changing legacyCasModel to \"false\", but then I can't access the object I need. Not sure how to resolve this issue. How can I use legacyCasModel=\"true\" in VS2013 with dynamic expressions? \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-12-17 18:31:18.6 UTC","last_activity_date":"2014-12-17 19:57:43.443 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3105880","post_type_id":"1","score":"1","tags":"c#|asp.net-mvc","view_count":"4372"} {"id":"33511888","title":"CSS with relative URL to background image?","body":"\u003cp\u003eI have a file structure of:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ehome.html\nimg/bg_damask1.jpg\ncss/style.css\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I set my body background image I can't get it to load. I've tried:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ebackground-image: url('../img/bg_damask1.jpg');\nbackground-image: url('/img/bg_damask1.jpg');\nbackground-image: url('img/bg_damask1.jpg');\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut none are working. How do I get my css to reference the background image?\u003c/p\u003e\n\n\u003cp\u003eETA: In browser dev tools I see that no matter what file path I put in, the browser is only referencing 'bg_damask1.jpg' without the file path. If I edit it in dev tools the image shows up using option #1. Now I'm stumped as to what's causing the breakdown.\u003c/p\u003e","answer_count":"2","comment_count":"2","creation_date":"2015-11-04 00:50:35.223 UTC","last_activity_date":"2015-11-04 01:51:03.037 UTC","last_edit_date":"2015-11-04 01:51:03.037 UTC","last_editor_display_name":"","last_editor_user_id":"5464492","owner_display_name":"","owner_user_id":"5464492","post_type_id":"1","score":"0","tags":"css|background-image","view_count":"406"} {"id":"46160163","title":"Share canvas image on android","body":"\u003cp\u003eHello so I write a small game where in the end you can share your result. The result is written on an image using canvas. The problem is when sharing i get the error \"Error, could not locate the file\". The error is seen on screen only and not reflected in logcat. I've already spent countless hours trying to solve it, but nothing seems to work. I get no errors what so ever but the file still appears to be impossible to share. Does anyone has a suggestion on why it does not work? \u003c/p\u003e\n\n\u003cp\u003eQuick recap: Load bitmap, make it a canvas, paint it, check for permissions to save, save it, get the URI of the saved file, use the URI inside of the share intent. I really don't see what is missing. \u003c/p\u003e\n\n\u003cp\u003eThe canvas painting part was tested separately and I was able to share the bitmap to Facebook using fb library. Unfortunately android native share does not allow to share bitmaps without saving them. \u003c/p\u003e\n\n\u003cp\u003eIn manifest I have WRITE and READ permissions for both internal and external storage. I would really appreciate any help. \u003c/p\u003e\n\n\u003cp\u003eShare button on click listener: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eBitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.Myimage); \n mutableBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);\n Canvas canvas = new Canvas(mutableBitmap);\n Paint paint = new Paint();\n paint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));\n paint.setColor(Color.BLACK);\n paint.setTextSize(170);\n\n int top_margin = 1000;\n int left_margin = 1700;\n\n canvas.drawText(\"You got a ton of points\", left_margin, top_margin, paint);\n\nActivityCompat.requestPermissions(test_process.this,\n new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE},1);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ePermission result: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Override\npublic void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {\n switch (requestCode) {\n case 1: {\n if (grantResults.length \u0026gt; 0\n \u0026amp;\u0026amp; grantResults[0] == PackageManager.PERMISSION_GRANTED) {\n sharethis(mutableBitmap);\n } else {\n Toast.makeText(test_process.this, \"Permission denied to read your External storage\", Toast.LENGTH_SHORT).show();\n }\n return;\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eShare method: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic void sharethis(Bitmap bitmap){\n\n File file_path = getFilesDir();\n\n File file = new File(file_path, \"resultImg.jpg\");\n FileOutputStream fOut;\n try {\n fOut = new FileOutputStream(file);\n bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fOut);\n fOut.flush();\n fOut.close();\n } catch (Exception e) {\n e.printStackTrace();\n Log.i(\"file saving problem\", String.valueOf(e));\n }\n\n Uri uri = Uri.fromFile(file);\n Uri uriContent = getImageContentUri(this, file);\n\n Intent intent = new Intent();\n intent.setAction(Intent.ACTION_SEND);\n intent.setType(\"image/jpeg\");\n Log.i(\"Uri\", String.valueOf(uri));\n Log.i(\"UriContent\", String.valueOf(uriContent));\n intent.putExtra(Intent.EXTRA_STREAM, uriContent);\n startActivity(Intent.createChooser(intent, \"Share Cover Image\"));\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd URI convertor: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic static Uri getImageContentUri(Context context, File imageFile) {\n String filePath = imageFile.getAbsolutePath();\n Cursor cursor = context.getContentResolver().query(\n MediaStore.Images.Media.EXTERNAL_CONTENT_URI,\n new String[] { MediaStore.Images.Media._ID },\n MediaStore.Images.Media.DATA + \"=? \",\n new String[] { filePath }, null);\n\n if (cursor != null \u0026amp;\u0026amp; cursor.moveToFirst()) {\n int id = cursor.getInt(cursor\n .getColumnIndex(MediaStore.MediaColumns._ID));\n Uri baseUri = Uri.parse(\"content://media/external/images/media\");\n return Uri.withAppendedPath(baseUri, \"\" + id);\n } else {\n if (imageFile.exists()) {\n ContentValues values = new ContentValues();\n values.put(MediaStore.Images.Media.DATA, filePath);\n return context.getContentResolver().insert(\n MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);\n } else {\n return null;\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"46160246","answer_count":"1","comment_count":"0","creation_date":"2017-09-11 16:19:18.32 UTC","last_activity_date":"2017-09-11 16:24:12.69 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8570512","post_type_id":"1","score":"0","tags":"android|canvas|bitmap|share","view_count":"52"} {"id":"43313535","title":"change CSS in external URL stylesheet - Wordpress","body":"\u003cp\u003eI am using a wordpress rating plugin that connects to an external URL stylesheet in order to display the ratings. \u003c/p\u003e\n\n\u003cp\u003eSo I'd like to change the font-size of the stars that are displaying on my site.\u003c/p\u003e\n\n\u003cp\u003eI can see that the look of the font is defined in the following stylesheet and url: \u003ccode\u003ehttps://publ.ratingz.com/app/FF897e.app.css\u003c/code\u003e \u003c/p\u003e\n\n\u003cp\u003eThe star font is using class \u003ccode\u003e.rate-me-ratingz\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eI've been trying to change the font size using this class together with \u003ccode\u003e!important\u003c/code\u003e tag, but I guess that will not work, right?\u003c/p\u003e\n\n\u003cp\u003eIs there any way to edit and customise this external stylesheet in this case?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-04-10 00:54:43.063 UTC","last_activity_date":"2017-04-10 00:59:54.193 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4339640","post_type_id":"1","score":"0","tags":"css|wordpress","view_count":"27"} {"id":"12267645","title":"Restart application hangman","body":"\u003cp\u003eI've got an restart button in my hangman application, but I have no clue on how to restart the application... can anyone help by giving me the right idea or pointing me to the right direction?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic void actionPerformed(ActionEvent e){\n // Adds word to Words.txt\n if(e.getSource() == btnAddWord){\n try{\n FileWriter fw = new FileWriter(\"Words.txt\", true);\n PrintWriter pw = new PrintWriter(fw, true);\n\n String word = JOptionPane.showInputDialog(\"Please enter a word: \");\n\n pw.println(word);\n pw.close();\n }\n catch(IOException ie){\n System.out.println(\"Error Thrown\" + ie.getMessage());\n }\n }\n // Restarts game\n if(e.getSource() == btnRestart){\n\n }\n // brings up Help screen\n if(e.getSource() == btnHelp){\n String message = \"The word to guess is represented by a row of dashes, giving the number of letters and category of the word.\"\n + \"\\nIf the guessing player suggests a letter which occurs in the word, the other player writes it in all its correct positions.\"\n + \"\\nIf the suggested letter does not occur in the word, the other player draws one element of the hangman diagram as a tally mark.\"\n + \"\\n\"\n + \"\\nThe game is over when:\"\n + \"\\nThe guessing player completes the word, or guesses the whole word correctly\"\n + \"\\nThe other player completes the diagram\";\n JOptionPane.showMessageDialog(null,message, \"Help\",JOptionPane.INFORMATION_MESSAGE);\n }\n //Exits application\n if(e.getSource() == btnExit){\n System.exit(0);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"12267693","answer_count":"1","comment_count":"3","creation_date":"2012-09-04 16:24:46.513 UTC","last_activity_date":"2012-09-04 16:27:52.58 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1614977","post_type_id":"1","score":"1","tags":"java","view_count":"273"} {"id":"23047018","title":"Netty server and C# Socket Client. Receive on client doesn't work","body":"\u003cp\u003eI want to receive message on C# client from Netty server. I use sync C# socket and protobuf.\nI send message to server and it's ok. But I can't receive response.\nNetty server uses ProtobufDecoder. Server ChannelInboundHandler has this part of code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e public void channelRead0(final ChannelHandlerContext ctx, Object msg) {\n ...\n Set\u0026lt;String\u0026gt; keys = jedis.keys(\"tanks*\");\n\n String allKeys = \"\";\n for(String key: keys){\n allKeys+=key+\";\";\n }\n\n ctx.write(allKeys);\n ctx.flush();\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eC# client code is:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e const string server = \"localhost\";\nconst int port = 8080;\nvar tcpClient = new TcpClient(server, port);\n_networkStream = tcpClient.GetStream();\n\nvar stream = new MemoryStream();\nSerializer.Serialize(stream, tankDataObject);\nvar data = stream.ToArray();\n_networkStream.Write(data, 0, data.Length);\n\ndata = new Byte[10000];\n\n// String to store the response ASCII representation.\nString responseData = String.Empty;\n\n// Read the first batch of the TcpServer response bytes.\nInt32 bytes = _networkStream.Read(data, 0, data.Length);\nresponseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);\n\n// Close everything.\n_networkStream.Close();\ntcpClient.Close();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eClient doesn't receive any bytes or receive empty array if I call ctx.close() on server. Any help will be appreciated. Thank you.\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2014-04-13 18:57:04.117 UTC","favorite_count":"1","last_activity_date":"2014-04-13 18:57:04.117 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3529659","post_type_id":"1","score":"1","tags":"c#|sockets|netty|tcpclient|protobuf-net","view_count":"948"} {"id":"31936406","title":"Xtext - enum literal overrides id","body":"\u003cp\u003eI have following excerpt of my grammar, where the rule \u003ccode\u003eFormat\u003c/code\u003e seems to override the \u003ccode\u003eFieldColumnName\u003c/code\u003e rule. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eStatement:\n 'select * from' table=Table where=WhereClause;\n\nWhereClause: \n 'where' symbol=FieldColumn op=\"=\" right=STRING; \n\nFieldColumn:\n fieldName=FieldColumnName;\n\nFieldColumnName hidden():\n ID ('.' ID)?;\n\nenum Format:\n iso | de | en;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eDeveloping an DSL-Script on following grammar I am getting an validation error in the editor, with following \u003ccode\u003eStatement\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eselect * from foo where foo.de = 'bar';\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe error marks the \u003ccode\u003ede\u003c/code\u003e in \u003ccode\u003efoo.de\u003c/code\u003e and its message is:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003emismatched input 'de' expecting RULE_ID\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eHow can I use reserved words like the \u003ccode\u003ede\u003c/code\u003e in contexts where I do not expect that keyword?\u003c/p\u003e","accepted_answer_id":"31938212","answer_count":"1","comment_count":"0","creation_date":"2015-08-11 08:08:19.74 UTC","last_activity_date":"2015-08-11 09:34:32.827 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"119855","post_type_id":"1","score":"0","tags":"parsing|enums|grammar|xtext","view_count":"140"} {"id":"22444951","title":"Non-greedy multi-line and single-line matching","body":"\u003cp\u003eI'm trying to modify a flex+bison generator to allow the inclusion of code snippets denoted by surrounding '{{' and '}}'. Unlike the multi-line comment case, I must capture all of the content.\u003c/p\u003e\n\n\u003cp\u003eMy attempts either fail in the case where the '{{' and the '}}' are on the same line or they are painfully slow.\u003c/p\u003e\n\n\u003cp\u003eMy first attempt was something like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e%{\n#include \u0026lt;stdio.h\u0026gt;\n// sscce implementation of a growing string buffer\nchar codeBlock[4096];\nint codeOffset;\nconst char* curFilename = \"file.l\";\nextern int yylineno;\n\nvoid add_code_line(const char* yytext)\n{\n codeOffset += sprintf(codeBlock + codeOffset, \"#line %u \\\"%s\\\"\\n\\t%s\\n\", yylineno, curFilename, yytext);\n}\n\n%}\n\n%option stack\n%option yylineno\n\n%x CODE_FRAG\n\n%%\n\n\"{{\"[ \\n]* { codeOffset = 0; yy_push_state(CODE_FRAG); }\n\u0026lt;CODE_FRAG\u0026gt;\"}}\" { codeBlock[codeOffset] = 0; printf(\"// code\\n%s\\n\", codeBlock); yy_pop_state(); }\n\u0026lt;CODE_FRAG\u0026gt;[^\\n]* { add_code_line(yytext); }\n\u0026lt;CODE_FRAG\u0026gt;\\n\n\n\\n\n.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNote: the \"codeBlock\" implementation is a contrivance for the purpose of an SSCCE only. It's not what I'm actually using.\u003c/p\u003e\n\n\u003cp\u003eThis works for a simple test case:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{{ from line 1\nfrom line 2\n}}\n\n{{\n\nfrom line 7\n}}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eOutputs\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e// code\n#line 1 \"file.l\"\n from line 1\n#line 2 \"file.l\"\n from line 2\n\n// code\n#line 7 \"file.l\"\n from line 7\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut it can't handle\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{{ hello }}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe two solutions I can think of are:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e /* capture character-by-character */\n \u0026lt;CODE_FRAG\u0026gt;. { add_code_character(yytext[0]); }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;INITIAL\u0026gt;\"{{\".*?\"}}\" { int n = strlen(yytext); yytext + (n - 2) = 0; add_code(yytext + 2); }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe former seems likely to be slow, and the latter just feels wrong.\u003c/p\u003e\n\n\u003cp\u003eAny ideas?\u003c/p\u003e\n\n\u003cp\u003e--- EDIT ---\u003c/p\u003e\n\n\u003cp\u003eThe following appears to achieve the result desired, but I'm not sure if it's a \"good\" Flex way to do this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\"{{\"[ \\n]* { codeOffset = 0; yy_push_state(CODE_FRAG); }\n\u0026lt;CODE_FRAG\u0026gt;\"}}\" { codeBlock[codeOffset] = 0; printf(\"// code\\n%s\\n\", codeBlock); yy_pop_state(); }\n\u0026lt;CODE_FRAG\u0026gt;.*?/\"}}\" { add_code_line(yytext); }\n\u0026lt;CODE_FRAG\u0026gt;.*? { add_code_line(yytext); }\n\u0026lt;CODE_FRAG\u0026gt;\\n\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"22445434","answer_count":"1","comment_count":"0","creation_date":"2014-03-17 00:18:45.507 UTC","last_activity_date":"2014-03-17 03:07:07.24 UTC","last_edit_date":"2014-03-17 03:02:33.333 UTC","last_editor_display_name":"","last_editor_user_id":"257645","owner_display_name":"","owner_user_id":"257645","post_type_id":"1","score":"1","tags":"flex-lexer","view_count":"305"} {"id":"38976977","title":"Make a listener to know when a new item is being added to DynamoDB","body":"\u003cp\u003eI have a DynamoDB table with about 5-6 items in it.\u003c/p\u003e\n\n\u003cp\u003eIn my android app, I want to create a listener which will run in background. The listener's purpose is to detect when a new item is being added to the DynamoDB table remotely, and when it detects a new item in the DB, the app will inform the user about it with a push notification which will include also one of the attributes of the item.\u003c/p\u003e\n\n\u003cp\u003eIs it possible? And if it does, then how can I do it?\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2016-08-16 14:00:29.307 UTC","last_activity_date":"2016-08-16 15:23:02.413 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6574442","post_type_id":"1","score":"3","tags":"android|push-notification|amazon-dynamodb","view_count":"689"} {"id":"25746918","title":"syntax error in update statement on Vb.net","body":"\u003cp\u003eI want to check from the database if a product code exist in database before and if it does it should update d database but it is displaying error in update statement\nHelp, below is my code \n con = New OleDbConnection(\"Provider=Microsoft.Jet.Oledb.4.0; Data Source=\" \u0026amp; Application.StartupPath \u0026amp; \"\\pharmacy.mdb\")\n con.Open()\n Dim ct1 As String = \"select * from stock where code= '\" \u0026amp; TxtCode.Text \u0026amp; \"'\"\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e cmd = New OleDbCommand(ct1)\n cmd.Connection = con\n rdr = cmd.ExecuteReader()\n\n If rdr.Read Then\n\n con = New OleDbConnection(\"Provider=Microsoft.Jet.Oledb.4.0; Data Source=\" \u0026amp; Application.StartupPath \u0026amp; \"\\pharmacy.mdb\")\n con.Open()\n\n Dim cb As String = \"UPDATE stock SET company = '\" \u0026amp; CmbCompany.Text \u0026amp; \"', Productname = '\" \u0026amp; TxtPrdtName.Text \u0026amp; \"', [quantity]= quantity + '\" \u0026amp; TxtQuantity.Text \u0026amp; \"', unitPrice = '\" \u0026amp; TxtunitPrice.Text \u0026amp; \"', ddate = '\" \u0026amp; TxtDate.Text \u0026amp; \"', batchNo = '\" \u0026amp; TxtBatchNo.Text \u0026amp; \"', Type = '\" \u0026amp; CmbType.Text \u0026amp; \"', expDate '\" \u0026amp; dtpExpirationDate.Text \u0026amp; \"' where code = '\" \u0026amp; TxtCode.Text \u0026amp; \"'\"\n\n cmd = New OleDbCommand(cb)\n\n cmd.Connection = con\n\n\n cmd.ExecuteReader()\n MessageBox.Show(\"Successfully updated\", \"Product Details\", MessageBoxButtons.OK, MessageBoxIcon.Information)\n\n rdr.Close()\n con.Close()\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"1","creation_date":"2014-09-09 14:15:44.93 UTC","last_activity_date":"2014-09-09 14:21:25.997 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4020407","post_type_id":"1","score":"0","tags":".net","view_count":"35"} {"id":"24587533","title":"Google Plus \"Sign in api\" and Splash screen","body":"\u003cp\u003eCurrently I have 3 activities in my application. The first activity is to load default Splashscreen.class, I would like this activity to check whether the user accessed with your Google+ account \"Sign In\" on Login.class class. \u003c/p\u003e\n\n\u003cp\u003eIn short, La Splashscreen.class class to check if the user logged in or not and direct it to one activity or another. I leave my code.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eSplashscreen.class\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class SplashScreen extends Activity {\n\n private boolean mIsBackButtonPressed;\n private static final int SPLASH_DURATION = 2500;\n\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.splash_screen);\n Handler handler = new Handler();\n\n handler.postDelayed(new Runnable() {\n\n @Override\n public void run() { \n finish();\n\n if (!mIsBackButtonPressed) {\n /*if(){ If the user is connected go to class Mainactivity.class\n\n Intent intent = new Intent(SplashScreen.this, MainActivity.class);\n SplashScreen.this.startActivity(intent);\n }\n }else{\n //If the user is not connected go to class Login.class\n Intent intent = new Intent(SplashScreen.this, Login.class);\n SplashScreen.this.startActivity(intent);\n }\n\n*/\n }\n\n }, SPLASH_DURATION);\n\n }\n\n @Override\n public void onBackPressed() {\n mIsBackButtonPressed = true;\n super.onBackPressed();\n }\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eLogin.class\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class Login extends Activity implements OnPageChangeListener,GoogleApiClient.ConnectionCallbacks,\nGoogleApiClient.OnConnectionFailedListener, View.OnClickListener{\n\n /* Request code used to invoke sign in user interactions. */\n private static final int RC_SIGN_IN = 0;\n static Context context;\n /* Client used to interact with Google APIs. */\n private static GoogleApiClient mGoogleApiClient;\n\n /* A flag indicating that a PendingIntent is in progress and prevents\n * us from starting further intents.\n */\n private boolean mIntentInProgress;\n private boolean mSignInClicked;\n private ConnectionResult mConnectionResult;\n\n boolean result_back;\n private ViewPager vp;\n private ViewPagerAdapter vpAdapter;\n private List\u0026lt;View\u0026gt; views;\n private ProgressDialog pDialog;\n\n @Override\n public void onCreate(Bundle savedInstanceState) {\n\n super.onCreate(savedInstanceState);\n setContentView(R.layout.login);\n initViews();\n\n mGoogleApiClient = new GoogleApiClient.Builder(this)\n .addConnectionCallbacks(this)\n .addOnConnectionFailedListener(this)\n .addApi(Plus.API)\n .addScope(Plus.SCOPE_PLUS_LOGIN)\n .build();\n\n pDialog = new ProgressDialog(this);\n pDialog.setMessage(\"Conectando ...\");\n\n findViewById(R.id.btn_sign_in).setOnClickListener(this);\n\n }\n public void onClick(View view) {\n pDialog.show();\n if (view.getId() == R.id.btn_sign_in\n \u0026amp;\u0026amp; !mGoogleApiClient.isConnecting()) {\n mSignInClicked = true;\n resolveSignInError();\n }\n }\n\n protected void onStart() {\n super.onStart();\n mGoogleApiClient.connect();\n }\n\n protected void onStop() {\n super.onStop();\n\n if (mGoogleApiClient.isConnected()) {\n mGoogleApiClient.disconnect();\n }\n }\n\n public void onConnectionFailed(ConnectionResult result) {\n if (!mIntentInProgress) {\n // Store the ConnectionResult so that we can use it later when the user clicks\n // 'sign-in'.\n mConnectionResult = result;\n\n if (mSignInClicked) {\n // The user has already clicked 'sign-in' so we attempt to resolve all\n // errors until the user is signed in, or they cancel.\n resolveSignInError();\n }\n }\n }\n\n public void onConnected(Bundle connectionHint) {\n // We've resolved any connection errors. mGoogleApiClient can be used to\n // access Google APIs on behalf of the user.\n pDialog.dismiss();\n mSignInClicked = false;\n\n //Toast.makeText(this, \"User is connected!\", Toast.LENGTH_SHORT).show();\n getProfileInformation();\n Intent i=new Intent(Login.this, MainActivity.class);\n startActivity(i); \n }\n\n /**\n * Fetching user's information name, email, profile pic\n * */\n public static void getProfileInformation() {\n try {\n if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {\n Person currentPerson = Plus.PeopleApi\n .getCurrentPerson(mGoogleApiClient);\n String personName = currentPerson.getDisplayName();\n currentPerson.getImage().getUrl();\n currentPerson.getUrl();\n Plus.AccountApi.getAccountName(mGoogleApiClient);\n\n Toast.makeText(context,\"Name: \" + personName,Toast.LENGTH_LONG).show(); \n } else {\n Toast.makeText(context,\n \"Person information is null\", Toast.LENGTH_LONG).show();\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n\n protected void onActivityResult(int requestCode, int responseCode, Intent intent) {\n if (requestCode == RC_SIGN_IN) {\n if (responseCode != RESULT_OK) {\n mSignInClicked = false;\n }\n\n mIntentInProgress = false;\n\n if (!mGoogleApiClient.isConnecting()) {\n mGoogleApiClient.connect();\n }\n }\n }\n public void onConnectionSuspended(int cause) {\n mGoogleApiClient.connect();\n }\n\n private void resolveSignInError() {\n if(mConnectionResult == null){\n Toast.makeText(getApplicationContext(), \"Es null\", Toast.LENGTH_SHORT).show(); \n }else{\n if (mConnectionResult.hasResolution()) {\n try {\n mIntentInProgress = true;\n startIntentSenderForResult(mConnectionResult.getResolution().getIntentSender(),\n RC_SIGN_IN, null, 0, 0, 0);\n } catch (IntentSender.SendIntentException e) {\n // The intent was canceled before it was sent. Return to the default\n // state and attempt to connect to get an updated ConnectionResult.\n mIntentInProgress = false;\n mGoogleApiClient.connect();\n }\n }\n }\n }\n\n\n private void initViews() {\n LayoutInflater inflater = LayoutInflater.from(this);\n\n views = new ArrayList\u0026lt;View\u0026gt;(); \n views.add(inflater.inflate(R.layout.layout_one, null));\n views.add(inflater.inflate(R.layout.layout_two, null));\n views.add(inflater.inflate(R.layout.layout_three, null));\n\n vpAdapter = new ViewPagerAdapter(views, this);\n\n vp = (ViewPager) findViewById(R.id.pager);\n vp.setAdapter(vpAdapter);\n vp.setOnPageChangeListener(this);\n\n CirclePageIndicator indicator = (CirclePageIndicator)findViewById(R.id.circle);\n indicator.setViewPager(vp);\n indicator.setSnap(true);\n }\n\n\n @Override\n public void onPageScrollStateChanged(int arg0) {\n }\n\n @Override\n public void onPageScrolled(int arg0, float arg1, int arg2) {\n }\n\n @Override\n public void onPageSelected(int arg0) { \n }\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThank you all, Greetings!\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2014-07-05 14:44:27.303 UTC","last_activity_date":"2014-07-05 14:44:27.303 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3786116","post_type_id":"1","score":"1","tags":"android|google-plus|google-play-services","view_count":"375"} {"id":"22623987","title":"How to change the user.email and user.name in git?","body":"\u003cp\u003eI have pushed some commits to remote server with old user.name 'yesgo', and user.email 'yesgo@domain.com', and I need to change the change the user.name to 'newname', user.email to 'newname@domain.com' in old commits that I have pushed, so can I do this, and how? many thanks.\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2014-03-25 01:46:20.21 UTC","last_activity_date":"2014-03-25 01:46:20.21 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2891194","post_type_id":"1","score":"0","tags":"git|commit","view_count":"34"} {"id":"33470497","title":"Cant show sub-checkbox","body":"\u003cp\u003eI'm working on a checkbox list, if a check one of the checkbox, all of the check box will appear. I already hide the sub-checkbox by php but when I'm trying to check one of the checkboxes that allows to appear all the sub-check box it doesn't work.\u003c/p\u003e\n\n\u003cp\u003eHere's what I got so far (I used php also to show \u0026amp; connect the list of main checkbox that is stored on the database and as you can see I used prepared statement [bind]):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;form action=\"avfunc.php\" method=\"POST\" class=\"form-horizontal well\"\u0026gt;\n\u0026lt;div id=\"updatediv\"\u0026gt;\n \u0026lt;input type=\"submit\" name=\"update\" id=\"update\" value=\"Update Reference\" style=\"width:100px; display:none;\" class=\"edit\" /\u0026gt;\n\u0026lt;/div\u0026gt;\n\u0026lt;fieldset\u0026gt;\n\u0026lt;div class=\"row\"\u0026gt;\n \u0026lt;div class=\"col-lg-3\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"col-lg-6\"\u0026gt;\n \u0026lt;?php\n $tsql = \"select * from medtest\";\n $tstmt = $con-\u0026gt;prepare($tsql);\n $tstmt-\u0026gt;execute();\n $tstmt-\u0026gt;bind_result($mti,$mtn);\n $tstmt-\u0026gt;store_result();\n\n while ($tstmt-\u0026gt;fetch()){\n $d1= '\u0026lt;input type=\"checkbox\" name=\"test\"\n value=\"'.$mti.'\" onClick=\"var e=document.getElementById(\"updatediv\"); var s=document.getElementById(\"update\"); e.removeChild(s) ; this.form.submit();\"\u0026gt;'.$mtn.'\u0026lt;br\u0026gt; ';\n echo $d1;\n\n } \n\n ?\u0026gt; \n \u0026lt;?php if($_POST['checkbox'] == \"3\"){ ?\u0026gt;\n \u0026lt;h4\u0026gt;Laboratory Examination\u0026lt;/h4\u0026gt;\n \u0026lt;hr\u0026gt;\n \u0026lt;div class=\"row\"\u0026gt;\n \u0026lt;div class=\"col-lg-6\"\u0026gt;\n \u0026lt;div class=\"col-xs-2\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"col-xs-7\"\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"1\"\u0026gt;\u0026lt;span\u0026gt;Complete Blood Count\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"2\"\u0026gt;\u0026lt;span\u0026gt;Blood Typing\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"3\"\u0026gt;\u0026lt;span\u0026gt;Urinalysis\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"4\"\u0026gt;\u0026lt;span\u0026gt;RPR/TPHA\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"5\"\u0026gt;\u0026lt;span\u0026gt;Hepatitis B screening\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"6\"\u0026gt;\u0026lt;span\u0026gt;Fasting Blood Sugar\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"7\"\u0026gt;\u0026lt;span\u0026gt;Creatinine\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"8\"\u0026gt;\u0026lt;span\u0026gt;Total Cholesterol(Low Cholesterol, High Cholesterol)\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"9\"\u0026gt;\u0026lt;span\u0026gt;Triglyceride\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"10\"\u0026gt;\u0026lt;span\u0026gt;VLDL\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"11\"\u0026gt;\u0026lt;span\u0026gt;Blood Uric Acid\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"12\"\u0026gt;\u0026lt;span\u0026gt;Anti-HAV Igm Screening\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"13\"\u0026gt;\u0026lt;span\u0026gt;Anti HBaAg\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"14\"\u0026gt;\u0026lt;span\u0026gt;Drug \u0026amp; Alcohol Test\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;input type=\"checkbox\" name=\"topic\" value=\"15\"\u0026gt;\u0026lt;span\u0026gt;Stool Culture\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;/div\n \u0026lt;?php } ?\u0026gt; \u0026gt;\n \u0026lt;div class=\"col-xs-3\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"col-lg-6\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"col-lg-3\"\u0026gt;\n \u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-11-02 03:54:25.84 UTC","last_activity_date":"2015-11-02 05:37:01.757 UTC","last_edit_date":"2015-11-02 05:28:04.32 UTC","last_editor_display_name":"","last_editor_user_id":"3711988","owner_display_name":"","owner_user_id":"5379013","post_type_id":"1","score":"1","tags":"javascript|php","view_count":"34"} {"id":"8710174","title":"What's the best way to perform recurring task in iOS?","body":"\u003cp\u003eSo I have a simple personal finance app that needs to perform recurring expense on monthly basis (Automatically, without user action). What's the best way to do it? \u003c/p\u003e\n\n\u003cp\u003eEventKit seems not the best tools for it while NSTimer is limited on 50 - 100 milliseconds. \u003c/p\u003e\n\n\u003cp\u003eThanks!\u003c/p\u003e","accepted_answer_id":"8711840","answer_count":"3","comment_count":"2","creation_date":"2012-01-03 09:31:57.973 UTC","last_activity_date":"2012-01-03 11:47:50.467 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1377631","post_type_id":"1","score":"1","tags":"iphone|objective-c|ios4","view_count":"1032"} {"id":"30925029","title":"Proguard with Cordova Android 4?","body":"\u003cp\u003eI had ProGuard running for release builds when Cordova built with Ant, but now that Gradle is used my project's release builds aren't being obfuscated (my \"cordova build --release android\" output shows a step for :CordovaLib:mergeReleaseProguardFiles, but no other proguard/minification/obfuscation entries). \u003c/p\u003e\n\n\u003cp\u003eWith Ant, my project.properties file referred to my proguard-project.txt file using the proguard.config parameter. \u003c/p\u003e\n\n\u003cp\u003eHow do I configure this to work now that Cordova uses Gradle?\u003c/p\u003e","accepted_answer_id":"31102525","answer_count":"1","comment_count":"0","creation_date":"2015-06-18 20:17:15.847 UTC","last_activity_date":"2015-06-28 17:14:47.427 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2199492","post_type_id":"1","score":"1","tags":"android|cordova|gradle|proguard","view_count":"1974"} {"id":"11367005","title":"Adding List to Object in Django View","body":"\u003cp\u003eI have searched and read through the internet trying to figure out this problem. Thank you for any advice on this issue.\u003c/p\u003e\n\n\u003cp\u003eI have been having problems adding a list of objects to another object in Django. I have an object \u003cem\u003e'category'\u003c/em\u003e and a list of objects \u003cem\u003e'subcategory'\u003c/em\u003e, but when I try to put them together as a package \u003cem\u003e'ad'\u003c/em\u003e, there is a \u003ccode\u003eTypeError: 'subcategory' is an invalid keyword argument for this function\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eHere is the view:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef create_in_category(request, slug):\n category = get_object_or_404(Category, slug=slug)\n subcategory = SubCategory.objects.all()\n\n ad = Ad.objects.create(category=category, subcategory=subcategory, user=request.user,\n expires_on=datetime.datetime.now(), active=False)\n ad.save()\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat am I missing to be able to get all of these elements together? Thanks very much for sharing your knowledge.\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003cp\u003eEdit: added the models. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass Category(models.Model):\n name = models.CharField(max_length=200)\n slug = models.SlugField()\n\n def __unicode__(self):\n return self.name + u' Category'\n\nclass SubCategory(models.Model):\n name = models.CharField(max_length=50, unique=True)\n category = models.ManyToManyField(Category)\n\n def __unicode__(self):\n return self.name + u' SubCategory'\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"11367304","answer_count":"2","comment_count":"5","creation_date":"2012-07-06 17:29:13.987 UTC","last_activity_date":"2012-07-06 20:03:11.293 UTC","last_edit_date":"2012-07-06 20:03:11.293 UTC","last_editor_display_name":"","last_editor_user_id":"903143","owner_display_name":"","owner_user_id":"903143","post_type_id":"1","score":"0","tags":"python|django|views","view_count":"162"} {"id":"19244411","title":"Center Align title in action bar using styles in android.","body":"\u003cp\u003eHi I am developing android application. In my application I am using action bar. I want to make center align my title of window in action-bar. I know it is possible using xml files. but I want to do it using style so that it will applicable for my every window, how to do this need help. Thank you.\u003c/p\u003e","accepted_answer_id":"19244633","answer_count":"4","comment_count":"2","creation_date":"2013-10-08 09:49:14.193 UTC","favorite_count":"7","last_activity_date":"2016-10-28 16:43:08.13 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"861204","post_type_id":"1","score":"14","tags":"android|android-actionbar|title|center-align","view_count":"45652"} {"id":"30633418","title":"Signing requests with API secret in an iOS application","body":"\u003cp\u003eI have a webservice, and an iOS client(application) for one of my projects.\u003c/p\u003e\n\n\u003cp\u003eMy webservice exposes several REST endpoints. I am looking for a way to make sure that webservice processes requests that come from iOS application only. \u003c/p\u003e\n\n\u003cp\u003eI understand that it is impossible to be 100% sure that the requests are coming iOS application. \u003c/p\u003e\n\n\u003cp\u003eBut are there any best practices that I can use to make sure that requests are coming from iOS only.\u003c/p\u003e\n\n\u003cp\u003eHere are few things that I was trying to do .\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eBundle API secret with iOS application (known only to iOS and server)\u003c/li\u003e\n\u003cli\u003eSign all the requests with secret and timestamps\u003c/li\u003e\n\u003cli\u003eRecycle API secret with every (or alternate) application release cycles.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eI am new to most of this, so any help/advice/constructive-criticism would be super helpful\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-06-04 01:16:58.873 UTC","last_activity_date":"2015-06-04 01:59:05.66 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"462455","post_type_id":"1","score":"0","tags":"ios|web-services|rest|secret-key|shared-secret","view_count":"90"} {"id":"9628533","title":"Best practices for SOA and articles","body":"\u003cp\u003eI am building a SOA, and one of the things it will provide to the clients (all under our control), is articles. On the client side I figured on just caching the articles and article listings so that there would be no need to store them in the db. The problem comes up that comments would have to be stored on a per client basis. I thought it seemed odd to store article comments without the article in the db, and it seems pretty obvious to me that this should not be handled by the SOA.\u003c/p\u003e\n\n\u003cp\u003eI guess my question is, faced with this problem, what is teh best way to proceed? Store the comments in the db, without the articles. Store the articles and the comments in the db. Or maybe make the SOA handle them?\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2012-03-09 03:26:53.613 UTC","last_activity_date":"2012-03-09 03:26:53.613 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"485296","post_type_id":"1","score":"0","tags":"php|soa","view_count":"175"} {"id":"40435855","title":"Getting the error ,' SyntaxError: can't assign to function call '","body":"\u003cp\u003eI'm trying to subtract the value in 'remove' variable from either A, B or C without using if...else inside while loop, but it's throwing a syntax error for line 9. What is the reason behind this?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprint \"\\t\\t\\t\\t\\t Welcome to the game of piles\"\nA=3\nB=3\nC=3\nprint \"A: %d\\t B: %d\\t C: %d\" %(A,B,C)\nwhile A\u0026gt;0 and B\u0026gt;0 and C\u0026gt;0:\n choose_pile = raw_input(\"\\nChoose a pile: \")\n remove = input(\"How many to remove from pile %s\" %choose_pile)\n int(choose_pile)=int(choose_pile)-remove\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-11-05 07:31:08.127 UTC","last_activity_date":"2016-11-05 07:40:24.483 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5269053","post_type_id":"1","score":"2","tags":"python-2.7|while-loop","view_count":"47"} {"id":"47527902","title":"How I can specify GraphQL query for Apollo Client and get items which property has an occurrence of the appropriate string","body":"\u003cp\u003eI did not work with GraphQL before the last days. I use Apollo Client with \u003ccode\u003egraphql-tag\u003c/code\u003e. Now I can get the list of cities from a server with this query:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003equery {\n cities(country:countryName, limit:30){\n id\n name\n } \n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut I want to get only the cities which names (\u003ccode\u003ename\u003c/code\u003e property) have an occurrence of the string that user typed. It should work like autocomplete. For example when user type \u003ccode\u003esan\u003c/code\u003e I want to get array of objects for \u003ccode\u003eSan Francisco, San Jose, San Juan...\u003c/code\u003e. Is it possible to do it on the client side, or I should to ask the backend developer for it?\u003c/p\u003e","accepted_answer_id":"47562829","answer_count":"1","comment_count":"0","creation_date":"2017-11-28 09:20:53.067 UTC","last_activity_date":"2017-11-29 22:22:20.533 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"9019027","post_type_id":"1","score":"0","tags":"javascript|graphql|apollo|apollo-client","view_count":"26"} {"id":"974504","title":"NHibernate collection mapping problem","body":"\u003cp\u003eI'm trying to map a relatively simple parent-children (Invoice-InvoiceEntry) scenario in NHibernate. Here are some parts of my mapping files:\u003c/p\u003e\n\n\u003cp\u003efrom Invoice.hbm.xml\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;set name=\"InvoiceEntries\" table=\"InvoiceEntries\" inverse=\"true\" cascade=\"all-delete-orphan\" lazy=\"false\"\u0026gt;\n \u0026lt;key column=\"InvoiceID\" /\u0026gt;\n \u0026lt;one-to-many class=\"Jobflow.Models.Entities.InvoiceEntry, Jobflow\" /\u0026gt;\n\u0026lt;/set\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003efrom InvoiceEntry.hbm.xml\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;many-to-one name=\"Invoice\" class=\"Jobflow.Models.Entities.Invoice, Jobflow\" column=\"InvoiceID\" not-null=\"true\" lazy=\"false\" /\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003efrom Invoice.cs\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprivate ISet\u0026lt;IInvoiceEntry\u0026gt; _invoiceEntries = new HashedSet\u0026lt;IInvoiceEntry\u0026gt;();\n\n public virtual ISet\u0026lt;IInvoiceEntry\u0026gt; InvoiceEntries\n {\n get { return _invoiceEntries; } \n set { _invoiceEntries = value;}\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat happens is that when I save an invoice everything is fine. A new record is inserted into both tables. The value in column InvoiceID in the InvoiceEntries table is the same as the ID column in the Invoices table. However, when I try to load the invoice from the repository via NHibernate I get the following error:\u003c/p\u003e\n\n\u003cp\u003eNHibernate.ObjectNotFoundException: No row with the given identifier exists[Jobflow.Models.Entities.InvoiceEntry#55]\u003c/p\u003e\n\n\u003cp\u003e55 is indeed the correct ID in the Invoices table and the correct InvoiceID in the InvoiceEntries table. However, it seems like NHibernate might be looking for the InvoiceEntries PK which is EnvoiceEntryID instead.\u003c/p\u003e\n\n\u003cp\u003eCan anybody help me with this?\u003c/p\u003e","accepted_answer_id":"974913","answer_count":"1","comment_count":"0","creation_date":"2009-06-10 09:15:26.033 UTC","last_activity_date":"2009-06-10 11:01:11.86 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"49240","post_type_id":"1","score":"0","tags":"collections|nhibernate-mapping","view_count":"1306"} {"id":"35023867","title":"Proper method to handle Angular scope instead of $parent.$parent","body":"\u003cp\u003eI've been reading a few articles, and haven't found the example that solves my issue.\u003c/p\u003e\n\n\u003cp\u003eMy understanding is that:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003e\u003ccode\u003eng-if\u003c/code\u003e and \u003ccode\u003eng-repeat\u003c/code\u003e create isolate scopes.\u003c/li\u003e\n\u003cli\u003eUsing \u003ccode\u003e$parent.someProperty\u003c/code\u003e is bad.\u003c/li\u003e\n\u003cli\u003eUsing \u003ccode\u003e$parent.$parent.someProperty\u003c/code\u003e would be an abomination.\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eSo, with the given template markup, how can I properly bind the the controller \u003cem\u003eso that the controller property updates\u003c/em\u003e?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eMarkup:\u003c/strong\u003e\u003cbr\u003e\n(note the nested \u003ccode\u003eng-if\u003c/code\u003e and \u003ccode\u003eng-repeat\u003c/code\u003e, creating a sort of \u003ccode\u003e$parent.$parent\u003c/code\u003e situation) \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div ng-app=\"MyApp\" ng-controller=\"MyCtrl\"\u0026gt;\n \u0026lt;div ng-if=\"showOnCondition\"\u0026gt;\n \u0026lt;label ng-repeat=\"item in repeatingItems\"\u0026gt;\n {{item}}\n \u0026lt;setting item=\"item\" /\u0026gt;\n \u0026lt;/label\u0026gt;\n \u0026lt;/div\u0026gt;\n {{checkSetting()}}\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eJavaScript\u003c/strong\u003e \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar myApp = angular.module('MyApp', []);\n\nmyApp.controller('MyCtrl', function($scope) {\n $scope.settings = {\n someProperty: '',\n anotherProperty: 'Hello'\n }\n\n $scope.repeatingItems = [\n 'One',\n 'Two',\n 'Three'\n ];\n\n $scope.showOnCondition = true;\n\n $scope.checkSetting = function() {\n // When calling checkSettings(), I would like to access the value of someProperty here\n return $scope.settings;\n }\n});\n\nmyApp.directive('setting', function() {\n return {\n restrict: 'E',\n require: '^myCtrl',\n // HOW DO I SOLVE THIS?\n // $parent.$parent is bad.\n template: '\u0026lt;input type=\"radio\" ng-model=\"$parent.$parent.settings.someProperty\" name=\"mySetting\" value=\"{{item}}\" /\u0026gt;',\n scope: {\n settings: '=',\n item: '='\n }\n };\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eGiven the above example, how to I properly construct the directive and / or markup in order to access \u003ccode\u003esettings.someProperty\u003c/code\u003e in the controller? Or is there something entirely different I need to be doing?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eClarification\u003c/strong\u003e\u003cbr\u003e\nThere seems to be some confusion around what I'm trying to do. The \u003ccode\u003esomeProperty\u003c/code\u003e is available in the directive - that is working fine. Please note I'm trying to \u003cem\u003eassign values\u003c/em\u003e to the controller's \u003ccode\u003esomeProperty\u003c/code\u003e property from \u003cem\u003ewithin\u003c/em\u003e the directive (using ng-model)\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eUpdate\u003c/strong\u003e\u003cbr\u003e\nI've revised the code above to known, working code, plus added a \u003ca href=\"http://jsfiddle.net/XyUGE/473/\" rel=\"nofollow\"\u003ejsFiddle\u003c/a\u003e.\nNote that it \u003cem\u003eworks\u003c/em\u003e, but it uses \u003ccode\u003e$parent.$parent\u003c/code\u003e in the template. This is the problem I need to understand how to solve.\u003c/p\u003e","accepted_answer_id":"35025628","answer_count":"4","comment_count":"7","creation_date":"2016-01-26 21:01:00.887 UTC","favorite_count":"1","last_activity_date":"2016-01-27 14:36:14.61 UTC","last_edit_date":"2016-01-26 21:56:04.847 UTC","last_editor_display_name":"","last_editor_user_id":"870729","owner_display_name":"","owner_user_id":"870729","post_type_id":"1","score":"5","tags":"javascript|angularjs","view_count":"119"} {"id":"39217234","title":"angular2 http middleware with rxjs","body":"\u003cp\u003eI'm using angular2 and have an \u003ccode\u003eApiService\u003c/code\u003e... the full class it is below...\u003c/p\u003e\n\n\u003cp\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-js lang-js prettyprint-override\"\u003e\u003ccode\u003eimport {Store} from '@ngrx/store';\r\nimport { Injectable } from '@angular/core';\r\nimport { Headers, RequestOptions, Http } from '@angular/http';\r\nimport {AppState} from '../app.store';\r\nimport { Observable } from 'rxjs/Observable';\r\nimport {AuthActions} from '../actions/AuthActions';\r\n\r\n@Injectable()\r\nexport class ApiService {\r\n\r\n private currentState: AppState;\r\n\r\n constructor(\r\n private store: Store\u0026lt;AppState\u0026gt;,\r\n private http: Http\r\n ) {\r\n // get config once...\r\n store.subscribe((state:AppState) =\u0026gt; {\r\n this.currentState = state;\r\n });\r\n }\r\n\r\n // PUBLIC\r\n\r\n /*\r\n -- POST\r\n */\r\n post(path:string, payload:Object) {\r\n\r\n let request = this.http.post(\r\n this.getEndpoint(path),\r\n JSON.stringify(payload),\r\n this.getHeaderOptions('post')\r\n );\r\n\r\n // DOESN'T WORK... fires http twice\r\n // this.responseMiddleware(request);\r\n\r\n return request;\r\n }\r\n\r\n /*\r\n -- GET\r\n */\r\n get(path:string) {\r\n\r\n let request = this.http.get(\r\n this.getEndpoint(path),\r\n this.getHeaderOptions('get')\r\n );\r\n\r\n return request;\r\n }\r\n\r\n /*\r\n -- DELETE\r\n */\r\n delete(path:string) {\r\n\r\n let request = this.http.delete(\r\n this.getEndpoint(path),\r\n this.getHeaderOptions('delete')\r\n );\r\n\r\n return request;\r\n\r\n }\r\n\r\n // PROCESS ALL REQUESTS LOOKING FOR BAD STUFF ??\r\n // HOW to subscribe without firing http 2x ??\r\n // private responseMiddleware(request:Observable\u0026lt;any\u0026gt;) {\r\n // request.subscribe(\r\n // (res) =\u0026gt; {},\r\n // (err) =\u0026gt; {\r\n // // catch error\r\n // if(err.status === 401) {\r\n // // unorthorised\r\n // this.store.dispatch({type:AuthActions.AUTHENTICATE_DELETE});\r\n // }\r\n // },\r\n // () =\u0026gt; {}\r\n // );\r\n // }\r\n\r\n // GET ENDPOINT FROM CONFIG FILE\r\n private getEndpoint(path:string) {\r\n if(!this.currentState.config.file.endpoint) {\r\n throw new Error('========= CONFIG NOT SET =========');\r\n }\r\n return this.currentState.config.file.endpoint + path;\r\n }\r\n\r\n // PUT TOGETHER CORRECT HEADER OBJECT BASED ON REQUEST TYPE\r\n private getHeaderOptions(type:string = 'get') {\r\n\r\n let headersObj:any = {\r\n 'Accept' : 'application/json',\r\n 'X-Lc-Svc-Channel': 'lc-web-product'\r\n };\r\n\r\n switch(type) {\r\n case 'post':\r\n headersObj['Content-Type'] = 'application/json';\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n let token = this.currentState.auth.token;\r\n if(token) {\r\n headersObj.Authorization = token;\r\n }\r\n\r\n return new RequestOptions({ headers: new Headers(headersObj)});\r\n\r\n }\r\n}\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/p\u003e\n\n\u003cp\u003eWhat I want to do is have some sort of middleware on each request to listen for status codes... but the solution I tried (subscribing to the http observable) fires the http requests twice. \u003c/p\u003e\n\n\u003cp\u003eHow could I do this without this happening?\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2016-08-30 00:43:29.537 UTC","last_activity_date":"2016-08-30 21:53:53.51 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"334304","post_type_id":"1","score":"2","tags":"angular|rxjs","view_count":"1245"} {"id":"509352","title":"Where is Html.Image in ASP .NET MVC RC?","body":"\u003cp\u003eI can't find the Html.Image method in new MVC RC version. Please somebody give me example how to render simple Image in ASP .NET MVC RC sites.\u003c/p\u003e","accepted_answer_id":"509396","answer_count":"5","comment_count":"0","creation_date":"2009-02-03 23:02:40.087 UTC","favorite_count":"6","last_activity_date":"2011-07-11 18:28:00.727 UTC","last_edit_date":"2009-09-24 04:07:30.037 UTC","last_editor_display_name":"","last_editor_user_id":"5640","owner_display_name":"dario","owner_user_id":"59528","post_type_id":"1","score":"18","tags":"asp.net-mvc","view_count":"33441"} {"id":"1201955","title":"PHPMailer, AddStringAttachment and Data URI Scheme","body":"\u003cp\u003eI have converted the contents of a \u003ccode\u003ecanvas\u003c/code\u003e element to data (URI Scheme) using \u003ccode\u003etoDataURL()\u003c/code\u003e (\u003ccode\u003e$contact_image_data\u003c/code\u003e) and I want to send this via email as an attachment. This is currently how I have PHPMailer set up:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$contact_image_data=\"data:image/png;base64,iVBORw0KGgo[...]\";\n$filename=\"test.png\"; \n$encoding = \"base64\"; \n$type = \"image/png\";\n$mail-\u0026gt;AddStringAttachment($contact_image_data, $filename, $encoding, $type); \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am wondering if this is actually possible, and if so, what steps I am missing.\u003c/p\u003e\n\n\u003cp\u003eI can send an email, attach a file named “test.png” which contains the contents of \u003ccode\u003e$contact_image_data\u003c/code\u003e, but it doesn’t actually create an image.\u003c/p\u003e\n\n\u003cp\u003eAny help would be \u003cem\u003emuch\u003c/em\u003e appreciated.\u003c/p\u003e\n\n\u003cp\u003eSamuel.\u003c/p\u003e","accepted_answer_id":"1201996","answer_count":"2","comment_count":"0","creation_date":"2009-07-29 17:52:46.897 UTC","favorite_count":"2","last_activity_date":"2017-07-20 12:30:58.367 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"15935","post_type_id":"1","score":"7","tags":"php|phpmailer","view_count":"11790"} {"id":"37271550","title":"SQL - Poor Performance SELECT Query on 377 million table","body":"\u003cp\u003eI got a table with the following structure:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eId | clientid | type | timeStamp | message |\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm using this query to get the first rows of table to start deleting rows but is crashing the DB:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT TOP 10 [id]\n ,[clientid]\n ,[type]\n ,[timeStamp]\n ,[message]\nFROM [db].[dbo].[table]\nWHERE timeStamp LIKE '%2014-01-01 00:00:00.000%'\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs there any way to get the first rows without crashing and delete them before arrive to \u003ccode\u003etimeStamp\u003c/code\u003e \u003ccode\u003e'2016-01-01 00:00:00.000'\u003c/code\u003e?\u003c/p\u003e","accepted_answer_id":"37271802","answer_count":"7","comment_count":"8","creation_date":"2016-05-17 08:58:49.233 UTC","last_activity_date":"2017-11-03 13:55:47.683 UTC","last_edit_date":"2017-11-03 13:55:47.683 UTC","last_editor_display_name":"","last_editor_user_id":"2350083","owner_display_name":"","owner_user_id":"3507535","post_type_id":"1","score":"3","tags":"sql|sql-server|performance|bigdata","view_count":"94"} {"id":"20039063","title":"How to build wxFormBuilder 3.x on Mac","body":"\u003cp\u003eI downloaded \u003ca href=\"http://sourceforge.net/projects/wxformbuilder/\" rel=\"nofollow noreferrer\"\u003ewxFormBuilder 3.4 beta mac\u003c/a\u003e to appropriate directory.\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/OxzxU.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eand open a terminal i run to \u003ccode\u003esh create_build_files4.sh\u003c/code\u003e but console show to me following error.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eMinSeok-ui-iMac-3:wxFormBuilder MinSeok$ sh create_build_files4.sh\ncreate_build_files4.sh: line 7: wx-config: command not found\ncreate_build_files4.sh: line 66: wx-config: command not found\nmake: *** ./premake/macosx: No such file or directory. Stop.\ncreate_build_files4.sh: line 91: ./premake/macosx/bin/release/premake4: No such file or directory\ncreate_build_files4.sh: line 92: ./premake/macosx/bin/release/premake4: No such file or directory\ncreate_build_files4.sh: line 93: ./premake/macosx/bin/release/premake4: No such file or directory\ncreate_build_files4.sh: line 95: ./premake/macosx/bin/release/premake4: No such file or directory\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy Environment is OS X Mountain Lion (also Mavericks). I already install \u003ccode\u003ewxPython\u003c/code\u003e version is 2.9.5.\u003c/p\u003e\n\n\u003cp\u003eWhat is my problem?... google, never show hint to me.\u003c/p\u003e\n\n\u003cp\u003eThank in advance.\u003c/p\u003e\n\n\u003ch2\u003eEDIT\u003c/h2\u003e\n\n\u003cp\u003eI'm installed wxWidgets 3.0 and placed premake4. I think It seems almost close to solving. wxFormBuilder using a lua script. but i don't know solution.lua script build code. any hint?\nsee a below shell create_build_files4.sh script. one thing is certain must know solution.lua script code. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#!/bin/sh\n\n# Parse command line options\nshared=\"\"\narch=\"\"\nwxroot=\"\"\nwxpath=`wx-config --prefix`\n\n# These works only on wxWidgets 2.8.10+\n#wxcharset=`wx-config --query-chartype`\n#wxversion=`wx-config --query-version`\nfor args in \"$@\"\ndo\n haveroot=`expr \"${args}\" : '--wx-root=.*'`\n havearch=`expr \"${args}\" : '--architecture=.*'`\n haverpath=`expr \"${args}\" : '--rpath=.*'`\n if ( [ ${args} = \"--help\" ] || [ ${args} = \"-h\" ] ); then\n echo \"Available options:\"\n echo\n echo \"--disable-mediactrl Disable wxMediaCtrl / wxMedia library.\"\n echo\n echo \"--disable-shared Use static wxWidgets build instead of shared libraries.\"\n echo\n echo \"--disable-unicode Whether to use an Unicode or an ANSI build.\"\n echo \" Ignored in wxWidgets 2.9 and later.\"\n echo \" Example: --disable-unicode produces an ANSI build.\"\n echo \" Default: Unicode build on all versions.\"\n # echo \" Current: $wxcharset\"\n echo\n echo \"--wx-root Specify the wxWidgets build path,\"\n echo \" useful for wxWidgets builds not installed\"\n echo \" in your system (alternate/custom builds)\"\n echo \" Example: --wx-root=/home/devel/wx/3.0/buildgtk\"\n echo \" Current: $wxpath\"\n echo\n echo \"--architecture Specify build architecture (e.g. --architecture=i386).\"\n echo \"--rpath Specify a rpath (e.g. --rpath=/usr/lib/wxformbuilder).\"\n echo\n exit\n elif [ ${args} = \"--disable-mediactrl\" ]; then\n mediactrl=\"--disable-mediactrl\"\n continue\n elif [ ${args} = \"--disable-unicode\" ]; then\n wxunicode=\"--disable-unicode\"\n continue\n elif [ ${args} = \"--disable-shared\" ]; then\n shared=\"--disable-shared\"\n continue\n elif [ ${args} = \"--disable-unicode\" ]; then\n wxunicode=\"--disable-unicode\"\n continue\n elif ( [ \"$haveroot\" -gt \"0\" ] ); then\n wxroot=${args}\n continue\n elif ( [ \"$havearch\" -gt \"0\" ] ); then\n arch=${args}\n continue\n elif ( [ \"$haverpath\" -gt \"0\" ] ); then\n rpath=${args}\n continue\n fi\ndone\n\n# Autodetect wxWidgets version\nif [ \"$wxroot\" = \"\" ]; then\n wxver=`wx-config --release`\nelse\n wxpath=${wxroot#-*=}\n wxver=`$wxpath/wx-config --release`\nfi\n\nwxversion=\"--wx-version=\"$wxver\n\n# Autodetect OS\nisbsd=`expr \"$unamestr\" : '.*BSD'`\nplatform=\"unknown\"\nunamestr=$(uname)\n\nif ( [ \"$isbsd\" -gt \"0\" ] ); then\n platform=\"bsd\"\nelif [ \"$unamestr\" = \"Linux\" ]; then\n platform=\"linux\"\nelif [ \"$unamestr\" = \"Darwin\" ]; then\n platform=\"macosx\"\nfi\n\n# Build premake\ncd build\nmake CONFIG=Release -C./premake/$platform\n\n./premake/$platform/bin/release/premake4 --file=./premake/solution.lua $wxunicode $wxroot $wxversion $mediactrl $shared $arch codeblocks\n./premake/$platform/bin/release/premake4 --file=./premake/solution.lua $wxunicode $wxroot $wxversion $mediactrl $shared $arch $rpath codelite\n./premake/$platform/bin/release/premake4 --file=./premake/solution.lua $wxunicode $wxroot $wxversion $mediactrl $shared $arch $rpath gmake\nif [ \"$platform\" = \"macosx\" ]; then\n ./premake/$platform/bin/release/premake4 --file=./premake/solution.lua $wxunicode $wxroot $wxversion $mediactrl $shared $arch xcode3\nfi\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"3","comment_count":"0","creation_date":"2013-11-18 02:26:19.803 UTC","last_activity_date":"2014-06-04 04:48:36.497 UTC","last_edit_date":"2013-12-27 07:50:35.047 UTC","last_editor_display_name":"","last_editor_user_id":"785923","owner_display_name":"","owner_user_id":"785923","post_type_id":"1","score":"3","tags":"python|wxpython|osx-mountain-lion|wxformbuilder","view_count":"3468"} {"id":"16031267","title":"How to connect JSON with a chartengine library","body":"\u003cp\u003eI am using achartEngine to draw linechart in my android application. I am setting data in the code. Now I need to get data from JSON and display it in my graphics, but I don't know how to connect my JSON with achartengine and display it into linechart.\u003c/p\u003e\n\n\u003cp\u003eThis is my wrong source code :\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eparsing json\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class ErizaChartEngine extends Activity {\nList NabList = new ArrayList();\nboolean statuskoneksi= true;\nprivate ProgressDialog Dialog;\nprotected Context context;\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n new LineChartAsyncTask().execute();\n setContentView(R.layout.layoutchart);\n\n}\n public class LineChartAsyncTask extends AsyncTask \u0026lt;String, String, String\u0026gt;{\n\n @Override\n protected void onPreExecute (){\n super.onPreExecute();\n Dialog=new ProgressDialog(ErizaChartEngine.this);\n Dialog.setMessage(\"Mohon Tunggu Sebentar...\");\n Dialog.setIndeterminate(false);\n Dialog.setCancelable(true);\n Dialog.show();\n }\n\n\n @Override\n protected String doInBackground(String... params) {\n String url= \"http://www.ab.com/NabChart.htm?id=03\u0026amp;nilai=10\";\n try {\n JSONParser jp= new JSONParser();\n JSONArray ja= jp.takeJson(url);\n\n for (int i=0; i\u0026lt;ja.length();i++){\n JSONObject jo = ja.getJSONObject(i);\n HashMap\u0026lt;String, String\u0026gt; map = new HashMap\u0026lt;String, String\u0026gt;();\n if (jo.has(\"lnu_nilai\")) \n map.put(\"lnu_nilai\", jo.get(\"lnu_nilai\").toString());\n if (jo.has(\"tanggal\")) \n map.put(\"tanggal\", jo.get(\"tanggal\").toString());\n NabList.add(map);\n System.out.println(\"json parser done\");\n }\n }\n catch (JSONException e) {\n e.printStackTrace();\n }\n return null;\n }\n\n @Override\n protected void onPostExecute(String file_url) {\n Dialog.dismiss();\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is my class for drawing graphics :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic void drawNABContentSimpleChart\n (\n String strtanggal,\n String strNilaiNABHMin0)\n {\n XYSeries nabseries = new XYSeries(\"nab\");\n\n for (int i=0;i\u0026lt;NabList.size();i++){\n nabseries.add(strNilaiNABHMin0[i]);\n }\n XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();\n // Adding Income Series to the dataset\n dataset.addSeries(nabseries);\n\n XYSeriesRenderer incomeRenderer = new XYSeriesRenderer();\n incomeRenderer.setColor(Color.WHITE);\n incomeRenderer.setPointStyle(PointStyle.CIRCLE);\n incomeRenderer.setFillPoints(true);\n incomeRenderer.setLineWidth(2);\n incomeRenderer.setDisplayChartValues(true);\n\n XYMultipleSeriesRenderer multiRenderer = new XYMultipleSeriesRenderer();\n multiRenderer.setXLabels(0);\n multiRenderer.setChartTitle(\"NAB 1 year\");\n multiRenderer.setXTitle(\"Year 2012\");\n multiRenderer.setYTitle(\"Nilai\");\n multiRenderer.setZoomButtonsVisible(true); \n for(int i=0;i\u0026lt;NabList.size();i++){\n multiRenderer.addXTextLabel(strtanggal[i]); \n } \n multiRenderer.addSeriesRenderer(incomeRenderer);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e// multiRenderer.addSeriesRenderer(expenseRenderer);\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e // Creating an intent to plot line chart using dataset and multipleRenderer\n Intent intent = ChartFactory.getLineChartIntent(getBaseContext(), dataset, multiRenderer);\n\n // Start Activity\n startActivity(intent);\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI really need help to solve my problem, because my code still wrong and I don't know how to fix it. is there anyone can help me to solve this?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-04-16 07:35:37.453 UTC","last_activity_date":"2015-12-10 13:59:48.523 UTC","last_edit_date":"2015-12-10 13:59:48.523 UTC","last_editor_display_name":"","last_editor_user_id":"4370109","owner_display_name":"","owner_user_id":"2230703","post_type_id":"1","score":"0","tags":"java|android|json|achartengine","view_count":"660"} {"id":"36327088","title":"Migration from maven to gradle","body":"\u003cp\u003eWe are migrating maven project to gradle. We have flex for front end and as requested we are migrating it as well using gradlefx. Have added the dependencies:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edependencies{\n classpath 'com.adobe.flex.framework:flex-framework:4.0.0.14159'\n classpath files(\"./libs/flex/parsley-core-3.0.0.swc\")\n classpath files(\"./libs/flex/parsley-flex-3.0.0.swc\")\n classpath files(\"./libs/flex/legacy-parsley-commands-2.5.0.swc\")\n classpath files(\"./libs/flex/spicelib-commands-3.1.1.swc\")\n classpath files(\"./libs/flex/spicelib-reflect-3.0.0.swc\")\n classpath files(\"./libs/flex/spicelib-util-3.1.0.swc\")\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e2.My mxml has contents like:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"utf-8\"?\u0026gt;\n\u0026lt;Object xmlns:fx=\"http://ns.adobe.com/mxml/2009\" \nxmlns=\"http://www.spicefactory.org/parsley\"\u0026gt;\n\u0026lt;fx:Script\u0026gt;\u0026lt;![CDATA[//some imports]]\u0026gt;\u0026lt;/fx:Script\u0026gt;\u0026lt;/Object\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever on build am getting following error.\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e[ant:java] Java Result: 1\u003cbr\u003e\n FAILED\u003c/p\u003e\n \n \u003cp\u003eFAILURE: Build failed with an exception.\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cul\u003e\n\u003cli\u003eWhat went wrong:\nExecution failed for task \u003ccode\u003e:Common_Components:compileFlex\u003c/code\u003e.\n\n\u003cblockquote\u003e\n \u003cp\u003ejava.lang.Exception: mxmlc execution failed: Loading configurationfile D:\\Softwares\\flex_sdk_4.6\\frameworks\\flex-config.xmlD:\\Xyz\\Workspace\\Common_Components\\src\\com\\abc\\common\\MenuContext.mxml(9): Error: Could not resolve to a component implementation. xmlns:presentation1=\"com.abc.helpframework.presentation.*\"\u003e`\u003c/p\u003e\n\u003c/blockquote\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eThe same setup is working for other mxml file. I doubt with object tag, not very sure though.\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2016-03-31 07:40:02.543 UTC","last_activity_date":"2016-03-31 07:43:12.407 UTC","last_edit_date":"2016-03-31 07:43:12.407 UTC","last_editor_display_name":"","last_editor_user_id":"3932569","owner_display_name":"","owner_user_id":"6138287","post_type_id":"1","score":"1","tags":"java|maven|flex|mxml|gradlefx","view_count":"59"} {"id":"27558050","title":"Override onBackPressed to back to a specific Fragment?","body":"\u003cp\u003eI have a Fragment(CustomerFrag). My target is that when I press the back button of the device from any other fragment, they all redirect to this one. In order to do this I did override \u003ccode\u003eonBackPressed\u003c/code\u003e method but that doesn't work as I need.\u003c/p\u003e\n\n\u003cp\u003eHow can I achieve this?\u003c/p\u003e\n\n\u003cp\u003eSo far I have tried this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Override\npublic void onBackPressed() {\n CustomerFrag cf = (CustomerFrag)getSupportFragmentManager().findFragmentByTag(\"Customer\");\n if (cf != null){\n FragmentTransaction ft = getFragmentManager().beginTransaction(); \n Fragment frag = new CustomerFrag();\n ft.replace(R.id.fl, frag);\n ft.addToBackStack(\"back\");\n ft.commit();\n }else{\n super.onBackPressed();\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"27558769","answer_count":"1","comment_count":"2","creation_date":"2014-12-19 00:26:49.3 UTC","last_activity_date":"2014-12-19 02:05:25.98 UTC","last_edit_date":"2014-12-19 01:58:48.453 UTC","last_editor_display_name":"","last_editor_user_id":"1483084","owner_display_name":"","owner_user_id":"1483084","post_type_id":"1","score":"1","tags":"android|android-fragments","view_count":"317"} {"id":"23649199","title":"Listview row getting highlighted making the widgets invisible","body":"\u003cp\u003eI have generated a Listview using \u003ccode\u003efortysevendegree swipelistview\u003c/code\u003e library. I want to highlight the selected Listview row with a specific color and not the default highlighter in android. i have done the following code but my whole row gets the color and the widgets get masked. If i remove the \u003ccode\u003eandroid:drawSelectorOnTop=\"true\"\u003c/code\u003e there is no Highlight on the row. Can anyone please tell me what to do? My codes are as below::\u003c/p\u003e\n\n\u003cp\u003emyactivity.xml\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;com.fortysevendeg.swipelistview.SwipeListView\n android:id=\"@+id/swipy\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\"\n swipe:swipeFrontView=\"@+id/front\"\n swipe:swipeBackView=\"@+id/back\"\n android:focusable=\"true\"\n android:focusableInTouchMode=\"true\"\n android:listSelector=\"@drawable/list_selector\"\n android:drawSelectorOnTop=\"true\"\n android:dividerHeight=\"1dp\"\n swipe:swipeMode=\"right\"\n /\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003elistselector.xml in drawable folder\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;?xml version=\"1.0\" encoding=\"utf-8\"?\u0026gt;\n \u0026lt;selector xmlns:android=\"http://schemas.android.com/apk/res/android\"\u0026gt;\n \u0026lt;item android:drawable=\"@drawable/list_item_bg_normal\" android:state_activated=\"false\"/\u0026gt;\n \u0026lt;item android:drawable=\"@drawable/list_item_bg_pressed\" android:state_pressed=\"true\"/\u0026gt;\n \u0026lt;item android:drawable=\"@drawable/list_item_bg_pressed\" android:state_activated=\"true\"/\u0026gt;\n \u0026lt;/selector\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003elist_item_bg_normal.xml in drawable\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;shape xmlns:android=\"http://schemas.android.com/apk/res/android\"\nandroid:shape=\"rectangle\"\u0026gt;\n\u0026lt;gradient\n android:startColor=\"@color/list_background\"\n android:endColor=\"@color/list_background\"\n android:angle=\"90\" /\u0026gt;\n\u0026lt;/shape\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003elist_item_bg_pressed.xml in drawable\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;shape xmlns:android=\"http://schemas.android.com/apk/res/android\"\nandroid:shape=\"rectangle\"\u0026gt;\n\u0026lt;gradient\n android:startColor=\"@color/list_background_pressed\"\n android:endColor=\"@color/list_background_pressed\"\n android:angle=\"90\" /\u0026gt;\n\u0026lt;/shape\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"3","creation_date":"2014-05-14 08:20:02.07 UTC","last_activity_date":"2014-05-14 08:20:02.07 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3256145","post_type_id":"1","score":"0","tags":"android|android-listview","view_count":"86"} {"id":"31225130","title":"How can UIColor be a type in Swift?","body":"\u003cp\u003eI am learning Swift and this basic piece of code is confusing to me. Here is the code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar newBackgroundColor : UIColor\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI practiced with : Int or : String... Never this \"custom\" ones. My question is: is UIColor a class or a type? And if it is a class why don't we use this code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar newBackgroundColor = UIColor\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"31225213","answer_count":"3","comment_count":"0","creation_date":"2015-07-04 21:11:29.267 UTC","last_activity_date":"2015-07-04 21:23:41.897 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4886785","post_type_id":"1","score":"0","tags":"swift|class|types","view_count":"95"} {"id":"31232173","title":"J2ME (Java ME): StringItem Alignment","body":"\u003cp\u003eIn simple words, is it possible to center a StringItem or fit it to the width of the screen? I know that I may need to provide no example code, but for instance: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eStringItem Addbutton = new StringItem(\"\", \"Add New\", Item.BUTTON);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow to apply it on this button for example?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-07-05 15:54:04.743 UTC","last_activity_date":"2017-03-11 06:50:02.157 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4701022","post_type_id":"1","score":"1","tags":"java|mobile|java-me","view_count":"51"} {"id":"29307487","title":"External IPs not assigned within VM","body":"\u003cp\u003eI have a couple of Centos 6 VMs that I am trying to setup. I assigned static IPs to them but when running ifconfig, I do not see the external IPs, just the internal IPs. Does Google not allow this capability?\u003c/p\u003e","answer_count":"2","comment_count":"5","creation_date":"2015-03-27 18:12:09.84 UTC","last_activity_date":"2015-03-29 08:12:04.89 UTC","last_edit_date":"2015-03-27 18:40:42.967 UTC","last_editor_display_name":"","last_editor_user_id":"1288184","owner_display_name":"","owner_user_id":"4721886","post_type_id":"1","score":"0","tags":"static|ip|virtual-machine|google-compute-engine|nat","view_count":"386"} {"id":"33849845","title":"iOS9 App Transport Security: Allow insecure HTTP loads only on certain subpages","body":"\u003cp\u003eIs there a way to allow insecure HTTP loads only on certain subpages of a domain without allowing insecure HTTP loads for the entire domain?\u003c/p\u003e\n\n\u003cp\u003eIn my app I'm getting data from an API that I reach under the domain \u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003ehttps://example.com/api/...\u003c/code\u003e \u003c/p\u003e\n\n\u003cp\u003eThe whole API uses HTTPS so I want to disallow insecure HTTP loads there.\u003c/p\u003e\n\n\u003cp\u003eIn another part of the app I need to display a privacy and a terms \u0026amp; conditions HTML page in a UIWebView. The URLs for this pages are \u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003ehttp://example.com/privacy\u003c/code\u003e \u003c/p\u003e\n\n\u003cp\u003eand \u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003ehttp://example.com/terms\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eThese two pages are only available as HTTP, so I have to allow insecure HTTP loads for them. But I want to allow insecure loads for \u003cstrong\u003eonly\u003c/strong\u003e these 2 URLs, while enforcing HTTPS for the rest of the domain.\u003c/p\u003e\n\n\u003cp\u003eDoes anybody know if that is possible? \u003c/p\u003e","accepted_answer_id":"33953623","answer_count":"1","comment_count":"0","creation_date":"2015-11-21 23:25:32.49 UTC","last_activity_date":"2015-11-27 08:58:38.173 UTC","last_edit_date":"2015-11-27 08:10:03.95 UTC","last_editor_display_name":"","last_editor_user_id":"790877","owner_display_name":"","owner_user_id":"790877","post_type_id":"1","score":"0","tags":"ios|swift|uiwebview|ios9|app-transport-security","view_count":"140"} {"id":"44434409","title":"VBA Delete autofiltered rows in linked table","body":"\u003cp\u003eI have a linked table where I want to delete rows based on a date. \nI get it to work out all the way to when I want to delete the rows where i get the error message \"Delete method of Range Class failed\".\nWhat can be wrong here in the end? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSheets(\"TimeSeries\").Select\nRange(\"TimeSeries[#Headers]\").Select\nSelection.AutoFilter\nActiveSheet.ListObjects(\"TimeSeries\").Range.AutoFilter Field:=4, Operator:= _\n xlFilterValues, Criteria2:=Array(1, Format(Sheets(\"Start\").Range(\"C2\").Value, \"mm/dd/yyyy\"))\nRange(\"A1\").Select\nSelection.End(xlDown).Select\nRange(Selection, Selection.End(xlUp)).Select\nRange(Selection, Selection.End(xlToRight)).Select\nSelection.SpecialCells(xlCellTypeVisible).Offset(0, 0).Select\nSelection.EntireRow.Delete\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks!\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-06-08 11:25:35.623 UTC","last_activity_date":"2017-06-08 20:03:34.22 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6708694","post_type_id":"1","score":"0","tags":"excel-vba|delete-row|autofilter","view_count":"18"} {"id":"21657949","title":"Rotating table header when using twitter bootstrap tables","body":"\u003cp\u003eI have managed to to rotate the header of a column on a table as such I am still getting the following problem:\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/SVoZd.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eHere is my HTML and CSS:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e .box_rotate \n {\n -moz-transform: rotate(-90deg); /* FF3.5+ */\n -o-transform: rotate(-90deg); /* Opera 10.5 */\n -webkit-transform: rotate(-90deg); /* Saf3.1+, Chrome */\n filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083); /* IE6,IE7 */\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083)\"; /* IE8 */\n }\n\n\u0026lt;table class=\"table table-bordered\"\u0026gt;\n \u0026lt;tr style=\"height:5%;\"\u0026gt;\u0026lt;th style=\"width:2.5%\"\u0026gt;#\u0026lt;/th\u0026gt;\u0026lt;th style=\"width:25%;\"\u0026gt;Task\u0026lt;/th\u0026gt;\u0026lt;th\u0026gt;Progress\u0026lt;/th\u0026gt;\u0026lt;th\u0026gt;\u0026lt;div class=\"box_rotate\" style=\"height:10%;\"\u0026gt;Start Time\u0026lt;/div\u0026gt;\u0026lt;/th\u0026gt;\u0026lt;th\u0026gt;End Time\u0026lt;/th\u0026gt;\u0026lt;th style=\"width:2.5%\"\u0026gt;1\u0026lt;/th\u0026gt;\u0026lt;th style=\"width:2.5%\"\u0026gt;2\u0026lt;/th\u0026gt;\u0026lt;th style=\"width:2.5%\"\u0026gt;3\u0026lt;/th\u0026gt;\u0026lt;th style=\"width:2.5%\"\u0026gt;4\u0026lt;/th\u0026gt;\u0026lt;th style=\"width:2.5%\"\u0026gt;5\u0026lt;/th\u0026gt;\u0026lt;th style=\"width:2.5%\"\u0026gt;6\u0026lt;/th\u0026gt;\u0026lt;th style=\"width:2.5%\"\u0026gt;7\u0026lt;/th\u0026gt;\u0026lt;th style=\"width:2.5%\"\u0026gt;8\u0026lt;/th\u0026gt;\u0026lt;th style=\"width:2.5%\"\u0026gt;9\u0026lt;/th\u0026gt;\u0026lt;th style=\"width:2.5%\"\u0026gt;10\u0026lt;/th\u0026gt;\u0026lt;/tr\u0026gt;\n \u0026lt;/table\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI've tried trying to change the row and columns height to see if the words would fit into the column but I haven't had any luck. Any ideas?\u003c/p\u003e","accepted_answer_id":"21658435","answer_count":"1","comment_count":"0","creation_date":"2014-02-09 10:29:35.19 UTC","favorite_count":"1","last_activity_date":"2014-02-09 11:28:31.157 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1638809","post_type_id":"1","score":"1","tags":"html|css|twitter-bootstrap","view_count":"4318"} {"id":"14564824","title":"Does MailApp.sendEmail() method impersonate sender address?","body":"\u003cp\u003eI'm sending mail to a third party-service from Gmail using Google Apps Script. This third party requires the sender email address be registered with them. If the sender is not registered, an error/marketing message is sent back to the original sender.\u003c/p\u003e\n\n\u003cp\u003eWhen the message is sent from Gmail manually, it is processed as expected by the third party. When the message is sent by a script, the message is not processed by the third party and no error response is sent as described above. After adding a different gmail address as a BCC on one such message, I found the script generated message shows \"mailed-by: bounce.secureserver.net\" and \"signed-by: gmail.com\"\u003c/p\u003e\n\n\u003cp\u003eI'm worried GAS is impersonating the sender in such a way that the third party does not recognize the sender as a registered address. Or, the third party may be dropping the messages as spam. (\u003ca href=\"http://productforums.google.com/d/topic/apps-script/tGxlioK1ejg/discussion\" rel=\"nofollow\"\u003ehttp://productforums.google.com/d/topic/apps-script/tGxlioK1ejg/discussion\u003c/a\u003e)\u003c/p\u003e\n\n\u003cp\u003eCommunity feedback on this problem is most appreciated.\u003c/p\u003e","accepted_answer_id":"14566598","answer_count":"1","comment_count":"3","creation_date":"2013-01-28 15:03:26.803 UTC","last_activity_date":"2013-01-28 16:31:49.227 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1301305","post_type_id":"1","score":"0","tags":"gmail|google-apps-script","view_count":"1293"} {"id":"25725431","title":"check if gpg-agent is installed from bash","body":"\u003cp\u003eI'm looking for the best way to check if gpg-agent is installed in a a machine.\nI need to check from a shell script.\u003c/p\u003e\n\n\u003cp\u003eThank you.\u003c/p\u003e","accepted_answer_id":"25730132","answer_count":"1","comment_count":"0","creation_date":"2014-09-08 13:30:12.763 UTC","last_activity_date":"2014-09-08 17:47:01.41 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1159337","post_type_id":"1","score":"-1","tags":"bash|scripting|fedora|gnupg","view_count":"108"} {"id":"37186337","title":"PHP- Array combine not working properly","body":"\u003cp\u003eI am trying to do array combine, but it is not working properly. I have one array called \u003ccode\u003e$models\u003c/code\u003e which consits of objects and it looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003earray:5 [▼\n 0 =\u0026gt; Comment {#377 ▶}\n 1 =\u0026gt; Thumb {#378 ▶}\n 2 =\u0026gt; View {#379 ▶}\n 3 =\u0026gt; Vote {#380 ▶}\n]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThen since I am passing it to another function, I am adding one more object as an element like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e array_push($models, new User);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd then I get an array that looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e array:5 [▼\n 0 =\u0026gt; Comment {#377 ▶}\n 1 =\u0026gt; Thumb {#378 ▶}\n 2 =\u0026gt; View {#379 ▶}\n 3 =\u0026gt; Vote {#380 ▶}\n 4 =\u0026gt; User {#399 ▶}\n]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am then doing foreach loop to get the total count in the DB for each model like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eforeach ($models as $model){\n $modelCounts[] = $model-\u0026gt;count();\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy \u003ccode\u003e$modelCounts\u003c/code\u003e than looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003earray:5 [▼\n 0 =\u0026gt; 19\n 1 =\u0026gt; 22\n 2 =\u0026gt; 15\n 3 =\u0026gt; 17\n 4 =\u0026gt; 3\n]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd then I am trying to do array_combine so that my objects are keys and the counts are values like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e $result = array_combine($models, $modelCounts);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut something is not working right because when I do \u003ccode\u003edd($result);\u003c/code\u003e I get:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e array:1 [▼\n \"[]\" =\u0026gt; 3\n]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut when I do it the other way around like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$result = array_combine($modelCounts, $models);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt works fine and I get:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003earray:5 [▼\n 19 =\u0026gt; Comment {#377 ▶}\n 22 =\u0026gt; Thumb {#378 ▶}\n 15 =\u0026gt; View {#379 ▶}\n 17 =\u0026gt; Vote {#380 ▶}\n 3 =\u0026gt; User {#399 ▶}\n]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut I need it the other way around and not like this.\u003c/p\u003e","accepted_answer_id":"37186490","answer_count":"2","comment_count":"1","creation_date":"2016-05-12 12:04:05.14 UTC","last_activity_date":"2016-05-12 12:28:10.877 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4592083","post_type_id":"1","score":"0","tags":"php|arrays","view_count":"68"} {"id":"2019015","title":"how to add the new cell in table view from app in objective-c","body":"\u003cp\u003ehow to add the new cell in tableview after running the program. that mean from the app\ni want to add the new cell for new entity like adding the new contact name in table view.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2010-01-07 08:14:53.11 UTC","last_activity_date":"2014-05-19 13:57:33.497 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"239457","post_type_id":"1","score":"-3","tags":"iphone|objective-c","view_count":"660"} {"id":"46505997","title":"pynamodb - Get DB entries with only hash key","body":"\u003cp\u003eUsing \u003ca href=\"https://github.com/pynamodb/PynamoDB\" rel=\"nofollow noreferrer\"\u003epynamodb\u003c/a\u003e, I want to get all range keys that match a certain hash key in a table.\u003c/p\u003e\n\n\u003cp\u003eI know I can do a scan and then filter out entries that match the hash key like so:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom pynamodb.models import Model \nfrom pynamodb.attributes import UnicodeAttribute\n\nclass Users(Model):\n class Meta:\n table_name = 'user_posts'\n username = UnicodeAttribute(hash_key=True)\n post_id = UnicodeAttribute(range_key=True)\n\n# Get all post_id's for a username\nuser = 'johndoe22'\nposts = []\n\nfor entry in Users.scan():\n if entry.username == user:\n posts.append(entry.post_id)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'd like to move the filtering logic to the query level so I don't have to pull down the entire contents of the db. How can I achieve this?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-09-30 18:50:05.35 UTC","last_activity_date":"2017-10-06 14:03:24.813 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3673055","post_type_id":"1","score":"0","tags":"python|amazon-web-services|amazon-dynamodb|boto3","view_count":"61"} {"id":"15193192","title":"RegEx to determine if string is score","body":"\u003cp\u003eGood Evening,\u003c/p\u003e\n\n\u003cp\u003eI'm in the process of attempting to parse large amounts of data using php. I'm working through discovering what is contained within the data. If I'm given a string such as \u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eAtlante 0-1 Toluca \u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eI'd like to use a RegEx pattern to detect if the string contains #-#, regardless of what is before or after the #-#.\u003c/p\u003e\n\n\u003cp\u003eScores, in theory could be anything from 0-0 -\u003e 0-100.\u003c/p\u003e\n\n\u003cp\u003eAny help creating this pattern is appreciated!\u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","accepted_answer_id":"15193255","answer_count":"1","comment_count":"2","creation_date":"2013-03-04 01:34:26.613 UTC","last_activity_date":"2013-03-04 01:41:41.897 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2130158","post_type_id":"1","score":"-5","tags":"php|regex","view_count":"737"} {"id":"16916280","title":"testing the performance of a bunch of instructions in PHP","body":"\u003cp\u003eI've finished to code a page that retrieves data from my database and then makes some manipulation on it. But wow, just when I thought I was coding slowly to prevent performance lack and to get the code beautified, I just end up with a page selfishly taking some big seconds to load.\u003c/p\u003e\n\n\u003cp\u003eHowever they are quite a lot of treatment and I want to optimize the lines. So the first thing I could do is to just read some articles on which methods to use rather than others to get the code faster but I'm pretty interested in finding a way to check time performance targeting a hand of instructions.\u003c/p\u003e\n\n\u003cp\u003eTyping things like 'benchmark a php program' leads me to some good pages of how to do so. However I'd like to ask here because I'm curious the way you do/the way you think it's better.\u003c/p\u003e\n\n\u003cp\u003eso let say i have the following pattern :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003einstruction 1;\n...\ninstruction N;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003efrom \u003cem\u003einstruction 1\u003c/em\u003e to \u003cem\u003eN\u003c/em\u003e, I want to check the time (or other types of information ?).\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2013-06-04 11:08:45.213 UTC","last_activity_date":"2013-06-07 20:33:08.317 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"773595","post_type_id":"1","score":"2","tags":"php|performance|time|benchmarking","view_count":"129"} {"id":"8201133","title":"UILocalizedIndexedCollation - MPMediaQuery","body":"\u003cp\u003eThe following code, is used to partition and add sections to a list of songs.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e query = [MPMediaQuery songsQuery];\n [query addFilterPredicate: artistNamePredicate]; \n NSArray *itemsFromArtistQuery = [query items]; \n self.artist1 = [self partitionObjects:itemsFromArtistQuery collationStringSelector:@selector(title)];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWorks perfectly. However when I try to do it with:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e query = [MPMediaQuery albumsQuery]; //same with playlistsQuery, artistsQuery, genresQuery\n [query addFilterPredicate: artistNamePredicate]; \n NSArray *itemsFromArtistQuery = [query collections]; \n self.artist1 = [self partitionObjects:itemsFromArtistQuery collationStringSelector:@selector(title)];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI get a SIGABRT error every single time. I've attributed it to the \"collections\" part of the code, as that's the only difference in the whole block. I've tried changing \"title\" to \"name\" \"albumTitle\", \"playlist\", \"genre\" and more, but I still end up with:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\"-[MPConcreteMediaItemCollection title]: unrecognized selector sent to instance\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan anybody help me here? I'm ready to rip my hair out!\u003c/p\u003e\n\n\u003cp\u003eTHANK-YOU!\u003c/p\u003e\n\n\u003cp\u003eBenBen\u003c/p\u003e","accepted_answer_id":"8668475","answer_count":"1","comment_count":"5","creation_date":"2011-11-20 11:14:15.507 UTC","favorite_count":"2","last_activity_date":"2011-12-29 13:30:53.427 UTC","last_edit_date":"2011-11-21 00:14:06.35 UTC","last_editor_display_name":"","last_editor_user_id":"405264","owner_display_name":"","owner_user_id":"405264","post_type_id":"1","score":"1","tags":"ios|ios4|mpmediaitem|ios5|mpmediaquery","view_count":"1568"} {"id":"35523573","title":"select max valued column row based on multiple columns","body":"\u003cp\u003eI have the following table \u003ccode\u003edocuments\u003c/code\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e+--------+-------------+------------+----------+---------+\n| doc_id | module_name | mapping_id | doc_type | version |\n+--------+-------------+------------+----------+---------+\n| 5 | asdf | asd | POI | 1 |\n| 6 | asdf | asd | POI | 2 |\n| 7 | asdf | asd | CAF | 1 |\n| 8 | asdf | abc | POI | 1 |\n| 9 | asdf | abc | ISR | 1 |\n| 10 | asdf | abc | ISR | 2 |\n| 11 | asdf | xyz | POA | 1 |\n| 12 | asdf | xyz | CAF | 1 |\n| 13 | asdf | xyz | CAF | 2 |\n| 14 | asdf | xyz | CAF | 3 |\n| 15 | pqrs | asd | POI | 1 |\n| 16 | pqrs | asd | POI | 2 |\n| 17 | pqrs | asd | CAF | 1 |\n| 18 | pqrs | abc | POI | 1 |\n| 19 | pqrs | abc | ISR | 1 |\n| 20 | pqrs | abc | ISR | 2 |\n| 21 | pqrs | xyz | POA | 1 |\n| 22 | pqrs | xyz | CAF | 1 |\n| 23 | pqrs | xyz | CAF | 2 |\n| 24 | pqrs | xyz | CAF | 3 |\n+--------+-------------+------------+----------+---------+\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand I want to get results as:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e+--------+-------------+------------+----------+---------+\n| doc_id | module_name | mapping_id | doc_type | version |\n+--------+-------------+------------+----------+---------+\n| 6 | asdf | asd | POI | 2 |\n| 7 | asdf | asd | CAF | 1 |\n| 8 | asdf | abc | POI | 1 |\n| 10 | asdf | abc | ISR | 2 |\n| 11 | asdf | xyz | POA | 1 |\n| 14 | asdf | xyz | CAF | 3 |\n| 16 | pqrs | asd | POI | 2 |\n| 17 | pqrs | asd | CAF | 1 |\n| 18 | pqrs | abc | POI | 1 |\n| 20 | pqrs | abc | ISR | 2 |\n| 21 | pqrs | xyz | POA | 1 |\n| 24 | pqrs | xyz | CAF | 3 |\n+--------+-------------+------------+----------+---------+\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ewhere the \u003ccode\u003emax\u003c/code\u003e version number row should be returned in combination of \u003ccode\u003emodule_name\u003c/code\u003e,\u003ccode\u003emapping_id\u003c/code\u003e and \u003ccode\u003edoc_type\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eI am unable to figure out the query. Need help.\u003c/p\u003e","accepted_answer_id":"35523598","answer_count":"2","comment_count":"2","creation_date":"2016-02-20 12:57:24.997 UTC","last_activity_date":"2016-02-20 15:37:26.963 UTC","last_edit_date":"2016-02-20 13:38:33.497 UTC","last_editor_display_name":"","last_editor_user_id":"725306","owner_display_name":"","owner_user_id":"725306","post_type_id":"1","score":"1","tags":"mysql|sql","view_count":"33"} {"id":"40390794","title":"Why is Amazon Redshift serializing my concurrent updates?","body":"\u003cp\u003eI have a table on Amazon Redshift with ~600 million rows. I have a python process that issues the following query over a sqlalchemy_redshift connection:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ebegin;\nUPDATE dogs\nSET computed_dog_type = f_get_dog_type(name, breed, age, color)\nWHERE week = :week;\ncommit;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThat query works fine; however, it is too slow to run over 600 million rows at once. The where clause effectively limits by week where a week's worth of rows range from 2K to 2-3 million.\u003c/p\u003e\n\n\u003cp\u003eI wrapped the query code in python threads where the execution looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e16:38 $ python dog_classifier.py update_range 2009-10-05 2009-10-26\n11-02 16:39 PTC INFO DOG CLASSIFIER STARTED\n11-02 16:39 PTC INFO START update of dogs.computed_dog_type for week: 2009-10-05\n11-02 16:39 PTC INFO START update of dogs.computed_dog_type for week: 2009-10-12\n11-02 16:39 PTC INFO START update of dogs.computed_dog_type for week: 2009-10-19\n11-02 16:39 PTC INFO START update of dogs.computed_dog_type for week: 2009-10-26\n11-02 16:45 PTC INFO END update of 338378 records in dogs.computed_dog_type for week: 2009-10-12 in 6 minutes\n11-02 16:52 PTC INFO END update of 355796 records in dogs.computed_dog_type for week: 2009-10-05 in 13 minutes\n11-02 16:59 PTC INFO END update of 337909 records in dogs.computed_dog_type for week: 2009-10-19 in 20 minutes\n11-02 17:07 PTC INFO END update of 281617 records in dogs.computed_dog_type for week: 2009-10-26 in 28 minutes\n11-02 17:07 PTC INFO DOG CLASSIFIER STOPPED AFTER UPDATING 1313700 RECORDS\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ewhere I'm running a month at a time - typically, 4-5 weeks of data being about a million rows or so.\u003c/p\u003e\n\n\u003cp\u003eIt appears as though the queries are being serialized on redshift. If you examine the output from cloud watch dashboard while these queries are running, the peaks and valleys are very clearly tied to my update queries where there is essentially one week peak per query per run. \u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/sm5W3.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/sm5W3.png\" alt=\"cloudwatch dashboard\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI have considered that the default query queue is a likely culprit but examining its behavior at runtime seems challenging.\u003c/p\u003e\n\n\u003cp\u003eHow can I debug this? What would be causing the queries to serialize like this?\u003c/p\u003e","accepted_answer_id":"40392154","answer_count":"1","comment_count":"0","creation_date":"2016-11-02 22:21:12.87 UTC","favorite_count":"1","last_activity_date":"2016-11-03 00:54:38.453 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"173308","post_type_id":"1","score":"2","tags":"python|postgresql|amazon-web-services|sqlalchemy|amazon-redshift","view_count":"59"} {"id":"9175944","title":"How to display a viewController from an extended iOS module","body":"\u003cp\u003eI am creating an Module in Titanium which is extended in iOS. In that module I am creating a viewController and I want to show it on the screen when i called that module.\nNot able to figure it out.. What will be right approach for it.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-02-07 12:04:13.397 UTC","last_activity_date":"2012-04-17 08:43:43.227 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1021896","post_type_id":"1","score":"0","tags":"ios|titanium|appcelerator","view_count":"1193"} {"id":"32901056","title":"Lazy\u003cT\u003e - Always create a new object?","body":"\u003cp\u003eI am importing a \u003ccode\u003eLazy\u0026lt;MyForm\u0026gt;\u003c/code\u003e object using MEF (dependency injection, constructor injection) and basically have the problem, that when I show and close the form and afterwards try to open the form again, it won't work anymore, cause the object has already been disposed. I want to have a completely new instance of the form everytime I open it.\u003c/p\u003e\n\n\u003cp\u003eIs there a class similar to \u003ccode\u003eLazy\u0026lt;T\u0026gt;\u003c/code\u003e, but always gives me a new object?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eEdit:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eI can't give you my code at the moment, but I will go bit more into detail:\u003c/p\u003e\n\n\u003cp\u003eWhere are two forms:\u003c/p\u003e\n\n\u003cp\u003eForm1 is the starting form, which has an ImportingConstructor which currently imports a \u003ccode\u003eLazy\u0026lt;Form2\u0026gt;\u003c/code\u003e object.\nMy \u003ccode\u003eForm2\u003c/code\u003e has also an ImportingConstructor, which imports a few other classes.\nWhen I click a button on \u003ccode\u003eForm1\u003c/code\u003e, \u003ccode\u003em_lazyForm2.Value\u003c/code\u003e is being accessed and the \u003ccode\u003eForm2\u003c/code\u003e shows up.\u003c/p\u003e\n\n\u003cp\u003eMEF (and my Form1) are initialised using this bootstrapper I build myself.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003einternal class Bootstrapper\u0026lt;T\u0026gt; where T : Form\n{\n [Import]\n private T m_frmStartup;\n private CompositionContainer m_container;\n\n public void Init()\n {\n Application.EnableVisualStyles();\n Application.SetCompatibleTextRenderingDefault(false);\n\n var catalog = new AggregateCatalog();\n catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));\n catalog.Catalogs.Add(new DirectoryCatalog(\".\"));\n\n var batch = new CompositionBatch();\n batch.AddPart(catalog);\n\n m_container = new CompositionContainer(catalog);\n m_container.ComposeParts(this);\n }\n\n public void Start()\n {\n Application.Run(m_frmStartup);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"32951674","answer_count":"2","comment_count":"7","creation_date":"2015-10-02 05:29:50.443 UTC","last_activity_date":"2015-10-05 14:58:59.52 UTC","last_edit_date":"2015-10-05 14:58:59.52 UTC","last_editor_display_name":"","last_editor_user_id":"3256506","owner_display_name":"","owner_user_id":"985798","post_type_id":"1","score":"1","tags":"c#","view_count":"113"} {"id":"14516347","title":"the number with the greatest priority","body":"\u003cp\u003eGiven an integer of number and their priority, return the number with the greatest priority\nSay\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eint[] number={0,1,3,4}\nint[] priority={1,3,4,2} //All numbers are distinct\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI would want to have the value 3(with priority 4 which is the largest), how could I achieve that easily and efficiently?\u003c/p\u003e","accepted_answer_id":"14516433","answer_count":"5","comment_count":"5","creation_date":"2013-01-25 06:12:30.863 UTC","last_activity_date":"2013-01-25 12:49:03.913 UTC","last_edit_date":"2013-01-25 06:22:28.41 UTC","last_editor_display_name":"","last_editor_user_id":"491243","owner_display_name":"","owner_user_id":"1497720","post_type_id":"1","score":"-2","tags":"c#|.net|algorithm","view_count":"112"} {"id":"30367791","title":"Where to put traversing graph query in DDD while avoiding doing hundreds of smaller ones?","body":"\u003cp\u003eSo I've been trying to make a bit of DDD at the project I work on, but I'm facing the problem I mention in the title.\nWe have the \u003ccode\u003eEntity.php\u003c/code\u003e generated by the Symfony console, with the Doctrine annotations in there (I know it is not how it should be made), and the corresponding \u003ccode\u003eEntityRepository.php\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eThe applicable object graph is:\u003cbr\u003e\n\u003ccode\u003ePost\u003c/code\u003e entity contains a \u003ccode\u003eMessages\u003c/code\u003e collection, which in turn have a \u003ccode\u003eReadMessages\u003c/code\u003ecollection because we need to know by whom has it been read. To know whether a \u003ccode\u003ePost\u003c/code\u003e has been read, we want to left join \u003ccode\u003eMessages\u003c/code\u003e with \u003ccode\u003eReadMessages\u003c/code\u003e filtering by the user we need, and if there are any blank \u003ccode\u003eReadMessages\u003c/code\u003e, we'll know it has not been read.\u003c/p\u003e\n\n\u003cp\u003eIf we use a method in the \u003ccode\u003ePost\u003c/code\u003e entity to iterate over all \u003ccode\u003eMessages\u003c/code\u003e and all \u003ccode\u003eReadMessages\u003c/code\u003e for each of those, Doctrine will be making lots of queries unless we configure the associations as \u003cem\u003eEager\u003c/em\u003e, which we don't want to because then it will be retrieving the associations all the times we ask for a \u003ccode\u003ePost\u003c/code\u003e; the ideal way would be to use a DQL query that loads the joined entities, but since there is no way to access the repository from the entity (apart from injecting one in the other -which I don't even know if is possible-), I think the only option left is to use a Symfony2 service that gets Doctrine injected. The thing is that I don't really like having to add another piece just as a helper.\u003c/p\u003e\n\n\u003cp\u003eIs there any other way to do this?\u003c/p\u003e\n\n\u003cp\u003eThanks in advance.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-05-21 07:56:07.47 UTC","last_activity_date":"2015-05-21 14:44:18.697 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3779073","post_type_id":"1","score":"0","tags":"php|symfony|doctrine2|domain-driven-design|ddd-repositories","view_count":"67"} {"id":"31467330","title":"Routing between two projects in angularjs","body":"\u003cp\u003eI was looking at an article about how an Angular app was routing between two projects.\u003c/p\u003e\n\n\u003cp\u003eI have two projects called \u003cem\u003epresentation.web\u003c/em\u003e and \u003cem\u003esecurity.web\u003c/em\u003e. \u003c/p\u003e\n\n\u003cp\u003eIn \u003cem\u003esecurity.web\u003c/em\u003e I have controllers for an authentication service. Once the user has been authenticated the page needs to be redirected to the home page in \u003cem\u003epresentation.web\u003c/em\u003e.\u003c/p\u003e\n\n\u003cp\u003eHow do I achieve this by using a single app? Or how can I route between two apps? I'm using visual studio 2013 to develop my project (developing an AngularJS app with C#)\u003c/p\u003e\n\n\u003cp\u003eI have controller for registration and sign in under security.web(highlighted in screenshot) project\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/TEu8e.jpg\" alt=\"have controller for registration and sign in\"\u003e\u003c/p\u003e\n\n\u003cp\u003eand i have home controller and todocontroller under presentation.web project(highlighted in screenshot) when the user was signedin the page has to be redirected to todoManager.\u003c/p\u003e\n\n\u003cp\u003esignincontroller:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e .success(function (data, status, headers, config) {\n $http.defaults.headers.common.Authorization = \"Bearer \" + data.access_token;\n $http.defaults.headers.common.RefreshToken = data.refresh_token;\n\n $cookieStore.put('_Token', data.access_token);\n window.location = '#/todomanager';\n })\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/wVL0H.jpg\" alt=\"home controller\"\u003e\u003c/p\u003e\n\n\u003cp\u003enow what i want is the app which i have the routing to the pages in normal way what we using but i want to route the modules between these two projects. is it possible to route the module in like below? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e//================================================\n// Routes\n//================================================\n$routeProvider.when('/home', {\n templateUrl: 'App/Home',\n controller: 'homeCtrl'\n});\n$routeProvider.when('/register', {\n templateUrl: 'App/Register',\n controller: 'registerCtrl'\n});\n$routeProvider.when('/signin/:message?', {\n templateUrl: 'App/SignIn',\n controller: 'signInCtrl'\n});\n$routeProvider.when('/todomanager', {\n templateUrl: 'App/TodoManager',\n controller: 'todoManagerCtrl'\n});`app.run(['$http', '$cookies', '$cookieStore', function ($http, $cookies, $cookieStore) {\n//If a token exists in the cookie, load it after the app is loaded, so that the application can maintain the authenticated state.\n$http.defaults.headers.common.Authorization = 'Bearer ' + $cookieStore.get('_Token');\n$http.defaults.headers.common.RefreshToken = $cookieStore.get('_RefreshToken');}]);`\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ehere im getting the token in presentation.web\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eapp.run(['$rootScope', '$http', '$cookies', '$cookieStore', function ($rootScope, $http, $cookies, $cookieStore) {\n\n$rootScope.logout = function () {\n\n $http.post('/api/Account/Logout')\n .success(function (data, status, headers, config) {\n $http.defaults.headers.common.Authorization = null;\n $http.defaults.headers.common.RefreshToken = null;\n $cookieStore.remove('_Token');\n $cookieStore.remove('_RefreshToken');\n $rootScope.username = '';\n $rootScope.loggedIn = false;\n window.location = '#/signin';\n });\n\n}\n\n$rootScope.$on('$locationChangeSuccess', function (event) {\n if ($http.defaults.headers.common.RefreshToken != null) {\n var params = \"grant_type=refresh_token\u0026amp;refresh_token=\" + $http.defaults.headers.common.RefreshToken;\n $http({\n url: '/Token',\n method: \"POST\",\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n data: params\n })\n .success(function (data, status, headers, config) {\n $http.defaults.headers.common.Authorization = \"Bearer \" + data.access_token;\n $http.defaults.headers.common.RefreshToken = data.refresh_token;\n\n $cookieStore.put('_Token', data.access_token);\n $cookieStore.put('_RefreshToken', data.refresh_token);\n\n $http.get('/api/WS_Account/GetCurrentUserName')\n .success(function (data, status, headers, config) {\n if (data != \"null\") {\n $rootScope.username = data.replace(/[\"']{1}/gi, \"\");//Remove any quotes from the username before pushing it out.\n $rootScope.loggedIn = true;\n }\n else\n $rootScope.loggedIn = false;\n });\n\n\n })\n .error(function (data, status, headers, config) {\n $rootScope.loggedIn = false;\n });\n }\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e}]);\u003c/p\u003e\n\n\u003cp\u003eor what can i do for routing?\u003c/p\u003e","answer_count":"0","comment_count":"9","creation_date":"2015-07-17 02:00:38.883 UTC","last_activity_date":"2015-07-17 06:13:38.46 UTC","last_edit_date":"2015-07-17 06:13:38.46 UTC","last_editor_display_name":"","last_editor_user_id":"1793475","owner_display_name":"","owner_user_id":"1793475","post_type_id":"1","score":"0","tags":"c#|angularjs|angularjs-routing","view_count":"143"} {"id":"22461864","title":"Python iterate through lists within tuple data structure","body":"\u003cp\u003eI have the following data structure:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edata = (['test1','test2','test3'], ['foo1','foo2','foo3'], ['bar1','bar2','bar3'])\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI want to iterate through this data structure and create a new tuple which appends position 1 of each list to it. I would like to create a data structure with \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e(test1,foo1,bar1), (test2,foo2,bar2), (test3,foo3,bar3)\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"4","creation_date":"2014-03-17 17:59:57.827 UTC","last_activity_date":"2014-03-17 18:03:07.257 UTC","last_edit_date":"2014-03-17 18:03:07.257 UTC","last_editor_display_name":"","last_editor_user_id":"157770","owner_display_name":"","owner_user_id":"1800125","post_type_id":"1","score":"0","tags":"python","view_count":"118"} {"id":"30991835","title":"How to debug insert exception in laravel 4 / cartalyst sentry","body":"\u003cp\u003eI took over a project written in Laravel 4. There are two systems (dev and production) which basically should be doing the same.\u003c/p\u003e\n\n\u003cp\u003eWhen I try to register a user (the package used is cartalyst/sentry) it works on production. On the dev environment it fails as there are some columns defined as not null and there is no statement in the code to set it. So I understand why it fails, what I don't understand is why it works on another machine and what kind of tweak I could make on dev to get it working. Without altering the db-columns (I want to understand the system before making such changes).\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eException:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSQLSTATE[HY000]: General error: 1364 Field 'auto_token' doesn't have a default value \n(SQL: insert into `users` (`first_name`, `last_name`, `display_name`, `email`, \n`password`, `updated_at`, `created_at`) values (?, ?, ?, ?, ?, ?, ?)) (Bindings: array ...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eCode to regiser a new user:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e $user = Sentry::register(array(\n 'first_name' =\u0026gt; Input::get('first_name'),\n 'last_name' =\u0026gt; Input::get('last_name'),\n 'display_name'=\u0026gt; Input::get('display_name'),\n 'email' =\u0026gt; Input::get('email'),\n 'password' =\u0026gt; Input::get('password'),\n ));\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eDB-Schema:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eid (unsigned int, not null)\nfirst_name (varchar, not null)\nlast_name (varchar, not null)\ndisplay_name (varchar, not null)\nemail (varchar, not null)\npassword (varchar, not null)\nauto_token (varchar, not null)\n... more columns like auto_token\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eProd: MySQL 5.5.42 - PHP 5.4.30 - running on Linux\u003c/p\u003e\n\n\u003cp\u003eDev : MySQL 5.6.21 - PHP 5.4.30 - running on Windows\u003c/p\u003e\n\n\u003cp\u003eI know that the query should not run successfully in the first place, the database schema in general is flawed. I would like to learn what causes this and how to solve this issue.\u003c/p\u003e\n\n\u003cp\u003eWhere I got stuck is why on one System it's working and on the other not. Anybody knows a direction?\u003c/p\u003e","accepted_answer_id":"30994311","answer_count":"1","comment_count":"0","creation_date":"2015-06-23 00:09:45.617 UTC","last_activity_date":"2015-06-23 05:33:08.857 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4747923","post_type_id":"1","score":"1","tags":"php|mysql|exception|laravel-4|cartalyst-sentry","view_count":"76"} {"id":"28245165","title":"Iterating through and displaying an attribute of an element of a list","body":"\u003cp\u003eSo - this seems like a simple question, and its really probably an order-of-operations-ish question. \u003c/p\u003e\n\n\u003cp\u003eI have a list of objects titled \"RequirementsList\". Each element of the list is a \"Requirements\" object, with an attribute \"environment\". I just want to iterate through the list and display all of the attributes. \u003c/p\u003e\n\n\u003cp\u003eMy code thus far: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;core:forEach var=\"record\" items=\"${recordModel.requirementsList}\" varStatus=\"outer\"\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt; requirementsList[${outer.index}].environment\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n\u0026lt;core:forEach\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI've tried various combinations of double quotes and $s, but the issue (I think) is that, I need to encapsulate the entire thing in a ${} for it to bind to the model, but also, the outer.index needs to be evaluated and placed within that. How can I do both? Does that make sense?\u003c/p\u003e","accepted_answer_id":"28248873","answer_count":"1","comment_count":"0","creation_date":"2015-01-30 21:47:38.753 UTC","last_activity_date":"2015-01-31 06:24:14.477 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4513141","post_type_id":"1","score":"0","tags":"html|spring|spring-mvc|jstl","view_count":"43"} {"id":"31168007","title":"How to make cordova local notification on android sticky","body":"\u003cp\u003eI am using \u003ca href=\"https://github.com/katzer/cordova-plugin-local-notifications\" rel=\"nofollow\"\u003ethis\u003c/a\u003e cordova plugin and wondering if it is possible to make the local notifications sticky/non-removable?\u003c/p\u003e","accepted_answer_id":"31187625","answer_count":"1","comment_count":"0","creation_date":"2015-07-01 17:32:26.597 UTC","favorite_count":"1","last_activity_date":"2015-07-02 14:46:40.907 UTC","last_edit_date":"2015-07-02 14:34:12.013 UTC","last_editor_display_name":"","last_editor_user_id":"2488459","owner_display_name":"","owner_user_id":"2488459","post_type_id":"1","score":"3","tags":"android|cordova|notifications|ionic|cordova-plugins","view_count":"577"} {"id":"12769277","title":"How to convert the currency AED to USD then pass it to Paypal","body":"\u003cp\u003eCan anyone provide me a solution .How to convert the currency AED to USD before pass it to Paypal .\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2012-10-07 13:31:08.087 UTC","favorite_count":"0","last_activity_date":"2017-09-25 08:00:16.37 UTC","last_edit_date":"2012-10-07 13:37:04.67 UTC","last_editor_display_name":"","last_editor_user_id":"1503304","owner_display_name":"","owner_user_id":"1503304","post_type_id":"1","score":"1","tags":"php|paypal|currency|paypal-ipn","view_count":"1146"} {"id":"43182278","title":"VSTS is it possible to run selenium UI test tasks against localhost web app?","body":"\u003cp\u003eI might be missing something obvious here but my mvc web app is successfully tested using specflow UI tests on my dev machine using localhost but I can't get this to work on a CI Build pipeline in VSTS?\u003c/p\u003e\n\n\u003cp\u003eHere is my setup, 1 x Asp.Net solution comprising of:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003e1 x WebCalculator (MVC app that simply adds 2 numbers together)\u003c/li\u003e\n\u003cli\u003e1 x UI Specflow tests project\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eOn my Dev machine: I can run the unit tests using NUnit3TestAdapter within visual studio, with my website running at localhost:58909\u003c/p\u003e\n\n\u003cp\u003eOn VSTS: After the build task, the Visual Studio Test Task is picking up the NUnit Adapter and tries to run the tests (using InternetExplorerDriver server) but fails to find my website running on localhost it seems:\u003c/p\u003e\n\n\u003cp\u003eHere's the output:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e2017-04-03T09:02:31 Starting test execution, please wait...\n2017-04-03T09:02:32 Information: NUnit Adapter 3.7.0.0: Test execution started\n2017-04-03T09 Information: Running all tests in C:\\a\\1\\s\\WebCalculator.UiTestsNUnitRunner\\bin\\Release\\WebCalculator.UiTestsNUnitRunner.dll\n2017-04-03T09:02:32 Information: NUnit3TestExecutor converted 3 of 3 NUnit test cases\n2017-04-03T09:02:33 Started InternetExplorerDriver server (32-bit)\n2017-04-03T09:02:33 3.0.0.0\n2017-04-03T09:02:33 Listening on port 1065\n2017-04-03T09:02:33 Only local connections are allowed\n2017-04-03T09:03:54 Started InternetExplorerDriver server (32-bit)\n2017-04-03T09:03:54 3.0.0.0\n2017-04-03T09:03:54 Listening on port 1123\n2017-04-03T09:03:54 Only local connections are allowed\n2017-04-03T09:03:54 Failed AddTwoNumbers(\"50\",\"70\",\"120\",System.String[])\n2017-04-03T09:03:54 ##[error]Error Message:\n2017-04-03T09:03:54 ##[error] OpenQA.Selenium.WebDriverTimeoutException : Timed out after 10 seconds\n2017-04-03T09:03:54 ##[error] ----\u0026gt; OpenQA.Selenium.NoSuchElementException : Unable to find element with id == summandOne\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo my question, is the Visual Studio Test Task smart enough to test against my website which is built as part of the solution at localhost:58909 ?\u003c/p\u003e\n\n\u003cp\u003eThe example from MS here: \u003ca href=\"https://www.visualstudio.com/en-us/docs/test/continuous-testing/getting-started/continuous-test-selenium\" rel=\"nofollow noreferrer\"\u003ehttps://www.visualstudio.com/en-us/docs/test/continuous-testing/getting-started/continuous-test-selenium\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eHas the Specflow tests pointing at an XXX.azurewebsites.net url so I'm starting to think that building the website and executing the UI tests together (like I'm attempting) isn't the right approach for this?\u003c/p\u003e\n\n\u003cp\u003eIs it the case that when you want to run Specflow tests against a website - I need to build and release this to a hosted environment first??\u003c/p\u003e","accepted_answer_id":"43197123","answer_count":"1","comment_count":"0","creation_date":"2017-04-03 10:31:35.657 UTC","last_activity_date":"2017-04-04 02:03:46.673 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3796750","post_type_id":"1","score":"0","tags":"selenium|specflow|vsts-build|vsts-build-task|nunittestadapter","view_count":"407"} {"id":"33580355","title":"Convert string into array by space","body":"\u003cp\u003eI have below sample string\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edevice_name=\"Text Data\" d_id=7454579598 status=\"Active\" Key=947-4378-43248274\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI want to convert this string into array \u003c/p\u003e\n\n\u003cp\u003eExpected output\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edevice_name=\"Text Data\"\nd_id=7454579598\nstatus=\"Active\" \nKey=947-4378-43248274\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI tried this using explode function for this but its gives below output\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$data='device_name=\"Text Data\" d_id=7454579598 status=\"Active\" Key=947-4378-43248274';\n$arr= explode(\"\",$data);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003egenerated output\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edevice_name=\"Text \nData\"\nd_id=7454579598\nstatus=\"Active\" \nKey=947-4378-43248274\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"33580444","answer_count":"3","comment_count":"5","creation_date":"2015-11-07 07:29:41.26 UTC","last_activity_date":"2015-11-07 08:02:09.183 UTC","last_edit_date":"2015-11-07 07:40:39.723 UTC","last_editor_display_name":"","last_editor_user_id":"2638256","owner_display_name":"","owner_user_id":"2638256","post_type_id":"1","score":"1","tags":"php|arrays","view_count":"56"} {"id":"40201861","title":"htaccess in folder to act like root","body":"\u003cp\u003eI have a website and it have many folders. In one folder named \u003cb\u003e\u003ccode\u003eposter\u003c/code\u003e\u003c/b\u003e and i want that if there is any HTML file which has css link like this \u003ccode\u003e/css/style.css\u003c/code\u003e to \u003ccode\u003e/poster/css/style.css\u003c/code\u003e. Is it possible to do this with .htaccess?\u003c/p\u003e\n\n\u003cp\u003eThis folder should act like root for inside content.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-10-23 10:21:56.903 UTC","last_activity_date":"2016-10-23 12:49:32.217 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1542839","post_type_id":"1","score":"0","tags":"html|.htaccess","view_count":"35"} {"id":"19251370","title":"gem uninstall rake-10.1.0 error (couldnt remove from gem list and im trying to use rake-0.8.3)","body":"\u003cp\u003egem list shows rake (10.1.0, 0.8.3),trying to uninstall rake 10.1.0 by gem uninstall rake -v '10.1.0' getting ..INFO: gem \"rake\" is not installed showing rake 10.1.0 in gem list...my goal is to use rake-0.8.3 So any one can help (using rails-2.3.5)?\u003c/p\u003e","accepted_answer_id":"19251459","answer_count":"1","comment_count":"0","creation_date":"2013-10-08 15:03:05.583 UTC","last_activity_date":"2013-10-08 15:06:55.37 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2556805","post_type_id":"1","score":"0","tags":"ruby-on-rails-2","view_count":"385"} {"id":"4950966","title":"A better way to run code for a period of time","body":"\u003cp\u003eI need to run some code for a predefined length of time, when the time is up it needs to stop. Currently I am using a TimerTask to allow the code to execute for a set amount of time but this is causing endless threads to be created by the code and is just simply not efficient. Is there a better alternative?\u003c/p\u003e\n\n\u003cp\u003eCurrent code;\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e// Calculate the new lines to draw \n Timer timer3 = new Timer();\n timer3.schedule(new TimerTask(){\n public void run(){\n ArrayList\u0026lt;String\u0026gt; Coords = new ArrayList\u0026lt;String\u0026gt;();\n int x = Float.valueOf(lastFour[0]).intValue();\n int y = Float.valueOf(lastFour[1]).intValue();\n int x1 = Float.valueOf(lastFour[2]).intValue();\n int y1 = Float.valueOf(lastFour[3]).intValue();\n //Could be the wrong way round (x1,y1,x,y)?\n Coords = CoordFiller.coordFillCalc(x, y, x1, y1);\n String newCoOrds = \"\";\n for (int j = 0; j \u0026lt; Coords.size(); j++)\n {\n newCoOrds += Coords.get(j) + \" \";\n }\n newCoOrds.trim();\n ClientStorage.storeAmmendedMotion(newCoOrds);\n\n }\n\n }\n ,time);\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"4951059","answer_count":"4","comment_count":"0","creation_date":"2011-02-09 21:53:58.483 UTC","favorite_count":"8","last_activity_date":"2015-01-07 20:05:14.96 UTC","last_edit_date":"2011-10-26 08:25:42.563 UTC","last_editor_display_name":"","last_editor_user_id":"21234","owner_display_name":"","owner_user_id":"595807","post_type_id":"1","score":"8","tags":"java|timertask","view_count":"19540"} {"id":"6415217","title":"Non greedy regex matching in sed/perl","body":"\u003cp\u003eI was doing\n\u003ccode\u003esed /http.*.torrent/s/.*(http.*.torrent).*/\\1/;/http.*.torrent/p 1.html\u003c/code\u003e\nto extract links. However since sed lacks non-greedy quantifier (which is needed because further in the line there is again 'torrent'), tried to convert it to perl. Though need help with perl. (Or if you know how to do it with sed, say so.)\n\u003ccode\u003eperl -ne s/.*(http.*?.torrent).*/\\1/ 1.html\u003c/code\u003e\nNow I need to add this part, after convering it from sed:\n\u003ccode\u003e/http.*.torrent/p\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eThis was a part of\n\u003ccode\u003esed /http.*.torrent/s/.*(http.*.torrent).*/\\1/;/http.*.torrent/p 1.html\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003ebut this didn't work either; sed started but didn't quit, and as I pressed keys they echoed and nothing else.\u003c/p\u003e","answer_count":"2","comment_count":"3","creation_date":"2011-06-20 17:42:45.07 UTC","last_activity_date":"2011-06-21 00:44:32.92 UTC","last_edit_date":"2011-06-20 17:47:35.053 UTC","last_editor_display_name":"","last_editor_user_id":"807589","owner_display_name":"","owner_user_id":"807589","post_type_id":"1","score":"3","tags":"regex|perl|sed","view_count":"2001"} {"id":"4075205","title":"how to change the position of the button in perl tk?","body":"\u003cpre\u003e\u003ccode\u003e$mw-\u0026gt;Checkbutton(-text =\u0026gt; \"FAU_GEN1.1 \", -command =\u0026gt; sub{faugen1=1} )-\u0026gt;pack;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis command creates a check button at the centre. How do I shift it to a certain position ?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2010-11-02 05:47:57.01 UTC","last_activity_date":"2010-11-02 06:35:30.403 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"105167","post_type_id":"1","score":"0","tags":"perl","view_count":"564"} {"id":"37622354","title":"How to display datetime value in API response with gorm","body":"\u003cp\u003eI am building simple API with Golang and I am using gorm with Postgres.\nI am storing datetime value with \u003ccode\u003etime.Now()\u003c/code\u003e in database and it stores it correctly.\nWhen I am trying to display this value in API response I am getting \u003ccode\u003e\"0001-01-01T00:00:00Z\"\u003c/code\u003e value.\u003c/p\u003e\n\n\u003cp\u003eServer logs:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e(sql: Scan error on column index 5: unsupported driver -\u0026gt; Scan pair: []uint8 -\u0026gt; *time.Time)\n[2016-06-03 22:41:22]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eGetAll func:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunc GetAll() map[string]*Project {\n db, err := NewDB()\n if err != nil {\n panic(\"failed to connect database\")\n }\n\n Projects = make(map[string]*Project)\n projects := []Project{}\n db.Find(\u0026amp;projects)\n\n for i := range projects {\n fmt.Println(i, \u0026amp;projects[i])\n v := \u0026amp;projects[i]\n Projects[v.PackageName] = \u0026amp;projects[i]\n }\n return Projects\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhy does it happen?\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2016-06-03 19:51:26.357 UTC","last_activity_date":"2016-06-28 20:59:25.617 UTC","last_edit_date":"2016-06-28 20:59:25.617 UTC","last_editor_display_name":"","last_editor_user_id":"151825","owner_display_name":"","owner_user_id":"1835337","post_type_id":"1","score":"1","tags":"postgresql|datetime|go|go-gorm","view_count":"62"} {"id":"23906400","title":"Is regular expression search guaranteed to return first match?","body":"\u003cp\u003eI am looking for a method to return the first match of a given regexp in a string. It looks like \u003ca href=\"https://docs.python.org/2/library/re.html#re.search\" rel=\"nofollow\"\u003e\u003ccode\u003ere.search\u003c/code\u003e\u003c/a\u003e is exactly the method I am looking for.\u003c/p\u003e\n\n\u003cp\u003eHowever, the documentation is not explicit about whether the first match is guaranteed to be returned from search method. \u003c/p\u003e\n\n\u003cp\u003eThe documentation claims that the method \"scans through string\" which suggests to me that it does so from the beginning of the string.\u003c/p\u003e\n\n\u003cp\u003eHowever I need some strong argument. Merely testing that \u003ccode\u003ecat1\u003c/code\u003e is found in \u003ccode\u003ecat1cat2\u003c/code\u003e is not enough.\u003c/p\u003e\n\n\u003cp\u003eThe best would be a hint to official documentation or implementation.\u003c/p\u003e","accepted_answer_id":"23908727","answer_count":"3","comment_count":"3","creation_date":"2014-05-28 08:27:06.173 UTC","last_activity_date":"2014-06-03 09:12:52.39 UTC","last_edit_date":"2014-05-28 11:04:09.143 UTC","last_editor_display_name":"","last_editor_user_id":"2864740","owner_display_name":"","owner_user_id":"766551","post_type_id":"1","score":"5","tags":"python|regex","view_count":"111"} {"id":"31479516","title":"Cannot convert ViewModel to Generic IEnumerable ViewModel","body":"\u003cp\u003eI am trying to use the packaged \u003ccode\u003ePagedList.MVC\u003c/code\u003e to try and force my data into splitting into pages. However I get so far in the \u003cem\u003econtroller\u003c/em\u003e and then receive the above error and another error is given below:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eThe best overloaded method match for 'PagedList.PagedList.PagedList(System.Collections.Generic.IEnumerable\u0026lt;ViewModel\u0026gt;, int, int)' has some invalid arguments\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eBut, I think this error will be fixed once my first error is solved. \u003c/p\u003e\n\n\u003cp\u003eCan anybody help me with the problem?\u003c/p\u003e\n\n\u003cp\u003eController: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic ActionResult SupplierReportSelection(int ClientID, int? SupplierID = null, int? ReviewPeriodID = null, int page = 1)\n{\n ClaimsBySupplierViewModel SupplierModel = ClaimsBySupplier(ClientID, SupplierID, ReviewPeriodID);\n\n int pageSize = 10;\n int pageNumber = (page);\n\n PagedList\u0026lt;ClaimsBySupplierViewModel\u0026gt; model = new PagedList\u0026lt;ClaimsBySupplierViewModel\u0026gt;(SupplierModel, page, pageSize);\n ViewBag.client = client;\n\n return View(\"ClaimsBySupplier\", model);\n} \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eViewModel:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class ClaimsBySupplierViewModel : ReportViewModel {\n public IQueryable\u0026lt;ClaimsBySupplierReport\u0026gt; ReportData { get; set; }\n public IQueryable\u0026lt;SupplierAndClaimNumberReviewTotalsByStatusCategory\u0026gt; ReportTotalData { get; set; }\n public decimal? Conversion { get; set; }\n }\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"6","creation_date":"2015-07-17 15:36:38.933 UTC","last_activity_date":"2015-07-17 16:10:58.763 UTC","last_edit_date":"2015-07-17 15:45:59.55 UTC","last_editor_display_name":"","last_editor_user_id":"4819595","owner_display_name":"","owner_user_id":"4819595","post_type_id":"1","score":"0","tags":"c#|asp.net-mvc|pagination","view_count":"426"} {"id":"15928588","title":"Sencha Touch 2 sass compiling time very long","body":"\u003cp\u003eI started working with SenchaTouch2 and currently trying to use SASS.\u003c/p\u003e\n\n\u003cp\u003eWhen compiling my .scss file (app.scss) which is generated by Sencha, it takes up to 10 seconds.\u003c/p\u003e\n\n\u003cp\u003eI now wonder if this is normal because to wait 10 seconds every time I change somthing seems to long when developing an application.\u003c/p\u003e\n\n\u003cp\u003eI would like to know if you experience similiar times when compiling your sencha .scss file(s).\u003c/p\u003e\n\n\u003cp\u003eI use the following versions for compiling:\nSass 3.3.0.alpha.121 (Bleeding Edge)\nCompass 0.12.2 (Alnilam)\nruby 1.8.7 (2012-02-08 patchlevel 358)\u003c/p\u003e\n\n\u003cp\u003eThanks in advance!\u003c/p\u003e","accepted_answer_id":"15933788","answer_count":"2","comment_count":"0","creation_date":"2013-04-10 14:24:19.527 UTC","last_activity_date":"2013-04-10 18:38:38.7 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"996137","post_type_id":"1","score":"0","tags":"sencha-touch|sass|compass-sass","view_count":"332"} {"id":"8990196","title":"Parsing the Google Profile xml feed","body":"\u003cp\u003eI am trying to parse the xml feed provide by google apis for there profiles. The xml looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;ns0:feed ns1:etag=\"W/\"Dk8BQ3o8eCt7I2A9WhRUE0g.\"\"\u0026gt;\n \u0026lt;ns0:updated\u0026gt;2012-01-23T21:40:52.470Z\u0026lt;/ns0:updated\u0026gt;\n \u0026lt;ns0:category scheme=\"http://schemas.google.com/g/2005#kind\" term=\"http://schemas.google.com/contact/2008#profile\"/\u0026gt;\n \u0026lt;ns0:id\u0026gt;domain.com\u0026lt;/ns0:id\u0026gt;\n \u0026lt;ns0:generator uri=\"http://www.google.com/m8/feeds\" version=\"1.0\"\u0026gt;Contacts\u0026lt;/ns0:generator\u0026gt;\n\u0026lt;ns0:author\u0026gt;\n \u0026lt;ns0:name\u0026gt;domain.com\u0026lt;/ns0:name\u0026gt;\n \u0026lt;/ns0:author\u0026gt;\n \u0026lt;ns0:link href=\"http://www.google.com/\" rel=\"alternate\" type=\"text/html\"/\u0026gt;\n \u0026lt;ns0:link href=\"https://www.google.com/m8/feeds/profiles/domain/domain.com/full\" rel=\"http://schemas.google.com/g/2005#feed\" type=\"application/atom+xml\"/\u0026gt;\n \u0026lt;ns0:link href=\"https://www.google.com/m8/feeds/profiles/domain/domain.com/full/batch\" rel=\"http://schemas.google.com/g/2005#batch\" type=\"application/atom+xml\"/\u0026gt;\n \u0026lt;ns0:link href=\"https://www.google.com/m8/feeds/profiles/domain/domain.com/full?max-results=300\" rel=\"self\" type=\"application/atom+xml\"/\u0026gt;\n \u0026lt;ns2:startIndex\u0026gt;1\u0026lt;/ns2:startIndex\u0026gt;\n \u0026lt;ns2:itemsPerPage\u0026gt;300\u0026lt;/ns2:itemsPerPage\u0026gt;\n\u0026lt;ns0:entry ns1:etag=\"\"URRaQR4KTit7I2A4\"\"\u0026gt;\n \u0026lt;ns0:category scheme=\"http://schemas.google.com/g/2005#kind\" term=\"http://schemas.google.com/contact/2008#profile\"/\u0026gt;\n \u0026lt;ns0:id\u0026gt;http://www.google.com/m8/feeds/profiles/domain/domain.com/full/pname\u0026lt;/ns0:id\u0026gt;\n\u0026lt;ns1:name\u0026gt;\n \u0026lt;ns1:familyName\u0026gt;Name\u0026lt;/ns1:familyName\u0026gt;\n \u0026lt;ns1:fullName\u0026gt;Persobn Name\u0026lt;/ns1:fullName\u0026gt;\n \u0026lt;ns1:givenName\u0026gt;Robert\u0026lt;/ns1:givenName\u0026gt;\n \u0026lt;/ns1:name\u0026gt;\n \u0026lt;ns0:updated\u0026gt;2012-01-23T21:40:52.597Z\u0026lt;/ns0:updated\u0026gt;\n\u0026lt;ns1:organization primary=\"true\" rel=\"http://schemas.google.com/g/2005#work\"\u0026gt;\n \u0026lt;ns1:orgTitle\u0026gt;JobField\u0026lt;/ns1:orgTitle\u0026gt;\n \u0026lt;ns1:orgDepartment\u0026gt;DepartmentField\u0026lt;/ns1:orgDepartment\u0026gt;\n \u0026lt;ns1:orgName\u0026gt;CompanyField\u0026lt;/ns1:orgName\u0026gt;\n \u0026lt;/ns1:organization\u0026gt;\n \u0026lt;ns3:status indexed=\"true\"/\u0026gt;\n \u0026lt;ns0:title\u0026gt;Person Name\u0026lt;/ns0:title\u0026gt;\n \u0026lt;ns0:link href=\"https://www.google.com/m8/feeds/photos/profile/domain.com/pname\" rel=\"http://schemas.google.com/contacts/2008/rel#photo\" type=\"image/*\"/\u0026gt;\n \u0026lt;ns0:link href=\"https://www.google.com/m8/feeds/profiles/domain/domain.com/full/pname\" rel=\"self\" type=\"application/atom+xml\"/\u0026gt;\n \u0026lt;ns0:link href=\"https://www.google.com/m8/feeds/profiles/domain/domain.com/full/pname\" rel=\"edit\" type=\"application/atom+xml\"/\u0026gt;\n \u0026lt;ns1:email address=\"pname@gapps.domain.com\" rel=\"http://schemas.google.com/g/2005#other\"/\u0026gt;\n \u0026lt;ns1:email address=\"pname@domain.com\" primary=\"true\" rel=\"http://schemas.google.com/g/2005#other\"/\u0026gt;\n \u0026lt;ns4:edited\u0026gt;2012-01-23T21:40:52.597Z\u0026lt;/ns4:edited\u0026gt;\n \u0026lt;/ns0:entry\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI only need the name fields and the fields that are under the Ofganization ns. My question is on the proper way to do this. I have never had to parse xml before, and I see people saying Element Tree, Stone Soup, sax, so on. I have this so far:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport xml.dom.minidom\n\ndef explore_children(nodelist,inset):\n for subnode in nodelist:\n if (subnode.nodeType == subnode.ELEMENT_NODE):\n which = subnode.tagName\n called = \"\" # in case it's not an img or title\n if (which == \"img\"): called = subnode.getAttribute(\"name\")\n if (which == \"title\"): called = subnode.getAttribute(\"text\")\n print inset + which + \" \" + called\n explore_children(subnode.childNodes,\" \"+inset)\n if (subnode.nodeType == subnode.TEXT_NODE):\n pass\n\nfh = open(\"c:\\\\python27\\\\junk.xml\",\"r\")\ndoc = xml.dom.minidom.parse(fh)\nexplore_children(doc.childNodes,\"\")\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhich prints all attrib names to the console and the text from any with name or text. What i want is all the name and org text from a record on one line, and I am completely lost, any help would be much appreciated. \u003c/p\u003e","accepted_answer_id":"8990584","answer_count":"1","comment_count":"3","creation_date":"2012-01-24 16:16:14.66 UTC","last_activity_date":"2012-01-24 16:49:25.877 UTC","last_edit_date":"2012-01-24 16:49:25.877 UTC","last_editor_display_name":"","last_editor_user_id":"110098","owner_display_name":"","owner_user_id":"110098","post_type_id":"1","score":"0","tags":"python|xml","view_count":"438"} {"id":"37850443","title":"C# ticket system","body":"\u003cp\u003eI am currently designing a ticket system for my place of work.\u003c/p\u003e\n\n\u003cp\u003eCurrently, I have most of it working except one small part. It is setup to automatically send it to the person that is responsible for fixing it. After it tells the user their Unique ID and the estimated date it should be finished. The only problem is People work different shifts. The things I want it to be able to do is\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eIf a ticket is put in before the persons shift, it adjusts to the time they come in for their shift.\u003c/li\u003e\n\u003cli\u003eIf a ticket is put in after a persons shift, adjusts it to the next day and the start of the persons shift.\u003c/li\u003e\n\u003cli\u003eIf the ticket takes longer than the time remaining in the shift, use the time remaining in the shift and the remaining in the following day.\u003c/li\u003e\n\u003cli\u003eBe able to add time from previous tickets that are not completed and maintain the work schedule. (Currently working except maintaining work schedule) \u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eFor example: \u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eFirst shift comes in at 7:00 am and someone puts in a ticket at 3:00 am, it should go to 7:00 am and than adjust the amount of time needed.\u003c/li\u003e\n\u003cli\u003eFirst shift leaves at 3:30pm and someone puts in a ticket at 3:00 pm that takes roughly an hour to complete, it should finish the 30 minutes in the day and go 30 minutes into the following day.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eThe code I currently have to try to handle this\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif (DateTime.Now.AddMinutes(sum).Hour \u0026lt;= 8)\n{\n MessageBox.Show(\"Too early\");\n var now = DateTime.Now;\n var tomorrow8am = now.AddDays(0).Date.AddHours(8);\n double totalHours = (tomorrow8am - now).TotalHours;\n MessageBox.Show(\"totalHours=\" + totalHours);\n var today8am = now.Date.AddHours(8).Hour;\n EstimatedCompleteDate = DateTime.Today.Month + \"/\" + DateTime.Today.AddDays(0).Day + \"/\" + DateTime.Today.Year + \" \" + DateTime.Now.AddHours(totalHours).AddMinutes(timetoadd).ToLongTimeString();\n MessageBox.Show(now.ToString() + Environment.NewLine + tomorrow8am.ToString() + Environment.NewLine + totalHours.ToString());\n MessageBox.Show(now.AddHours(totalHours).AddMinutes(timetoadd).Hour.ToString());\n if (DateTime.Now.AddHours(totalHours).AddMinutes(timetoadd).Hour \u0026gt; 15)\n {\n double hourstoadd = 0;// = timetoadd / 60;\n do\n {\n hourstoadd++;\n timetoadd = timetoadd - 60;\n }\n while (timetoadd \u0026gt; 60);\n var remaining = hourstoadd;\n int i = 0;\n MessageBox.Show(remaining.ToString());\n do\n {\n if (remaining \u0026gt; 0)\n {\n MessageBox.Show(\"Remaining1: \" + remaining.ToString());\n MessageBox.Show(\"Remaining - totalHours\" + (remaining - totalHours).ToString());\n i++;\n EstimatedCompleteDate = DateTime.Today.Month + \"/\" + DateTime.Today.AddDays(i).Day + \"/\" + DateTime.Today.Year + \" \" + DateTime.Now.AddHours(totalHours + remaining).AddMinutes(timetoadd + now.Minute).ToLongTimeString();\n remaining = remaining - 8;\n }\n }\n while (remaining \u0026gt; 0);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eplease excuse the messagebox's I am using to give some feedback to me.\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2016-06-16 05:21:16.227 UTC","last_activity_date":"2016-06-16 05:55:52.897 UTC","last_edit_date":"2016-06-16 05:55:52.897 UTC","last_editor_display_name":"","last_editor_user_id":"6472764","owner_display_name":"","owner_user_id":"6472764","post_type_id":"1","score":"2","tags":"c#|oledb","view_count":"181"} {"id":"38622876","title":"Comparing dates in python","body":"\u003cp\u003eI am trying to compare dates in python. Can anyone tell me why this will not work.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e cursor = conn.cursor()\n\n tech = raw_input(\"Please enter your id number: \")\n\n cursor.execute(\"Select cust_id from client where tech_id = %s\" % tech)\n rows = cursor.fetchall()\n day_num = datetime.datetime.today().weekday()\n\n\n dte = datetime.datetime.today()\n week = datetime.timedelta(days=5)\n service_inc = datetime.timedelta(days=14)\n friday = dte + datetime.timedelta(days=5)\n work = []\n for row in rows:\n client = row[0];\n cursor.execute(\"Select last_serviced from client where \" \\\n \"cust_id= %s\" % client)\n ser_date = cursor.fetchone()\n ser_date = ser_date[0] + service_inc\n if dte \u0026lt;= ser_date \u0026lt;= friday:\n work.append(client)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe error I continue to get is can't compare datetime.datetime to datetime.date. Thanks for any help in advance.\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2016-07-27 20:44:41.717 UTC","last_activity_date":"2016-07-27 22:43:12.95 UTC","last_edit_date":"2016-07-27 20:55:56.477 UTC","last_editor_display_name":"","last_editor_user_id":"6646556","owner_display_name":"","owner_user_id":"6646556","post_type_id":"1","score":"2","tags":"python|postgresql|python-2.7|datetime|psycopg2","view_count":"180"} {"id":"1516141","title":"VisualStudio.TestTools.WebTesting.TestDescriptionAttribute Syntax","body":"\u003cp\u003eWhat is the syntax to use the [TestDescriptionAttribute][1] of a test to populate the Description column in the Test Results window?\u003c/p\u003e\n\n\u003cp\u003eContext: Visual Studio 2008 Team System\u003c/p\u003e\n\n\u003cp\u003eI've read the documentation, but am not able to find a concrete example.\u003c/p\u003e\n\n\u003cp\u003eBased, loosely, on Ngu's suggestion, I've tried:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eusing GlobalSim;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing Microsoft.VisualStudio.TestTools.WebTesting;\n\nnamespace GlobalSimTests {\n\n /// \u0026lt;summary\u0026gt;\n ///This is a test class for PongerTest and is intended\n ///to contain all PongerTest Unit Tests\n ///\u0026lt;/summary\u0026gt;\n [TestClass()]\n [TestDescriptionAttribute( \"hello\" )]\n public class PongerTest {\n\n private TestContext testContextInstance;\n\n /// \u0026lt;summary\u0026gt;\n ///Gets or sets the test context which provides\n ///information about and functionality for the current test run.\n ///\u0026lt;/summary\u0026gt;\n public TestContext TestContext {\n get {\n return testContextInstance;\n }\n set {\n testContextInstance = value;\n }\n }\n\n /// \u0026lt;summary\u0026gt;\n ///A test for Ping\n ///\u0026lt;/summary\u0026gt;\n [TestMethod()]\n public void PingTest () {\n Ponger target = new Ponger();\n string expected = \"Pong\";\n string actual;\n actual = target.Ping();\n Assert.AreEqual( expected, actual );\n }\n\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis compiles, but doesn't display the test description in the Description column of the Test Results window.\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://farm3.static.flickr.com/2423/3979975988_b079e8b7d4_o.jpg\" alt=\"alt text\"\u003e\u003c/p\u003e\n\n\u003cp\u003eI've also tried this syntax:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e /// \u0026lt;summary\u0026gt;\n ///A test for Ping\n ///\u0026lt;/summary\u0026gt;\n [TestMethod()]\n [TestDescription( \"hello\" )]\n public void PingTest () {\n Ponger target = new Ponger();\n string expected = \"Pong\";\n string actual;\n actual = target.Ping();\n Assert.AreEqual( expected, actual );\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhich returns from the compiler:\u003c/p\u003e\n\n\u003cp\u003eAttribute 'TestDescription' is not valid on this declaration type. It is only valid on 'class' declarations.\u003c/p\u003e\n\n\u003cp\u003eHere is the syntax that works. Thanks all!\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e /// \u0026lt;summary\u0026gt;\n ///A test for Ping\n ///\u0026lt;/summary\u0026gt;\n [TestMethod()]\n [Description( \"Hello\" )]\n public void PingTest () {\n Ponger target = new Ponger();\n string expected = \"Pong\";\n string actual;\n actual = target.Ping();\n Assert.AreEqual( expected, actual );\n }\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"1516315","answer_count":"2","comment_count":"0","creation_date":"2009-10-04 10:51:32.407 UTC","last_activity_date":"2016-12-29 20:05:46.737 UTC","last_edit_date":"2017-02-08 14:15:56.94 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"90837","post_type_id":"1","score":"0","tags":"unit-testing|visual-studio-2008|attributes|mstest","view_count":"288"} {"id":"33742590","title":"Is there a more efficient way of comparing strings?","body":"\u003cp\u003eI am creating a program that stores 3 film objects in an \u003ccode\u003earray\u003c/code\u003e. As part of it there is a method that searches for films that have the same 2 actors supplied by the user. The actual actors in the object are simply stored as variables (\u003ccode\u003e_actor1\u003c/code\u003e and \u003ccode\u003e_actor2\u003c/code\u003e). This is my code: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003estatic void sameActors(string actor1, string actor2)\n {\n foreach (Film i in filmLibrary)\n {\n //check if both actors are in the film\n if ((i.getActor1() == actor1 \u0026amp;\u0026amp; i.getActor2() == actor2) || (i.getActor1() == actor2 \u0026amp;\u0026amp; i.getActor2() == actor1))\n {\n foreach (Film j in filmLibrary)\n {\n //makes sure that it does not compare to itself\n if (i.getName() != j.getName())\n {\n //checks if films have same actors\n if ((actor1.Equals(j.getActor1()) \u0026amp;\u0026amp; actor2.Equals(j.getActor2())) || (actor2.Equals(j.getActor1()) \u0026amp;\u0026amp; actor2.Equals(j.getActor2())))\n {\n Console.WriteLine(i.getName() + \" and \" + j.getName() + \" both share the same actors.\");\n }\n }\n }\n }\n }\n menu();\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe code does the job, but to me there is a lot of thinking to do if you are first looking at the code. Is there a more efficient way?\u003c/p\u003e\n\n\u003cp\u003eAlso, when this code is executed, it will compare twice, so once it will say \"\u003cem\u003eMovie 1 and Movie 2 have the same actors.\u003c/em\u003e\" and then it will say \"\u003cem\u003eMovie 2 and Movie 1 have the same actors.\u003c/em\u003e\" What's the best way to prevent this?\u003c/p\u003e","accepted_answer_id":"33742657","answer_count":"2","comment_count":"3","creation_date":"2015-11-16 18:58:39.707 UTC","last_activity_date":"2015-11-16 23:38:57.807 UTC","last_edit_date":"2015-11-16 19:08:08.133 UTC","last_editor_display_name":"","last_editor_user_id":"335858","owner_display_name":"","owner_user_id":"4284273","post_type_id":"1","score":"0","tags":"c#|loops|compare","view_count":"81"} {"id":"18610368","title":"How to use a Yii fixture object that's not in the defaultScope? Is there a way of using resetScope() with Yii fixtures?","body":"\u003cp\u003eHere's a test file:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass MyTest extends CDbTestCase \n{\n public $fixtures = array(\n 'my_data' =\u0026gt; 'MyData',\n );\n\n public function testMyFunction()\n {\n $myObjectNotInDefaultScope = $this-\u0026gt;my_data('out_of_scope_object');\n\n //Can't do anything with $myObjectNotInDefaultScope since it returns null\n // Is it possible to use resetScope?\n // I can always set a primary key for the object and use findByPk but that's a hack\n\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand here's the corresponding fixture:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\nreturn array(\n 'out_of_scope_object' =\u0026gt; array(\n 'title' =\u0026gt; 'This one is out of scope',\n 'status' =\u0026gt; 'archived', // so not in the default scope\n ),\n 'in_scope_object' =\u0026gt; array(\n 'title' =\u0026gt; 'This one is in scope',\n 'status' =\u0026gt; 'active',\n ),\n);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBoth rows in the fixture are added to the db table, so that's not the problem. I can access both rows via the primary keys that they're allocated. But I can't access the out of scope object in this way:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$myObjectNotInDefaultScope = $this-\u0026gt;my_data('out_of_scope_object');\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ewhich when you're testing is really how you want to access it, I think.\u003c/p\u003e\n\n\u003cp\u003eI have a less than satisfactory solution in use for now of allocating the object a primary key value and using findByPk (edit: with resetScope()) to load the object. I would prefer to use the normal way of working with fixtures instead, if that's possible.\u003c/p\u003e\n\n\u003cp\u003eEdit: To clarify a little in response to some posts:\u003c/p\u003e\n\n\u003cp\u003eIt is possible to use fixtures as a method to return an object. This would work:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$myObjectInDefaultScope = $this-\u0026gt;my_data('in_scope_object');\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut this wouldn't work BECAUSE it's not in the default scope and there's seemingly no way currently of running resetScope() for a fixture method call:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$myObjectNotInDefaultScope = $this-\u0026gt;my_data('out_of_scope_object');\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhy do I need to do this? Well, I might want to test my unarchive method, for example. Seems reasonable to me. (As mentioned before, I can get round this a little inelegantly by using a primary key to load the object corresponding to the fixture).\u003c/p\u003e\n\n\u003cp\u003eAlthough I can access the fixture data as an array using:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$arrayNotInDefaultScope = $this-\u0026gt;my_data['out_of_scope_object'];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eit's returning an array not an object, so I can't test the object's methods on an array.\u003c/p\u003e","accepted_answer_id":"24206614","answer_count":"2","comment_count":"0","creation_date":"2013-09-04 09:40:23.6 UTC","last_activity_date":"2014-06-13 13:50:33.52 UTC","last_edit_date":"2014-06-13 11:52:45.27 UTC","last_editor_display_name":"","last_editor_user_id":"2111952","owner_display_name":"","owner_user_id":"2111952","post_type_id":"1","score":"2","tags":"php|unit-testing|yii|fixtures","view_count":"145"} {"id":"9609818","title":"AjaxControlsToolkit in SharePoint 2010","body":"\u003cp\u003eI need to add the AjaxControlsToolkit reference to the default.master, so first I added the dll to the GAC. Next I've added this to the SafeControl assembly \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;SafeControl Assembly=\"AjaxControlToolkit, Version=3.5.40412.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e, processorArchitecture=MSIL\" Namespace=\"AjaxControlToolkit\" TypeName=\"*\" Safe=\"True\" AllowRemoteDesigner=\"True\" /\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThen in my default.master I've added the register assembly directive and the script manager tag (inside form tag.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;%@ Register Assembly=\"AjaxControlToolkit\" Namespace=\"AjaxControlToolkit\" TagPrefix=\"ajaxToolkit\" %\u0026gt;\u0026lt;ajaxToolkit:ToolkitScriptManager ID=\"ScriptManager1\" runat=\"server\"/\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I run it, I get an \"An unexpected error has occured.\" If I remove the line of code from safe controls, I get \"The control type 'AjaxControlToolkit.ToolkitScriptManager' is not allowed on this page. The type is not registered as safe. \"\u003c/p\u003e\n\n\u003cp\u003eAs I'm typing this, I just noticed that there already is a \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;asp:ScriptManager id=\"ScriptManager\" runat=\"server\" EnablePageMethods=\"false\" EnablePartialRendering=\"true\" EnableScriptGlobalization=\"false\" EnableScriptLocalization=\"true\" /\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo conflict perhaps? I need the Ajax toolkit for some custom webparts I'm bringing in from MOSS 2007 and in my research I've not seen any langauage wheather Ajax in integrated in SP2010 so I'm just doing what I've done many times in MOSS 2007.\u003c/p\u003e\n\n\u003cp\u003eWhat is one to do?\u003c/p\u003e\n\n\u003cp\u003eThanks,\u003c/p\u003e\n\n\u003cp\u003eRisho\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-03-07 22:02:42.477 UTC","last_activity_date":"2012-03-08 19:40:03.063 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"234188","post_type_id":"1","score":"0","tags":"sharepoint-2010","view_count":"1046"} {"id":"43289524","title":"Node zlib module inflate, and knowing how much data was read (total_in)?","body":"\u003cp\u003eI'm trying to parse out a stream of data which contains sequences of Zlib compressed data. To do this, I need to know how much data is read for decompressing, so I know where to continue reading from for the next decompression.\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://www.zlib.net/manual.html\" rel=\"nofollow noreferrer\"\u003eIn the native zlib library\u003c/a\u003e, this value would be exposed through the \u003ccode\u003etotal_in\u003c/code\u003e member of the \u003ccode\u003ez_stream_s\u003c/code\u003e struct.\u003c/p\u003e\n\n\u003cp\u003eI can do this with the JavaScript port of zlib \u003ca href=\"https://github.com/nodeca/pako\" rel=\"nofollow noreferrer\"\u003epako\u003c/a\u003e, but I would prefer to use \u003ca href=\"https://nodejs.org/api/zlib.html\" rel=\"nofollow noreferrer\"\u003ethe native Node module\u003c/a\u003e, as it would avoid the extra dependency and has asyncronous support.\u003c/p\u003e\n\n\u003cp\u003eHere's a code sample that shows this dilemma in action.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e'use strict';\n\nconst zlib = require('zlib');\nconst pako = require('pako');\n\nconst str = 'testing';\nconst extra = new Uint8Array([2, 4, 6, 8, 10]);\n\nconst data = new Uint8Array(zlib.deflateSync(str));\n\nconst dataExtra = new Uint8Array(data.length + extra.length);\ndataExtra.set(data);\ndataExtra.set(extra, data.length);\n\nconsole.log(data);\nconsole.log(dataExtra);\n\n\n// Inflate with pako module.\n// Accessing the amount read is easy.\nconst pakoInflate = new pako.Inflate();\npakoInflate.push(dataExtra, true);\nconst pakoInflated = new Buffer(pakoInflate.result.buffer);\nconsole.log(pakoInflated, pakoInflated.toString());\nconsole.log(pakoInflate.strm.total_in);\n\n\n// Inflate with zlib module.\n// Any way to know how much data was actually read?\nconst zlibInflated = zlib.inflateSync(new Buffer(dataExtra));\nconsole.log(zlibInflated, zlibInflated.toString());\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSample output (the 15 being the length of the compressed data read):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eUint8Array [ 120, 156, 43, 73, 45, 46, 201, 204, 75, 7, 0, 12, 30, 2, 255 ]\nUint8Array [ 120, 156, 43, 73, 45, 46, 201, 204, 75, 7, 0, 12, 30, 2, 255, 2, 4, 6, 8, 10 ]\n\u0026lt;Buffer 74 65 73 74 69 6e 67\u0026gt; 'testing'\n15\n\u0026lt;Buffer 74 65 73 74 69 6e 67\u0026gt; 'testing'\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt appears that \u003ccode\u003ezlib.inflate*\u003c/code\u003e methods do not expose this information, but is there another way to do this? Perhaps one of the other methods of the \u003ccode\u003ezlib\u003c/code\u003e module enables this? Or is this information completely unavailable to JavaScript code?\u003c/p\u003e","accepted_answer_id":"44770504","answer_count":"1","comment_count":"2","creation_date":"2017-04-08 02:29:23.377 UTC","last_activity_date":"2017-06-27 00:14:10.01 UTC","last_edit_date":"2017-04-08 03:54:25.927 UTC","last_editor_display_name":"","last_editor_user_id":"3155639","owner_display_name":"","owner_user_id":"3155639","post_type_id":"1","score":"0","tags":"javascript|node.js|zlib|node-modules","view_count":"29"} {"id":"5091269","title":"ASP.NET Web Service + Module + Public variable = thread safe?","body":"\u003cp\u003eIn my ASP.NET Web Service I've included a module in which their are Public declared variables. Will they be thread-safe? Will they get mixed up upon simultaneous calls?\u003c/p\u003e\n\n\u003cp\u003eThose variables are mostly DatsSet, DataTable and SQLDataAdapter..\u003c/p\u003e\n\n\u003cp\u003ePartial code of the module:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\nImports System.Data.OleDb\nImports System.Diagnostics\n\nModule modCommon\n\n Public bDoLog As Boolean\n Public sCurrentODBC As String\n Public cn As SqlConnection\n Public Query1ds As DataSet\n Public Query1 As DataTable\n Public Query1adapter As SqlDataAdapter\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003chr\u003e\n\n\u003cp\u003e@scripni\u003c/p\u003e\n\n\u003cp\u003eThanks, as I'm not familiary with your suggestions, I will move everything locally. \u003c/p\u003e\n\n\u003cp\u003eAdditionally, will the following variables be thread-safe?: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\n[ToolboxItem(False)]_\nPublic Class Service1 \n Inherits System.Web.Services.WebService \n\n Dim sName As String \n Dim sCurrentPath As String \n\n [WebMethod()]_\n Public Function Capture(ByVal sPath As String) As String \n sName = \"Joe\"\n End Function \nEnd Class \n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"5091708","answer_count":"1","comment_count":"0","creation_date":"2011-02-23 13:02:15.65 UTC","last_activity_date":"2011-08-20 01:55:03.227 UTC","last_edit_date":"2011-08-20 01:55:03.227 UTC","last_editor_display_name":"","last_editor_user_id":"1288","owner_display_name":"","owner_user_id":"598951","post_type_id":"1","score":"1","tags":"asp.net|module|thread-safety","view_count":"719"} {"id":"30888094","title":"Angular parse JSON into directive","body":"\u003cp\u003eBasically I am using angular routing for my pages and its respective template. Every pages has form in which it has more HTML fields(input/select/textarea). I am trying to create reusable Directive to create html field like below\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eapp.directive('field',function(){\n return {\n restrict : \"E\",\n scope : {\n\n },\n link : function(scope,elem,attr){\n var content;\n scope.Options = {\n id: scope.$id+'_'+elem.attr('id'),\n label : elem.attr('label'),\n placeholder : elem.attr(\"placeholder\"),\n\n };\n scope.contentUrl = 'templates/fields/'+elem.attr('template')+'.html'; \n },\n template: '\u0026lt;div ng-include=\"contentUrl\"\u0026gt;\u0026lt;/div\u0026gt;'\n }\n }) \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow from my respective page HTML, I will use this directive. For example from customer page HTML has, \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;field id=\"NAME\" template=\"text\" label=\"First Name\" placeholder=\"Enter First Name\"\u0026gt;\u0026lt;/field\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo far so good. Field is generated as expected. Now I wanted to prepopulate the customer JSON data into directive respective fields.\u003c/p\u003e\n\n\u003cp\u003eI tried to create factory service to get JSON data and inject this service to my customer controller like below \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eFactory service\u003c/strong\u003e \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eapp.factory('dataService', function($http) {\n return {\n getCustomerData: function() {\n //return the promise directly.\n return $http.get('offline/customer.json')\n .then(function(result) {\n //resolve the promise as the data\n return result.data;\n });\n }\n }\n });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003ecustomerController\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eapp.controller('customerController', ['$scope', 'dataService',function($scope,dataService) {\n dataService.getCustomerData();//need to parse this data into field directive\n }]); \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAm I doing right way? How do we parse respective page data into their page fields created by directive?\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2015-06-17 09:51:24.777 UTC","last_activity_date":"2015-06-17 12:28:36.867 UTC","last_edit_date":"2015-06-17 10:22:25.197 UTC","last_editor_display_name":"","last_editor_user_id":"3885376","owner_display_name":"","owner_user_id":"662038","post_type_id":"1","score":"0","tags":"javascript|jquery|html|json|angularjs","view_count":"379"} {"id":"45619692","title":"Modbus Slave don`t respond","body":"\u003cp\u003eI am trying to use a Raspberry Pi 3B (run Ubuntu Mate 16.04 operating system)as a Master to read values from an electric energy meter which supports Modbus-RTU protocol.\u003c/p\u003e\n\n\u003cp\u003eI used a RS232/USB adapter and a RS485/RS232 adapter to link the meter and the USB port on the Raspberry Pi. I have tried the \u003cstrong\u003e\u003cem\u003emodbus_tk 0.5.7\u003c/em\u003e\u003c/strong\u003e and \u003cstrong\u003e\u003cem\u003eMinimalModbus\u003c/em\u003e\u003c/strong\u003e to implement the communication under \u003cstrong\u003e\u003cem\u003eModbus-RTU\u003c/em\u003e\u003c/strong\u003e protocol.\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/lMk5J.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/lMk5J.jpg\" alt=\"The meter reading system based on the Modbus-RTU protocol\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eWhen I use \u003cstrong\u003e\u003cem\u003emodbus_tk 0.5.7\u003c/em\u003e\u003c/strong\u003e and run the following code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport sys import serial\n\n#add logging capability import logging import modbus_tk import modbus_tk.defines as cst import modbus_tk.modbus_rtu as modbus_rtu\n\nlogger = modbus_tk.utils.create_logger(\"console\")\nif __name__ == \"__main__\":\n try:\n #Connect to the slave\n master = modbus_rtu.RtuMaster(serial.Serial(port=\"/dev/ttyUSB0\", baudrate=9600, bytesize=8, parity='N', stopbits=1, xonxoff=0))\n master.set_timeout(5.0) #Change the timeout value/Defines a timeout on the MAC layer\n master.set_verbose(True) #print some more log prints for debug purpose\n logger.info(\"connected\")\n\n logger.info(master.execute(1, cst.READ_HOLDING_REGISTERS, 0, 49))\n\n except modbus_tk.modbus.ModbusError, e:\n logger.error(\"%s- Code=%d\" % (e, e.get_exception_code()))\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eThe parameters such as port, baudrate, bytesize,parity,and stopbits were set correctly, but it always returns this:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e2017-08-10 19:24:34,282 INFO modbus_rtu.__init__ MainThread RtuMaster /dev/ttyUSB0 is opened\n2017-08-10 19:24:34,283 INFO rtumaster_example.\u0026lt;module\u0026gt; MainThread connected\n2017-08-10 19:24:34,284 DEBUG modbus.execute MainThread -\u0026gt; 1-3-0-0-0-49-132-30\n2017-08-10 19:24:39,291 DEBUG modbus.execute MainThread \u0026lt;-\nTraceback (most recent call last):\n File \"rtumaster_example.py\", line 34, in \u0026lt;module\u0026gt;\n logger.info(master.execute(1, cst.READ_HOLDING_REGISTERS, 0, 49))\n File \"build/bdist.linux-x86_64/egg/modbus_tk/utils.py\", line 39, in new\nmodbus_tk.exceptions.ModbusInvalidResponseError: Response length is invalid 0\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I use \u003cstrong\u003e\u003cem\u003eMinimalModbus\u003c/em\u003e\u003c/strong\u003e and run the following code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#!/usr/bin/env python\nimport minimalmodbus\n\ninstrument.serial.port='/dev/ttyUSB0' # this is the serial port name\ninstrument.serial.baudrate = 9600 # Baud\ninstrument.serial.bytesize = 8\ninstrument.serial.parity = serial.PARITY_NONE\ninstrument.serial.stopbits = 1\ninstrument.serial.timeout = 0.05 # seconds\n\n#instrument.address # this is the slave address number\ninstrument.mode = minimalmodbus.MODE_RTU # rtu or ascii mode\ninstrument = minimalmodbus.Instrument('/dev/ttyUSB0', 1) # port name, slave address (in decimal)\nenergy = instrument.read_register(10, 1) # Registernumber, number of decimals\nprint energy\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt always returns this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e raise IOError('No communication with the instrument (no answer)')\nIOError: No communication with the instrument (no answer)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd then I use the same serial transmission line to link the meter and the laptop, and use a debugging tool running on Windows XP, which was developed by the manufacturer of the meter. The debugging tool sends the same Request \u003cstrong\u003e(1-3-0-0-0-49-132-30)\u003c/strong\u003e as before, \u003cstrong\u003ebut the debugging tool can get correct Responses. (Maybe it's because it ignored some incorrect Responses and keep on send Requests regularly) And \u003cem\u003eit can represent that the Request message is correct and the connection of serial transmission has no problem.\u003c/em\u003e\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eI also used the CuteCom(a graphical serial terminal) and the RS232/USB adapter to confirm that \u003cstrong\u003ethe USB port can send and receive correctly.\u003c/strong\u003e It is also useless to add a resistor between two RS485 lines\u003c/p\u003e\n\n\u003cp\u003eI have tried many times, but the Raspberry Pi never gets a Response, and always returns the same error information. I also try to run the same code on a Ubuntu virtual machine, it returned the same message as above and never get a Respond.\u003c/p\u003e\n\n\u003cp\u003eI am new to Modbus and serial communication, so any help would be appreciated.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-08-10 17:06:52.503 UTC","last_activity_date":"2017-08-12 06:28:04.047 UTC","last_edit_date":"2017-08-11 04:18:54.247 UTC","last_editor_display_name":"","last_editor_user_id":"7311767","owner_display_name":"","owner_user_id":"7732046","post_type_id":"1","score":"0","tags":"python|ubuntu|raspberry-pi|serial-port|modbus","view_count":"90"} {"id":"4320566","title":"Picture or photo viewer on my Web site","body":"\u003cp\u003eLets say I let the customer upload up to 5 pictures. I'm looking for a good way to let visitors see the images one by one. \u003c/p\u003e\n\n\u003cp\u003eI've seen some.. where there are thumbnails on the side/bottom (that looks like a vertical/horizontal film strip) and the default picture is the large one displayed. And viewers can click into others to show those pictures. \u003c/p\u003e\n\n\u003cp\u003eThis could possibly be an AJAX solution. I just couldn't come up with the right keywords to Google this custom Web component. Perhaps it is \"photo gallery\". But I would be more interested to know what solutions developers here use for their site.\u003c/p\u003e","accepted_answer_id":"4320584","answer_count":"3","comment_count":"1","creation_date":"2010-12-01 01:58:45.4 UTC","last_activity_date":"2010-12-01 03:53:06.933 UTC","last_edit_date":"2010-12-01 02:15:56.33 UTC","last_editor_display_name":"","last_editor_user_id":"499053","owner_display_name":"","owner_user_id":"499053","post_type_id":"1","score":"0","tags":"asp.net|ajax|photo-gallery","view_count":"1046"} {"id":"47371068","title":"Overwriting items retrieved from storage","body":"\u003cp\u003eI'm making a Mad Libs program. The intent is to reload the text inputs into local storage so that the story is rebuilt upon reloading the page. \u003c/p\u003e\n\n\u003cp\u003eI'm not able to overwrite the story with new inputs, even though new inputs are being stored in local storage as intended. \u003c/p\u003e\n\n\u003cp\u003eWhat do I need to do to my createStory function to make it overwrite the text generated from the retrieve function? For some reason, 'document.getElementById(id).innerHTML = var isn't working. \u003c/p\u003e\n\n\u003cp\u003eJavascript: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar myStory = \"A {{adjective}} {{noun}} ventured out into the world in search of {{thing}}. \"\n\nvar adjective = 'adjective';\nvar noun = 'noun';\nvar thing = 'thing';\n\n\nfunction retrieve() {\n var adjective = localStorage.getItem('adjective');\n var noun = localStorage.getItem('noun');\n var thing = localStorage.getItem('thing');\n myStory = myStory.replace(/(.*)({{adjective}})(.*)({{noun}})(.*)({{thing}})(.*)/g, '$1' + adjective + '$3' + noun + '$5' + thing + '$7');\n document.getElementById('storyResult').innerHTML=myStory;\n}\n\nfunction createStory () {\n var adjective = document.getElementById('adjective').value;\n var noun = document.getElementById('noun').value;\n var thing = document.getElementById('thing').value;\n localStorage.adjective = document.getElementById('adjective').value;\n localStorage.noun = document.getElementById('noun').value;\n localStorage.thing = document.getElementById('thing').value;\n myStory = myStory.replace(/(.*)({{adjective}})(.*)({{noun}})(.*)({{thing}})(.*)/g, '$1' + adjective + '$3' + noun + '$5' + thing + '$7');\n document.getElementById('storyResult').innerHTML=\"\";\n document.getElementById('storyResult').innerHTML=myStory;\n console.log(myStory);\n};\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHTML: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;!DOCTYPE HTML\u0026gt;\n\u0026lt;html\u0026gt;\n\u0026lt;head\u0026gt;\n \u0026lt;title\u0026gt;\u0026lt;/title\u0026gt;\n \u0026lt;link rel=\"stylesheet\" href=\"css/styles.css\"\u0026gt;\n\u0026lt;/head\u0026gt;\n\u0026lt;body onload=\"retrieve()\"\u0026gt;\n \u0026lt;h1\u0026gt;Create a Story\u0026lt;/h1\u0026gt;\n \u0026lt;p\u0026gt; Adjective \u0026lt;/p\u0026gt;\u0026lt;input type=\"text\" id=\"adjective\"\u0026gt;\n \u0026lt;p\u0026gt; Noun\u0026lt;/p\u0026gt;\u0026lt;input type=\"text\" id=\"noun\"\u0026gt;\n \u0026lt;p\u0026gt; Thing \u0026lt;/p\u0026gt;\u0026lt;input type=\"text\" id=\"thing\"\u0026gt;\n \u0026lt;br\u0026gt;\u0026lt;button onclick=\"createStory()\"\u0026gt; Tell your tale.\u0026lt;/button\u0026gt;\u0026lt;button onclick=\"clear()\"\u0026gt;Clear\u0026lt;/button\u0026gt;\n\n \u0026lt;div id='storyResult'\u0026gt; \u0026lt;/div\u0026gt;\n\n\n\u0026lt;/body\u0026gt;\n\u0026lt;script type=\"text/javascript\" src=\"js/main.js\"\u0026gt;\u0026lt;/script\u0026gt;\n\u0026lt;/html\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"2","creation_date":"2017-11-18 21:08:39.44 UTC","last_activity_date":"2017-11-18 22:23:23.613 UTC","last_edit_date":"2017-11-18 22:01:28.25 UTC","last_editor_display_name":"","last_editor_user_id":"2718801","owner_display_name":"","owner_user_id":"8702325","post_type_id":"1","score":"1","tags":"javascript|local-storage","view_count":"33"} {"id":"43780253","title":"Compose-for-mongodb Bluemix connection with pencilblue","body":"\u003cp\u003eCurrently, I am using Bluemix to deploy and host a website with PencilBlue. My issue lies in the connection of a storage service \"compose-for-mongo\" and the pencilblue framework.\nThis connection is done through the VCAP JSON.\nThe VCAP comes with the following structure;\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{\n \"compose-for-mongodb\": [\n {\n \"credentials\": {\n \"db_type\": \"mongodb\",\n \"name\": \"**************************************\",\n \"uri_cli\": \"**************************************\",\n \"ca_certificate_base64\": \"*********************************************************************\",\n \"deployment_id\": \"*********************************\",\n \"uri\": \"******************************************************\"\n },\n \"syslog_drain_url\": null,\n \"label\": \"compose-for-mongodb\",\n \"provider\": null,\n \"plan\": \"***********\",\n \"name\": \"************************\",\n \"tags\": [\n \"big_data\",\n \"data_management\",\n \"ibm_created\"\n ]\n }\n ]\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAs I understand this, \"compose-for-mongodb\" is a cluster instead of a server. We need to make the connection between PencilBlue and this \"cluster\" through the VCAP JSON. Currently, we are trying to lead the JSON parse in the \u003ccode\u003econfig.js\u003c/code\u003e like so:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e if (typeof process.env.VCAP_SERVICES === 'string') {\n try {\n var vcapServices = JSON.parse(process.env.VCAP_SERVICES);\n var vcapMongo = vcapServices['compose-for-mongodb'][0].credentials;\n\n var uri = vcapMongo.uri;\n\n mongoConfig.servers = [\n uri\n ];\n\n var userPassword = uri.split('mongodb://')[1].split('@')[0].split(':');\n\n mongoConfig.authentication = {\n un: userPassword[0],\n pw: userPassword[1]\n };\n\n var db = uri.split('?uri=')[0].split('/')[1];\n\n mongoConfig.options.mongos = {\n ssl: true,\n sslValidate: true,\n sslCA: [new Buffer(vcapMongo.ca_certificate_base64, 'base64')],\n poolSize: 1,\n reconnectTries: 1\n };\n\n mongoConfig.name = db;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWe have tried multiple ways without any success.\u003c/p\u003e\n\n\u003cp\u003eHas anyone encountered this problem yet? Is there any documentation on this subject?\u003c/p\u003e\n\n\u003cp\u003eSteps to Reproduce:\u003c/p\u003e\n\n\u003cp\u003eCreate a Bluemix Node App and connect it with the \"compose-for-mongodb\" storage service.\u003c/p\u003e\n\n\u003cp\u003ePencilBlue Version: 0.8.0\u003c/p\u003e\n\n\u003cp\u003eEnvironment Description: Node.js SDK in Bluemix and compose-for-mongodb service connected\u003c/p\u003e","accepted_answer_id":"43797315","answer_count":"1","comment_count":"0","creation_date":"2017-05-04 10:24:09.61 UTC","last_activity_date":"2017-05-05 05:42:41.073 UTC","last_edit_date":"2017-05-04 16:45:53.54 UTC","last_editor_display_name":"","last_editor_user_id":"3198917","owner_display_name":"","owner_user_id":"7962544","post_type_id":"1","score":"0","tags":"node.js|mongodb|ibm-bluemix|compose|pencilblue","view_count":"75"} {"id":"34750482","title":"how to find parent product have no category - magento","body":"\u003cp\u003eI have some orphan records of parent product in my magento product catalogue how can i find them with out any extension installation. SQL code will be great.\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2016-01-12 17:47:07.56 UTC","last_activity_date":"2016-01-12 18:15:37.147 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5780335","post_type_id":"1","score":"-1","tags":"php|sql|magento","view_count":"63"} {"id":"36419442","title":"The role defined for the function cannot be assumed by Lambda","body":"\u003cp\u003eI'm getting the error \"The role defined for the function cannot be assumed by Lambda\" when I'm trying to create a lambda function with create-function command.\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eaws lambda create-function\u003cbr\u003e\n --region us-west-2\u003cbr\u003e\n --function-name HelloPython\u003cbr\u003e\n --zip-file fileb://hello_python.zip\u003cbr\u003e\n --role arn:aws:iam::my-acc-account-id:role/default\u003cbr\u003e\n --handler hello_python.my_handler\u003cbr\u003e\n --runtime python2.7\u003cbr\u003e\n --timeout 15\u003cbr\u003e\n --memory-size 512\u003c/p\u003e\n\u003c/blockquote\u003e","answer_count":"4","comment_count":"3","creation_date":"2016-04-05 07:09:35.323 UTC","favorite_count":"2","last_activity_date":"2017-08-28 21:38:24.143 UTC","last_edit_date":"2016-05-28 19:46:50.417 UTC","last_editor_display_name":"","last_editor_user_id":"1476885","owner_display_name":"","owner_user_id":"3045354","post_type_id":"1","score":"15","tags":"python|amazon-web-services|boto|aws-sdk|aws-lambda","view_count":"8016"} {"id":"21100854","title":"Can structural typing work with generics?","body":"\u003cp\u003eI have an interface defined using a structural type like this: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etrait Foo { \n def collection: { \n def apply(a: Int) : String \n def values() : collection.Iterable[String]\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI wanted to have one of the implementers of this interface do so using a standard mutable HashMap:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass Bar { \n val collection: HashMap[Int, String] = HashMap[Int, String]()\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt compiles, but at runtime I get a NoSuchMethod exception when referring a Bar instance through a Foo typed variable. Dumping out the object's methods via reflection I see that the HashMap's apply method takes an Object due to type erasure, and there's some crazily renamed generated apply method that does take an int. Is there a way to make generics work with structural types? Note in this particular case I was able to solve my problem using an actual trait instead of a structural type and that is overall much cleaner. \u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2014-01-13 20:37:01.147 UTC","last_activity_date":"2014-02-17 03:34:30.103 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3191348","post_type_id":"1","score":"2","tags":"scala|type-erasure","view_count":"97"} {"id":"19203315","title":"build a list with Javascript append","body":"\u003cp\u003eI want to build a list with a Javascript that uses Append function.\u003c/p\u003e\n\n\u003cp\u003eI have a index.php file, script.js file and a search.php file that makes the mysql query.\u003c/p\u003e\n\n\u003cp\u003eI got it all to work but the layout is not the best. So i wounder how to make the layout better. \u003c/p\u003e\n\n\u003cp\u003eI want it to be displayed as a list this should be done with CSS or table?\u003c/p\u003e\n\n\u003cp\u003eRight now it just shows up like this 414622570992222\u003c/p\u003e\n\n\u003cp\u003ethis.number=70992222\nthis.code=4146225\u003c/p\u003e\n\n\u003cp\u003eSo what i want it to like like is a list without boarders like this (but no borders).\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e----------------------\n| Number | Code |\n----------------------\n| 70992222 | 4146225 |\n----------------------\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is some code from my script.js file.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$.each(data.results, function(){\n //Give the list element a rel with the data results ID incase we want to act on this later, like selecting from the list\n\n $('#results-list').append(\"\u0026lt;li rel='\" + this.number + \"'\u0026gt;\" + this.code + this.number + \"\u0026lt;/li\u0026gt;\");\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd this is the display line in my index.php file\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;div id='results-holder'\u0026gt;\n\n\n \u0026lt;ul id='results-list'\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"19203459","answer_count":"3","comment_count":"1","creation_date":"2013-10-05 22:19:47.53 UTC","last_activity_date":"2013-10-05 22:37:07.66 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2494970","post_type_id":"1","score":"1","tags":"javascript|php|jquery|css","view_count":"74"} {"id":"20892626","title":"Python – time.time() vs. bash time","body":"\u003cp\u003eI've been working on some Project Euler problems in Python 3 [osx 10.9], and I like to know how long they take to run.\u003c/p\u003e\n\n\u003cp\u003eI've been using the following two approaches to time my programs:\u003c/p\u003e\n\n\u003cp\u003e1)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport time\nstart = time.time()\n\n[program]\n\nprint(time.time() - start)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e2) On the bash command line, typing \u003ccode\u003etime python3 ./program.py\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eHowever, these two methods often give \u003cem\u003ewildy\u003c/em\u003e different results. In the program I am working on now, the first returns \u003ccode\u003e0.000263\u003c/code\u003e (seconds, truncated) while the second gives\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ereal 0m0.044s\nuser 0m0.032s\nsys 0m0.009s\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eClearly there is a huge discrepancy - two orders of magnitude compared to the \u003ccode\u003ereal\u003c/code\u003e time. \u003c/p\u003e\n\n\u003cp\u003eMy questions are:\u003cbr\u003e\na) Why the difference? Is it overhead from the interpreter?\u003cbr\u003e\nb) Which one should I be using to accurately determine how long the program takes to run? Is \u003ccode\u003etime.time()\u003c/code\u003e accurate at such small intervals?\u003c/p\u003e\n\n\u003cp\u003eI realize these miniscule times are not of the utmost importance; this was more of a curiosity.\u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e\n\n\u003cp\u003e[\u003cstrong\u003eUPDATE:\u003c/strong\u003e]\u003cbr\u003e\nThank-you to all of the answers \u0026amp; comments. You were correct with the overhead. This program:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e import time\n start = time.time()\n\n print(\"hello world\")\n\n print(time.time() - start)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003etakes ~0.045 sec, according to bash.\u003c/p\u003e\n\n\u003cp\u003eMy complicated Project Euler problem took ~0.045 sec, according to bash. Problem solved.\u003c/p\u003e\n\n\u003cp\u003eI'll take a look at \u003ccode\u003etimeit\u003c/code\u003e. Thanks.\u003c/p\u003e","accepted_answer_id":"20892693","answer_count":"2","comment_count":"2","creation_date":"2014-01-02 21:52:44.993 UTC","favorite_count":"1","last_activity_date":"2014-01-03 03:14:45.167 UTC","last_edit_date":"2014-01-03 03:14:45.167 UTC","last_editor_display_name":"","last_editor_user_id":"1631673","owner_display_name":"","owner_user_id":"1631673","post_type_id":"1","score":"5","tags":"python|osx|bash|time","view_count":"958"} {"id":"12250475","title":"Create a pandas DataFrame from a csv stacked file","body":"\u003cp\u003eI'd like to create a pandas DataFrame from the following csv file:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e...........\nEUR MS 3M;20111025;7d;1.1510;\nEUR MS 3M;20111024;7d;1.1530;\nEUR MS 3M;20111025;1m;1.1580;\nEUR MS 3M;20111024;1m;1.1590;\n...........\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe DataFrame ideally would have a name given as the first column value (\"EUR MS 3M\"), an index composed by values in the second column (\"20111025\"), and where the column names for the DataFrame would be taken from the third column (\"7d\", \"1m\" etc.), with correspondent values given in the last csv column (\"1.150\" etc.).\nI have tried with different methods, but couldn't sort this thing out the proper way. I think the first thing I should do should be to 'unstack' the values in the csv, in order to have an aligned index first, and then create a DataFrame, but really don't how...\nAnyone more expert than me have any clue? I'm started learning pandas only few weeks ago...\nThanks for your kind help!\u003c/p\u003e\n\n\u003cp\u003e(I'm editing the question to make thing a bit clearer:\nI'd like to get a dataframe named EUR MS 3M containing columns such as: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eindex 7d 1m \n20111024 1.1530 1.1590 \n20111025 1.1510 1.1580 \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ehope it is a bit clearer now. Thanks)\u003c/p\u003e","accepted_answer_id":"12252786","answer_count":"1","comment_count":"2","creation_date":"2012-09-03 15:16:55.747 UTC","last_activity_date":"2012-09-03 18:52:56.903 UTC","last_edit_date":"2012-09-03 16:48:34.76 UTC","last_editor_display_name":"","last_editor_user_id":"1529852","owner_display_name":"","owner_user_id":"1529852","post_type_id":"1","score":"2","tags":"python|csv|dataframe|pandas","view_count":"2863"} {"id":"28219386","title":"Argument Exception when calling remote appdomain method with local argument after .exe got renamed","body":"\u003cp\u003eI have written a program in C# which loads it's own assembly in another appdomain:\u003cbr\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eAppDomain otherAppDomain = AppDomain.CreateDomain(\"otherDomain\");\notherAppDomain.Load(Assembly.GetExecutingAssembly().GetName());\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIn the original AppDomain I am creating an object (Anchor anchor) and use it as argument when calling a method of an object of the other appDomain.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eAnchor anchor = new Anchor();\nRemoteObject ro = (RemoteObject)otherAppDomain.CreateInstanceFromAndUnwrap(Application.ExecutablePath, typeof(RemoteObject).FullName);\nro.DoStuffInTheOtherAppDomain(anchor); // \u0026lt;- Exception happens here\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnchor extends MarshalByRefObject and implements an interface. Anchor and RemoteObject are in the same assembly (the executing assembly).\u003c/p\u003e\n\n\u003cp\u003eDoStuffInTheOtherAppDomain with it's full signature: public void DoStuffInTheOtherAppDomain (Anchor anchor).\u003c/p\u003e\n\n\u003cp\u003eAfter compiling my code \u003cb\u003ethis works perfectly\u003c/b\u003e. But if \u003cb\u003eI rename the .exe file\u003c/b\u003e (say from a.exe to b.exe) I get the following Exception:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e System.ArgumentException: The object type cannot be converted to the target type\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI marked where exactly the exception occurs in the second code block.\u003c/p\u003e\n\n\u003cp\u003e\u003cb\u003eWhy does this happen and is there a way to avoid it even when I rename my .exe?\u003c/b\u003e\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2015-01-29 16:12:41.133 UTC","last_activity_date":"2015-01-29 16:12:41.133 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2306536","post_type_id":"1","score":"0","tags":"c#|.net|appdomain","view_count":"71"} {"id":"5789110","title":"Get URL image content using php","body":"\u003cp\u003eI have a url like this.\n\u003ca href=\"http://www.cardekho.com/\" rel=\"nofollow\"\u003ehttp://www.cardekho.com/\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eIf i wish to get all the image content(jpg,png,gif - only images) from this url to my local machine(C:\\images) - How to do this.. \u003c/p\u003e\n\n\u003cp\u003ePlease help me.\nThanks -\nHaan\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2011-04-26 10:39:11.297 UTC","last_activity_date":"2011-04-26 11:14:17.147 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"549481","post_type_id":"1","score":"0","tags":"php","view_count":"908"} {"id":"13942451","title":"Is it possible to manage JobObjects by name only, without keeping an open HANDLE?","body":"\u003cp\u003eWith processes, I can do the following:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eint pid;\n::CreateProcess(NULL, cmd, ..., \u0026amp;pi);\npid = pi.dwProcessId;\n::CloseHandle(pi.hProcess);\n// then later...\nHANDLE proc = ::OpenProcess(PROCESS_TERMINATE, FALSE, pid);\n::TerminateProcess(proc, 1);\n::CloseHandle(proc);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIn this fashion, I can manage windows processes by pid only, which is nice for multi-platform code.\u003c/p\u003e\n\n\u003cp\u003eI would like to extend this pattern to job objects:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eHANDLE job = ::CreateJobObject(NULL, name);\n::AssignProcessToJobObject(job, proc); // proc from above\n::CloseHandle(job);\n// then later...\njob = ::OpenJobObject(JOB_OBJECT_TERMINATE, FALSE, name);\n::TerminateJobObject(job, 1);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eTo be clear, I am not in the job, but my child process is. \u003ca href=\"http://msdn.microsoft.com/en-us/library/windows/desktop/ms682409%28v=vs.85%29.aspx\" rel=\"nofollow\"\u003eMSDN says\u003c/a\u003e \"The job is destroyed when its last handle has been closed and all associated processes have exited\". In this case, my main process has closed his last handle, but the child is still running, and still has a handle. A call to \u003ccode\u003eIsProcessInJob(proc, NULL, \u0026amp;isit)\u003c/code\u003e confirms the job still exists. However, my call to open the job returns NULL, and the error code is ERROR_FILE_NOT_FOUND.\u003c/p\u003e\n\n\u003cp\u003eSo the question: does my main process have any way to get a handle to the job after closing it?\u003c/p\u003e","accepted_answer_id":"13998136","answer_count":"2","comment_count":"2","creation_date":"2012-12-18 22:19:40.1 UTC","favorite_count":"1","last_activity_date":"2012-12-21 22:43:03.73 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"508616","post_type_id":"1","score":"1","tags":"c|windows|process|handle|jobs","view_count":"325"} {"id":"47304565","title":"How to read a number above 999 that is separated by a comma (eg. 10,000)?","body":"\u003cp\u003eI'm new to C (and programming) and it's possible that my question can be answered with some basic searching and reading; please point me to an answer to the question if it exists.\u003c/p\u003e\n\n\u003cp\u003eLet's say that I want to read a number that can possibly be above 999 from the user. From my experience, if I enter the value 10,000 (including the comma), the program would read the number until the comma and then stop taking input. Thus, the input would be 10 instead of 10000.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eHow can I make it read '10,000' as if it is 10000?\u003c/strong\u003e\u003c/p\u003e","answer_count":"4","comment_count":"2","creation_date":"2017-11-15 10:10:22.713 UTC","favorite_count":"0","last_activity_date":"2017-11-15 11:16:28.9 UTC","last_edit_date":"2017-11-15 11:16:28.9 UTC","last_editor_display_name":"","last_editor_user_id":"8944219","owner_display_name":"","owner_user_id":"8944219","post_type_id":"1","score":"1","tags":"c","view_count":"60"} {"id":"17631093","title":"How to know if a File represents a Root or My Computer?","body":"\u003cp\u003eI have a \u003ccode\u003ejava.io.File\u003c/code\u003e object and i don't know to which it corresponds. Using the \u003ccode\u003eisDirectory()\u003c/code\u003e method we can check whether it is a directory or not. A normal folder and a drive both returns true upon call to \u003ccode\u003eisDirectory()\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eHow could i check if a \u003ccode\u003eFile\u003c/code\u003e object is a drive or My Computer?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-07-13 14:28:25.117 UTC","last_activity_date":"2013-07-13 14:28:25.117 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2534090","post_type_id":"1","score":"1","tags":"java|java-io|java.nio.file","view_count":"1944"} {"id":"36387274","title":"What is the RSpec syntax equivalent for assert (minitest)","body":"\u003cp\u003eI am following Michael Hartl's Ruby on Rails tutorial. I observe that he used minitest to run his tests. I use RSpec. Below is a line of code from the tutorial I want to replicate with RSpec\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etest \"email validation should accept valid addresses\" do\n valid_addresses = %w[user@example.com USER@foo.COM A_US-ER@foo.bar.org\n first.last@foo.jp alice+bob@baz.cn]\n valid_addresses.each do |valid_address|\n @user.email = valid_address\n assert @user.valid?, \"#{valid_address.inspect} should be valid\"\n end\nend\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is how I will do this in with RSpec.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eit \"email validation should accept valid addresses\" do\n valid_addresses = [\"user@example.com\", \"USER@foo.COM\", \"A_US-ER@foo.bar.org\",\n \"first.last@foo.jp\", \"alice+bob@baz.cn\"]\n valid_addresses.each do |valid_address|\n user.email = valid_address\n expect(@user.valid?).to be true, \"#{valid_address.inspect} is not correct\"\n end\nend\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever, I get Argument error when I run this test. It appears RSpec expects only one argument in test cases.\u003c/p\u003e","accepted_answer_id":"36390879","answer_count":"2","comment_count":"0","creation_date":"2016-04-03 15:22:00.01 UTC","last_activity_date":"2016-04-03 20:39:32.74 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5535989","post_type_id":"1","score":"0","tags":"ruby-on-rails|rspec|railstutorial.org","view_count":"60"} {"id":"6344607","title":"F# Asynch thread problem","body":"\u003cp\u003eI am learning F# and very interested in this language\u003c/p\u003e\n\n\u003cp\u003eI try to create async expression to run asynchronously.\u003c/p\u003e\n\n\u003cp\u003efor example\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003elet prop1=async{ \n for i=0 to 1000000 do ()\n MessageBox.Show(\"Done\")\n }\n\nlet prop2=async{ \n for i=0 to 1000000 do ()\n MessageBox.Show(\"Done2\")\n }\n\nAsync.Start(prop1)\nAsync.Start(prop2)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ewhen i run the program, i got that there are thread amount increasing of program process, from 6 to 8 , when i done close 2 message box , the process seem not destroy those created threads , the count also 8 , what happened or i got misunderstand about F# asynchronous \u003c/p\u003e\n\n\u003cp\u003eThank for your help\u003c/p\u003e","accepted_answer_id":"6344670","answer_count":"2","comment_count":"0","creation_date":"2011-06-14 13:53:41.24 UTC","last_activity_date":"2011-06-14 13:58:47.583 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"790232","post_type_id":"1","score":"1","tags":"multithreading|asynchronous|f#","view_count":"836"} {"id":"14816964","title":"Make function variable available to other php files","body":"\u003cp\u003eI have a paging.php file, which has a function \u003ccode\u003elatest($imagesPerPage, $site) {\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eInside that function, I have a variable $lastPage:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$catResult-\u0026gt;data_seek(0); \n$totalComics = 0;\nwhile ($row = $catResult-\u0026gt;fetch_assoc()) {\n $totalComics++;\n}\n\nglobal $lastPage;\n$lastPage = ceil($totalComics/$imagesPerPage);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI have another file, homepage.php, which needs to use \u003ccode\u003e$lastPage\u003c/code\u003e defined above in the paging.php file's \"latest()\" function.\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003cp\u003eAt the top of homepage.php, I include the paging file: \u003ccode\u003einclude 'scripts/paging.php';\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eI then call \u003ccode\u003e\u0026lt;?php echo latest(15, $site); ?\u0026gt;\u003c/code\u003e to display some images...\u003c/p\u003e\n\n\u003cp\u003eAnd below, I want to handle page numbers and navigation, and need to use the $lastPage variable:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e for($i = 1; $i \u0026lt;= $lastPage; $i++) {\n echo '\u0026lt;li\u0026gt;\u0026lt;span class=navItems\u0026gt;\u0026lt;a href=\"?site=' . $site . '\u0026amp;cat=' . $cat . '\u0026amp;page=' . $i .'\"\u0026gt;' . $i . '\u0026lt;/a\u0026gt;\u0026lt;/span\u0026gt;\u0026lt;/li\u0026gt;';\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ehomepage.php keeps complaining that $lastPage is undefined... I've tried \u003ccode\u003eglobal $lastPage\u003c/code\u003e, \u003ccode\u003e$GLOBALS[$lastPage]\u003c/code\u003e... but it's still not available.\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003cp\u003eMy questions are:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003e\u003cp\u003eHow can I make \u003ccode\u003e$lastPage\u003c/code\u003e available outside the function to the homepage.php file?\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eHow can I make \u003ccode\u003e$lastPage\u003c/code\u003e available to other functions within paging.php?\u003c/p\u003e\u003c/li\u003e\n\u003c/ol\u003e","accepted_answer_id":"14816985","answer_count":"1","comment_count":"0","creation_date":"2013-02-11 16:58:43.443 UTC","last_activity_date":"2013-02-12 09:10:02.463 UTC","last_edit_date":"2013-02-11 18:15:34.163 UTC","last_editor_display_name":"","last_editor_user_id":"507624","owner_display_name":"","owner_user_id":"507624","post_type_id":"1","score":"1","tags":"php","view_count":"671"} {"id":"33874726","title":"Replacing string by boolean in a JSON string?","body":"\u003cp\u003eConsider the following JSON data as string\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e'{\"prop0\":\"true\", \"prop1\":\n [\n {\"prop0\":\"false\", \"prop1\":\"true\", \"prop2\":\n [\n {\"prop0\":\"false\"}\n ]\n }\n ]\n }'\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis structure is dynamic and could have a lot more nodes, children etc. This is how my backend receives this \"unclean\" JSON data (that is in fact a string). For performance matters, I'm trying to avoid to parse to a JSON obj and cycle through every node to find is there is a string that can be converted to boolean. \u003c/p\u003e\n\n\u003cp\u003eI know how to do that, I'm just wondering if there would be a \"magical\" solution to replace \"true\" by true \u003cstrong\u003einside the string\u003c/strong\u003e, something like\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003estr_replace(\"true\", true, $data);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThat obviously won't work. All I need after all is to remove the quotes around the boolean value. Does anyone know of a quick way to do that?\u003c/p\u003e","accepted_answer_id":"33874812","answer_count":"1","comment_count":"2","creation_date":"2015-11-23 15:30:25.607 UTC","last_activity_date":"2015-11-23 15:35:04.433 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"749657","post_type_id":"1","score":"1","tags":"php|json","view_count":"135"} {"id":"47569587","title":"How to get child nodes within specific tags in xml using java?","body":"\u003cp\u003eBelow is an xml File that i have to parse..\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;dataroot\u0026gt;\n \u0026lt;PARM\u0026gt;\n \u0026lt;P1\u0026gt;123\u0026lt;/P1\u0026gt;\n \u0026lt;P2\u0026gt;abc\u0026lt;/P2\u0026gt;\n \u0026lt;/PARM\u0026gt;\n \u0026lt;PARM\u0026gt;\n \u0026lt;P1\u0026gt;456\u0026lt;/P1\u0026gt;\n \u0026lt;P2\u0026gt;def\u0026lt;/P2\u0026gt;\n \u0026lt;/PARM\u0026gt;\n \u0026lt;PARM\u0026gt;\n \u0026lt;P1\u0026gt;789\u0026lt;/P1\u0026gt;\n \u0026lt;P2\u0026gt;ghi\u0026lt;/P2\u0026gt;\n \u0026lt;/PARM\u0026gt;\n.......(15times)\n\u0026lt;/dataroot\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003emy goal is to get the child nodes (ie p1,p2 not the values inside) and compare those names with a template. \u003c/p\u003e\n\n\u003cp\u003esay if p2 is not present i have to append that particular tag to that particular position in the \u003cstrong\u003exml\u003c/strong\u003e file. The problem is when i use \u003ccode\u003egetElementsByTagNames()\u003c/code\u003e and store that in an array and then compare it with the template it includes \u003cstrong\u003edataroot\u003c/strong\u003e and \u003cstrong\u003ePARM\u003c/strong\u003e as well which i don't want. \u003c/p\u003e\n\n\u003cp\u003eso how can i get just p1 and p2 (for upto 15times) only.\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2017-11-30 09:08:40.04 UTC","last_activity_date":"2017-11-30 09:52:34.287 UTC","last_edit_date":"2017-11-30 09:25:10.967 UTC","last_editor_display_name":"","last_editor_user_id":"5320802","owner_display_name":"","owner_user_id":"9031651","post_type_id":"1","score":"0","tags":"java|xml|dom","view_count":"22"} {"id":"27069378","title":"String processing in Asterisk","body":"\u003cp\u003eIn an Asterisk dialplan, is there any way to search for a character (or substring) in another string? I basically want to parse out the middle portion of a string, but the exact character positions will vary.\u003c/p\u003e","accepted_answer_id":"27072429","answer_count":"1","comment_count":"0","creation_date":"2014-11-21 20:03:40.12 UTC","last_activity_date":"2014-11-22 00:03:23.097 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"17693","post_type_id":"1","score":"1","tags":"asterisk","view_count":"81"} {"id":"38941819","title":"Count specific characters in a cell - Excel","body":"\u003cp\u003eI would like to count all special characters (!%_*?+-,) in a cell.\u003c/p\u003e\n\n\u003cp\u003eFor example:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/1QIT7.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/1QIT7.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eWith this formula \u003ccode\u003e=LEN(D2)-LEN(SUBSTITUTE(D2;\"!\";\"\"))\u003c/code\u003e i can only count one character, but i need to count multiple characters in single cell...is there a way how to tweak this?\u003c/p\u003e\n\n\u003cp\u003eThanks for the help!\u003c/p\u003e","accepted_answer_id":"38942026","answer_count":"4","comment_count":"1","creation_date":"2016-08-14 11:35:29.203 UTC","favorite_count":"3","last_activity_date":"2016-08-14 12:22:47.657 UTC","last_edit_date":"2016-08-14 11:37:24.933 UTC","last_editor_display_name":"","last_editor_user_id":"235442","owner_display_name":"","owner_user_id":"6387302","post_type_id":"1","score":"2","tags":"excel|vba","view_count":"1018"} {"id":"8264973","title":"Why are anonymous namespaces preferred to static globals?","body":"\u003cblockquote\u003e\n \u003cp\u003e\u003cstrong\u003ePossible Duplicate:\u003c/strong\u003e\u003cbr\u003e\n \u003ca href=\"https://stackoverflow.com/questions/4422507/superiority-of-unnamed-namespace-over-static\"\u003eSuperiority of unnamed namespace over static?\u003c/a\u003e\u003cbr\u003e\n \u003ca href=\"https://stackoverflow.com/questions/4977252/why-unnamed-namespace-is-a-superior-alternative-to-static\"\u003eWhy unnamed namespace is a\u0026ldquo; superior\u0026rdquo; alternative to static?\u003c/a\u003e \u003c/p\u003e\n\u003c/blockquote\u003e\n\n\n\n\u003cp\u003eI know know anonymous namespaces are \"encouraged\" over static globals which are more C like (and deprecated), etc etc, and I use them often myself. However, despite having read other posts and questions about this topic, I haven't really seen explicit reasons why an anonymous namespace is better than a set of simple static globals.\u003c/p\u003e\n\n\u003cp\u003eIs there a definite reason why I should stick to the former?\u003c/p\u003e","accepted_answer_id":"8265044","answer_count":"1","comment_count":"5","creation_date":"2011-11-25 05:03:22.517 UTC","last_activity_date":"2011-11-25 05:47:18.797 UTC","last_edit_date":"2017-05-23 12:03:37.597 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"565058","post_type_id":"1","score":"2","tags":"c++|static|namespaces","view_count":"721"} {"id":"4107822","title":"jQuery radio button show div","body":"\u003cp\u003eHey guys, what function could I use to say, if this radio button is checked show this 'div'. \nThanks in advance.\u003c/p\u003e","accepted_answer_id":"4108027","answer_count":"4","comment_count":"0","creation_date":"2010-11-05 16:19:06.617 UTC","favorite_count":"1","last_activity_date":"2013-01-25 13:28:28.667 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"363549","post_type_id":"1","score":"1","tags":"jquery|html","view_count":"11288"} {"id":"45001725","title":"Openfiledialog shows the full path with backslashes in filename box in C#","body":"\u003cp\u003eOpenFileDialog object which has \u003ccode\u003eRestoreDirectory=True\u003c/code\u003e shows the filename as fullpath same as the filename selected before. In the first time I open the dialog it works normally, but in the others it shows the fullpath like in below images.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eFirst opening of OpenFileDialog\u003c/strong\u003e\n\u003ca href=\"https://i.stack.imgur.com/AOxiT.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/AOxiT.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eSecond opening\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/iQHcY.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/iQHcY.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eWhat is the reason of this problem?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-07-09 22:40:46.92 UTC","last_activity_date":"2017-07-10 05:38:05.893 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5698517","post_type_id":"1","score":"0","tags":"c#|filenames|openfiledialog","view_count":"41"} {"id":"21191339","title":"Tweens working on Added to Stage, but not in response to button click","body":"\u003cp\u003eI have four multiple choice questions (sprites containing text fields) that I initially set to not visible. When a button is clicked, I make them visible, then I want them to fade to alpha 0, with only the correct answer remaining. The following code accomplishes this -- but only when I call initTweens() on the addedToStage handler. If I try to call it from the button click event -- playClickHandler -- the alpha fades don't happen. Can anyone see why?\u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epackage\n{\nimport com.greensock.TimelineLite;\nimport com.greensock.TweenLite;\nimport com.greensock.easing.*;\n\nimport flash.display.Bitmap;\nimport flash.display.GradientType;\nimport flash.display.Graphics;\nimport flash.display.Shape;\nimport flash.display.Sprite;\nimport flash.events.Event;\nimport flash.events.MouseEvent;\nimport flash.geom.Matrix;\nimport flash.net.URLRequest;\nimport flash.net.navigateToURL;\nimport flash.text.TextField;\nimport flash.text.TextFieldAutoSize;\nimport flash.text.TextFieldType;\nimport flash.text.TextFormat;\n\nimport views.Icons;\n\n[SWF(width=\"400\", height=\"350\", backgroundColor=\"0xffffff\")]\npublic class game extends Sprite\n{\n//sprites\nprivate var container:Sprite;\nprivate var question:Sprite = new Sprite();\nprivate var answer1:Sprite = new Sprite();\nprivate var answer2:Sprite = new Sprite();\nprivate var answer3:Sprite = new Sprite();\nprivate var answer4:Sprite = new Sprite();\nprivate var explanation:Sprite = new Sprite();\nprivate var playButton:Sprite;\n\n//text fields\nprivate var txtQuestion:TextField = new TextField();\nprivate var txtAnswer1:TextField = new TextField();\nprivate var txtAnswer2:TextField = new TextField();\nprivate var txtAnswer3:TextField = new TextField();\nprivate var txtAnswer4:TextField = new TextField();\nprivate var txtExplanation:TextField = new TextField();\nprivate var vBuffer:Number = 10;\n\n//strings for textfields\nprivate var currentQuestion:String;\nprivate var currentAnswer1:String;\nprivate var currentAnswer2:String;\nprivate var currentAnswer3:String;\nprivate var currentAnswer4:String;\nprivate var currentExplanation:String;\n\nprivate var questionSets:Array = [];\nprivate var timeline:TimelineLite = new TimelineLite();\nprivate var fadeSpeed:Number = 3;\n\nprivate var bmpplayButton:Bitmap;\nprivate var centeredAnswerPosition:Number;\n\n//create a keyword which will trigger the presentation of a given questionSet\nprivate var keyWord:String;\n\nprivate var questionObj:Object;\n\nprivate var textWidth:Number = 400;\nprivate var textHeight:Number;\n\npublic function game()\n{\nthis.addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);\n}\n\nprivate function addedToStageHandler(e:Event):void\n{\nbmpplayButton = new Icons.PlayButtonMedium();\nloadData(\"amzn\");\nsetUpQuestion();\n//initTweens(); //this works\n}\n\nprivate function playClickHandler(e:MouseEvent):void\n{\nmakeVisible();\ninitTweens(); //code runs, but this doesn't work -- the alpha changes don't happen.\n}\n\n\nprivate function makeVisible():void\n{\nanswer1.visible = true;\nanswer2.visible = true;\nanswer3.visible = true;\nanswer4.visible = true;\nexplanation.visible = true;\n}\n\nprivate function initTweens():void\n{\ntimeline.insert(TweenLite.to(answer1,fadeSpeed, {autoAlpha:0, delay:4}),0);\ntimeline.insert(TweenLite.to(answer3,fadeSpeed, {autoAlpha:0, delay:7}),0);\ntimeline.insert(TweenLite.to(answer4,fadeSpeed, {autoAlpha:0, delay:10}),0);\ntimeline.insert(TweenLite.to(answer2, 2, {x:100,scaleX:2, scaleY:2, delay: 12}),0);\ntimeline.insert(TweenLite.to(explanation, fadeSpeed, {autoAlpha:1, delay:14}),0);\ntimeline.append(TweenLite.delayedCall(3, clear));\n}\n\n\n\nprivate function setUpQuestion():void\n{\ncontainer = new Sprite();\ncontainer.name = \"container\";\ncontainer.buttonMode = true;\ncontainer.useHandCursor = true;\naddChild(container);\n\n\ntxtQuestion.name = \"txtQuestion\";\ntxtQuestion.width = textWidth;\ntxtQuestion.wordWrap = true;\ntxtQuestion.multiline = true;\ntxtQuestion.type = TextFieldType.DYNAMIC;\ntxtQuestion.autoSize = TextFieldAutoSize.LEFT;\nquestion.addChild(txtQuestion);\n\nvar textFormat:TextFormat = new TextFormat(\"Arial\", 14, 0x000000, false, false, false, \"\", \"\", \"left\", 0, 0, 0, 0);\ntxtQuestion.setTextFormat(textFormat);\ntxtQuestion.defaultTextFormat = textFormat;\ntxtQuestion.text = currentQuestion;\n\nanswer1.y = question.y + question.height + vBuffer;\ntxtAnswer1.width = textWidth;\ntxtAnswer1.wordWrap = true;\ntxtAnswer1.multiline = true;\ntxtAnswer1.type = TextFieldType.DYNAMIC;\ntxtAnswer1.autoSize = TextFieldAutoSize.LEFT;\ntxtAnswer1.setTextFormat(textFormat);\ntxtAnswer1.defaultTextFormat = textFormat;\ntxtAnswer1.text = currentAnswer1;\nanswer1.addChild(txtAnswer1);\nanswer1.visible = false;\n\nanswer2.y = answer1.y + answer1.height + vBuffer\ntxtAnswer2.width = textWidth;\ntxtAnswer2.wordWrap = true;\ntxtAnswer2.multiline = true;\ntxtAnswer2.type = TextFieldType.DYNAMIC;\ntxtAnswer2.autoSize = TextFieldAutoSize.LEFT;\ntxtAnswer2.setTextFormat(textFormat);\ntxtAnswer2.defaultTextFormat = textFormat;\ntxtAnswer2.text = currentAnswer2;\nanswer2.addChild(txtAnswer2);\ncenteredAnswerPosition = stage.stageWidth/2 - answer2.width/2;\nanswer2.visible = false;\n\nanswer3.y = answer2.y + answer2.height + vBuffer;\ntxtAnswer3.width = textWidth;\ntxtAnswer3.wordWrap = true;\ntxtAnswer3.multiline = true;\ntxtAnswer3.type = TextFieldType.DYNAMIC;\ntxtAnswer3.autoSize = TextFieldAutoSize.LEFT;\ntxtAnswer3.setTextFormat(textFormat);\ntxtAnswer3.defaultTextFormat = textFormat;\ntxtAnswer3.text = currentAnswer3;\nanswer3.addChild(txtAnswer3);\nanswer3.visible = false;\n\nanswer4.y = answer3.y + answer3.height + vBuffer;\ntxtAnswer4.width = textWidth;\ntxtAnswer4.wordWrap = true;\ntxtAnswer4.multiline = true;\ntxtAnswer4.type = TextFieldType.DYNAMIC;\ntxtAnswer4.autoSize = TextFieldAutoSize.LEFT;\ntxtAnswer4.setTextFormat(textFormat);\ntxtAnswer4.defaultTextFormat = textFormat;\ntxtAnswer4.text = currentAnswer4;\nanswer4.addChild(txtAnswer4);\nanswer4.visible = false;\n\nexplanation.y = answer4.y + answer4.height + vBuffer;\nexplanation.alpha = 0; //hide it\ntxtExplanation.width = textWidth;\ntxtExplanation.wordWrap = true;\ntxtExplanation.multiline = true;\ntxtExplanation.type = TextFieldType.DYNAMIC;\ntxtExplanation.autoSize = TextFieldAutoSize.LEFT;\ntxtExplanation.y = txtAnswer4.y + txtAnswer1.height + vBuffer;\ntxtExplanation.setTextFormat(textFormat);\ntxtExplanation.defaultTextFormat = textFormat;\ntxtExplanation.text = currentExplanation;\nexplanation.addChild(txtExplanation);\nexplanation.visible = false;\n\nplayButton = new Sprite();\nplayButton.name = \"play\";\nplayButton.buttonMode = true;\nplayButton.useHandCursor = true;\nplayButton.addChild(bmpplayButton);\nplayButton.x = stage.stageWidth/2 - playButton.width/2;\nplayButton.y = explanation.y + explanation.height + 5*vBuffer;\nplayButton.addEventListener(MouseEvent.CLICK, playClickHandler);\n\ncontainer.addChild(question);\ncontainer.addChild(answer1);\ncontainer.addChild(answer2);\ncontainer.addChild(answer3);\ncontainer.addChild(answer4);\ncontainer.addChild(explanation);\ncontainer.addChild(playButton);\n}\n\n\nprivate function loadData(questionSet:String):void\n{\nswitch(questionSet)\n{\ncase \"cap\":\ncurrentQuestion = \"What is the term for the number of a company's shares currently available for trading?\";\ncurrentAnswer1 = \"The Cap\" ;\ncurrentAnswer2 = \"The Float\";\ncurrentAnswer3 = \"The Book\";\ncurrentAnswer4 = \"The Major Leagues\";\ncurrentExplanation = \"If a large percentage of the float is 'short' then it can set up a short squeeze.\";\nbreak;\ncase \"amzn\":\ncurrentQuestion = \"How much has Amazon gone up in the last 10 years?\";\ncurrentAnswer1 = \"100%\" ;\ncurrentAnswer2 = \"10000%\";\ncurrentAnswer3 = \"1000%\";\ncurrentAnswer4 = \"400%\";\ncurrentExplanation = \"Yes, it's gone up a hundredfold. Buy and hold!\";\nbreak;\n}\n\n}\n\nprivate function clear():void\n{\nquestion.visible = false;\nanswer1.visible = false;\nanswer2.visible = false;\nanswer3.visible = false;\nanswer4.visible = false;\nexplanation.visible = false;\n}\n}\n} \n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"21219589","answer_count":"2","comment_count":"0","creation_date":"2014-01-17 16:48:32.173 UTC","last_activity_date":"2015-10-06 09:20:27.017 UTC","last_edit_date":"2015-10-06 09:20:27.017 UTC","last_editor_display_name":"","last_editor_user_id":"1213296","owner_display_name":"","owner_user_id":"182683","post_type_id":"1","score":"0","tags":"actionscript-3|flex|flex4.5|greensock|flash-builder4.5","view_count":"99"} {"id":"24314942","title":"Map ViewModel to IdentityUser","body":"\u003cp\u003eI have some additional fields on my User Class for Asp.Net Identity:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class User : IdentityUser\n{ \n public string Website { get; set; }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI have a ViewModel for users:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e public class UserViewModel\n {\n public string UserId { get; set; }\n\n public string Website { get; set; }\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd here is my mapping:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Mapper.CreateMap\u0026lt;UserViewModel, User\u0026gt;()\n .ForMember(dest =\u0026gt; dest.Id, opt =\u0026gt; opt.MapFrom(src =\u0026gt; src.UserId));\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt fails when I try to save a new user, saying Id can't be null:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e public async Task\u0026lt;ActionResult\u0026gt; ExternalLoginConfirmation(UserViewModel model, string returnUrl)\n { \n var user = Mapper.Map\u0026lt;User\u0026gt;(model);\n IdentityResult result = await UserManager.CreateAsync(user);\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow do I correctly map the Id field?\u003c/p\u003e","accepted_answer_id":"24321139","answer_count":"1","comment_count":"4","creation_date":"2014-06-19 19:38:01.733 UTC","last_activity_date":"2014-06-20 06:23:37.86 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"589089","post_type_id":"1","score":"0","tags":"c#|automapper|asp.net-identity","view_count":"397"} {"id":"10152241","title":"detect if an ASIHTTPReuquest is working","body":"\u003cp\u003eI hope detect an ASIHTTPRequest is working or not,\nThus I can cancel the async request of the ASIHttp.\u003c/p\u003e\n\n\u003cp\u003eIs there a way to detect if an ASIHTTPReuquest request is working?\u003c/p\u003e\n\n\u003cp\u003eWelcome any comment\u003c/p\u003e","accepted_answer_id":"10170392","answer_count":"2","comment_count":"1","creation_date":"2012-04-14 08:41:24.503 UTC","last_activity_date":"2015-11-08 17:21:17.67 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"262325","post_type_id":"1","score":"0","tags":"iphone","view_count":"59"} {"id":"11053805","title":"How can I manage Twig inheritance across multiple bundles?","body":"\u003cp\u003eI'm (still) a beginner with Symfony and have been reading about \u003ca href=\"http://symfony.com/doc/current/book/templating.html#three-level-inheritance\" rel=\"nofollow\"\u003ethree-level inheritance\u003c/a\u003e with Twig.\u003c/p\u003e\n\n\u003cp\u003eIf you define blocks in your bundle their names might be bundle specific and not match block names defined in your app \u003ccode\u003ebase.html.twig\u003c/code\u003e or other bundles, or even the names could be the same but the usage could be different.\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eHas anyone found this to be a problem?\u003c/li\u003e\n\u003cli\u003eAre there ways to manage this, will overriding templates under \u003ccode\u003eapp/\u003c/code\u003e help?\u003c/li\u003e\n\u003cli\u003eAre there any conventions for block names or anything else that will minimise maintenance problems?\u003c/li\u003e\n\u003c/ul\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-06-15 15:32:03.883 UTC","last_activity_date":"2012-06-16 04:40:57.437 UTC","last_edit_date":"2012-06-15 15:48:07.263 UTC","last_editor_display_name":"","last_editor_user_id":"598832","owner_display_name":"","owner_user_id":"598832","post_type_id":"1","score":"0","tags":"symfony|twig","view_count":"747"} {"id":"45321429","title":"JSP: How to add value in a list with onClick or onSubmit event?","body":"\u003cp\u003eHi everyone I am new to JSP. I'm working on a simple activity where I can add add a user on a list and display it. The displaying of the list of users works fine but I have problem in adding a user. \u003c/p\u003e\n\n\u003cp\u003eThe code below displays the List of Users: \u003c/p\u003e\n\n\u003cp\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-html lang-html prettyprint-override\"\u003e\u003ccode\u003e\u0026lt;div id=\"userList\"\u0026gt;\r\n \u0026lt;h3\u0026gt;List of Users\u0026lt;/h3\u0026gt;\r\n \u0026lt;ul\u0026gt;\r\n \u0026lt;% for (User user : data.getUsers())\r\n {%\u0026gt;\r\n \u0026lt;li\u0026gt;\r\n -\u0026lt;%= user.getFirstName()%\u0026gt; \r\n \u0026lt;%= user.getLastName()%\u0026gt; \r\n \u0026lt;br\u0026gt;Address: \u0026lt;%= user.getAddress()%\u0026gt;\r\n \u0026lt;br\u0026gt;Age: \u0026lt;%= user.getAge()%\u0026gt;\r\n \u0026lt;/li\u0026gt;\r\n \u0026lt;%}%\u0026gt;\r\n \u0026lt;/ul\u0026gt;\r\n\u0026lt;/div\u0026gt;\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/p\u003e\n\n\u003cp\u003eThe Code below is the form to add user:\u003c/p\u003e\n\n\u003cp\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-html lang-html prettyprint-override\"\u003e\u003ccode\u003e\u0026lt;form onsubmit=\"addToList()\"\u0026gt;\r\n \u0026lt;ul\u0026gt;\r\n \u0026lt;li\u0026gt;\r\n \u0026lt;h3\u0026gt;Add User\u0026lt;/h3\u0026gt;\r\n \u0026lt;/li\u0026gt;\r\n \u0026lt;li\u0026gt;\r\n First Name: \u0026lt;input id=\"firstNameField\" type=\"Text\" \u0026gt;\u0026lt;/input\u0026gt;\r\n Last Name: \u0026lt;input id=\"lastNameField\" type=\"Text\"\u0026gt;\u0026lt;/input\u0026gt;\r\n \u0026lt;/li\u0026gt;\r\n \u0026lt;li\u0026gt;\r\n Age: \u0026lt;input id=\"ageField\" type=\"Text\" \u0026gt;\u0026lt;/input\u0026gt;\r\n Address: \u0026lt;input id=\"addressField\" type=\"Text\"\u0026gt;\u0026lt;/input\u0026gt;\r\n \u0026lt;/li\u0026gt;\r\n \u0026lt;li\u0026gt;\r\n \u0026lt;button id=\"submit\" onclick=\"addToList()\"\u0026gt;Submit\u0026lt;/button\u0026gt;\r\n \u0026lt;/li\u0026gt;\r\n \u0026lt;/ul\u0026gt;\r\n \u0026lt;/form\u0026gt;\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/p\u003e\n\n\u003cp\u003eAnd here is the code that handle the event:\u003c/p\u003e\n\n\u003cp\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-js lang-js prettyprint-override\"\u003e\u003ccode\u003e\u0026lt;--Javascript--\u0026gt;\r\n\u0026lt;script\u0026gt;\r\n function addToList()\r\n {\r\n \u0026lt;%data.addUsers(request.getParameter(\"firstNameField\"), request.getParameter(\"lastNameField\"), request.getParameter(\"ageField\"), request.getParameter(\"addressField\"));%\u0026gt; \u0026lt;%-- data.adduser adds user to sample data --\u0026gt; \r\n }\r\n\u0026lt;/script\u0026gt;\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/p\u003e\n\n\u003cp\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-js lang-js prettyprint-override\"\u003e\u003ccode\u003e\u0026lt;--JQuery--\u0026gt;\r\n\u0026lt;script\u0026gt;\r\n $(document).ready(function () {\r\n $(\"#submit\").click(function () {\r\n \u0026lt;%\r\n data.addUsers(request.getParameter(\"firstNameHidden\"), request.getParameter(\"lastNameHidden\"), request.getParameter(\"ageHidden\"), request.getParameter(\"addressHidden\"));\r\n %\u0026gt;\r\n });\r\n });\r\n\u0026lt;/script\u0026gt;\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/p\u003e\n\n\u003cp\u003eWhen I run it there is a new user added with null values but when I try to submit again it will not trigger the event. Can someone enlighten me if I'm doing something wrong? Thank you.\u003c/p\u003e","accepted_answer_id":"45339766","answer_count":"2","comment_count":"6","creation_date":"2017-07-26 08:29:31.137 UTC","last_activity_date":"2017-07-27 02:08:34.073 UTC","last_edit_date":"2017-07-26 08:54:39.683 UTC","last_editor_display_name":"","last_editor_user_id":"8335236","owner_display_name":"","owner_user_id":"8335236","post_type_id":"1","score":"1","tags":"java|jsp","view_count":"90"} {"id":"46165440","title":"How do you get a custom element to load using Aurelia","body":"\u003cp\u003eI have a custom element like the nav-bar in the skeleton-navigation except I am not using the router part. I can't seem to get it to fire any events.\u003c/p\u003e\n\n\u003cp\u003eCode:\nnav-bar.html\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;template\u0026gt;\n \u0026lt;ul id=\"topMenu\"\u0026gt;\u0026lt;/ul\u0026gt;\n\u0026lt;/template\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003enav-bar.js\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e attached() {\n alert('test')\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eContaining page:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;template\u0026gt;\n \u0026lt;require from=\"./nav-bar.html\"\u0026gt;\u0026lt;/require\u0026gt;\n\n \u0026lt;div class=\"desktop\" id=\"container\"\u0026gt;\n \u0026lt;nav-bar\u0026gt;\u0026lt;/nav-bar\u0026gt;\n \u0026lt;/div\u0026gt;\n\n\u0026lt;/template\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"46165863","answer_count":"1","comment_count":"1","creation_date":"2017-09-11 22:57:34.35 UTC","last_activity_date":"2017-09-11 23:49:49.597 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1673241","post_type_id":"1","score":"0","tags":"aurelia","view_count":"27"} {"id":"31266106","title":"JsonWebToken encode is undefined","body":"\u003cp\u003eI'm creating my first ever login system, using JsonWebTokens, and I've hit an obstacle trying to use the \u003ccode\u003eencode\u003c/code\u003e function.\u003c/p\u003e\n\n\u003cp\u003eMy error message says: \u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eif (this.ended \u0026amp;\u0026amp; !this.hasRejectListeners()) throw reason;\n ^ TypeError: undefined is not a function\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eand I've managed to narrow the error down to this line of code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar jwt = require('jsonwebtoken');\n\n jwt.encode(payload, superSecret);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe function this is a part of looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar moment = require('moment');\nvar jwt = require('jsonwebtoken');\nvar superSecret = require('../config/token.js').secret;\n\n function (user) {\n\n var payload = {\n sub: user._id,\n iat: moment().unix(),\n exp: moment().add(14, 'days').unix()\n };\n\n return = jwt.encode(payload, superSecret);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNeedless to say, since this is the first time I'm authenticating anything, I don't know why this would cause an error. Please help.\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2015-07-07 10:31:06.933 UTC","last_activity_date":"2015-07-07 10:51:32.693 UTC","last_edit_date":"2015-07-07 10:51:32.693 UTC","last_editor_display_name":"","last_editor_user_id":"4049536","owner_display_name":"","owner_user_id":"4049536","post_type_id":"1","score":"0","tags":"javascript|authentication|jwt|json-web-token","view_count":"461"} {"id":"33426162","title":"Read and write json files to server with flask","body":"\u003cp\u003eI need a json file on the server to store some data, but it won't be too big to need a database. So I try to read the file, and after I finish using it I will need to overwrite the data to keep update.\nI tried like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@app.route(\"/json\")\ndef readwrite():\n SITE_ROOT = os.path.realpath(os.path.dirname(__file__))\n json_url = os.path.join(SITE_ROOT,'static', 'test.json')\n token = open(json_url)\n return token\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut I get a 404 error on those. I'm not sure how I can read out those data and further rewrite. Please help if you see any problem in my code. Thanks!\u003c/p\u003e","accepted_answer_id":"33426354","answer_count":"1","comment_count":"1","creation_date":"2015-10-29 23:04:50.337 UTC","last_activity_date":"2015-10-29 23:22:15.677 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5323259","post_type_id":"1","score":"-1","tags":"python|json|flask","view_count":"1220"} {"id":"20849274","title":"Chrome css3 animation display bug","body":"\u003cp\u003eI'm trying to make an animation using css3.\nbasically the idea is to split up an image into cubes and rotate each cube separately by 180deg to show the image on the other side.\u003c/p\u003e\n\n\u003cp\u003eHere's a \u003ca href=\"http://jsfiddle.net/JUvnm/2/\" rel=\"nofollow noreferrer\"\u003efiddle\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI got 16 cubes like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"cubeOuter\" style=\"width: 100px; height: 75px; position: absolute; left: 100px; top: 0px;\"\u0026gt;\n \u0026lt;div class=\"cube rotate\"\u0026gt;\n \u0026lt;div class=\"bottom\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"top\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"left\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"right\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"back\"\u0026gt;\n \u0026lt;img src=\"someimage.jpg\" width=\"400\" height=\"300\" \n style=\"position: absolute; display: block; left: -100px; top: 0px;\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"front\"\u0026gt;\n \u0026lt;img src=\"anotherimage.jpg\" width=\"400\" height=\"300\" \n style=\"position: absolute; display: block; left: -100px; top: 0px;\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe positions are different for each block, so that they form the whole image.\u003c/p\u003e\n\n\u003cp\u003eIt looks fine in Firefox, but in Chrome and Opera (using the latest stable versions) the sides of the cubes are showing through.\nHere's an image of what chrome is rendering (the sides are red, as you can see, they're showing through the image):\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://imgur.com/axrczFk\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.imgur.com/axrczFk.jpg\" title=\"Hosted by imgur.com\" /\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eAny ideas how to fix it for Chrome and Opera?\u003c/p\u003e\n\n\u003cp\u003eThe error does't occur if there are only 2 cubes per axis (2x2, 1x2, 2x1)\u003c/p\u003e","accepted_answer_id":"20861355","answer_count":"2","comment_count":"0","creation_date":"2013-12-30 23:23:55.56 UTC","last_activity_date":"2013-12-31 17:52:15.607 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1680837","post_type_id":"1","score":"3","tags":"html|css|google-chrome|css-animations","view_count":"398"} {"id":"8037324","title":"Issue with getting Facebook pages like count in my account","body":"\u003cp\u003e\u003cstrong\u003eRequirement\u003c/strong\u003e: Get like count of all pages under my FB account. \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eFQL\u003c/strong\u003e \u003ca href=\"https://api.facebook.com/method/fql.query?query=SELECT+user_id,object_id,post_id+FROM+like+WHERE+user_id=me()\" rel=\"nofollow noreferrer\"\u003ehttps://api.facebook.com/method/fql.query?query=SELECT+user_id,object_id,post_id+FROM+like+WHERE+user_id=me()\u003c/a\u003e \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eProblem\u003c/strong\u003e Every time i hit this FQL, i get the following ERROR:\u003cbr\u003e\n\"Querying like on user_id requires the read_stream extended permission.\" \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eSource\u003c/strong\u003e\n\u003ca href=\"https://stackoverflow.com/questions/4877919/get-facebook-like-count-for-every-page-on-my-domain\"\u003eGet Facebook \u0026quot;Like\u0026quot; count for every page on my domain\u003c/a\u003e \u003c/p\u003e\n\n\u003cp\u003ePlease help me to solve this issue.\u003c/p\u003e\n\n\u003cp\u003eBest Regards,\u003cbr\u003e\nMohit\u003c/p\u003e","accepted_answer_id":"8037526","answer_count":"1","comment_count":"0","creation_date":"2011-11-07 13:48:31.367 UTC","favorite_count":"1","last_activity_date":"2011-11-07 14:04:37.997 UTC","last_edit_date":"2017-05-23 10:24:21.707 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"1033836","post_type_id":"1","score":"0","tags":"facebook-fql","view_count":"992"} {"id":"32437256","title":"parameter is null while sending post request to webAPi from angularjs","body":"\u003cp\u003eI am trying to call one method but parameter is coming out as null\u003c/p\u003e\n\n\u003cp\u003eServer Side Code\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[HttpPost]\n public IHttpActionResult PostRule(ActionRuleParameter actionRule)\n {\n // SOME CODE \n return BadRequest();\n }\n\n public class ActionRuleParameter\n {\n public string action;\n public string rule;\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eClient Side Code\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eaddRule: function ($scope) {\n //var data = { \"action\": \"post\", \"rule\": { \"ID\": \"1\", \"Name\": \"Ramesh\", \"PassFail\": \"Pass\" } }\n\n var data1 = { \"action\": \"post\",\"rule\":\"rule\" };\n\n\n $http({\n url: urlContent + '/api/Rules',\n method: \"POST\",\n data: { \"actionRule\": data1 }\n }).success(function (response) {\n $scope.rules = response;\n });;\n },\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003ccode\u003eaction\u003c/code\u003e and \u003ccode\u003erule\u003c/code\u003e are coming out as null.\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2015-09-07 11:11:21.627 UTC","favorite_count":"1","last_activity_date":"2015-09-07 11:16:31.18 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"795420","post_type_id":"1","score":"1","tags":"javascript|c#|json|angularjs|asp.net-web-api2","view_count":"980"} {"id":"35769951","title":"Locate input element and send filepath to upload file","body":"\u003cp\u003eI am trying to upload a file using selenium web driver. The UI has an upload button which is inside a div tag. The button has a hidden textbox which is inside a span tag. I am able to locate till the span tag.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"ng-scope\" ng-if=\"showUpload\" style=\"padding-bottom:5px;\"\u0026gt;\n\u0026lt;div class=\"btn ng-binding\" ng-class=\"class\" flow-drop=\"\" style=\"padding-top:30px;vertical-align:middle;width:370px;height:100px;background-color:#eee;border:1px solid #ccc\" ng-style=\"style\" flow-drag-leave=\"style={border:'1px solid #ccc'}\" flow-drag-enter=\"style={border:'1px solid #007670'}\" flow-prevent-drop=\"\"\u0026gt;Drag and Drop your files here.\u0026lt;/div\u0026gt;\n\u0026lt;span class=\"ng-binding\" style=\"padding:0 20px\"\u0026gt;or\u0026lt;/span\u0026gt;\n\u0026lt;span class=\"btn btn-primary ng-binding\" flow-attrs=\"{accept:'image/*,.pdf,.csv,.txt,.doc'}\" flow-btn=\"\"\u0026gt;\n\u0026lt;i class=\"icon icon-file\"/\u0026gt;\nUpload File \n\u0026lt;input type=\"file\" style=\"visibility: hidden; position: absolute; width: 1px; height: 1px;\" multiple=\"multiple\" accept=\"image/*,.pdf,.csv,.txt,.doc\"/\u0026gt;\n\u0026lt;/span\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am able to locate the input tag by firepath, but the same using java code doesnt work.\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003eWebElement m_upload = driver.findElement(By.CssSelector(\"input[type='files']\"));\u003c/code\u003e returns null.\nCan anyone tell me how to go about this?\u003c/p\u003e","answer_count":"2","comment_count":"5","creation_date":"2016-03-03 10:45:13.417 UTC","last_activity_date":"2016-03-03 12:17:15.817 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3445505","post_type_id":"1","score":"0","tags":"html|angularjs|selenium","view_count":"42"} {"id":"43518026","title":"AndroidStudio shall not reformat case-statement","body":"\u003cp\u003eI have a switch statement with lots of small cases like\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eswitch (someValue) {\n case 1: message= \"This is message 1\"; break;\n case 2: message= \"This is something 2\"; break;\n case 3: message= \"Here we go with 3\"; break;\n case 4: message= \"and so on\"; break;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAndroidStudio always blows up lines by 3 into \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e case 1:\n message= \"This is message 1\";\n break;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIn this particular case tabular style is better to understand than the expanded version and it saves scrolling too.\u003cbr\u003e\nCan I tell Studio to leave this style for \u003ccode\u003ecase\u003c/code\u003e? Settings are full of stuff concerning formatting but nothing that looks close to my wish works.\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-04-20 11:17:59.157 UTC","last_activity_date":"2017-04-20 11:20:04.047 UTC","last_edit_date":"2017-04-20 11:20:04.047 UTC","last_editor_display_name":"","last_editor_user_id":"4826457","owner_display_name":"","owner_user_id":"3771449","post_type_id":"1","score":"0","tags":"java|android-studio|case|autoformat","view_count":"13"} {"id":"20322725","title":"getting error \"Errors occurred during the build.\" on using ggts","body":"\u003cp\u003eI am ggts to run my grails project. Whenever I save any edit i get a popup saying\u003c/p\u003e\n\n\u003cp\u003e'Building Workspace has encountered a problem'\u003c/p\u003e\n\n\u003cp\u003eon clicking on details I get\u003c/p\u003e\n\n\u003cp\u003eErrors occurred during the build.\nErrors running builder 'Java Builder' on project 'peelworkscustomer2.0'.\nCould not initialize class org.slf4j.LoggerFactory\u003c/p\u003e\n\n\u003cp\u003eI am unable to remove this error.\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2013-12-02 07:12:32.5 UTC","last_activity_date":"2013-12-02 07:29:59.603 UTC","last_edit_date":"2013-12-02 07:29:59.603 UTC","last_editor_display_name":"","last_editor_user_id":"6509","owner_display_name":"","owner_user_id":"1230483","post_type_id":"1","score":"0","tags":"java|eclipse|grails|logging","view_count":"238"} {"id":"46818885","title":"SQL Import Wizard - Error","body":"\u003cp\u003eI have a CSV file that I'm trying to import into SQL Management Server Studio.\u003c/p\u003e\n\n\u003cp\u003eIn Excel, the column giving me trouble looks like this:\n\u003ca href=\"https://i.stack.imgur.com/pm0uS.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/pm0uS.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eTasks \u003e import data \u003e Flat Source File \u003e select file\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/G4b6I.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/G4b6I.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI set the data type for this column to DT_NUMERIC, adjust the DataScale to 2 in order to get 2 decimal places, but when I click over to Preview, I see that it's clearly not recognizing the numbers appropriately:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/NZhiQ.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/NZhiQ.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eThe column mapping for this column is set to type = decimal; precision 18; scale 2.\u003c/p\u003e\n\n\u003cp\u003eError message: Data Flow Task 1: Data conversion failed. The data conversion for column \"Amount\" returned status value 2 and status text \"The value could not be converted because of a potential loss of data.\".\n (SQL Server Import and Export Wizard)\u003c/p\u003e\n\n\u003cp\u003eCan someone identify where I'm going wrong here? Thanks!\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2017-10-18 20:40:39.95 UTC","last_activity_date":"2017-10-18 20:45:18.393 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7178871","post_type_id":"1","score":"0","tags":"sql-server","view_count":"12"} {"id":"45076825","title":"BigQuery SPLIT manual creation of table","body":"\u003cp\u003eIn reference to this \u003ca href=\"https://stackoverflow.com/questions/44134145/create-a-table-in-big-query\"\u003equestion\u003c/a\u003e I would like to create multiple columns manually.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT SPLIT(Titles) AS Title \nFROM (SELECT 'Title 1,Title 2,Title 3,Title 4' AS Titles)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI have tried simply adding new column like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT SPLIT(Titles) AS Title, SPLIT(Names) AS Name,FROM (SELECT 'Title 1,Title 2,Title 3,Title 4' AS Titles, 'Name 1,Name 2,Name 3,Name 4' AS NAMES)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever BQ shows me following error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eError: Cannot output multiple independently repeated fields at the same time. Found Title and Name\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI think it could be related how BQ flatten the results and I found similar problem \u003ca href=\"https://stackoverflow.com/questions/25583878/flattening-google-analytics-data-with-repeated-fields-not-working-anymore\"\u003ehere\u003c/a\u003e. Unfortunately I am not able to transform my code. I can use just Legacy SQL.\u003c/p\u003e\n\n\u003cp\u003eEDIT: \nExpected table should look like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e-- +---------+--------+\n-- | Title | Name |\n-- +---------+--------+\n-- | Title 1 | Name 1 |\n-- | Title 2 | Name 2 | \n-- | Title 3 | Name 3 |\n-- | Title 4 | Name 4 |\n-- +---------+--------+\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"45083660","answer_count":"1","comment_count":"2","creation_date":"2017-07-13 09:36:45.79 UTC","last_activity_date":"2017-07-13 14:42:03.783 UTC","last_edit_date":"2017-07-13 14:15:26.653 UTC","last_editor_display_name":"","last_editor_user_id":"7952096","owner_display_name":"","owner_user_id":"7952096","post_type_id":"1","score":"1","tags":"sql|r|google-bigquery","view_count":"57"} {"id":"2205927","title":"Retrieving server address from email","body":"\u003cp\u003eHow can I retrieve mail's SMTP server from email (for example oneat@op.pl) ?\u003c/p\u003e","answer_count":"3","comment_count":"0","creation_date":"2010-02-05 08:42:45.943 UTC","last_activity_date":"2012-11-17 20:37:14.647 UTC","last_edit_date":"2012-11-17 20:37:14.647 UTC","last_editor_display_name":"","last_editor_user_id":"60462","owner_display_name":"","owner_user_id":"257530","post_type_id":"1","score":"1","tags":"dns|smtp","view_count":"479"} {"id":"30438585","title":"WebService(asmx) serialize issue with related objects","body":"\u003cp\u003eI'm using EF codefirst with existing database in my webservice projects. I have User object.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic partial class User\n{\n public string Id { get; set; }\n\n public string Email { get; set; }\n\n public bool EmailConfirmed { get; set; }\n\n public string PasswordHash { get; set; }\n\n public string SecurityStamp { get; set; }\n\n public string PhoneNumber { get; set; }\n\n public bool PhoneNumberConfirmed { get; set; }\n\n public bool TwoFactorEnabled { get; set; }\n\n public DateTime? LockoutEndDateUtc { get; set; }\n\n public bool LockoutEnabled { get; set; }\n\n public int AccessFailedCount { get; set; }\n\n public string UserName { get; set; }\n\n public string Name { get; set; }\n\n public string Surname { get; set; }\n\n public DateTime? BirthDay { get; set; }\n\n public int? BirthPlace { get; set; }\n\n public string Discriminator { get; set; }\n\n public int? TeamId { get; set; }\n\n public int? AvatarId { get; set; }\n\n public DateTime? RegisterationDate { get; set; }\n\n public DateTime? CodeSendDate { get; set; }\n\n public string ActivationCode { get; set; }\n\n public string PasswordResetToken { get; set; }\n\n public string FacebookAvatar { get; set; }\n\n public string FacebookId { get; set; }\n\n public bool? UseFacebookAvatar { get; set; }\n\n public string Address { get; set; }\n\n public string IpAddress { get; set; }\n\n public bool? SmsCheck { get; set; }\n\n [XmlIgnore]\n public virtual Avatar Avatar { get; set; }\n\n [XmlIgnore]\n public virtual ICollection\u0026lt;CouponApplicationUser\u0026gt; CouponApplicationUsers { get; set; }\n [XmlIgnore]\n public virtual ICollection\u0026lt;Coupon\u0026gt; Coupons { get; set; }\n [XmlIgnore]\n public virtual ICollection\u0026lt;UserClaim\u0026gt; UserClaims { get; set; }\n [XmlIgnore]\n public virtual ICollection\u0026lt;UserLogin\u0026gt; UserLogins { get; set; }\n [XmlIgnore]\n public virtual ICollection\u0026lt;UserRole\u0026gt; UserRoles { get; set; }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is my object relations : \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprotected override void OnModelCreating(DbModelBuilder modelBuilder)\n {\n modelBuilder.Entity\u0026lt;Avatar\u0026gt;()\n .HasMany(e =\u0026gt; e.Users)\n .WithOptional(e =\u0026gt; e.Avatar)\n .WillCascadeOnDelete();\n\n modelBuilder.Entity\u0026lt;User\u0026gt;()\n .HasMany(e =\u0026gt; e.CouponApplicationUsers)\n .WithRequired(e =\u0026gt; e.User)\n .HasForeignKey(e =\u0026gt; e.ApplicationUser_Id);\n\n modelBuilder.Entity\u0026lt;User\u0026gt;()\n .HasMany(e =\u0026gt; e.UserClaims)\n .WithOptional(e =\u0026gt; e.User)\n .HasForeignKey(e =\u0026gt; e.IdentityUser_Id);\n\n modelBuilder.Entity\u0026lt;User\u0026gt;()\n .HasMany(e =\u0026gt; e.UserLogins)\n .WithOptional(e =\u0026gt; e.User)\n .HasForeignKey(e =\u0026gt; e.IdentityUser_Id);\n\n modelBuilder.Entity\u0026lt;User\u0026gt;()\n .HasMany(e =\u0026gt; e.UserRoles)\n .WithOptional(e =\u0026gt; e.User)\n .HasForeignKey(e =\u0026gt; e.IdentityUser_Id);\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMember.asmx : \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[WebMethod] \npublic User GetUser(string userId)\n{\n using (var context = new MemberContext())\n {\n var user = context.Users.FirstOrDefault(u =\u0026gt; u.Id == userId);\n return user;\n } \n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI m getting error while seriazlie on runtime. \u003c/p\u003e\n\n\u003cp\u003e\"System.InvalidOperationException: There was an error generating the XML document. ---\u003e System.InvalidOperationException: The type System.Data.Entity.DynamicProxies.User_43DB1D255133CC8990A023D6D7354697C201107F7F44D46786E12943B0163999 was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.\"\u003c/p\u003e\n\n\u003cp\u003eIts about related objects which have \u003cstrong\u003e[XmlIgnore]\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eI tried to remove relations and it worked. \u003c/p\u003e\n\n\u003cp\u003eWhat is the solution to ignore these properties on serialize ? \u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2015-05-25 12:37:28.11 UTC","last_activity_date":"2015-05-25 12:37:28.11 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"792891","post_type_id":"1","score":"0","tags":"c#|.net|asmx","view_count":"60"} {"id":"25483863","title":"How to structure SQL Statement to avoid so many joins","body":"\u003cp\u003eI am trying to build a select statement which will allow me to build a local in app cache when my application starts up. My table structure looks as follows;\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/onYTP.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eI know to get some help I must demonstrate what I have already attempted but its extremely \u003c/p\u003e\n\n\u003cp\u003eI am using hibernate which should make things easier but I am really hitting a road block, the only approach I can think of is to select all the fields and then do a left outer join on the table ids matching, however the issue with this approach is that one user can have 0-1 business cards/ 0-1 social cards, 0-1 personal cards which means when i left outer join some of the data potentially might be missing for a user. The personalInfo/Logindetails and Device Data is all 1:1 mapping\u003c/p\u003e\n\n\u003cp\u003eIs there a more efficient way to do the select in hibernate which will allow me to easily construct my cache?\u003c/p\u003e\n\n\u003cp\u003eIdeally I would like to construct an object such that;\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class User {\n\n private BusinessCard businessCard;\n private SocialCard socialCard;\n private PersonalCard personalCard;\n\n private PersonalInformation personalInformation;\n private LoginDetails loginDetails;\n private DeviceData deviceData;\n\n\n public BusinessCard getBusinessCard() {\n return businessCard;\n }\n\n public void setBusinessCard(BusinessCard businessCard) {\n this.businessCard = businessCard;\n }\n\n public SocialCard getSocialCard() {\n return socialCard;\n }\n\n public void setSocialCard(SocialCard socialCard) {\n this.socialCard = socialCard;\n }\n\n public PersonalCard getPersonalCard() {\n return personalCard;\n }\n\n public void setPersonalCard(PersonalCard personalCard) {\n this.personalCard = personalCard;\n }\n\n public PersonalInformation getPersonalInformation() {\n return personalInformation;\n }\n\n public void setPersonalInformation(PersonalInformation personalInformation) {\n this.personalInformation = personalInformation;\n }\n\n public LoginDetails getLoginDetails() {\n return loginDetails;\n }\n\n public void setLoginDetails(LoginDetails loginDetails) {\n this.loginDetails = loginDetails;\n }\n\n public DeviceData getDeviceData() {\n return deviceData;\n }\n\n public void setDeviceData(DeviceData deviceData) {\n this.deviceData = deviceData;\n }\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","accepted_answer_id":"25487869","answer_count":"1","comment_count":"2","creation_date":"2014-08-25 10:28:17.383 UTC","last_activity_date":"2014-08-25 14:12:25.263 UTC","last_edit_date":"2014-08-25 10:59:47.9 UTC","last_editor_display_name":"","last_editor_user_id":"287732","owner_display_name":"","owner_user_id":"287732","post_type_id":"1","score":"0","tags":"java|mysql|sql|hibernate|select","view_count":"65"} {"id":"16746173","title":"Render MathML directly to HTML without using script tag","body":"\u003cp\u003eI know the default way to render the MathML to HTML is placing the MathML code inside and SCRIPT tag, then use MathJax to typeset the elements containing the SCRIPT tags.\u003c/p\u003e\n\n\u003cp\u003eI am wondering if there is an easy way to config the MathJax to directly process the MathML code without placing the MathML inside a script tag? So when the MathJax typesetting the HTML elements containing the tags, the MathML can be rendered to the HTML without using any script tags.\u003c/p\u003e\n\n\u003cp\u003eThis would be very useful when the MathML can be edited on the web and it wants to prevent the editors to input the dangerous scripts by confusing they are the MathML script tags.\u003c/p\u003e","accepted_answer_id":"16748508","answer_count":"1","comment_count":"0","creation_date":"2013-05-25 03:44:25.557 UTC","last_activity_date":"2013-05-25 10:13:28.337 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"230945","post_type_id":"1","score":"0","tags":"mathjax|mathml","view_count":"302"} {"id":"39391809","title":"Artisan returning localhost as url","body":"\u003cp\u003eI'm using Laravel 5.2.43 to build an application. My config/app.php reads as follows:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e'url' =\u0026gt; env('APP_URL', 'http://domain.dev'),\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand in the .env file\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eAPP_URL=domain.dev\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003emy schedule send an email with a link back to the website. But this url is returned as \u003cstrong\u003e\u003ca href=\"http://localhost\" rel=\"nofollow\"\u003ehttp://localhost\u003c/a\u003e\u003c/strong\u003e instead of \u003cstrong\u003e\u003ca href=\"http://domain.dev\" rel=\"nofollow\"\u003ehttp://domain.dev\u003c/a\u003e\u003c/strong\u003e. Can someone help?\u003c/p\u003e","answer_count":"0","comment_count":"4","creation_date":"2016-09-08 13:07:19.38 UTC","last_activity_date":"2016-09-08 13:07:19.38 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1971793","post_type_id":"1","score":"2","tags":"routes|laravel-5.2|artisan","view_count":"240"} {"id":"29106334","title":"Trying to Bind Data to GridView But unable to Bind","body":"\u003cp\u003eI am trying to bind data to gridView. Basically I want to bind particular persons record to gridview so to do this I fetch data via query. I had also set \u003ccode\u003eAutoGenerateColumns=True\u003c/code\u003e. My code executes fine but there is no exception and no error. Please check and guide. Thank you.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\nusing System.Web.UI;\nusing System.Web.UI.WebControls;\nusing System.Data.SqlClient;\nusing System.Configuration;\nusing System.Data;\n\npublic partial class ViewRegisteredDonors : System.Web.UI.Page\n{\n protected void Button1_Click(object sender, EventArgs e)\n {\n SqlConnection conec = new SqlConnection(ConfigurationManager.ConnectionStrings[\"BloodDonorRegistrationConnectionString\"].ConnectionString);\n\n string query;\n query = \"select D_FirstName,D_LastName,D_BloodGroup,D_City,D_Phone from Donor where D_City= @BG AND D_City=@cc\";\n SqlCommand cmd = new SqlCommand(query, conec);\n cmd.Parameters.AddWithValue(\"@BG\", dropbownBlood.SelectedItem.Text);\n cmd.Parameters.AddWithValue(\"cc\", DropDownListCity.SelectedItem.Text);\n conec.Open();\n cmd.CommandType = CommandType.Text;\n //cmd.CommandType = CommandType.StoredProcedure;\n SqlDataAdapter da = new SqlDataAdapter(cmd);\n DataSet d = new DataSet();\n da.Fill(d);\n GridView1.DataSource = d;\n GridView1.DataBind();\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"5","creation_date":"2015-03-17 17:53:53.643 UTC","last_activity_date":"2015-09-29 10:21:42.593 UTC","last_edit_date":"2015-09-29 10:21:42.593 UTC","last_editor_display_name":"","last_editor_user_id":"13302","owner_display_name":"","owner_user_id":"4428319","post_type_id":"1","score":"0","tags":"c#|asp.net|datagridview","view_count":"245"} {"id":"31480845","title":"How to call an action while AVAudio is playing at a specific time?","body":"\u003cp\u003eI would like to know how to call an action while the AVAudio is playing at a specific time. \u003c/p\u003e\n\n\u003cp\u003eLet's just say AVAudio hits \"19 seconds\" of playing then call an action of whatever you want.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-07-17 16:50:16.1 UTC","last_activity_date":"2015-07-17 17:06:22.92 UTC","last_edit_date":"2015-07-17 16:54:19.963 UTC","last_editor_display_name":"","last_editor_user_id":"2227743","owner_display_name":"","owner_user_id":"4302130","post_type_id":"1","score":"0","tags":"ios|swift|cocoa-touch|avfoundation|avaudioplayer","view_count":"87"} {"id":"37451404","title":"How to make the misleading attribute [ReadOnly] generate a read-only field","body":"\u003cp\u003eFor a very long time, I thought applying the \u003ccode\u003eReadOnly\u003c/code\u003e attribute to a viewmodel property meant that the generated element would have the \u003ccode\u003ereadonly\u003c/code\u003e HTML attribute.\u003c/p\u003e\n\n\u003cp\u003eThen I was very dissapintd to discover that this \u003ccode\u003eReadOnly\u003c/code\u003e attribute only applied to model binding, and that the value in a read-only input isn't bound to the posted viewmodel, and people could still type in the UI field, letting them think the value would be stored.\u003c/p\u003e\n\n\u003cp\u003eNow I have to go through my viewmodel, and wherever there is this attribute, comment it out, and manually apply the HTML \u003ccode\u003ereadonly\u003c/code\u003e attributes to the Razor elements affected.\u003c/p\u003e\n\n\u003cp\u003eI would now like to make a \u003ccode\u003eReallyReadOnly\u003c/code\u003e attribute, so that for viewmodel properties marked as such, a genuine read-only input is generated, and its value is bound back to the posted view model\u003c/p\u003e\n\n\u003cp\u003eWhere can I, if I can, in the rendering process, can I check for and act on this new attribute?\u003c/p\u003e","answer_count":"1","comment_count":"5","creation_date":"2016-05-26 04:06:13.223 UTC","last_activity_date":"2016-05-26 04:38:49.33 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8741","post_type_id":"1","score":"0","tags":"c#|asp.net-mvc|readonly|asp.net-mvc-viewmodel|readonlyattribute","view_count":"144"} {"id":"43494861","title":"How to Convert String \"A\" into Image in android?","body":"\u003cp\u003eI am making a chat application. \nI have one imageview for users profile. \u003c/p\u003e\n\n\u003cp\u003eIf users image is null/empty, I want show first letter of users name, for example: suppose users name is \"UNKNOWN\" so i want to show only U on that image view.\u003cbr\u003e\n\u003ca href=\"https://i.stack.imgur.com/qf9px.png\" rel=\"nofollow noreferrer\"\u003eClick here to see sample of what I want\u003c/a\u003e \u003c/p\u003e\n\n\u003cp\u003eI have tried :\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eFirstly I have checked if users image is null\u003c/strong\u003e \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e if (item.getSender_img_url() == null || item.getSender_img_url().isEmpty()||item.getSender_img_url().equals(\"null\") ) {\n System.out.println(TAG + \" photo is not available \");\n\n //here i am getting first alphabet of Users Name \n String[] result = item.getSenderName().split(\"\\\\s+\"); \n // This is a regex for matching spaces\n // The string we'll create\n String abbrev = \"\";\n\n // Loop over the results from the string splitting\n for (int i = 0; i \u0026lt; result.length; i++) {\n\n System.out.println(TAG + \" abbrev 1 \"+ abbrev);\n // Grab the first character of this entry\n char c = result[i].charAt(0);\n\n System.out.println(TAG + \" abbrev c \"+ c);\n // If its a number, add the whole number\n if (c \u0026gt;= '0' \u0026amp;\u0026amp; c \u0026lt;= '9') {\n abbrev += result[i];\n }\n\n // If its not a number, just append the character\n else {\n abbrev += c;\n }\n\n System.out.println(TAG + \" abbrev 3 \"+ abbrev);\n }\n\n //here i am converting string value into image\n\n Bitmap bm = StringToBitMap(abbrev.toString());\n\n //here i am setting covertes bitmat image into image view\n\n ((ViewHolder) holder).friends_image.setImageBitmap(bm);\n\n\n } else {\n System.out.println(TAG + \" photo is available \");\n try {\n Picasso.with(mContext).load(item.getSender_img_url())\n .error(R.drawable.profile_avatar)\n .placeholder(R.drawable.profile_avatar).resize(40, 40).centerCrop()\n .into(((ViewHolder) holder).friends_image);\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n }\n\n\n\n\n\n\n\n.................................\n\n/**\n * @param encodedString\n * @return bitmap (from given string)\n */\n public static Bitmap StringToBitMap(String encodedString){\n try {\n byte [] encodeByte=Base64.decode(encodedString,Base64.DEFAULT);\n Bitmap bitmap=BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length);\n return bitmap;\n } catch(Exception e) {\n e.getMessage();\n return null;\n }\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAny help?\u003c/p\u003e","answer_count":"3","comment_count":"1","creation_date":"2017-04-19 11:46:53.77 UTC","last_activity_date":"2017-10-18 10:01:51.503 UTC","last_edit_date":"2017-10-18 10:01:51.503 UTC","last_editor_display_name":"","last_editor_user_id":"1000551","owner_display_name":"","owner_user_id":"5912342","post_type_id":"1","score":"-2","tags":"android|string|bitmap|imageview|dynamic-image-generation","view_count":"359"} {"id":"2848055","title":"Add button to navigationbar programmatically","body":"\u003cp\u003eHi I need to set the button on right side, in navigation bar, programatically , so that if I press the button I will perform some actions. I have created the navigation bar, programatically by;\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003enavBar=[[UINavigationBar alloc]initWithFrame:CGRectMake(0,0,320,44) ];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSimilarly, I need to add the button, on the right side of this navigation bar. For that I used, \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003e1.\u003c/strong\u003e \u0026nbsp;\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e UIView* container = [[UIView alloc] init];\n\n // create a button and add it to the container\n UIButton* button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 130, 44.01)];\n [container addSubview:button];\n [button release];\n\n // add another button\n button = [[UIButton alloc] initWithFrame:CGRectMake(160, 0, 50, 44.01)];\n [container addSubview:button];\n [button release];\n\n // now create a Bar button item\n UIBarButtonItem* item = [[UIBarButtonItem alloc] initWithCustomView:container];\n\n // set the nav bar's right button item\n self.navigationItem.rightBarButtonItem = item;\n [item release];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003e2.\u003c/strong\u003e \u0026nbsp;\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e UIImage *im;\n im=[UIImage imageNamed:@\"back.png\"];\n [button setImage:im forState:UIControlStateNormal];\n [im release];\n backButton = [[UIBarButtonItem alloc] initWithCustomView:button]; \n [backButton setImageInsets:UIEdgeInsetsMake(0, -10,5, 5)];\n [self.navigationItem setRightBarButtonItem:backButton];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003e3.\u003c/strong\u003e \u0026nbsp;\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e UIBarButtonItem *refreshItem = [[UIBarButtonItem alloc] initWithTitle:@\"button\" style:UIBarButtonItemStylePlain target:self action:@selector(refreshLogsAction:)];\n self.navigationItem.rightBarButtonItem = refreshItem;\n\n [refreshItem release];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI tried all these ways, but none is displaying the button on the right hand side.\u003c/p\u003e","accepted_answer_id":"3268359","answer_count":"12","comment_count":"0","creation_date":"2010-05-17 09:55:31.057 UTC","favorite_count":"19","last_activity_date":"2017-06-30 21:56:01.313 UTC","last_edit_date":"2016-12-28 05:27:06.997 UTC","last_editor_display_name":"","last_editor_user_id":"4078527","owner_display_name":"","owner_user_id":"290189","post_type_id":"1","score":"78","tags":"objective-c|iphone|uinavigationbar|uibarbuttonitem","view_count":"134288"} {"id":"30802298","title":"UITableView cell duplicates","body":"\u003cp\u003eI'm working on my first Swift app, and stuck on a bug forever. When adding a new entry to the coredata, everything goes fine the first time. However, with additional items, the previously added item is duplicated in the table.\u003c/p\u003e\n\n\u003cp\u003eThe data is not duplicated, only the cell. When the app is reloaded, the cells are displayed correctly.\u003c/p\u003e\n\n\u003cp\u003eHere's the code that populates the cells:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunc numberOfSectionsInTableView(tableView: UITableView) -\u0026gt; Int {\n if let fetchedSections: AnyObject = fetchedResultController.sections as AnyObject? {\n return fetchedSections.count\n } else {\n return 0\n }\n}\n\nfunc tableView(tableView: UITableView, numberOfRowsInSection section: Int) -\u0026gt; Int {\n if let fetchedSections: AnyObject = fetchedResultController.sections as AnyObject? {\n return fetchedSections[section].numberOfObjects\n } else {\n return 0\n }\n}\n\nfunc tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -\u0026gt; UITableViewCell! {\n\n let lookup = sortedArray[indexPath.row] as! NSManagedObjectID\n let spot = spotsDict[lookup] as! Spots\n let cell = tableView.dequeueReusableCellWithIdentifier(\"SpotCell\", forIndexPath:indexPath) as! SpotCell\n\n println(sortedArray)\n println(spot)\n\n cell.spotLabel.text = spot.title\n\n cell.spotPhoto.image = self.imagesDict[lookup]\n\n cell.distanceLabel.text = self.distanceStringDict[lookup] as NSString! as String\n\n cell.spotPhoto.layer.cornerRadius = 4\n cell.spotPhoto.clipsToBounds = true\n\n return cell\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"30807047","answer_count":"2","comment_count":"4","creation_date":"2015-06-12 11:46:50.703 UTC","favorite_count":"0","last_activity_date":"2015-06-12 15:39:10.537 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5002931","post_type_id":"1","score":"1","tags":"ios|swift|uitableview","view_count":"675"} {"id":"24979843","title":"getting url param value encoded in some format","body":"\u003cp\u003eI wrote below C code to get the value of url parameter.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003echar *param(char *attribute_name) {\n char *query_str = getenv(\"QUERY_STRING\");\n urlDecode(query_str);\n printf(\"qstr = %s\u0026lt;br/\u0026gt;\", query_str);\n int i;\n char *param_value;\n char *temp = malloc(strlen(attribute_name) + 3);\n char *x;\n strcpy(temp, \"?\");\n strcat(temp, attribute_name);\n strcat(temp, \"=\");\n\n x = strstr(query_str, temp);\n attribute_name = strdup(attribute_name);\n\n if (x == NULL) {\n free(temp);\n temp = malloc(strlen(attribute_name) + 3);\n strcpy(temp, \"\u0026amp;\");\n strcat(temp, attribute_name);\n strcat(temp, \"=\");\n x = strstr(query_str, temp);\n }\n\n if (x != NULL) {\n param_value = malloc(strlen(x) - strlen(temp) + 1);\n int s = strlen(x) - strlen(temp);\n int t = strlen(x) - s;\n strncpy(param_value, \u0026amp;x[t], 1);\n for (i = strlen(temp) + 1; i \u0026lt;= strlen(x); i++) {\n if (x[i] != '\u0026amp;') {\n strncat(param_value, \u0026amp;x[i], 1);\n } else {\n break;\n }\n }\n }\n free(temp);\n\n return param_value;\n}\n\n\n\nint urlDecode(char *str) {\n unsigned int i;\n char tmp[BUFSIZ];\n char *ptr = tmp;\n memset(tmp, 0, sizeof(tmp));\n for (i=0; i \u0026lt; strlen(str); i++) {\n if (str[i] != '%') {\n *ptr++ = str[i];\n continue;\n }\n if (!isdigit(str[i+1]) || !isdigit(str[i+2])) {\n *ptr++ = str[i];\n continue;\n }\n *ptr++ = ((str[i+1] - '0') \u0026lt;\u0026lt; 4) | (str[i+2] - '0');\n i += 2;\n }\n *ptr = '\\0';\n strcpy(str, tmp);\n\n return 0;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd below is my main() function:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eint main() {\n printf(\"Content-type: text/html\\n\\r\\n\\r\");\n printf(\"\u0026lt;!Doctype html\u0026gt;\");\n printf(\"\u0026lt;html\u0026gt;\");\n printf(\"\u0026lt;meta charset=\\\"UTF-8\\\"\u0026gt;\u0026lt;meta http-equiv=\\\"Content-type\\\" content=\\\"text/html; charset=UTF-8\\\"\u0026gt;\");\n printf(\"\u0026lt;body\u0026gt;\");\n\n char attr[] = \"u\";\n char *value = param(attr);\n puts(value);\n //free(value);\n\n printf(\"\u0026lt;/body\u0026gt;\u0026lt;/html\u0026gt;\");\n return 0;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd below is the output I received on browser after hitting the url: \u003ca href=\"http://example.com/cgi-bin/cgi_param?u=1212\u0026amp;sa=232%203\u0026amp;sdd=jdwjdjw\" rel=\"nofollow\"\u003ehttp://example.com/cgi-bin/cgi_param?u=1212\u0026amp;sa=232%203\u0026amp;sdd=jdwjdjw\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eqstr = u=1212\u0026amp;sa=232 3\u0026amp;sdd=jdwjdjw\u003c/p\u003e\n\n\u003cp\u003e�l12� \u003c/p\u003e\n\n\u003cp\u003ePlease correct me where am I doing mistake?\nThanks\u003c/p\u003e","accepted_answer_id":"24980965","answer_count":"2","comment_count":"3","creation_date":"2014-07-27 10:01:45.137 UTC","last_activity_date":"2014-07-27 19:25:37.84 UTC","last_edit_date":"2014-07-27 19:25:37.84 UTC","last_editor_display_name":"","last_editor_user_id":"2394874","owner_display_name":"","owner_user_id":"1552407","post_type_id":"1","score":"-1","tags":"html|c++|c|mime","view_count":"56"} {"id":"3588451","title":"How do I set separated layouts for each module?","body":"\u003cp\u003eI have my config file like this\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[production]\nphpSettings.display_startup_errors = 1\nphpSettings.display_errors = 1\nincludePaths.library = APPLICATION_PATH \"/../library\"\nbootstrap.path = APPLICATION_PATH \"/Bootstrap.php\"\nbootstrap.class = \"Bootstrap\"\nresources.frontController.moduleDirectory = APPLICATION_PATH \"/modules\"\nresources.modules[] =\n\n[staging : production]\n\n[testing : production]\nphpSettings.display_startup_errors = 1\nphpSettings.display_errors = 1\n\n[development : production]\nphpSettings.display_startup_errors = 1\nphpSettings.display_errors = 1\n\n[database]\nresources.db.adapter = PDO_MYSQL\nresources.db.params.dbname = \"ccgss\"\nresources.db.params.username = \"root\"\nresources.db.params.password = \"\"\nresources.db.params.hostname = \"localhost\"\nresources.db.isDefaultTableAdapter = true\n\n[layout]\nlayoutPath = APPLICATION_PATH \"/modules/default/layouts\"\ncontentKey = \"content\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis works for the default module, but then I have the admin panel and the layout is completely different. How do I set the layout for the admin module?\u003c/p\u003e","accepted_answer_id":"3589665","answer_count":"2","comment_count":"0","creation_date":"2010-08-27 22:06:55.44 UTC","last_activity_date":"2010-08-28 06:01:47.023 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"336945","post_type_id":"1","score":"0","tags":"php|zend-framework","view_count":"421"} {"id":"42108636","title":"Access Specific Elements in a Matrix","body":"\u003cp\u003eI'm new in Python and my problem involves getting specific elements in a matrix and create a new matrix with these elements. Here's my attempt to do it.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport numpy as np\n\na = [[ 1, 2, 3, 4, 5],\n [ 6, 7, 8, 9, 10],\n [ 11, 12, 13, 14, 15],\n [ 16, 17, 18, 19, 20],\n [ 21, 22, 23, 24, 25]]\n\nb = np.array(a)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI want to get only the 1st and 3rd column of this matrix then combine them to create a new matrix. I tried adding this code below:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003enewList = []\n\nfor i in range(len(b-1)):\n newList.append(b[i,0])+ newList.append(b[i,2])\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut I got the following error instead:\u003c/p\u003e\n\n\u003cp\u003eTypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'\u003c/p\u003e","answer_count":"1","comment_count":"4","creation_date":"2017-02-08 08:58:45.933 UTC","last_activity_date":"2017-02-08 09:54:58.263 UTC","last_edit_date":"2017-02-08 09:33:39.377 UTC","last_editor_display_name":"","last_editor_user_id":"7533385","owner_display_name":"","owner_user_id":"7533385","post_type_id":"1","score":"1","tags":"python|matrix","view_count":"47"} {"id":"8106098","title":"How do I customize header and footer in jqgrid?","body":"\u003cp\u003eI place to place few buttons in header and footer in jqgrid. Is there any way I can customize it?\u003c/p\u003e\n\n\u003cp\u003eI did the footerData option in jqgrid on this link:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods\" rel=\"nofollow\"\u003ehttp://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eHowever I think it is different and unrelated. Let me know if I am wrong.\u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","accepted_answer_id":"8111220","answer_count":"1","comment_count":"3","creation_date":"2011-11-12 17:16:01.043 UTC","last_activity_date":"2011-11-13 11:31:10.97 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"260594","post_type_id":"1","score":"2","tags":"javascript|jquery|jqgrid","view_count":"5628"} {"id":"6790650","title":"Instapaper API Access (Full API) - Problem with xAuth","body":"\u003cp\u003ei was playing around with the instapaper full api and im having some trouble with the OAuth api.\nMUST i have a token for using the full api or is this optional?\u003c/p\u003e","accepted_answer_id":"8862500","answer_count":"1","comment_count":"1","creation_date":"2011-07-22 13:24:37.903 UTC","favorite_count":"1","last_activity_date":"2012-01-14 13:27:52.257 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"450598","post_type_id":"1","score":"0","tags":"api|oauth|instapaper","view_count":"533"} {"id":"2809547","title":"Creating email templates with Django","body":"\u003cp\u003eI want to send HTML-emails, using Django templates like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;html\u0026gt;\n\u0026lt;body\u0026gt;\nhello \u0026lt;strong\u0026gt;{{username}}\u0026lt;/strong\u0026gt;\nyour account activated.\n\u0026lt;img src=\"mysite.com/logo.gif\" /\u0026gt;\n\u0026lt;/body\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI can't find anything about \u003ccode\u003esend_mail\u003c/code\u003e, and django-mailer only sends HTML templates, without dynamic data.\u003c/p\u003e\n\n\u003cp\u003eHow do I use Django's template engine to generate e-mails?\u003c/p\u003e","accepted_answer_id":"2810245","answer_count":"7","comment_count":"1","creation_date":"2010-05-11 09:41:59.73 UTC","favorite_count":"97","last_activity_date":"2017-04-20 15:35:42.227 UTC","last_edit_date":"2013-03-23 11:13:15.39 UTC","last_editor_display_name":"","last_editor_user_id":"2139766","owner_display_name":"","owner_user_id":"85107","post_type_id":"1","score":"152","tags":"django|email|django-email|django-mailer","view_count":"68221"} {"id":"16114823","title":"How does a service identify the user?","body":"\u003ch1\u003eUse case:\u003c/h1\u003e\n\n\u003cp\u003eA user takes a beautiful photo and wants to save it to their evernote account.\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/dbk4T.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eUser authorizes with OAuth 2.0. The service stores their credentials.\u003c/li\u003e\n\u003cli\u003eJust after the OAuth 2.0 dance completes, the service inserts a contact called \"Save to Evernote\".\u003c/li\u003e\n\u003cli\u003eNext, the service subscribes to updates in this user's timeline by inserting a subscription for the timeline collection.\u003c/li\u003e\n\u003cli\u003eThe user activates the contact. Save to Evernote is now fully set up.\u003c/li\u003e\n\u003cli\u003eOver time, the user takes photos.\u003c/li\u003e\n\u003cli\u003eThe user shares a photo with Save to Evernote. This makes the timeline card associated with this photo accessible to the service.\u003c/li\u003e\n\u003cli\u003eBecause the service is subscribed to timeline updates, a notification is sent to your service. This notification links to the timeline item containing the shared photo.\u003c/li\u003e\n\u003cli\u003eThe service examines the notification and uses the included id to fetch the timeline card that contains the photo.\u003c/li\u003e\n\u003cli\u003eNext, the service examines the timeline item and uses the attachment ID to fetch the bytes of the photo.\u003c/li\u003e\n\u003cli\u003eThe service uploads the photo to the user's Evernote.\u003c/li\u003e\n\u003cli\u003eFinally, the service constructs a new timeline card and inserts it into the user's timeline card with the success message. \u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eFrom the \u003ca href=\"https://developers.google.com/glass/subscriptions#shared_picture\" rel=\"nofollow noreferrer\"\u003eMirror API Documentation\u003c/a\u003e it appears that once a user shares a timeline item the service receives a POST quite like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{\n \"collection\": \"timeline\",\n \"itemId\": \"3hidvm0xez6r8_dacdb3103b8b604_h8rpllg\",\n \"operation\": \"UPDATE\",\n \"userToken\": \"harold_penguin\",\n \"verifyToken\": \"random_hash_to_verify_referer\",\n \"userActions\": [\n {\n \"type\": \"SHARE\"\n }\n ]\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs the userToken a value that I receive when first authenticating the application? If so can I use that value to connect the POST received from Glass with the User saved in my database? If not how do I connect the share to my service's contact with the Glass user so that my service can perform services specific to that user on their behalf?\u003c/p\u003e","accepted_answer_id":"16115047","answer_count":"1","comment_count":"0","creation_date":"2013-04-19 23:20:02.743 UTC","favorite_count":"2","last_activity_date":"2013-04-19 23:54:07.507 UTC","last_edit_date":"2013-04-19 23:49:40.673 UTC","last_editor_display_name":"","last_editor_user_id":"410240","owner_display_name":"","owner_user_id":"410240","post_type_id":"1","score":"4","tags":"google-mirror-api","view_count":"321"} {"id":"6405454","title":"When to delete[] a pointer c++?","body":"\u003cp\u003eI've been toying with c++ for a little while, and coming from java one of the most confusing aspects for me is memory management. For example, lets say I have a method, and in that method I declare a pointer to an object, i want to set that pointer to an attribute of another object using a get method:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSubObject *mySubObject = anotherObject.getSubObject();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy question is, what happens to this pointer when the method ends? should i use the following before it ends?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edelete mySubObject;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat if i don't delete it? Does it remain until the entire program ends?\u003c/p\u003e\n\n\u003cp\u003eI've tried googling around for basic memory management tutorials for c++, but i typically find more advanced stuff thats way over my head, any referals would be appretiated.\u003c/p\u003e","accepted_answer_id":"6405472","answer_count":"9","comment_count":"5","creation_date":"2011-06-19 22:23:02.703 UTC","last_activity_date":"2011-06-20 06:00:05.26 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"785259","post_type_id":"1","score":"0","tags":"c++|memory|pointers","view_count":"1267"} {"id":"14420566","title":"Apache mod rewrite to direct from one server to another","body":"\u003cp\u003eI've got to apache web servers running. One on port 80 and another on port 8077.\u003c/p\u003e\n\n\u003cp\u003eI'm wanting to try and redirect all the traffic through the port 80 version if possible.\u003c/p\u003e\n\n\u003cp\u003eWhat I'm ideally wanting is to be able to go to \u003ca href=\"http://translate.example.com\" rel=\"nofollow\"\u003ehttp://translate.example.com\u003c/a\u003e \nand the traffic get directed to \u003ca href=\"http://www.example.com:8077\" rel=\"nofollow\"\u003ehttp://www.example.com:8077\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI've already got a lot of mod_rewrite going on at the main port 80 server, but I'm not sure which of the servers needs configuration or whether both do.\u003c/p\u003e\n\n\u003cp\u003eI'm wanting to make sure that translate.example.com/img (or any other subdirectory) actually points to the 8087/images directory.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eupdate\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eI've now got the following:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eRewriteCond %{HTTP_HOST} example[NC]\nRewriteCond %{REQUEST_URI} ^/glot$ [NC]\nRewriteRule ^(.*)$ http://www.example.com:8077/$1 [P]\nProxyPassReverse / http://www.example.com/\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm getting to see the other servers new pages, but I'm finding all the resources aren't found like images, css etc\u003c/p\u003e\n\n\u003cp\u003eDoing a view source all the resources in the installed product are set with leading slash\u003c/p\u003e\n\n\u003cp\u003eFor example\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/img/glotpress-logo.png\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo I'm not sure how to get the resources loaded up.\nNote I'm happy enough if the original starting point is www.example.com/glot instead of glot.example.com as in the original question\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2013-01-20 00:47:09.297 UTC","last_activity_date":"2013-01-21 02:37:59.633 UTC","last_edit_date":"2013-01-20 08:40:30.527 UTC","last_editor_display_name":"","last_editor_user_id":"578374","owner_display_name":"","owner_user_id":"578374","post_type_id":"1","score":"1","tags":"apache|mod-rewrite","view_count":"3225"} {"id":"40152500","title":"In-App Purchase returning 0 products and product identifiers as invalidProductIdentifier","body":"\u003cp\u003eI know this question is asked few times. I have tried all solution but still not succeed. Here is my issue:\u003c/p\u003e\n\n\u003cp\u003eIn below lines of code I am getting \u003ccode\u003eresponse.products.count = 0\u003c/code\u003e and getting product ids that I have entered as \u003ccode\u003eresponse.invalidProductIdentifiers\u003c/code\u003e. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunc productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse) {\n if response.products.count != 0 {\n for product in response.products {\n productsArray.append(product )\n }\n }\n else {\n print(\"There are no products.\")\n }\n if response.invalidProductIdentifiers.count != 0 {\n print(response.invalidProductIdentifiers.description)\n }\n }\n[![enter image description here][1]][1]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSet up that I have done for IAP :\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003e\u003cp\u003eIn Xcode - \u003e target- \u003e In-App Purchased enabled. attaching screenshot.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eIn profile I have enabled In-app-Purchase. and attached that profile with project. \u003c/p\u003e\u003c/li\u003e\n\u003cli\u003eIn itunes connect made App and added product identifiers for IAP. \u003c/li\u003e\n\u003cli\u003ebundle id is same in Xcode, apple developer portal and in iTunes connect. \u003c/li\u003e\n\u003cli\u003eIn Itunes Connect App status is \"Prepare for submission\" and status of In-App purchase are \"Waiting for upload\" . I have not uploaded binary on iTuness connect yet. Is there need to upload binary at iTunes Connect ?Here is the screenshot of Itunes connect:\n\u003ca href=\"https://i.stack.imgur.com/4hKOs.png\" rel=\"nofollow\"\u003e\u003cimg src=\"https://i.stack.imgur.com/4hKOs.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/XfI4M.png\" rel=\"nofollow\"\u003e\u003cimg src=\"https://i.stack.imgur.com/XfI4M.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eIs there need to upload binary at iTunes Connect? Is anything I am missing? Any help will be appreciated.\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2016-10-20 10:58:43.987 UTC","last_activity_date":"2017-09-13 22:45:18.26 UTC","last_edit_date":"2016-10-20 11:27:51.35 UTC","last_editor_display_name":"","last_editor_user_id":"1850983","owner_display_name":"","owner_user_id":"1850983","post_type_id":"1","score":"3","tags":"ios|in-app-purchase","view_count":"1765"} {"id":"43690828","title":"Placing a JPanel on a new line using GridBagLayout","body":"\u003cp\u003eI'm trying to figure out a way to place a panel containing combo boxes in my JFrame on a new line using gridbaglayout. At the moment it appears next to another panel of the same type.\u003c/p\u003e\n\n\u003cp\u003eHere's what it looks like:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/74Eui.gif\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/74Eui.gif\" alt=\"https://i.stack.imgur.com/74Eui.gif\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eHere is the code for the particular areas \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eJPanel saleOfferPanel = new JPanel();\nJLabel dateOfSale = new JLabel(\"Select Date of Sale:\"); \nsaleOfferPanel.add(dateOfSale);\nJLabel saleDay = new JLabel(\"Day:\");\nsaleOfferPanel.add(saleDay);\nJComboBox\u0026lt;Integer\u0026gt; dayOfSale = new JComboBox\u0026lt;\u0026gt;();\nsaleOfferPanel.add(dayOfSale);\nJLabel saleMonth = new JLabel(\"Month:\");\nsaleOfferPanel.add(saleMonth);\nJComboBox\u0026lt;Integer\u0026gt; monthOfSale = new JComboBox\u0026lt;\u0026gt;();\nsaleOfferPanel.add(monthOfSale);\nJLabel saleYear = new JLabel(\"Year:\");\nsaleOfferPanel.add(saleYear);\nJComboBox\u0026lt;Integer\u0026gt; yearOfSale = new JComboBox\u0026lt;\u0026gt;();\nsaleOfferPanel.add(yearOfSale);\n\n\n\nJPanel endSalePanel = new JPanel();\nJLabel endOfSale = new JLabel(\"Select End Date of Sale:\");\nsaleOfferPanel.add(endOfSale);\nJLabel endDay = new JLabel(\"Day:\");\nsaleOfferPanel.add(endDay);\nJComboBox\u0026lt;Integer\u0026gt; endDayOfSale = new JComboBox\u0026lt;\u0026gt;();\nsaleOfferPanel.add(endDayOfSale);\nJLabel endMonth = new JLabel(\"Month:\");\nsaleOfferPanel.add(endMonth);\nJComboBox\u0026lt;Integer\u0026gt; endMonthOfSale = new JComboBox\u0026lt;\u0026gt;();\nsaleOfferPanel.add(endMonthOfSale);\nJLabel endYear = new JLabel(\"Year:\");\nsaleOfferPanel.add(endYear);\nJComboBox\u0026lt;Integer\u0026gt; endYearOfSale = new JComboBox\u0026lt;\u0026gt;();\nsaleOfferPanel.add(endYearOfSale);\n\n setLayout(new GridBagLayout());\n GridBagConstraints gbc = new GridBagConstraints();\n gbc.weightx = 0.5;\n gbc.weighty = 0;\n gbc.anchor = GridBagConstraints.NORTHWEST;\n //other panels...\n\n //panels in question\n gbc.gridx = 0;\n gbc.gridy = 9;\n gbc.gridheight = 1;\n add(saleOfferPanel, gbc);\n\n\n gbc.gridx = 0;\n gbc.gridy = 10;\n gbc.gridheight = 1;\n add(endSalePanel, gbc);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHoping that someone may be able to offer assistance.\u003c/p\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","answer_count":"2","comment_count":"1","creation_date":"2017-04-29 01:07:50.113 UTC","last_activity_date":"2017-04-29 10:37:49.547 UTC","last_edit_date":"2017-04-29 01:31:53.38 UTC","last_editor_display_name":"","last_editor_user_id":"131872","owner_display_name":"","owner_user_id":"7917821","post_type_id":"1","score":"0","tags":"java","view_count":"39"} {"id":"45983517","title":"Unity: My enemy projectile is being destroyed before ever leaving it's spawn location. What am i doing wrong?","body":"\u003cp\u003eLike the title says, the enemy projectiles are not launching. They are spawned and destroyed in the same place. They do not fire toward the target. Code in link: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eusing System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\n\npublic class MonkeyController : MonoBehaviour {\n\n private const int MAX_INJURES = 1;\n\n public float DurationMovement = 2f;\n public Transform SpawnLocation;\n public Transform[] PatrolPoints;\n public GameObject MonkeyProjectile;\n public Rigidbody2D Abby;\n public float AttackDelay = 0.75f;\n public float ProjectileSpeed = 1;\n public int ProjectilesCount = 4;\n\n public float activePosition;\n public float passivePosition;\n\n private List\u0026lt;GameObject\u0026gt; ProjectileList = new List\u0026lt;GameObject\u0026gt;();\n private int PatrolIndex = 0;\n\n\n private int injures = 0;\n\n private bool canPatrol;\n\n private Coroutine fireCoroutine;\n private Coroutine patrolCoroutine;\n private Coroutine movementCoroutine;\n\n WaitForSeconds delay;\n Vector2 AttackVector = Vector2.zero;\n // Use this for initialization\n private void Start () {\n delay = new WaitForSeconds(AttackDelay);\n InitializeProjectileList();\n\n fireCoroutine = StartCoroutine(MonkeyFireProjectileBehaviour());\n patrolCoroutine = StartCoroutine(PatrolBehaviour(PatrolPoints[PatrolIndex].position));\n }\n\n\n private IEnumerator MonkeyFireProjectileBehaviour()\n {\n yield return delay;\n\n if (GameManager.GetInstance().gameState == GameState.GAME_OVER)\n yield return null;\n\n AttackVector = Abby.transform.position - (transform.position /*+ (Vector3)Abby.velocity/10f*/);\n\n FireProjectile(AttackVector);\n\n fireCoroutine = StartCoroutine(MonkeyFireProjectileBehaviour());\n }\n\n\n private IEnumerator PatrolBehaviour(Vector3 animationLocation)\n {\n canPatrol = true;\n\n float distance = (transform.position - animationLocation).magnitude;\n float duration = DurationMovement;\n\n Vector3 startingPos = transform.position;\n float t = 0;\n while (t \u0026lt; 1 \u0026amp;\u0026amp; canPatrol)\n {\n t += Time.deltaTime / duration;\n transform.position = Vector3.Lerp(startingPos, animationLocation, t);\n yield return null;\n }\n\n if (!canPatrol)\n yield break;\n\n transform.position = animationLocation;\n IncrementMovementIndex();\n\n patrolCoroutine = StartCoroutine(PatrolBehaviour(PatrolPoints[PatrolIndex].position));\n\n yield return null;\n }\n\n private void IncrementMovementIndex()\n {\n PatrolIndex++;\n if(PatrolIndex == PatrolPoints.Length)\n {\n PatrolIndex = 0;\n }\n }\n private void InitializeProjectileList()\n {\n GameObject Projectile;\n for (int i = 0; i \u0026lt; ProjectilesCount; i++)\n {\n Projectile = Instantiate(MonkeyProjectile);\n Projectile.SetActive(false);\n ProjectileList.Add(Projectile);\n }\n }\n private void FireProjectile(Vector2 forceProjectile)\n {\n foreach (GameObject projectile in ProjectileList)\n {\n if (!projectile.activeInHierarchy)\n {\n projectile.transform.position = SpawnLocation.position;\n projectile.SetActive(true);\n projectile.GetComponent\u0026lt;TrailRenderer\u0026gt;().enabled = true;\n projectile.GetComponent\u0026lt;Rigidbody2D\u0026gt;().bodyType = RigidbodyType2D.Dynamic;\n projectile.GetComponent\u0026lt;Rigidbody2D\u0026gt;().AddForce(forceProjectile * (ProjectileSpeed + Random.Range(0, ProjectileSpeed/2)), ForceMode2D.Impulse);\n break;\n }\n }\n }\n\n private IEnumerator DoMovementCoroutine()\n {\n yield return new WaitForSeconds (0.01F);\n\n transform.localPosition = new Vector2(passivePosition, 0);\n\n yield return AnimatorExecutive.AnimatePositionCoroutine (gameObject, new Vector2 (activePosition, 0), 5.0F);\n\n fireCoroutine = StartCoroutine(MonkeyFireProjectileBehaviour());\n patrolCoroutine = StartCoroutine(PatrolBehaviour(PatrolPoints[PatrolIndex].position));\n }\n\n\n\n private void OnCollisionEnter2D(Collision2D otherCollision)\n {\n if (otherCollision.gameObject.tag == \"Projectile\")\n {\n injures++;\n\n if (injures \u0026gt;= MAX_INJURES)\n {\n injures = 0;\n canPatrol = false;\n GetComponent\u0026lt;AudioSource\u0026gt;().Play();\n\n if(fireCoroutine != null) StopCoroutine (fireCoroutine);\n if(patrolCoroutine != null) StopCoroutine (patrolCoroutine);\n\n movementCoroutine = StartCoroutine (DoMovementCoroutine());\n }\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"2","creation_date":"2017-08-31 14:08:10.853 UTC","favorite_count":"1","last_activity_date":"2017-08-31 18:28:14.863 UTC","last_edit_date":"2017-08-31 18:04:54.64 UTC","last_editor_display_name":"","last_editor_user_id":"7920473","owner_display_name":"","owner_user_id":"4982356","post_type_id":"1","score":"-1","tags":"c#|unity3d|game-physics|projectile","view_count":"32"} {"id":"44530513","title":"Passing pointer to function value not changing","body":"\u003cpre\u003e\u003ccode\u003e#include\u0026lt;stdio.h\u0026gt;\n\nvoid foo(int*);\nint main()\n{\n int i = 97, *p = \u0026amp;i;\n foo(p);\n printf(\"%d \", *p);\n getch();\n}\n\nvoid foo(int *p)\n{\n int j = 2;\n p = \u0026amp;j;\n printf(\"%d \", *p);\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eOutput is 2 97\nWhy not 2 2 ?\npointer p holds the address of j now so why 97 is printed ?\u003c/p\u003e","answer_count":"4","comment_count":"2","creation_date":"2017-06-13 20:02:22.257 UTC","last_activity_date":"2017-06-13 21:08:25.637 UTC","last_edit_date":"2017-06-13 20:05:04.34 UTC","last_editor_display_name":"","last_editor_user_id":"3684343","owner_display_name":"","owner_user_id":"6219266","post_type_id":"1","score":"0","tags":"c|pointers","view_count":"62"} {"id":"17440509","title":"Credit card number format","body":"\u003cp\u003eI'm trying to create a nifty credit card number input field that automatically formats a credit card number as a user types it in. Here's what I have:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# Whenever the credit card input changes, update its value.\n$(\".credit-card-number\").on \"input\", -\u0026gt;\n\n # retrieve the credit card number\n creditCardNumber = $(this).val()\n\n # remove everything that's not a number\n creditCardNumber = creditCardNumber.replace(/[^\\d]+/g, \"\")\n\n # ensure the value isn't more than 16 characters long\n creditCardNumber = creditCardNumber[0..15]\n\n # break apart the value every four numbers\n creditCardNumber = creditCardNumber.match(/.{1,4}/g)\n\n # insert spaces in the value when the value isn't null\n creditCardNumber = if creditCardNumber? then creditCardNumber.join(\" \") else \"\"\n\n # set the value\n $(this).val(creditCardNumber)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis works perfectly on the following HTML:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;input class=\"credit-card-number\" id=\"credit_card_number\" name=\"credit_card_number\" placeholder=\"Credit card number\" type=\"text\"\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever, if I set the input's type to \u003ccode\u003enumber\u003c/code\u003e, whenever I update the value and the value contains a space, Chrome changes the value to the empty string. Any ideas?\u003c/p\u003e","accepted_answer_id":"17441497","answer_count":"2","comment_count":"4","creation_date":"2013-07-03 05:42:17.447 UTC","last_activity_date":"2013-09-20 12:10:16.083 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"262125","post_type_id":"1","score":"0","tags":"javascript|jquery|coffeescript","view_count":"3616"} {"id":"495050","title":"List of CSS features not supported by IE6","body":"\u003cp\u003eI just finished slicing and coding a very nice table-less css template for my website, all the time I was testing with IE7 and Chrome.\u003c/p\u003e\n\n\u003cp\u003eThen I just had the brilliant idea of testing this template with IE6, I installed Windows XP on a Virtual PC and then I opened my website on IE6.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eIt looks extremely bad!\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eThe format of my page looked like garbage, nothing displaying correctly like in IE7 and Chrome. I knew that some things were not supported by IE6, but I didn't think that my page would render like it did.\u003c/p\u003e\n\n\u003cp\u003eSo I would like to know if there is a place where I can see what is not supported by IE6 so I can fix my CSS or even create a new one only for IE6.\u003c/p\u003e\n\n\u003cp\u003eAny info will be very helpful!\u003c/p\u003e\n\n\u003cp\u003eThanks!\u003c/p\u003e","accepted_answer_id":"495077","answer_count":"9","comment_count":"3","creation_date":"2009-01-30 10:24:18.573 UTC","favorite_count":"11","last_activity_date":"2015-01-31 23:30:38.3 UTC","last_edit_date":"2009-02-02 11:31:32.603 UTC","last_editor_display_name":"Bruno","last_editor_user_id":"17648","owner_display_name":"Bruno","owner_user_id":"17648","post_type_id":"1","score":"11","tags":"css|internet-explorer-6","view_count":"7962"} {"id":"9356536","title":"Getting 'CGI (LoadError)' when migrating Tumblr blog to Octopress using Jekyll's Tumblr.rb","body":"\u003cp\u003eI am using RVM,\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$ ruby -v\nruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eInside the Octopress directory:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$ gem list\n\n*** LOCAL GEMS ***\n\naddressable (2.2.7)\nalbino (1.3.3)\nblankslate (2.1.2.4)\nbundler (1.0.22 ruby)\nchunky_png (1.2.5)\nclassifier (1.3.3)\ncompass (0.11.7)\ndirectory_watcher (1.4.1)\nfast-stemmer (1.0.0)\nffi (1.0.11)\nfssm (0.2.8.1)\nhaml (3.1.4)\nheroku (2.20.1)\njekyll (0.11.2, 0.11.0)\njson (1.6.5)\nkramdown (0.13.5, 0.13.4)\nlaunchy (2.0.5)\nliquid (2.3.0, 2.2.2)\nmaruku (0.6.0)\nmime-types (1.17.2)\nnokogiri (1.5.0)\nposix-spawn (0.3.6)\npygments.rb (0.2.4)\nrack (1.4.1)\nrake (0.9.2.2, 0.9.2)\nrb-fsevent (0.9.0)\nrdiscount (1.6.8)\nRedCloth (4.2.9)\nrequire (0.2.7)\nrest-client (1.6.7)\nrubypants (0.2.0)\nrubypython (0.5.3)\nrubyzip (0.9.6.1)\nsass (3.1.14)\nsequel (3.32.0)\nsinatra (1.2.6)\nstringex (1.3.0)\nsyntax (1.0.0)\nterm-ansicolor (1.0.7)\ntilt (1.3.3)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I run this:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e$ ruby -rubygems -e 'require \"jekyll/migrators/tumblr\";Jekyll::Tumblr.process(\"http://www.my_blog.tumblr.com\",\n format=\"md\")'\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eI get this:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e\u003ccode\u003e/home/n00shie/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in\u003c/code\u003erequire': no such file to load -- CGI (LoadError)\n from /home/n00shie/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in \u003ccode\u003erequire'\n from /home/n00shie/.rvm/gems/ruby-1.9.2-p290/gems/jekyll-0.11.2/lib/jekyll/migrators/tumblr.rb:5:in\u003c/code\u003e'\n from /home/n00shie/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in \u003ccode\u003erequire'\n from /home/n00shie/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in\u003c/code\u003erescue in require'\n from /home/n00shie/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in \u003ccode\u003erequire'\n from -e:1:in\u003c/code\u003e'\n `\u003c/p\u003e\n\u003c/blockquote\u003e","accepted_answer_id":"10183090","answer_count":"1","comment_count":"1","creation_date":"2012-02-20 05:22:08.93 UTC","last_activity_date":"2012-04-16 23:28:10.047 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1201104","post_type_id":"1","score":"3","tags":"ruby|cgi|tumblr|jekyll","view_count":"411"} {"id":"32553694","title":"Python infinite series pi/4","body":"\u003cp\u003eI have a problem to solve, but I am having some trouble. Here is the problem:\u003c/p\u003e\n\n\u003cp\u003eThe value of π/4 can be approximated by the infinite series: 1−1/3+1/5−1/7...\u003c/p\u003e\n\n\u003cp\u003eHave your program prompt the user for how many terms to use for the approximation and then display the result. Also show the user how much error is introduced by subtracting the approximated answer from Python’s math.pi value.\u003c/p\u003e\n\n\u003cp\u003eExample: User enters 4. Approximated value is ~.723809524. Error = ~0.06158863939745 \u003c/p\u003e\n\n\u003cp\u003eHere is my code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef proj3_6():\n print(\"This is a program that will approximate the value of pi / 4\")\n numberOfTerms = eval(input(\"How many terms should be used for the approximation? \"))\n expr = math.pi / 4\n roundedExpr = round(expr, numberOfTerms)\n error = math.pi - roundedExpr\n print(\"The approximation is: \", roundedExpr)\n print(\"The error would be: \", error)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eFor some reason, it prints out the wrong values for the approximation and the error. What am I doing wrong?\u003c/p\u003e","accepted_answer_id":"32554171","answer_count":"1","comment_count":"3","creation_date":"2015-09-13 19:29:03.687 UTC","last_activity_date":"2015-09-13 20:19:26.997 UTC","last_edit_date":"2015-09-13 19:32:37.667 UTC","last_editor_display_name":"","last_editor_user_id":"270986","owner_display_name":"","owner_user_id":"3741998","post_type_id":"1","score":"2","tags":"python","view_count":"234"} {"id":"35088389","title":"App is crashing when trying to switch to new Activity","body":"\u003cp\u003ethis is my first question on stackoverflow so don´t judge: :D \nI am creating a simple android app which is about physics (don´t ask why because I don´t know the answer). So I have created 3 Activites. The Main layout is composed such that there are 2 buttons. One is to get to the activity where there are 3 Newton laws of motion and the other is to get to the activity where there are laws of thermodynamics. Now I have managed to switch from Main activity to Newton activity (I watched a tutorial on youtube) but when I tried to do the same thing with thermodynamics (the code is completely the same) but when I click the button (thermodynamics button) the app crashes. Here is the code:\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eMainActivity\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class MainActivity extends AppCompatActivity {\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n\n}\n\n@Override\npublic boolean onCreateOptionsMenu(Menu menu) {\n // Inflate the menu; this adds items to the action bar if it is present.\n getMenuInflater().inflate(R.menu.menu_main, menu);\n return true;\n}\n\n@Override\npublic boolean onOptionsItemSelected(MenuItem item) {\n // Handle action bar item clicks here. The action bar will\n // automatically handle clicks on the Home/Up button, so long\n // as you specify a parent activity in AndroidManifest.xml.\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n return true;\n }\n else if (id == R.id.action_exit){\n finish();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n}\n\npublic void onGetNewtonLaw(View view)\n{\n Intent getNewtonLawIntent = new Intent(this, NewtonScreen.class);\n\n final int result = 1;\n\n startActivityForResult(getNewtonLawIntent,result);\n}\n\npublic void onGetThermodynamicsLaw(View view)\n{\n Intent getThermodynamicsLawIntent = new Intent(this, ThermodynamicsScreen.class);\n\n final int result = 1;\n\n startActivityForResult(getThermodynamicsLawIntent,result);\n\n}\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eThermodynamicsScreen Activity\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class ThermodynamicsScreen extends Activity {\n\n private Button thermodynamicsLawOneButton, thermodynamicsLawTwoButton,thermodynamicsLawThreeButton;\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.thermodynamics_layout);\n\n thermodynamicsLawOneButton = (Button) findViewById(R.id.thermodynamics_law_1_button);\n thermodynamicsLawTwoButton = (Button) findViewById(R.id.thermodynamics_law_2_button);\n thermodynamicsLawThreeButton = (Button) findViewById(R.id.thermodynamics_law_3_button);\n}\n\npublic void onClickThermodynamicsLawOne(View view)\n{\n Toast.makeText(this, \"Energy can neither be created nor destroyed; it can only be transferred or changed from one form to another.\\n\\n ΔE=q+w \",Toast.LENGTH_LONG).show();\n}\npublic void onClickThermodynamicsLawTwo(View view)\n{\n Toast.makeText(this, \"The entropy of the world only increases and never decreases.\", Toast.LENGTH_LONG).show();\n}\npublic void onClickThermodynamicsLawThree(View view)\n{\n Toast.makeText(this, \"that the entropy of a system approaches a constant value as the temperature approaches absolute zero.\", Toast.LENGTH_LONG).show();\n}\npublic void onClickBackToMainMenu (View view)\n{\n Intent mainMenu = new Intent();\n\n setResult(RESULT_OK, mainMenu);\n\n finish();\n}\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eNewtonScreen Activity\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class NewtonScreen extends Activity\n{\n\n\nprivate Button theAnswerButton, theHintButton, theSuckButton;\n@Override\nprotected void onCreate(Bundle savedInstanceState)\n{\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.newton_layout);\n\n theAnswerButton = (Button) findViewById(R.id.answer_button);\n theHintButton = (Button) findViewById(R.id.hint_button);\n theSuckButton = (Button)findViewById(R.id.suck_at_physics_button);\n\n}\n\npublic void onClickTheAnswerButton(View view)\n{\n\n Toast.makeText(this,\n \"An object at rest will remain at rest unless acted on by an unbalanced force. \" +\n \"An object in motion continues in motion with the same speed and in the same direction\" +\n \" unless acted upon by an unbalanced force.\",\n Toast.LENGTH_LONG).show();\n\n}\n\npublic void onClickTheHintButton(View view)\n{\n Toast.makeText(this, \"F = m*a\",Toast.LENGTH_SHORT).show();\n}\n\npublic void onClickTheSuckPhysicsButton(View view)\n{\n Toast.makeText(this, \"For every action there is an equal and opposite re-action.\", Toast.LENGTH_LONG).show();\n}\n\npublic void onClickBackToMainMenu (View view)\n{\n Intent mainMenu = new Intent();\n\n setResult(RESULT_OK, mainMenu);\n\n finish();\n}\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eE/AndroidRuntime﹕ FATAL EXCEPTION: main\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eLog (everything that was red)\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Process: com.example.android.newtonsfirstlawofmotion, PID: 8432\n java.lang.IllegalStateException: Could not execute method of the activity\n at android.view.View$1.onClick(View.java:3827)\n at android.view.View.performClick(View.java:4442)\n at android.view.View$PerformClick.run(View.java:18473)\n at android.os.Handler.handleCallback(Handler.java:733)\n at android.os.Handler.dispatchMessage(Handler.java:95)\n at android.os.Looper.loop(Looper.java:136)\n at android.app.ActivityThread.main(ActivityThread.java:5105)\n at java.lang.reflect.Method.invokeNative(Native Method)\n at java.lang.reflect.Method.invoke(Method.java:515)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)\n at dalvik.system.NativeStart.main(Native Method)\n Caused by: java.lang.reflect.InvocationTargetException\n at java.lang.reflect.Method.invokeNative(Native Method)\n at java.lang.reflect.Method.invoke(Method.java:515)\n at android.view.View$1.onClick(View.java:3822)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e            \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eat android.view.View.performClick(View.java:4442)\n            at android.view.View$PerformClick.run(View.java:18473)\n            at android.os.Handler.handleCallback(Handler.java:733)\n            at android.os.Handler.dispatchMessage(Handler.java:95)\n            at android.os.Looper.loop(Looper.java:136)\n            at android.app.ActivityThread.main(ActivityThread.java:5105)\n            at java.lang.reflect.Method.invokeNative(Native Method)\n            at java.lang.reflect.Method.invoke(Method.java:515)\n            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)\n            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)\n            at dalvik.system.NativeStart.main(Native Method)\n Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.android.newtonsfirstlawofmotion/com.example.android.newtonsfirstlawofmotion.ThermodynamicsScreen}; have you declared this activity in your AndroidManifest.xml?\n at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)\n at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)\n at android.app.Activity.startActivityForResult(Activity.java:3468)\n at android.app.Activity.startActivityForResult(Activity.java:3429)\n at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:748)\n at com.example.android.newtonsfirstlawofmotion.MainActivity.onGetThermodynamicsLaw(MainActivity.java:63)\n            at java.lang.reflect.Method.invokeNative(Native Method)\n            at java.lang.reflect.Method.invoke(Method.java:515)\n            at android.view.View$1.onClick(View.java:3822)\n            at android.view.View.performClick(View.java:4442)\n            at android.view.View$PerformClick.run(View.java:18473)\n            at android.os.Handler.handleCallback(Handler.java:733)\n            at android.os.Handler.dispatchMessage(Handler.java:95)\n            at android.os.Looper.loop(Looper.java:136)\n            at android.app.ActivityThread.main(ActivityThread.java:5105)\n            at java.lang.reflect.Method.invokeNative(Native Method)\n            at java.lang.reflect.Method.invoke(Method.java:515)\n            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)\n            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)\n            at dalvik.system.NativeStart.main(Native Method)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks for your response in advance! :)\u003c/p\u003e","answer_count":"3","comment_count":"2","creation_date":"2016-01-29 15:42:42.21 UTC","last_activity_date":"2016-01-29 22:44:45.49 UTC","last_edit_date":"2016-01-29 17:45:04.797 UTC","last_editor_display_name":"","last_editor_user_id":"5857906","owner_display_name":"","owner_user_id":"5857906","post_type_id":"1","score":"0","tags":"android|android-intent|android-activity","view_count":"57"} {"id":"11383365","title":"Parameter-passing in merge sort","body":"\u003cp\u003eGood day! This program should sort the first n words in a file. Please help me pass the parameters when I call the method mergeSort_srt. When I run this, the console says\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eException in thread \"main\" java.lang.Error: Unresolved compilation problem: \n The method mergeSort_srt(int[], int, int) in the type SortingAnalysis is not applicable for the arguments (String[], int, int)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm new to programming expecially in the Java language and I am so confused. Please help me. As much as I want to find the error on my own, I can't because I have little idea about this stuff and I need help from real people, not just by reading tutorials online. Thank you very much!\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport java.io.*;\nimport java.util.*;\n\npublic class SortingAnalysis {\n\n public static void mergeSort_srt(int array[],int lo, int n){\n int low = lo;\n int high = n;\n if (low \u0026gt;= high) {\n return;\n }\n\n int middle = (low + high) / 2;\n mergeSort_srt(array, low, middle);\n mergeSort_srt(array, middle + 1, high);\n int end_low = middle;\n int start_high = middle + 1;\n while ((lo \u0026lt;= end_low) \u0026amp;\u0026amp; (start_high \u0026lt;= high)) {\n if (array[low] \u0026lt; array[start_high]) {\n low++;\n } else {\n int Temp = array[start_high];\n for (int k = start_high- 1; k \u0026gt;= low; k--) {\n array[k+1] = array[k];\n }\n array[low] = Temp;\n low++;\n end_low++;\n start_high++;\n }\n }\n } \n\n public static void main(String[] args) {\n final int NO_OF_WORDS = 10000;\n try {\n Scanner file = new Scanner(new File(args[0]));\n String[] words = new String[NO_OF_WORDS];\n\n int i = 0;\n while(file.hasNext() \u0026amp;\u0026amp; i \u0026lt; NO_OF_WORDS) {\n words[i] = file.next();\n i++;\n }\n long start = System.currentTimeMillis();\n\n mergeSort_srt(words, 0, words.length-1);\n long end = System.currentTimeMillis();\n System.out.println(\"Sorted Words: \");\n for(int j = 0; j \u0026lt; words.length; j++) {\n System.out.println(words[j]);\n } \n System.out.print(\"Running time: \" + (end - start) + \"ms\");\n\n }\n catch(SecurityException securityException) {\n System.err.println(\"You do not have proper privilege to access the files.\");\n System.exit(1);\n }\n catch(FileNotFoundException fileNotFoundException) {\n System.err.println(\"Error accessing file\");\n System.exit(1);\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-07-08 13:03:57.483 UTC","last_activity_date":"2012-10-07 11:36:52.03 UTC","last_edit_date":"2012-10-07 11:36:52.03 UTC","last_editor_display_name":"","last_editor_user_id":"635608","owner_display_name":"","owner_user_id":"1240382","post_type_id":"1","score":"0","tags":"java|merge|parameter-passing|mergesort","view_count":"770"} {"id":"2474078","title":"Load the main page if user visits a page meant for an ajax request?","body":"\u003cp\u003eI am using jQuery for a simple website and have a main page 'index.html' which can load some content (e.g. 'info1.html' or 'info2.html') via jQuery ajax requests, and display the result of these requests inside an element in the 'index.html' page.\u003c/p\u003e\n\n\u003cp\u003eIf a user somehow visits say 'info1.html' directly, is their a way to redirect or load the main 'index.html' page? (or what's best practice for this type of thing) as Google is indexing all the small html files used for the ajax requests and sometimes a user can click into the site via these pages.\u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","accepted_answer_id":"2474107","answer_count":"4","comment_count":"0","creation_date":"2010-03-18 23:37:28.277 UTC","last_activity_date":"2013-10-18 07:01:31.603 UTC","last_edit_date":"2010-03-18 23:44:20.367 UTC","last_editor_display_name":"","last_editor_user_id":"280730","owner_display_name":"","owner_user_id":"14260","post_type_id":"1","score":"3","tags":"jquery|html|ajax","view_count":"128"} {"id":"39754570","title":"How to pass the non dataframe argument to udf in spark","body":"\u003cp\u003eCan any please help to know how to pass the non dataframe value as an argument to udf.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eval df2 = df1.withColumn(\"newcol\", udffunc(df1(\"col1\"), x)).\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe udf function i defined as below.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eudffunc = udf(method _)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMethod i defined as below.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef method(inputvar1: String, inputvar2: String): Option[Long] = {\n ...\n ...\n return Longvariable\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"39761409","answer_count":"1","comment_count":"7","creation_date":"2016-09-28 17:59:21.63 UTC","last_activity_date":"2017-08-07 13:54:26.8 UTC","last_edit_date":"2016-09-28 18:00:30.907 UTC","last_editor_display_name":"","last_editor_user_id":"2411320","owner_display_name":"","owner_user_id":"6658698","post_type_id":"1","score":"0","tags":"apache-spark","view_count":"501"} {"id":"12914296","title":"Wp7 \u0026 ReactiveOauth","body":"\u003cp\u003eI´m having trouble populating a list with the result from an API using ReactiveOauth for wp7.\nIt works when i´m populating the listbox directly. But I can´t figure out how to add the object to a list instead. The list is always empty when doing it like this .Subscribe(a =\u003e lista.Add(new Device ...\u003c/p\u003e\n\n\u003cp\u003eAny suggestions is very appreciated.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e var token = TelldusWrapper.Security.GetToken();\n var lista = new List\u0026lt;Device\u0026gt;();\n\n var client = new OAuthClient(ConsumerKey, ConsumerSecret, token)\n {\n Url = \"http://api.telldus.com/xml/devices/list\",\n Parameters = { { \"supportedMethods\", \"TELLSTICK_TURNON\" } }\n };\n client.GetResponseText().Select(s =\u0026gt; XElement.Parse(s))\n .SelectMany(x =\u0026gt; x.Descendants(\"device\"))\n .Select(x =\u0026gt; new\n {\n Text = x.Attribute(\"id\").Value,\n Name = x.Attribute(\"name\").Value\n })\n .ObserveOnDispatcher()\n .Subscribe(a =\u0026gt; listbox.Items.Add(new Device { Id = a.Text, Name = a.Name }), ex =\u0026gt; MessageBox.Show(ex.ToString())); \n //.Subscribe(a =\u0026gt; lista.Add(new Device { Id = a.Text, Name = a.Name }), ex =\u0026gt; MessageBox.Show(ex.ToString())); \n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"0","creation_date":"2012-10-16 12:04:37.273 UTC","last_activity_date":"2012-10-17 08:28:19.56 UTC","last_edit_date":"2012-10-17 08:28:19.56 UTC","last_editor_display_name":"","last_editor_user_id":"1665741","owner_display_name":"","owner_user_id":"1665741","post_type_id":"1","score":"1","tags":"windows-phone-7|oauth","view_count":"74"} {"id":"12428459","title":"Expandable content div and background functionality","body":"\u003cp\u003eI'm new to web design/developing, and have a few questions.\u003c/p\u003e\n\n\u003cp\u003eFirstly, I'm interested in finding a method of making content within a page expandable, but not sure how it would affect the image that is set as the background, as well as the rest of the content (navigation, various other divs outside of the div that I want to make expandable). I've been reading up on a couple jQuery scripts for expandable divs and have also studied the \"sticky footer\", but am still slightly confused on the total process and procedure. I do design for some companies around my town and use various backgrounds that I've made in Photoshop, a lot of them just being basic gradient-style backgrounds.\u003c/p\u003e\n\n\u003cp\u003eAnyway, just looking for some answers/suggestions from a web veteran to a beginner.\u003c/p\u003e\n\n\u003cp\u003eThanks,\nEric\u003c/p\u003e","accepted_answer_id":"12430466","answer_count":"1","comment_count":"5","creation_date":"2012-09-14 16:27:22.783 UTC","last_activity_date":"2012-09-14 19:08:02.893 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1671905","post_type_id":"1","score":"0","tags":"jquery|background-image|footer|sticky-footer|expandable","view_count":"314"} {"id":"43939184","title":"How to call this classes in main method java?","body":"\u003cp\u003eI know this is probably a super simple question but I can't seem to figure it out for the life of me.\u003c/p\u003e\n\n\u003cp\u003eAs the title states I just want to call the class in the Main Method.\nI found some answers but still can't solve it.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic abstract class Trinome {\nprotected double a ;\nprotected double b ;\nprotected double c ;\nprotected Discriminant discriminant ;\npublic Trinome (double x, double y, double z, Discriminant delta) {\na = x ; b = y ; c = z ;\ndiscriminant = delta ;\n}\npublic static Trinome creer (double a, double b, double c) {\n Discriminant leDiscriminant = new Discriminant (a, b, c) ;\n double delta = leDiscriminant.valeur () ;\n Trinome trinome ;\n if (delta == 0.0) {\n return trinome =\n new TrinomeAvecUneRacineDouble(a, b, c, leDiscriminant) ;\n } else if (delta \u0026gt; 0.0) {\n return trinome =\n new TrinomeAvecDeuxRacinesDistinctes(a, b, c, leDiscriminant) ;\n } else {\n return trinome =\n new TrinomeSansRacine ( a, b, c, leDiscriminant) ;\n }\n }\npublic abstract void calculerRacines () ;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e2nd Class:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport java.util.Scanner;\n\npublic class TrinomeAvecDeuxRacinesDistinctes extends Trinome {\nDiscriminant delta;\n public TrinomeAvecDeuxRacinesDistinctes (double a, double b, double c, \nDiscriminant delta) {\n super (a, b, c, delta) ;\n }\n Scanner scan = new Scanner(System.in);\n {System.out.print(\"donnez la valeur de a:\"); \n a=scan.nextDouble();\n System.out.print(\"donnez la valeur de b:\"); \n b=scan.nextDouble();\n System.out.print(\"donnez la valeur de c:\"); \n c=scan.nextDouble();}\n public void calculerRacines() {\n System.out.println(\"-- Deux racines distinctes : x1 = \" + \n (- b + Math.sqrt(delta.valeur())) / (2.0 * a) + \" x2 = \" +\n (-b - Math.sqrt(delta.valeur())) / (2.0 * a));\n}\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe main Class where i want to call the other class:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class TestSecondDegre {\n\n public static void main(String[] args) {\n\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"43939976","answer_count":"1","comment_count":"5","creation_date":"2017-05-12 13:38:37.917 UTC","last_activity_date":"2017-05-12 14:16:38.003 UTC","last_edit_date":"2017-05-12 13:49:34.517 UTC","last_editor_display_name":"","last_editor_user_id":"8002711","owner_display_name":"","owner_user_id":"8002711","post_type_id":"1","score":"-9","tags":"java","view_count":"60"} {"id":"28419249","title":"MPLab Interrupt in Assembly Language","body":"\u003cp\u003eAssembly code interrupt in MPlab\u003c/p\u003e\n\n\u003cp\u003eMPLAB IDE: v8.92\nCHIP: dsPIC33FJ64GP802\u003c/p\u003e\n\n\u003cp\u003eI've been going over this code for an interrupt in assembly language. I'm not sure if there is a problem with the code or the linker files (I've used the linker and header files for the chip) but when I fire Asynchronous toggle INT0, the code encounters \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e CORE-W0008: Software Reset Instruction called at PC=0x000202\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand the code continues from the first line instead of going to the interrupt subroutine.\nMy research has not turned up many useful results for this software reset instruction.\u003c/p\u003e\n\n\u003cp\u003eHere is the code;\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e.include \"p33FJ64GP802.inc\" \n\n.global __reset \n.global __INT0interrupt ; ISR (Interrupt Service Routine) \n\n.text \n\n__reset: ; Code section\n\nMOV #0x900, W15 ; Enable the stack register\n\nMOV #__SPLIM_init, W0 \n\nMOV W0, SPLIM ; Initialize Stack Pointer Limit Register\n\nNOP \n\n\nCALL INITinit ; Initialize interrupt enables\n\nCALL initIO ; Initialize interrupt I/O ports\n\nCALL LED1\n\n\nINITinit: ; Initialize the interrupt\n\nBSET IPC0, #0 ; Set Interrupt Priority Control bit #0 high\n\nBSET IPC0, #1 ; \" \" \" \" bit #1 high\n\nBSET IPC0, #2 ; \" \" \" \" bit #2 high \n(interrupt has highest priority)\n\nBSET IEC0, #0 ; Set Interrupt Enable Control (Register 0) High \n(Interrupt request enabled) \n\nBCLR IFS0, #0 ; Clear Interrupt Flag Status (Register 0) Low\n\nRETURN\n\n\ninitIO: ; Initialize Input/Output\n\nMOV #0XFFFF, W0\n\nMOV W0, AD1PCFGL ; Disable analog I/O\n\nMOV #0x0000, W0 \n\nMOV W0, TRISB ; Output direction\n\nNOP\n\nBCLR TRISB, #1 ; Bit #1 cleared 'low' in TRISB | Pin RB1 is \noutput for LED1\n\nNOP\n\nBCLR TRISB, #2 ; Bit #2 cleared 'low' in TRISB | Pin RB2 is \noutput for LED2\n\nNOP\n\nBSET TRISB, #7 ; Bit #7 set 'high' in TRISB | Pin RB7 is \ninput for interupt\n\nNOP\n\nRETURN \n\n\nLED1: ; Start of function 'LED 1' \n\nMOV #0xFFFF, W1 ; Blue LED 1 On \n\nMOV W1, PORTB \n\nCALL DELAY \n\nMOV #0x0000, W1 ; Blue LED 1 Off\n\nMOV W1, PORTB \n\nCALL DELAY \n\nGOTO LED1 ; Go to LED1\n\n\nDELAY: ; Start function delay\n\nMOV #0x0001, W2 ; Set W2 High\n\nMOV #0x0000, W3 ; Start W3 Low\n\nagain0: ; Function 'again1'\n\nADD #0x0001, W3 ; Add value '1' to regiter 3\n\nCPSEQ W3, W2 ; Compare W3 to W2- if equal then skip next line\n\ngoto again0 ; Go to again1\n\nRETURN ; Return from subroutine\n\n\n__INT0interrupt: ; ISR \n\nNOP ; No operation\n\nBTG PORTB, #7 ; BIT #7 of Port B is toggled(complimented)\n\nMOV #0x0005, W4\n\nMOV #0X0000, W5\n\nagain1:\n\nMOV #0XFFFF, W1\n\nMOV W1, PORTB ; Red LED 2 On\n\nCALL DELAY\n\nMOV #0X0000, W1\n\nMOV W1, PORTB ; Red LED 2 OFF\n\nCALL DELAY\n\nINC W5, W5\n\nCPSEQ W4, W5\n\ngoto again1\n\nBCLR IFS0, #0 ; BIT #0 of the IFSO is cleared\n\nNOP\n\nRETFIE ; Return from interupt enable\n\n\n.end\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIf anyone knew how to send the program counter to enter the interrupt service routine it would be greatly appreciated. \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-02-09 20:59:50.67 UTC","last_activity_date":"2015-08-21 10:16:19.177 UTC","last_edit_date":"2015-02-09 21:43:00.58 UTC","last_editor_display_name":"","last_editor_user_id":"2181768","owner_display_name":"","owner_user_id":"4547917","post_type_id":"1","score":"0","tags":"assembly|interrupt|mplab","view_count":"322"} {"id":"8802450","title":"jQuery iFrame Content Panning ( instead of Scrolling )","body":"\u003cp\u003eI'm looking for an iFrame \u003cstrong\u003eContent Panning\u003c/strong\u003e like Google Maps instead of regular scrolling.. \nWhat I mean is .. Say, I have loaded google.com inside iFrame. But instead of scrolling that iFrame I want to use Panning to scroll the page content Up/Down.\u003c/p\u003e\n\n\u003cp\u003eIs there any plugin for such \u003cstrong\u003eiFrame Content Panning\u003c/strong\u003e ? \u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2012-01-10 11:21:10.427 UTC","last_activity_date":"2012-01-10 11:24:30.257 UTC","last_edit_date":"2012-01-10 11:24:30.257 UTC","last_editor_display_name":"","last_editor_user_id":"369411","owner_display_name":"","owner_user_id":"369411","post_type_id":"1","score":"0","tags":"jquery|jquery-ui|iframe|scroll|panning","view_count":"853"} {"id":"11068240","title":"What is the most efficient way to parse a CSS color in JavaScript?","body":"\u003cp\u003eGiven a string of a valid CSS color value:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003e#fff\u003c/li\u003e\n\u003cli\u003e#ffffff\u003c/li\u003e\n\u003cli\u003ewhite\u003c/li\u003e\n\u003cli\u003ergb(255, 255, 255)\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eNeed to get an array of numbers of the following format: [R, G, B]\u003c/p\u003e\n\n\u003cp\u003eWhat is the most efficient way of doing this in JavaScript (assuming a major browser)?\u003c/p\u003e","accepted_answer_id":"11068286","answer_count":"8","comment_count":"1","creation_date":"2012-06-17 01:21:45.973 UTC","favorite_count":"0","last_activity_date":"2017-07-24 15:16:01.657 UTC","last_edit_date":"2013-01-26 02:26:04.663 UTC","last_editor_display_name":"","last_editor_user_id":"139667","owner_display_name":"","owner_user_id":"139667","post_type_id":"1","score":"9","tags":"javascript|css|performance|parsing|colors","view_count":"9317"} {"id":"7162789","title":"Yii - Design question - Keeping dialoges separate from the main view file and accessing them","body":"\u003cp\u003eI have a case where on my view file there are 6 links and clicking on them opens CJuiDialog boxes . I am keeping all the 6 dialog boxes code in the same view file along with links and that is causing the file to be big and loading them all together once .The ideal scenario is the dialog boxes should get loaded only when the use clicks on the links .\u003c/p\u003e\n\n\u003cp\u003eSo is there any way we can keep only the links code in the main view file and keeping all the dialogue boxes in separate files and loading them only when the user clicks on the links\u003c/p\u003e\n\n\u003cp\u003eI mean \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eindex.php ( view containing only links)\n_dialog1 ( containing code for first dialog )\n_dialog2 ( containing code for second dialog )\n_dialog3 ( containing code for third dialog )\n_dialog4 ( containing code for fourth dialog )\n_dialog5 ( containing code for fifth dialog )\n_dialog6 ( containing code for sixth dialog )\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eSample Code\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e//First Dialog code\n\n $this-\u0026gt;beginWidget('zii.widgets.jui.CJuiDialog', array(\n 'id'=\u0026gt;'mydialog1',\n 'options'=\u0026gt;array(\n 'title'=\u0026gt;'Dialog box 1',\n 'autoOpen'=\u0026gt;false,\n 'modal'=\u0026gt;true, \n ),\n ));\n\n echo 'First dialog content here';\n\n $this-\u0026gt;endWidget('zii.widgets.jui.CJuiDialog');\n\n echo CHtml::link('open dialog', '#', array(\n 'onclick'=\u0026gt;'$(\"#mydialog1\").dialog(\"open\"); return false;',\n ));\n\n//2nd dialog code \n\n$this-\u0026gt;beginWidget('zii.widgets.jui.CJuiDialog', array(\n 'id'=\u0026gt;'mydialog2',\n 'options'=\u0026gt;array(\n 'title'=\u0026gt;'Dialog box 1',\n 'autoOpen'=\u0026gt;false,\n 'modal'=\u0026gt;true, \n ),\n ));\n\n echo 'dialog2 content here';\n\n $this-\u0026gt;endWidget('zii.widgets.jui.CJuiDialog');\n\n echo CHtml::link('open dialog', '#', array(\n 'onclick'=\u0026gt;'$(\"#mydialog2\").dialog(\"open\"); return false;',\n ));\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eSolution I came with\u003c/strong\u003e \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e//In controller\n\n public function actionOpenDialog1()\n {\n $data = array();\n $this-\u0026gt;renderPartial('_dialogContent1', $data, false, true);\n }\n public function actionOpenDialog2()\n {\n $data = array();\n $this-\u0026gt;renderPartial('_dialogContent2', $data, false, true);\n }\n\n//In index.view\n\n\u0026lt;div id=\"data\"\u0026gt;\n\u0026lt;/div\u0026gt;\n\n\u0026lt;?php\necho CHtml::ajaxButton (\"Open first dialog\", CController::createUrl('dialogTesting/openDialog1'),array('update' =\u0026gt; '#data'));\n\necho CHtml::ajaxButton (\"Open second dialog\", CController::createUrl('dialogTesting/openDialog2'),array('update' =\u0026gt; '#data'));\n?\u0026gt;\n\n//_dialogContent1.php\n\n\u0026lt;?php\n\n $this-\u0026gt;beginWidget('zii.widgets.jui.CJuiDialog', array(\n 'id'=\u0026gt;'mydialog1',\n 'options'=\u0026gt;array(\n 'title'=\u0026gt;'Dialog box 1',\n 'autoOpen'=\u0026gt;true,\n 'modal'=\u0026gt;true,\n ),\n ));\n\n echo 'first dialog content here';\n\n $this-\u0026gt;endWidget('zii.widgets.jui.CJuiDialog');\n?\u0026gt;\n\n\n//_dialogContent2.php\n\n\u0026lt;?php\n\n $this-\u0026gt;beginWidget('zii.widgets.jui.CJuiDialog', array(\n 'id'=\u0026gt;'mydialog1',\n 'options'=\u0026gt;array(\n 'title'=\u0026gt;'Dialog box 1',\n 'autoOpen'=\u0026gt;true,\n 'modal'=\u0026gt;true,\n ),\n ));\n\n echo 'first dialog content here';\n\n $this-\u0026gt;endWidget('zii.widgets.jui.CJuiDialog');\n?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks a lot for your help\u003c/p\u003e\n\n\u003cp\u003eRegards\u003c/p\u003e\n\n\u003cp\u003eKiran \u003c/p\u003e","accepted_answer_id":"7448469","answer_count":"3","comment_count":"2","creation_date":"2011-08-23 14:38:12.597 UTC","last_activity_date":"2011-09-16 17:45:59.583 UTC","last_edit_date":"2011-08-23 18:52:32.213 UTC","last_editor_display_name":"","last_editor_user_id":"274715","owner_display_name":"","owner_user_id":"274715","post_type_id":"1","score":"1","tags":"yii","view_count":"1449"} {"id":"15060681","title":"Remove Row on GridView","body":"\u003cp\u003eA gridtable has 5 rows which was filled by database.\u003cbr/\u003e\nIf we want to remove somerow on it.\u003cbr/\u003e\u003c/p\u003e\n\n\u003ch2\u003eSolution:\u003c/h2\u003e\n\n\u003cp\u003eCreate a datatableTemp, After remove on gridView, It will remove a table Temp too.\u003cbr/\u003e\nAfter that,It will be fill GridView by tableTemp.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e//========Get datatable from database.\ndtTempGrdBlockForDeviceByRole = Cls_BLOCKS.getDataTable_WriteField();\ngrdBlockForDeviceByRole = Cls_BLOCKS.getDataTable_WriteField(); \nfor (int x = 0; x \u0026lt; grdBlockForDeviceByRole.Rows.Count; x++)\n{\n CheckBox chk = grdBlockForDeviceByRole.Rows[x].FindControl(\"ckDelete\") as CheckBox;\n string txtD = grdBlockForDeviceByRole.Rows[x].Cells[0].Text; \n if (chk.Checked)\n {\n //If choice \n //What should we do in here? \n } \n}\ngrdBlockForDeviceByRole.DataSource = dtTempGrdBlockForDeviceByRole;\ngrdBlockForDeviceByRole.DataBind();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMay you help me?\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2013-02-25 05:27:01.507 UTC","last_activity_date":"2013-02-25 09:04:08.62 UTC","last_edit_date":"2013-02-25 07:10:29.193 UTC","last_editor_display_name":"","last_editor_user_id":"1793149","owner_display_name":"","owner_user_id":"1793149","post_type_id":"1","score":"-1","tags":"c#|asp.net|code-behind","view_count":"547"} {"id":"27917355","title":"How to split a string include some points coordinate in java?","body":"\u003cp\u003eI have a string as follow and I want to get as output. How can I do?\u003c/p\u003e\n\n\u003cp\u003eInput:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eString strconverted = \"MULTIPOINT Z (116.356887145739 39.887461162166 -28.1861667136582,116.374615732553 39.8883537940982 125.380505711997)\";\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eoutput:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eString pnt1= \"116.356887145739 39.887461162166 -28.1861667136582\"\n\nString pnt2= \"116.374615732553 39.8883537940982 125.380505711997\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ePlease note that may \"MULTIPOINT\" has more than two point.\u003c/p\u003e","answer_count":"2","comment_count":"3","creation_date":"2015-01-13 07:59:32.64 UTC","favorite_count":"1","last_activity_date":"2015-01-13 08:06:32.297 UTC","last_edit_date":"2015-01-13 08:01:25.093 UTC","last_editor_display_name":"","last_editor_user_id":"2138993","owner_display_name":"","owner_user_id":"4264802","post_type_id":"1","score":"-1","tags":"java","view_count":"75"} {"id":"34650188","title":"How to pass two-dimensional array by value to function","body":"\u003cp\u003eI'm trying to pass a 2d array to a function. But when I loop through the array in \u003ccode\u003esetParams\u003c/code\u003e there are some extra values in the array (happens for every \u003ccode\u003ecase\u003c/code\u003e in the \u003ccode\u003eswitch\u003c/code\u003e), I don't know where they are coming from. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction setParams(button, params) {\n\n\n $mydialog = $(\"#dialog\").dialog({\n autoOpen: true,\n buttons: {\n \"ok\": function() {\n $(this).dialog(\"close\");\n for(var key in params) {\n var value = params[key].toString();\n\n var arr = value.split(',');\n alert(arr[0] + \" \" + arr[1]);\n\n var control = $(\"#dialog\").find('input[name='+arr[1]+']');\n\n if (control.is(':checkbox'))\n {\n button.data('id')[arr[0]] = control.is(\":checked\");\n }\n else\n {\n button.data('id')[arr[0]] = control.val();\n }\n }\n sendRequest(button);\n },\n \"cancel\": function() {\n $(this).dialog(\"close\");\n }\n }\n });\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMenu function\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$(function() {\n $('#navigationMenu a').click(function(e) {\n e.preventDefault();\n e.stopPropagation();\n\n var button = $(this);\n var cl = button.attr(\"class\");\n console.log(button.attr('href'));\n\n switch(cl) {\n case \"input-params\":\n $('.id').show();\n $('.requestDate').hide();\n $('.startEndDate').hide();\n setParams(button, [[\"id\",\"id\"]]); \n break;\n case \"input-params-location\":\n $('.id').show();\n $('.requestDate').hide();\n $('.startEndDate').hide();\n setParams(button, [[\"locationId\",\"id\"]]); \n break;\n case \"input-params-openinghours\":\n $('.id').show();\n $('.requestDate').show();\n $('.startEndDate').hide();\n var myArray = [[\"locationId\",\"id\"],[\"requestDate\",\"date\"]];\n setParams(button, myArray);\n break;\n case \"input-params-allocations\":\n $('.id').hide();\n $('.requestDate').hide();\n $('.startEndDate').show();\n setParams(button, [[\"startDate\",\"startDate\"],[\"endDate\",\"endDate\"],[\"includeGroupActivities\",\"includeGroupActivities\"]]);\n break;\n case \"input-params-allocations-id\":\n $('.id').show();\n $('.requestDate').hide();\n $('.startEndDate').show();\n setParams(button, [[\"id\",\"id\"],[\"startDate\",\"startDate\"],[\"endDate\",\"endDate\"],[\"includeGroupActivities\",\"includeGroupActivities\"]]);\n break;\n default:\n sendRequest(button)\n }\n\n });\n });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eExcept the values I pass these values are in the array too\u003c/p\u003e\n\n\u003cp\u003e1)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction (){return v;\n} undefined\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e2)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction Array() {[native code]} undefined\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e3)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction (i v)Array.forEach(this\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow can I pass the array in a correct way without getting the extra values?\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2016-01-07 08:14:22.843 UTC","last_activity_date":"2016-01-07 08:35:52.187 UTC","last_edit_date":"2016-01-07 08:35:52.187 UTC","last_editor_display_name":"","last_editor_user_id":"1533666","owner_display_name":"","owner_user_id":"2175330","post_type_id":"1","score":"0","tags":"javascript|arrays|multidimensional-array","view_count":"83"} {"id":"39734873","title":"How do I implement oninput in Jade?","body":"\u003cpre\u003e\u003ccode\u003e input(type='range', id= 'inputSlider', min='0', max='255', value='50', step='1', oninput=showValue(this.value))\n span#outputText 50\n\nscript.\n var socket = io.connect();\n\n socket.on('led', function (data) {\n document.getElementById(\"inputSlider\").value = data.value;\n document.getElementById(\"outputText\").innerHTML = data.value;\n });\n\n function showValue(newValue)\n {\n document.getElementById(\"outputText\").innerHTML=newValue;\n socket.emit('led', { value: newValue });\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow do I assign a value to the \u003ccode\u003eoninput\u003c/code\u003e attribute in Jade?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-09-27 21:49:57.293 UTC","last_activity_date":"2016-09-28 18:34:26.423 UTC","last_edit_date":"2016-09-28 18:34:26.423 UTC","last_editor_display_name":"","last_editor_user_id":"5149381","owner_display_name":"","owner_user_id":"3849307","post_type_id":"1","score":"0","tags":"javascript|node.js|express|socket.io|pug","view_count":"45"} {"id":"47161720","title":"Support RTL in BottomSheetDialog","body":"\u003cp\u003eHow can I support RTL direction in BottomSheetDialog?\u003c/p\u003e\n\n\u003cp\u003eFor RTL supporting I have a LocaleHelper class which attached in \u003ccode\u003eattachBaseContext\u003c/code\u003e method in \u003ccode\u003eBaseActivity\u003c/code\u003e, \u003ccode\u003eBaseFragment\u003c/code\u003e and \u003ccode\u003eApplication\u003c/code\u003e class like below:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Override\nprotected void attachBaseContext(Context base) {\n super.attachBaseContext(LocaleHelper.onAttach(base));\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAll things works perfectly in all \u003ccode\u003eActivity\u003c/code\u003e and \u003ccode\u003eFragment\u003c/code\u003e, but in \u003ccode\u003eBottomSheetDialog\u003c/code\u003e I have no idea what doing for RTL supporting.\n\u003cbr/\u003e\u003cbr/\u003e\nThanks in advance!\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-11-07 15:33:52.487 UTC","last_activity_date":"2017-11-07 18:42:30.8 UTC","last_edit_date":"2017-11-07 18:42:30.8 UTC","last_editor_display_name":"","last_editor_user_id":"3719459","owner_display_name":"","owner_user_id":"3032347","post_type_id":"1","score":"0","tags":"android|dialog|right-to-left|bottom-sheet","view_count":"15"} {"id":"12926534","title":"Broken files - wrong path to php files when loading contact form in a div (using jquery load function) - what is wrong?","body":"\u003cp\u003eOkay, so I'm loading this (it's a contact form) in a div on www.mydomain.com/contact.html\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;script type=\"text/javascript\"\u0026gt;\n $(document).ready(function() {\n $('#result').load('http://www.mydomain.com/support/contact.php #ticketForm');\n });\n\u0026lt;/script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt shows the contact form, but there is a captcha picture that isn't loading because the path is wrongly set to www.mydomain.com/captcha.php (shows when I right-click the captcha \"broken file\" picture) instead of www.mydomain.com/support/captcha.php. Also seems that some of the styling is missing, most likely because of the same problem with a wrong path.\u003c/p\u003e\n\n\u003cp\u003eAll the files and folders that contact.php needs are located in the www.mydomain.com/support directory and not www.mydomain.com. \u003c/p\u003e\n\n\u003cp\u003eHow do I fix this problem without moving all the files? I'm no coder so please explain as much as possible. Thanks.\u003c/p\u003e","accepted_answer_id":"12926748","answer_count":"2","comment_count":"4","creation_date":"2012-10-17 03:10:29.217 UTC","last_activity_date":"2015-08-26 09:32:16.463 UTC","last_edit_date":"2015-08-26 09:32:16.463 UTC","last_editor_display_name":"","last_editor_user_id":"472495","owner_display_name":"","owner_user_id":"1647423","post_type_id":"1","score":"-3","tags":"php|javascript|jquery|website","view_count":"236"} {"id":"6937725","title":"Monitoring info about running processes of an iPhone with Objective C","body":"\u003cp\u003eI'm developing an iPhone app with XCode. I want to track the running applications of the phone and the memory, CPU usage for each of them. Still I wasn't able to find a way to do this. Can anyone help me?\u003c/p\u003e","accepted_answer_id":"6937735","answer_count":"1","comment_count":"0","creation_date":"2011-08-04 07:31:54.247 UTC","last_activity_date":"2011-08-04 07:34:21.303 UTC","last_edit_date":"2011-08-04 07:34:21.303 UTC","last_editor_display_name":"","last_editor_user_id":"253056","owner_display_name":"","owner_user_id":"610225","post_type_id":"1","score":"0","tags":"iphone|ios|xcode|memory-management|cpu-usage","view_count":"642"} {"id":"13848593","title":"Android drag two images on canvas","body":"\u003cp\u003eMy end goal here is to be able to add two (or more) images to a view/canvas, then turn that canvas into a single bitmap. I've seen many similar SO posts about dragging images around on a view, however, none of them cover dragging multiple images. \u003c/p\u003e\n\n\u003cp\u003eI am currently using the matrix commands to rotate and zoom, which work fine but only for one image. The code I am using is similar to \u003ca href=\"https://stackoverflow.com/questions/5894736/rotate-zoom-drag-image-in-android-imageview\"\u003ethis\u003c/a\u003e post. The issue here is that using fill_parent on the image will only allow for one image to be dragged because it is on top of the other image. Using wrap_content will only allow the image to be dragged within the confines of how big the image currently is, producing a cropped looking image.\u003c/p\u003e\n\n\u003cp\u003eSo, is there anyway to edit this code (or use fresh code) to allow multiple images to be dragged and/or zoomed? As I've mentioned, there are many other SO posts about this but none have any solid answers.\u003c/p\u003e","accepted_answer_id":"13848627","answer_count":"1","comment_count":"0","creation_date":"2012-12-12 21:02:59.627 UTC","favorite_count":"0","last_activity_date":"2012-12-12 21:06:22.213 UTC","last_edit_date":"2017-05-23 11:51:05.92 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"731904","post_type_id":"1","score":"1","tags":"android|imageview|android-canvas","view_count":"1320"} {"id":"29202274","title":"let Nsight start debugging after certain kernel function is executed","body":"\u003cp\u003eMy CUDA program have too many kernel functions and if I open the CUDA debugging mode, I'll have to wait for an whole hour after the breakpoint in certain kernel function is triggered.\u003c/p\u003e\n\n\u003cp\u003eIs there any way for Nsight to start debugging after certain kernel functions, or only debug the certain kernel function?\u003c/p\u003e\n\n\u003cp\u003eI'm using Nsight with VS2012\u003c/p\u003e","accepted_answer_id":"29203010","answer_count":"1","comment_count":"2","creation_date":"2015-03-23 02:08:00.33 UTC","last_activity_date":"2015-03-23 03:51:23.363 UTC","last_edit_date":"2015-03-23 03:08:05.963 UTC","last_editor_display_name":"","last_editor_user_id":"2277120","owner_display_name":"","owner_user_id":"2277120","post_type_id":"1","score":"1","tags":"cuda|nsight","view_count":"245"} {"id":"17516809","title":"What are the Cypher commands to delete index and index entry","body":"\u003cp\u003eIf I use the default Lucene index engine, what is the Cypher command to delete an index? and what is the Cypher command to delete an index entry within a specific index?\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2013-07-07 21:58:43.25 UTC","last_activity_date":"2015-06-08 14:21:19.097 UTC","last_edit_date":"2013-07-08 16:51:22.753 UTC","last_editor_display_name":"","last_editor_user_id":"2558892","owner_display_name":"","owner_user_id":"2558892","post_type_id":"1","score":"4","tags":"neo4j|cypher","view_count":"3173"} {"id":"22561756","title":"Visual Studio 2010 intellisense for KnockoutJS inside RequireJS","body":"\u003cp\u003eI want to get intellisense, inside Visual Studio 2010, for knockoutJS.\u003c/p\u003e\n\n\u003cp\u003eWhat I have after some research is:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e///reference path=\"../lib/knockout/knockout-2.3.0.debug.js\" /\u0026gt; \nko.WeGotIntellisenseHere; //As long as we don't add RequireJs intellisense reference above knockout reference\n\ndefine(['jquery', 'knockout'], function($, ko){\n ///\u0026lt;param name=\"ko\" type=\"knockout\"\u0026gt;\n ///some comments\n ///\u0026lt;/param\u0026gt;\n ko.NoIntellisenseHere(); // unless I change \"type=knockout\" by \"type=Array\"\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eDo you know if maybe the \"type=knockout\" is not correct??? When I change to \"type=Array\", intellisense works both outside (showing knockout members) and inside (showing Array members) of the \"define\" function\u003c/p\u003e\n\n\u003cp\u003eSame thing happens for jQuery\u003c/p\u003e\n\n\u003cp\u003eNote: In the example, I'm not writing the opening tag chracter \"\u0026lt;\" for the \"reference\" tag because it has problems on SO\u003c/p\u003e\n\n\u003cp\u003eThanks in advance\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2014-03-21 14:37:40.853 UTC","favorite_count":"1","last_activity_date":"2015-07-14 20:01:10.26 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"351194","post_type_id":"1","score":"3","tags":"knockout.js|requirejs|intellisense","view_count":"304"} {"id":"13347323","title":"Get last number from editbox Matlab","body":"\u003cp\u003eI am making calculator with matlab and I want to take last input number from editbox and put it into sind() brackets, when sin button is pushed. How to do that? I searched for several hours and didn't found anything.\u003c/p\u003e\n\n\u003cp\u003eNow my code for sin button looks like that:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e % --- Executes on button press in pushbutton40.\nfunction pushbutton40_Callback(hObject, eventdata, handles)\ninpfieldtxt = get(handles.edit1,'string');\nif(strcmp(inpfieldtxt,'0.')==1)\n set(handles.edit1,'String','sind(');\nelse\n inpfieldtxt=strcat(inpfieldtxt,'sind(');\n set(handles.edit1,'String',inpfieldtxt)\nend\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt just inserts 'sind(' to editbox and then I manually need to input number and closing bracket ')'.\u003c/p\u003e\n\n\u003cp\u003eI want this button to react as Windows 7 calculator's sin button. It also gets last number and puts it into sin(here).\u003c/p\u003e\n\n\u003cp\u003eI GOT IT!\nHere is solution:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e% --- Executes on button press in pushbutton40.\nfunction pushbutton40_Callback(hObject, eventdata, handles)\ninpfieldtxt = get(handles.edit1,'string');\nif(strcmp(inpfieldtxt,'0.')==1)\n set(handles.edit1,'String','sind(');\nelse\n isNumber = (inpfieldtxt \u0026gt;= '0') \u0026amp; (inpfieldtxt \u0026lt;= '9');\n i=length(inpfieldtxt);\n while (i \u0026gt; 0) \u0026amp;\u0026amp; (isNumber(i))\n if isNumber(i)\n i = i-1;\n end\n end\n lastnmb = inpfieldtxt(i+1:end);\n inpfieldtxt = inpfieldtxt(1:i);\n set(handles.edit1,'String',[inpfieldtxt,'sind(',lastnmb,')']);\nend\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThank you very much for help!\u003c/p\u003e","accepted_answer_id":"13347527","answer_count":"1","comment_count":"3","creation_date":"2012-11-12 16:19:06.787 UTC","last_activity_date":"2013-09-05 12:43:08.407 UTC","last_edit_date":"2013-09-05 12:43:08.407 UTC","last_editor_display_name":"","last_editor_user_id":"1228","owner_display_name":"","owner_user_id":"1818596","post_type_id":"1","score":"0","tags":"matlab|numbers|brackets|sin","view_count":"266"} {"id":"18522398","title":"Fastest way to read/write Images from a File into a BufferedImage?","body":"\u003col\u003e\n\u003cli\u003eWhat is the fastest way to read Images from a File into a BufferedImage in Java/Grails?\u003c/li\u003e\n\u003cli\u003eWhat is the fastest way to write Images from a BufferedImage into a File in Java/Grails?\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003emy variant (read): \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ebyte [] imageByteArray = new File(basePath+imageSource).readBytes()\nInputStream inStream = new ByteArrayInputStream(imageByteArray)\nBufferedImage bufferedImage = ImageIO.read(inStream)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003emy variant (write): \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eBufferedImage bufferedImage = // some image\ndef fullPath = // image page + file name\nbyte [] currentImage\n\ntry{\n\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n ImageIO.write( bufferedImage, \"jpg\", baos );\n baos.flush();\n currentImage = baos.toByteArray();\n baos.close();\n\n }catch(IOException e){\n System.out.println(e.getMessage());\n } \n } \n\n\ndef newFile = new FileOutputStream(fullPath)\nnewFile.write(currentImage)\nnewFile.close()\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"18522429","answer_count":"3","comment_count":"0","creation_date":"2013-08-29 23:11:27.07 UTC","favorite_count":"4","last_activity_date":"2017-06-02 08:11:19.24 UTC","last_edit_date":"2017-06-02 08:11:19.24 UTC","last_editor_display_name":"","last_editor_user_id":"1428606","owner_display_name":"user2722142","post_type_id":"1","score":"7","tags":"java|grails|grails-2.0|javax.imageio","view_count":"22653"} {"id":"18828028","title":"MVVM DataService Example","body":"\u003cp\u003eCan someone provide an example of how I would use the DataService with MVVMLight v4 to bind to a 'Company' Entity from my EDMX file (SQL 2008) when live or to a 'Company' collection at design time?\u003c/p\u003e\n\n\u003cp\u003eI have searched all over and find very few examples of how to use the DataService construct.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-09-16 12:26:49.143 UTC","last_activity_date":"2013-09-16 16:35:55.367 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"431168","post_type_id":"1","score":"0","tags":"mvvm-light|dataservice","view_count":"156"} {"id":"37017698","title":"is it necessary for a JsonDeserialize custom bean to be created for each field in object","body":"\u003cp\u003eI have a custom deserialization class that I am using to make sure that null Doubles are deserialized to null rather than 0.0\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class DoubleDeserializer extends JsonDeserializer\u0026lt;Double\u0026gt; {\n\n @Override\n public Double deserialize(JsonParser parser, DeserializationContext ctxt)\n throws IOException, JsonProcessingException {\n\n String doubleStr = parser.getText();\n if (doubleStr.isEmpty() || doubleStr == null) {\n return null;\n }\n return new Double(doubleStr);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI annotate each fields as such:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@JsonDeserialize(using = DoubleDeserializer.class)\nprivate Double partialPressureCO2;\n\n@JsonDeserialize(using = DoubleDeserializer.class)\nprivate Double partialPressureO2;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI have noticed for each field in the bean that a DoubleDeserializer object gets created as it is processed. This seems very inefficient. Is there something that I am doing incorrectly?\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2016-05-04 03:06:57.887 UTC","favorite_count":"0","last_activity_date":"2016-05-04 03:06:57.887 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"808655","post_type_id":"1","score":"1","tags":"java|json|jackson","view_count":"38"} {"id":"12896777","title":"Prepending class names with superfluous names that could be in the namespace","body":"\u003cp\u003eI am looking to see if this could come back to bite me in ways I did not anticipate. Right now I have 3 classes (example classes), which live in the same namespace.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e SqlServer.SqlServerConnectionSettings\n SqlServer.SqlServerCredentials\n SqlServer.SqlServerInstance\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eLater down the line I would also plan to have others like below.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e SqlLite.SqlLiteConnectionSettings\n SqlLite.SqlLiteCredentials\n SqlLite.SqlLiteInstance\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm starting to think it would be easier to \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e SqlServer.ConnectionSettings\n SqlServer.Credentials\n SqlServer.ServerInstance\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhere collisions are handled only when ambiguous, by appending the namespace like above.\u003c/p\u003e\n\n\u003cp\u003eMy only concern is that most code I see is prepended like my first example. Is there anyone that has gone and removed the prepended text from their codebases and found it improved or degraded readability?\u003c/p\u003e","accepted_answer_id":"12897079","answer_count":"1","comment_count":"5","creation_date":"2012-10-15 13:36:32.567 UTC","favorite_count":"1","last_activity_date":"2012-10-15 14:04:06.977 UTC","last_edit_date":"2012-10-15 14:04:06.977 UTC","last_editor_display_name":"","last_editor_user_id":"207202","owner_display_name":"","owner_user_id":"207202","post_type_id":"1","score":"2","tags":"c#|design","view_count":"84"} {"id":"29131802","title":"Specifying a separate injection for a particular interface","body":"\u003cp\u003eSuppose I have the following hierarchy which I wish to instantiate with DI:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eDatabaseService(IDatabaseRepository) : IDatabaseService\nDatabase1Service(IDatabaseRepository) : IDatabase1Service\nDatabase2Service(IDatabaseRepository) : IDatabase2Service\nDatabaseRepository(IUnitOfWork) : IDatabaseRepository\nDatabaseRepository2(IUnitOfWork) : IDatabaseRepository\nUnitOfWork(string) : IUnitOfWork\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs there a method in Stucturemap that would let me do this?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class MyRegistry : Registry\n{\n public MyRegistry()\n {\n //default-convention-scan code here\n\n //this is the unit of work for almost all of my interface implementations\n //i.e. new DatabaseService(new DatabaseRepository(new IUnitOfWork(\"Database1\")))\n // new Database1Service(new DatabaseRepository(new IUnitOfWork(\"Database1\")))\n For\u0026lt;IUnitOfWork\u0026gt;()\n .Use(new UnitOfWork(\"Database1\"));\n\n //Database2Service needs a separate implementation Of UnitOfWork\n //i.e. new Database2Service(new DatabaseRepository(new IUnitOfWork(\"Database2\")))\n For\u0026lt;IUnitOfWork\u0026gt;().IfDescendantDependencyOf\u0026lt;IDatabase2Service\u0026gt;()\n .Use(new UnitOfWork(\"Database2\"))\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIf it's not clear, I want all injected \u003ccode\u003eIUnitOfWork\u003c/code\u003es to point to the singleton \u003ccode\u003enew UnitOfWork(\"Database1\")\u003c/code\u003e, except if it was injected while trying to construct an instance of \u003ccode\u003eIDatabase2Service\u003c/code\u003e, where it should use the singleton \u003ccode\u003enew UnitOfWork(\"Database2\")\u003c/code\u003e.\u003c/p\u003e","answer_count":"1","comment_count":"5","creation_date":"2015-03-18 20:14:17.61 UTC","last_activity_date":"2015-03-19 20:28:08.28 UTC","last_edit_date":"2015-03-19 20:28:08.28 UTC","last_editor_display_name":"","last_editor_user_id":"1180926","owner_display_name":"","owner_user_id":"1180926","post_type_id":"1","score":"0","tags":"c#|structuremap","view_count":"48"} {"id":"30807429","title":"Is there a way to get a collectionViews frame from a collectionviewcell","body":"\u003cp\u003eI want to use \u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e-preferredLayoutAttributesFittingAttributes\u003c/code\u003e inside the \u003ccode\u003eUICollectionviewCell\u003c/code\u003e subclass we are writing. \u003c/p\u003e\n\n\u003cp\u003eCurrently we already had a weak pointer to out \u003ccode\u003eparentViewController\u003c/code\u003e and I try to set the collectionViewcell frame width to be the same as \u003ccode\u003eparentViewcontroller.view.frame.size.width\u003c/code\u003e. \u003c/p\u003e\n\n\u003cp\u003eI don't want to have a pointer to the \u003ccode\u003eparentViewController\u003c/code\u003e from the \u003ccode\u003eCollectionViewCell\u003c/code\u003e subclass as having a reference to the parentviewcontroller is a bad idea. \u003c/p\u003e\n\n\u003cp\u003eMy question is....\u003c/p\u003e\n\n\u003cp\u003eIs there a simple and ideal way to get the frame of collectionviewcell's super view from inside the \u003ccode\u003ecollectionViewcell\u003c/code\u003e class?\u003c/p\u003e","accepted_answer_id":"30808420","answer_count":"1","comment_count":"5","creation_date":"2015-06-12 15:58:35.93 UTC","last_activity_date":"2015-06-12 17:34:45.843 UTC","last_edit_date":"2015-06-12 17:34:45.843 UTC","last_editor_display_name":"","last_editor_user_id":"4903563","owner_display_name":"","owner_user_id":"4211199","post_type_id":"1","score":"1","tags":"ios|uicollectionview|uicollectionviewcell","view_count":"48"} {"id":"10139031","title":"Magento remove block only works with cache disabled","body":"\u003cp\u003eI have a static block that gets added to the footer reference on every page. My homepage is a CMS page and I've put code in the pages Layout Update XML to remove the block from that page.\u003c/p\u003e\n\n\u003cp\u003eThis is how it's added to the footer for all pages:\u003c/p\u003e\n\n\u003cp\u003eIn page.xml inside \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;reference name=\"footer\"\u0026gt;\n \u0026lt;block type=\"cms/block\" name=\"page_cta\" before=\"-\"\u0026gt;\n \u0026lt;action method=\"setBlockId\"\u0026gt;\u0026lt;block_id\u0026gt;page_cta\u0026lt;/block_id\u0026gt;\u0026lt;/action\u0026gt;\n \u0026lt;/block\u0026gt;\n\u0026lt;/reference\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCode in my homepages layout update xml to remove the block:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;reference name=\"footer\"\u0026gt;\n \u0026lt;remove name=\"page_cta\" /\u0026gt;\n\u0026lt;/reference\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe block shouldn't show on the homepage and should show on all other pages. This works fine but only if the cache is disabled. What seems to happen is the cache is enabled then I view the homepage and the block is removed but then it is also removed on every other page.\u003c/p\u003e\n\n\u003cp\u003eCan anyone shed some light on why this doesn't work if the cache is enabled?\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2012-04-13 10:17:18.75 UTC","favorite_count":"1","last_activity_date":"2015-02-20 07:00:51.413 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"299871","post_type_id":"1","score":"0","tags":"magento","view_count":"1071"} {"id":"42107472","title":"Split String end with special characters - Java","body":"\u003cp\u003eI have a string which I want to first split by space, and then separate the words from the special characters.\u003c/p\u003e\n\n\u003cp\u003eFor Example, let's say the input is:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eHi, How are you???\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI already wrote the logic to split by space here:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eString input = \"Hi, How are you???\";\nString[] words = input.split(\"\\\\\\\\s+\");\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow, I want to seperate each word from the special character.\u003c/p\u003e\n\n\u003cp\u003eFor example: \u003ccode\u003e\"Hi,\"\u003c/code\u003e to \u003ccode\u003e{\"Hi\", \",\"}\u003c/code\u003e and \u003ccode\u003e\"you???\"\u003c/code\u003e to \u003ccode\u003e{\"you\", \"???\"}\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eIf the string does not end with any special characters, just ignore it.\u003c/p\u003e\n\n\u003cp\u003eCan you please help me with the regular expression and code for this in Java?\u003c/p\u003e","answer_count":"3","comment_count":"3","creation_date":"2017-02-08 07:51:02.15 UTC","last_activity_date":"2017-02-18 17:51:09.13 UTC","last_edit_date":"2017-02-08 09:31:16.28 UTC","last_editor_display_name":"","last_editor_user_id":"1396977","owner_display_name":"","owner_user_id":"2609262","post_type_id":"1","score":"0","tags":"java|regex|string|split|pattern-matching","view_count":"114"} {"id":"22211966","title":"Javascript Can't Access an Objects Keys Values... They have quotes around them","body":"\u003cp\u003eSo I need to access the key value \"key\" in this object:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{\n \"__v\": 0,\n \"_id\": \"5317b71c902ff0080046349f\",\n \"user\": \"530ef48599c41200009bad9f\",\n \"email\": \"asdfa@sdgdf.com\",\n \"btcId\": \"9HjBb9eUhyXMKuVxSrTSkg\",\n \"name\": \"Bitcoin Payments\",\n \"dlFile\": \"a43ca076-4802-4cca-9648-82b2569ffc60.docx\",\n \"key\": \"3518d5ce-badf-495c-a08f-dc28bb6d8a64\",\n \"created\": \"2014-03-05T23:45:32.480Z\"\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut this code doesn't work:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003econsole.log(body.key) -\u0026gt; Undefined\nconsole.log(body['key'] -\u0026gt; undefined\nconsole.log(body['\"key\"'] -\u0026gt; undefined\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebody is where the object is stored.\u003c/p\u003e\n\n\u003cp\u003eI think it has something to do with the key's being strings? or having the \"\" around them?\nHowever I'm not creating the body variable so I can't control this...\u003c/p\u003e\n\n\u003cp\u003eAny ideas on how to make it work?\u003c/p\u003e","accepted_answer_id":"22212089","answer_count":"1","comment_count":"6","creation_date":"2014-03-05 23:51:16.463 UTC","last_activity_date":"2014-03-05 23:58:45.507 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1115155","post_type_id":"1","score":"1","tags":"javascript|string|variables|object|key","view_count":"1936"} {"id":"15368193","title":"Permission denied (publickey) on push into remote git-server","body":"\u003cp\u003eI try create new repositories on my remote git-server\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ecd /var/www/vhost/example.com\nsudo git init\nsudo git remote add origin ssh://git@111.111.111.111:30000/home/git/repositories/example.git\nsudo git add .\nsudo git commit -a -m \"Create empty example.com dir\"\nsudo git push origin master:refs/heads/master\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy ssh config:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eHost 111.111.111.111\nUser git\nPort 30000\nIdentityFile ~/.ssh/id_rsa\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy gitosis-admin.conf\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[gitosis]\n\n[group gitosis-admin]\nmembers = git@111.111.111.111\nwritable = gitosis-admin\n\n[group example-com]\nmembers = git@111.111.111.111 user@user\nwritable = example-com\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eGet error\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ePermission denied (publickey).\nfatal: The remote end hung up unexpectedly\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI can do\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003essh git@111.111.111.111\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eno problem, but can't do push. What i doing wrong? I had also looked into similar previous question \u003ca href=\"https://stackoverflow.com/questions/3617113/github-newbie-problems-permission-denied-publickey-fatal-the-remote-end\"\u003eGitHub: Permission denied (publickey). fatal: The remote end hung up unexpectedly\u003c/a\u003e , but i don't use github.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eUPDATE:\u003c/strong\u003e Ok, i think problem in sudo.\u003c/p\u003e\n\n\u003cp\u003eThis command complete whitout some sort of error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003egit push origin master:refs/heads/master\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis command:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003esudo git push origin master:refs/heads/master\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ecomplete with error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ePermission denied (publickey).\nfatal: The remote end hung up unexpectedly\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"5","creation_date":"2013-03-12 17:36:21.02 UTC","last_activity_date":"2015-10-22 17:40:04.483 UTC","last_edit_date":"2017-05-23 11:44:46.407 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"2112300","post_type_id":"1","score":"0","tags":"git","view_count":"1112"} {"id":"9078557","title":"Printer Resolution is negative returned as negative","body":"\u003cp\u003eI am accessing the resolution of the default printer using the \u003ccode\u003ePrintDocument\u003c/code\u003e. The problem is that i am getting the \u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003ePrintDocument.PrinterSettings.DefaultPageSettings.PrinterResolution.X;\n PrintDocument.PrinterSettings.DefaultPageSettings.PrinterResolution.Y;\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eas negative values.\u003c/p\u003e\n\n\u003cp\u003eWhat is the possible problem of behind this? I've tested it with some other printers(by setting it as default) and gave non negative values. \nWhen i checked the registry entries pertaining to the printer which is giving negative resolution in the code. I've seen \u003ccode\u003eprintMaxResolutionSupported\u003c/code\u003e missing. Is this the potential problem? . For those cases i am not getting correct values i have included the code to set it to 600. will there be a problem because of this,\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2012-01-31 11:14:27.08 UTC","last_activity_date":"2012-01-31 12:08:37.413 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"648045","post_type_id":"1","score":"1","tags":"c#|printing","view_count":"838"} {"id":"36939052","title":"Stop Reloading data when move into another navigation drawer","body":"\u003cp\u003ei have 5 Navigation , and every navigation have fragment tablayout with 3-5fragment , i can stop reloading data in tablayout fragment, but how to stop reloading data if im moving into another navigation ?\nexample : now im in Navigation A when Tablayout has 3 fragments(1,2,3) when im click another fragment its okay and if data already load, so they didnt load again. and when im move into Navigation B when TabLayout has 2 fragments(4,5) its okay data load because its firsttime click, but when im moving again into Navigation A data will reload again. how to stop reloading if data already reload?\u003c/p\u003e","answer_count":"0","comment_count":"5","creation_date":"2016-04-29 13:00:42.263 UTC","favorite_count":"1","last_activity_date":"2016-04-29 13:00:42.263 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6191394","post_type_id":"1","score":"0","tags":"android|android-fragments|fragment","view_count":"87"} {"id":"32573707","title":"Java update value between classes","body":"\u003cp\u003eI'm pretty new to Java and need some help with a program I am writing. Basically I have 2 classes that are trying to change the balance of a bank account. One class is adding deposits while the other is withdrawing. I though the easiest way to share a balance between the classes was to make a third class that looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class Balance {\nstatic int balance;\n\n public int getBalance(){\n return balance;\n }\n\n public void returnBalance(int bal){\n this.balance = bal;\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am correctly calling the getBalance method because that is pulling in the correct balance. However, when I use my object \u003ccode\u003eBalance balanceCall = new Balance();\u003c/code\u003e to give the changed balance (after depositing), it is not updating the balance within the class. I think I am again calling the method correctly, but it does not appear to actually change the value of the balance variable in my balance class. Is the code in my balance class used incorrectly for the \u003ccode\u003ereturnBalance\u003c/code\u003e method?\u003c/p\u003e\n\n\u003cp\u003eThanks for your help!\u003c/p\u003e\n\n\u003cp\u003eUPDATE: I changed the integer to static int balance. It is now updating the value between classes, however it seems to be creating a new value every time i do a deposit. \u003c/p\u003e\n\n\u003cp\u003eThis is what it looks like:\u003c/p\u003e\n\n\u003cp\u003eThread 1 deposits $76 Balance is $76\u003c/p\u003e\n\n\u003cp\u003eThread 8 withdraws $45 Balance is $31\u003c/p\u003e\n\n\u003cp\u003eThread 7 withdraws $12 Balance is $64\u003c/p\u003e\n\n\u003cp\u003eThread 6 withdraws $41 Balance is $35\u003c/p\u003e\n\n\u003cp\u003eThread 3 deposits $89 Balance is $165\u003c/p\u003e\n\n\u003cp\u003eThread 5 withdraws $10 Balance is $66\u003c/p\u003e\n\n\u003cp\u003eThread 4 withdraws $17 Balance is $59\u003c/p\u003e\n\n\u003cp\u003eThread 2 deposits $157 Balance is $157\u003c/p\u003e\n\n\u003cp\u003eHere is how I use the \u003ccode\u003eBalance\u003c/code\u003e instance:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ebalanceNum = balanceCall.getBalance();\nbalanceNum = balanceNum + 25;\nbalanceCall.returnBalance(balanceNum);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHopefully this helps to clear things up. \u003c/p\u003e\n\n\u003cp\u003eSOLVED: After changing my variable to \u003ccode\u003estatic int balance\u003c/code\u003e, which is suitable for my program's purposes as there is only one balance needed, it almost fixed the problem. I changed around the logic a tad and now it works. Instead of updating the balance and sending this value back to the Balance class I created a new method in the Balance class and sent it the value of how much I wanted to withdraw/deposit and then the string \"Withdraw\" or \"Deposit\" to perform the correct calculation. Now it seems to update the balance correctly. Thanks all for your help!\u003c/p\u003e","answer_count":"6","comment_count":"6","creation_date":"2015-09-14 20:51:29.57 UTC","last_activity_date":"2015-09-14 23:31:39.073 UTC","last_edit_date":"2015-09-14 23:31:39.073 UTC","last_editor_display_name":"","last_editor_user_id":"3281576","owner_display_name":"","owner_user_id":"3281576","post_type_id":"1","score":"1","tags":"java|class|methods","view_count":"1426"} {"id":"32693863","title":"How to install dotless on local pc, windows 10","body":"\u003cp\u003eHow to install dotless on local pc from command line.\u003c/p\u003e\n\n\u003cp\u003eFirst I install Ruby, then put in console \"gem install nu\", then \"nu install dotless\".\nThe installation tells me for all files: \"required\"\u003c/p\u003e","accepted_answer_id":"32711757","answer_count":"1","comment_count":"0","creation_date":"2015-09-21 11:17:31.853 UTC","last_activity_date":"2015-09-22 09:08:46.173 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5358941","post_type_id":"1","score":"-1","tags":"command-line|install|pc|dotless","view_count":"50"} {"id":"44893429","title":"Android BLE gattcallback issue on read and write","body":"\u003cp\u003eI'm stuck in one weird problem from last week and it will make me mad soon, Stackoverflow is my last hope.\nI simply wrote a code to communicate with BLE device. At first i'm just writing a value on characteristic.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic void writeEnableCredentials(String keysFn) {\n if ( sGattCharList != null) {\n Log.i(\"Callback WEC Method: \", \"Start!!!/n\" );\n String val = keysFn.substring(0, 2);\n String val2 = keysFn.substring(2, 4);\n int val_1 = Integer.parseInt(val);\n int val_2 = Integer.parseInt(val2);\n byte[] rk_byte_Value = new byte[1];\n final byte[] rk_byte_Value_2 = new byte[1];\n rk_byte_Value[0] = (byte)(val_1 \u0026amp; 0xFF);\n rk_byte_Value_2[0] = (byte)(val_2 \u0026amp; 0xFF);\n sGattCharList.get(1).setValue(rk_byte_Value);\n boolean ok = sBluetoothGatt.writeCharacteristic(sGattCharList.get(1));\n Log.i(\"Callback WEC Method: \", \"1 Verified = \" + ok);\n if(ok) {\n final Handler handler = new Handler();\n handler.postDelayed(new Runnable() {\n @Override\n public void run() {\n sGattCharList.get(2).setValue(rk_byte_Value_2);\n boolean ok = sBluetoothGatt.writeCharacteristic(sGattCharList.get(2));\n Log.i(\"Callback WEC Method: \", \"2 Verified = \" + ok);\n }\n }, 100);\n }\n } else {\n Toast.makeText(activity, \"Wait for services\", Toast.LENGTH_SHORT).show();\n }\n Log.i(\"Callback WEC Method: \", \"Stop!!!/n\" );\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBluetoothGattCallback methods are below:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprivate final BluetoothGattCallback sGattCallback = new BluetoothGattCallback() {\n @Override\n public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {\n if (newState == BluetoothProfile.STATE_CONNECTED) {\n Log.i(\"CallbackGatt\",\"Connecting with \" + sDevice.getsMac());\n sBluetoothGatt.discoverServices();\n }\n else if (newState == BluetoothProfile.STATE_DISCONNECTED) {\n sBluetoothGatt.close();\n Log.i(\"CallbackGatt\", \"Disconnected from GATT server.\");\n }\n }\n\n @Override\n public void onServicesDiscovered(BluetoothGatt gatt, int status) {\n services_List = gatt.getServices();\n sGattCharList = services_List.get(3).getCharacteristics();\n Log.i(\"CallbackGatt\",\"Characteristic List Found: \" + sGattCharList);\n }\n\n @Override\n public void onCharacteristicWrite(BluetoothGatt gatt,\n BluetoothGattCharacteristic characteristic, int status) {\n if(status == BluetoothGatt.GATT_SUCCESS) {\n byte[] bytes = characteristic.getValue();\n System.out.println(\"ON Characteristic WRITE Callback: \" + characteristic.getUuid()+\" value: \"+bytes);\n }\n }\n\n};\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eISSUE:\u003c/strong\u003e This code is working perfectly on API\u003e22. \u003cstrong\u003eBUT\u003c/strong\u003e on API\u0026lt;=22 BluetoothGattCallback are not working properly, sometime callback received but after running same build again i don't receive callbacks and characteristic don't wrote. \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eDebug Log\u003c/strong\u003e Running build on 5.1.1\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e*Trying to write 1st time*\n07-04 00:29:28.370 19270-19270/com.example.xxx.xxxx/Callback WEC Method:: Start!!!/n\n07-04 00:29:28.371 19270-19270/com.example.xxx.xxxx I/Callback WEC Method:: 1 Verified = true\n07-04 00:29:28.372 19270-19270/com.example.xxx.xxxx I/Callback WEC Method:: Stop!!!/n\n07-04 00:29:28.472 9115-9185/? E/bt-btif: already has a pending command!!\n07-04 00:29:28.472 9115-9185/? E/bt-att: GATTC_Write GATT_BUSY conn_id = 6\n07-04 00:29:28.474 19270-19270/com.example.xxx.xxxx I/Callback WEC Method:: 2 Verified = true\n\n*Trying to write 2nd time*\n07-04 00:29:33.371 19270-19270/com.example.xxx.xxxx I/Callback WEC Method:: Start!!!/n \n07-04 00:29:33.371 9115-9185/? E/bt-att: GATTC_Write GATT_BUSY conn_id = 6\n07-04 00:29:33.371 9115-9185/? E/GKI_LINUX: GKI_exception(): Task State Table\n07-04 00:29:33.371 9115-9185/? E/GKI_LINUX: TASK ID [0] task name [BTU] state [1]\n07-04 00:29:33.371 9115-9185/? E/GKI_LINUX: TASK ID [1] task name [BTIF] state [1]\n07-04 00:29:33.371 9115-9185/? E/GKI_LINUX: TASK ID [2] task name [A2DP-MEDIA] state [1]\n07-04 00:29:33.371 9115-9185/? E/GKI_LINUX: GKI_exception 65532 Freeing Linked Buf\n07-04 00:29:33.372 9115-9185/? E/GKI_LINUX: ********************************************************************\n07-04 00:29:33.372 9115-9185/? E/GKI_LINUX: * GKI_exception(): 65532 Freeing Linked Buf\n07-04 00:29:33.372 9115-9185/? E/GKI_LINUX: ********************************************************************\n07-04 00:29:33.372 19270-19270/com.example.xxx.xxxx I/Callback WEC Method:: 1 Verified = true\n07-04 00:29:33.373 19270-19270/com.example.xxx.xxxx I/Callback WEC Method:: Stop!!!/n\n07-04 00:29:33.474 9115-9185/? E/bt-att: GATTC_Write GATT_BUSY conn_id = 6\n07-04 00:29:33.474 19270-19270/com.example.xxx.xxxx I/Callback WEC Method:: 2 Verified = true\n07-04 00:29:33.474 9115-9185/? E/GKI_LINUX: GKI_exception(): Task State Table\n07-04 00:29:33.474 9115-9185/? E/GKI_LINUX: TASK ID [0] task name [BTU] state [1]\n07-04 00:29:33.474 9115-9185/? E/GKI_LINUX: TASK ID [1] task name [BTIF] state [1]\n07-04 00:29:33.474 9115-9185/? E/GKI_LINUX: TASK ID [2] task name [A2DP-MEDIA] state [1]\n07-04 00:29:33.474 9115-9185/? E/GKI_LINUX: GKI_exception 65532 Freeing Linked Buf\n07-04 00:29:33.474 9115-9185/? E/GKI_LINUX: ********************************************************************\n07-04 00:29:33.474 9115-9185/? E/GKI_LINUX: * GKI_exception(): 65532 Freeing Linked Buf\n07-04 00:29:33.474 9115-9185/? E/GKI_LINUX: ********************************************************************\n07-04 00:29:33.562 339-339/? I/Gobi: vendor/qcom/proprietary/RIDL/RIDLClient/RIDLSQL.cpp:1920: GetTransState() EBADF\n07-04 00:29:33.562 339-339/? I/Gobi: vendor/qcom/proprietary/RIDL/RIDLClient/MainCore.cpp:1346: Failed to get TransState, rc\n07-04 00:29:33.562 339-339/? I/Gobi: vendor/qcom/proprietary/RIDL/RIDLClient/RIDLSQL.cpp:1920: GetTransState() EBADF\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ekill app=\u003e clear cache=\u003e start app=\u003e make connection=\u003e try to write=\u003e kill app\u003c/p\u003e\n\n\u003cp\u003eAfter do that process 4 time i finally got callback :D\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e07-04 00:34:39.144 26148-26148/com.example.xxx.xxxx I/Callback WEC Method:: Start!!!/n\n07-04 00:34:39.147 26148-26148/com.example.xxx.xxxx I/Callback WEC Method:: 1 Verified = true\n07-04 00:34:39.147 26148-26148/com.example.xxx.xxxx I/Callback WEC Method:: Stop!!!/n\n07-04 00:34:39.233 26148-26166/com.example.xxx.xxxx I/System.out: ON Characteristic WRITE Callback: 0000fff2-0000-1000-8000-00805f9b34fb\n07-04 00:34:39.247 26148-26148/com.example.xxx.xxxx I/Callback WEC Method:: 2 Verified = true\n07-04 00:34:39.331 26148-26165/com.example.xxx.xxxx I/System.out: ON Characteristic WRITE Callback: 0000fff3-0000-1000-8000-00805f9b34fb\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIf you guys need any other detail please ask. Also please tell me what is: \u003cstrong\u003eE/GKI_LINUX: GKI_exception\u003c/strong\u003e, Thanks.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-07-03 20:24:27.677 UTC","last_activity_date":"2017-07-03 21:43:10.207 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7507520","post_type_id":"1","score":"0","tags":"android|bluetooth-lowenergy|android-ble","view_count":"53"} {"id":"43980248","title":"How to fetch data from mongo db by object key php","body":"\u003cp\u003eI am new to mongo db. I am trying to fetch record based on age key but the query always returns empty result.\u003c/p\u003e\n\n\u003cp\u003eHere is JSON string\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \"age_premium\": {\n \"age\": { \n \"65\": {\n \"Plan A\": \"136.24\",\n \"Plan B\": \"140.33\",\n \"Plan F\": \"172.72\",\n \"Plan G\": \"142.95\",\n \"Plan N\": \"117.45\" \n },\n \"66\": {\n \"Plan A\": \"136.24\",\n \"Plan B\": \"140.33\",\n \"Plan F\": \"172.72\",\n \"Plan G\": \"142.95\",\n \"Plan N\": \"117.45\" \n }}}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI want to fetch data according to age value.\u003c/p\u003e\n\n\u003cp\u003eI tried to fetch using this query\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$collection-\u0026gt;find(array('age_premium.age'=\u0026gt;'65'));\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"3","creation_date":"2017-05-15 13:00:41.223 UTC","last_activity_date":"2017-05-16 08:13:00.697 UTC","last_edit_date":"2017-05-16 05:56:19.263 UTC","last_editor_display_name":"","last_editor_user_id":"5193081","owner_display_name":"","owner_user_id":"5193081","post_type_id":"1","score":"0","tags":"php|mongodb","view_count":"41"} {"id":"25065889","title":"pymongo not able to retrieve files","body":"\u003cp\u003eI am playing around with mongodb (GridFS) to store files (zip) and try to retrieve them using python`s \"pymongo\" but its not working as expected i am not able to understand how to retrieve the file(s) i have addedd ...\u003c/p\u003e\n\n\u003cp\u003eBelow is the code i ran from IDLE ( Python 3.4.1 ) \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026gt;\u0026gt;\u0026gt; db = Connection(port=31000, host=\"localhost\").fs\n\u0026gt;\u0026gt;\u0026gt; db.name\n'fs'\n\u0026gt;\u0026gt;\u0026gt; db.validate_collection\n\u0026lt;bound method Database.validate_collection of Database(Connection('localhost', 31000), 'fs')\u0026gt;\n\u0026gt;\u0026gt;\u0026gt; blob_store = gridfs.GridFS(db, collection='bstore')\n\u0026gt;\u0026gt;\u0026gt; local_db = dict()\n\u0026gt;\u0026gt;\u0026gt; k = r'd:\\test\\my-scripts.zip'\n\u0026gt;\u0026gt;\u0026gt; local_db[k] = blob_store.put(open(k, 'rb'))\n\n[** File is saved, i checked using robomongo **]\n\n\u0026gt;\u0026gt;\u0026gt; blob_store.exists(filename=k)\nFalse\n\u0026gt;\u0026gt;\u0026gt; blob_store.exists(\"53da7cb1b3b44b13e0e27721\")\nFalse\n\u0026gt;\u0026gt;\u0026gt; local_db\n{'d:\\\\test\\\\my-scripts.zip': ObjectId('53da7cb1b3b44b13e0e27721')}\n\u0026gt;\u0026gt;\u0026gt; blob_store.list()\n[]\n\u0026gt;\u0026gt;\u0026gt; b = gridfs.GridFS(db, collection='bstore.files')\n\u0026gt;\u0026gt;\u0026gt; b.list()\n[]\n\u0026gt;\u0026gt;\u0026gt; x = blob_store.get(Objectid(\"53da7cb1b3b44b13e0e27721\"))\nTraceback (most recent call last):\n File \"\u0026lt;pyshell#20\u0026gt;\", line 1, in \u0026lt;module\u0026gt;\n x = blob_store.get(Objectid(\"53da7cb1b3b44b13e0e27721\"))\nNameError: name 'Objectid' is not defined\n\u0026gt;\u0026gt;\u0026gt; local_db\n{'d:\\\\test\\\\my-scripts.zip': ObjectId('53da7fd0b3b44b13e0e2772a')}\n\u0026gt;\u0026gt;\u0026gt; blob_store.find()\n\u0026lt;gridfs.grid_file.GridOutCursor object at 0x0000000003DC1828\u0026gt;\n\u0026gt;\u0026gt;\u0026gt; a = blob_store.find(ObjectId(\"53da7fd0b3b44b13e0e2772a\"))\nTraceback (most recent call last):\n File \"\u0026lt;pyshell#29\u0026gt;\", line 1, in \u0026lt;module\u0026gt;\n a = blob_store.find(ObjectId(\"53da7fd0b3b44b13e0e2772a\"))\nNameError: name 'ObjectId' is not defined\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow i am not sure how to retrieve the file from mongo? am i missing something obvious?\u003c/p\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","accepted_answer_id":"25510478","answer_count":"1","comment_count":"0","creation_date":"2014-07-31 18:01:02.92 UTC","favorite_count":"1","last_activity_date":"2014-08-26 16:12:39.98 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3086621","post_type_id":"1","score":"0","tags":"mongodb|pymongo|gridfs|python-3.4","view_count":"1512"} {"id":"45950971","title":"Swift 3: Method expecting variadic String parameter can only receive single String argument","body":"\u003cp\u003eI'm calling a method expecting a \u003ccode\u003eString...\u003c/code\u003e variadic parameter, but the only thing it allows receiving from the enclosing function is a plain \u003ccode\u003eString\u003c/code\u003e. \u003c/p\u003e\n\n\u003cp\u003eMy method looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic func deleteKeys(keysReceived:String..., completionHandler:@escaping () -\u0026gt; Void)\n{\n RedisClient.getClient(withIdentifier: RedisClientIdentifier()) {\n c in\n do {\n let client = try c()\n client.delete(keys: keysReceived){}\n completionHandler()\n }\n//...\n }\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe compile error is \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eCannot convert value of type '[String]' to expected argument type 'String'\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis method (\u003ccode\u003eclient.delete()\u003c/code\u003e) is from a Redis API for Perfect-Swift so I cannot change the signature, but I can change the enclosing function (deleteKeys). I also cannot call the function directly because it is within a callback closure\u003c/p\u003e\n\n\u003cp\u003eAny suggestions on how I can pass a received variadic parameter to an enclosed variadic function? I can break the array down to Single strings and delete individually but that doesn't seem very efficient\u003c/p\u003e","accepted_answer_id":"45951800","answer_count":"2","comment_count":"6","creation_date":"2017-08-30 02:29:18.603 UTC","last_activity_date":"2017-08-30 05:05:29.08 UTC","last_edit_date":"2017-08-30 02:39:46.507 UTC","last_editor_display_name":"","last_editor_user_id":"1685167","owner_display_name":"","owner_user_id":"1685167","post_type_id":"1","score":"0","tags":"swift|swift3|variadic|perfect","view_count":"102"} {"id":"45200874","title":"users can't edit their own profile on a office 365 / on-premises hybrid","body":"\u003cp\u003eSo i'm doing a co-op as an IT assistant at a company, and I have been asked to update user phone numbers in our on premises Active Directory/Office 365 hybrid system. I found how \u003cem\u003eI\u003c/em\u003e could edit each user one by one but i'd have to do that for a 100 people or so, and would prefer not to. \u003c/p\u003e\n\n\u003cp\u003eI was wondering if there was any way (assuming I have full permissions) that I could make it so that users could edit their own profiles and update their phone numbers without use of PowerShell? \u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","answer_count":"0","comment_count":"1","creation_date":"2017-07-19 20:57:23.853 UTC","last_activity_date":"2017-07-19 20:57:23.853 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8334256","post_type_id":"1","score":"0","tags":"active-directory|office365","view_count":"17"} {"id":"20700626","title":"OpenGL ES Manually invoking onSurfaceChanged() or onSurfaceCreated() functions","body":"\u003cp\u003eIs there a way that I can call any of those functions in Android OpenGL ES outside the loop?\u003c/p\u003e\n\n\u003cp\u003ee.g.:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic SurfaceView(Context context){ \n renderer = new Renderer(){\n ...openglstuff...\n }\n\n renderer.callOnSurfaceChanged(); // Something like this?\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eJust wondering. I know its probably not good practice.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-12-20 09:44:40.677 UTC","favorite_count":"2","last_activity_date":"2014-01-02 14:33:04.763 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1634454","post_type_id":"1","score":"1","tags":"android|function|opengl-es|renderer","view_count":"241"} {"id":"30813812","title":"How to show the content from RichTextArea.getHMTL() in a div properly?","body":"\u003cp\u003eIf pasting an image into RichTextArea,then.getHTML(),it will return a escaped html string like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\"\u0026amp;lt;img src=\u0026amp;quot;http://www.example.com/images/n1.png\u0026amp;quot; border=\u0026amp;quot;0\u0026amp;quot; height=\u0026amp;quot;75\u0026amp;quot; width=\u0026amp;quot;199\u0026amp;quot;\u0026amp;gt;\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethen if \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ediv.setInnerHTML(escaped html string),\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eit will be shown as plain html:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;img src=\"http://www.example.com/images/n1.png\" border=\"0\" height=\"75\" width=\"199\"\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003enot expected result:an image,and other html content has this issue,for example,if inputing this content to RichTextArea:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;script\u0026gt;alert(\"evil xss\");\u0026lt;/script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethen getHTML() will return:\u003c/p\u003e\n\n\u003cp\u003e\u0026lt;script\u0026gt;alert(\"evil xss\");\u0026lt;/script\u0026gt;\u003c/p\u003e\n\n\u003cp\u003eand then div.setInnertHTML(escapted html),it will be shown as\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026amp;lt;script\u0026amp;gt;alert(\"evil xss\");\u0026amp;lt;/script\u0026amp;gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003enot expected content:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;script\u0026gt;alert(\"evil xss\");\u0026lt;/script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo,how to show them properly?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-06-13 00:03:03.617 UTC","last_activity_date":"2015-06-16 02:19:30.203 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"258274","post_type_id":"1","score":"0","tags":"gwt|xss|richtextarea","view_count":"143"} {"id":"34091472","title":"Set id for multiple radio buttons list generated by a repeater","body":"\u003cp\u003eIs there a way to set the ID for multiple radiobuttonlists generated via repeater. \nie. ID= rep1 rep2 rep3 rep4\nI would like to be able to place my data in multiple columns across a table.\u003c/p\u003e\n\n\u003cp\u003eHeres is my code so far:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;asp:Content ID=\"BodyContent\" ContentPlaceHolderID=\"MainContent\" runat=\"server\"\u0026gt;\n\u0026lt;h2\u0026gt;\u0026lt;%: Title %\u0026gt;\u0026lt;/h2\u0026gt;\n\u0026lt;h3\u0026gt;Your application description page.\u0026lt;/h3\u0026gt;\n\u0026lt;asp:Repeater ID=\"Repeater1\" runat=\"server\" DataSourceID=\"SqlDataSource1\"\u0026gt;\n \u0026lt;ItemTemplate\u0026gt;\n \u0026lt;asp:Label ID=\"lblQuestion\" runat=\"server\" Text='\u0026lt;%# Eval(\"Text\") %\u0026gt;' /\u0026gt;\n \u0026lt;asp:RadioButtonList ID=\"ddlAnswer\" runat=\"server\" AutoPostBack=\"True\" RepeatDirection=\"Horizontal\"\u0026gt;\n \u0026lt;asp:ListItem Text=\"Yes\" Value=\"True\" /\u0026gt;\n \u0026lt;asp:ListItem Text=\"No\" Value=\"False\" /\u0026gt;\n \u0026lt;/asp:RadioButtonList\u0026gt;\n \u0026lt;asp:Panel ID=\"Panel1\" runat=\"server\"\u0026gt;\n \u0026lt;asp:Label ID=\"Label1\" runat=\"server\" Text=\"Provide more details:\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\n \u0026lt;asp:TextBox ID=\"TextBox1\" runat=\"server\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\n \u0026lt;/asp:Panel\u0026gt;\n \u0026lt;/p\u0026gt;\n \u0026lt;/ItemTemplate\u0026gt;\n\u0026lt;/asp:Repeater\u0026gt;\n\u0026lt;asp:SqlDataSource ID=\"SqlDataSource1\" runat=\"server\" ConnectionString=\"\u0026lt;%$ ConnectionStrings:DefaultConnection %\u0026gt;\" SelectCommand=\"SELECT [Text] FROM [Questions]\"\u0026gt;\u0026lt;/asp:SqlDataSource\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003cp\u003eBehind:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e protected void Page_Load(object sender, EventArgs e)\n {\n\n foreach (RepeaterItem item in Repeater1.Items)\n {\n RadioButtonList ddlAnswer = item.FindControl(\"ddlAnswer\") as RadioButtonList;\n System.Web.UI.WebControls.Panel Panel1 = item.FindControl(\"Panel1\") as System.Web.UI.WebControls.Panel;\n\n if (ddlAnswer.SelectedValue == \"False\")\n {\n Panel1.Visible = true;\n }\n\n else\n {\n Panel1.Visible = false;\n }\n }\n\n }\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"1","creation_date":"2015-12-04 15:13:55.88 UTC","last_activity_date":"2015-12-04 17:08:44.917 UTC","last_edit_date":"2015-12-04 15:43:37.003 UTC","last_editor_display_name":"","last_editor_user_id":"5576310","owner_display_name":"","owner_user_id":"3596726","post_type_id":"1","score":"0","tags":"c#|html|asp.net|repeater|radiobuttonlist","view_count":"435"} {"id":"36588711","title":"Why can't I serialize this in Java","body":"\u003cp\u003eI am curious as to why I am unable to successfully write \u003ccode\u003ethis\u003c/code\u003e to an \u003ccode\u003eObjectOutputStream\u003c/code\u003e. \u003c/p\u003e\n\n\u003cp\u003eI have written the following class and found it to work fine with all the necessary imports:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class Cereal implements Serializable{\n\n private String name ; \n private FileInputStream fis ; \n private ObjectInputStream ois ;\n private ObjectOutputStream oos; \n private FileOutputStream fos ; \n private Cereal readIn ; \n private Cereal writeOut; \n\n private Toy prize ; \n public Cereal( String newName, String prizeName){\n name = newName ; \n }\n public String readBox(){\n return name ; \n }\n //Where it happens; unsuccessful line commented out\n public void writeToFile( String arg ) throws Exception{\n try{\n fos = new FileOutputStream(arg) ; \n oos = new ObjectOutputStream(fos ) ; \n writeOut = new Cereal(name, prize.describe());\n oos.writeObject(writeOut);\n //oos.writeObject( this );\n oos.close();\n fos.close(); \n System.out.println(\"wrote to \" + arg);\n\n }catch( Exception e ){\n System.out.println(\"Problem\");\n e.printStackTrace(); \n }\n\n }\n public void writeToFile( ) throws Exception{\n //\n writeToFile( name + \".ser\") ; \n }\n public void readFromFile(String arg) throws Exception{\n\n try{\n fis = new FileInputStream(arg) ; \n ois = new ObjectInputStream(fis) ;\n\n System.out.println(\"Read from \" + arg); \n readIn = (Cereal) ois.readObject() ; \n this.name = readIn.readBox(); \n ois.close(); \n fis.close(); \n\n }catch(Exception e){\n System.out.println(\"Had a problem\");\n e.printStackTrace(); \n }\n }\n public void readFromFile() throws Exception{\n readFromFile( name + \".ser\"); \n }\n\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eYet replacing \u003ccode\u003eoos.writeObject(writeOut)\u003c/code\u003e with \u003ccode\u003eoos.writeObject(this)\u003c/code\u003e, I raise the following errors: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ejava.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.io.FileOutputStream\n at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1355)\n at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2000)\n at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1924)\n at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)\n at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)\n at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)\n at Cereal.readFromFile(Cereal.java:56)\n at MainDriver.main(MainDriver.java:13)\nCaused by: java.io.NotSerializableException: java.io.FileOutputStream\n at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)\n at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)\n at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)\n at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)\n at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)\n at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)\n at Cereal.writeToFile(Cereal.java:34)\n at Cereal.writeToFile(Cereal.java:47)\n at MainDriver.main(MainDriver.java:7)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am not sure why this should be an issue, anyone have an idea? Thanks in advance. (It seems cumbersome to initialize an attribute rather than just use \u003ccode\u003ethis\u003c/code\u003e as I am doing now.)\u003c/p\u003e","accepted_answer_id":"36588740","answer_count":"1","comment_count":"1","creation_date":"2016-04-13 04:38:23.303 UTC","last_activity_date":"2016-04-13 04:50:01.83 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6196630","post_type_id":"1","score":"1","tags":"java|serialization|this","view_count":"52"} {"id":"244563","title":"Create object from XML string in Ruby","body":"\u003cp\u003eI am trying to deserialize an object from XML in Ruby. \u003c/p\u003e\n\n\u003cp\u003eSomething simple like:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eu = User.new({:client_key =\u0026gt; \"Bar\"})\nv = User.new(u.to_xml)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI get an error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eNoMethodError: undefined method 'stringify_keys!' for #String:0x20fc7cc\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eI'm not sure what I have to do in order to get the string from XML to an object.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eUpdate:\u003c/strong\u003e @avdi gave me the tip. I was expecting from_xml to be a self method. You have to create the object first. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ev = User.new\nv.from_xml(s)\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"244597","answer_count":"1","comment_count":"1","creation_date":"2008-10-28 19:38:35.28 UTC","last_activity_date":"2015-04-09 23:58:15.123 UTC","last_edit_date":"2015-04-09 23:58:15.123 UTC","last_editor_display_name":"Matt Brown","last_editor_user_id":"918624","owner_display_name":"Matt Brown","owner_user_id":"7272","post_type_id":"1","score":"3","tags":"ruby-on-rails|xml|ruby|activerecord","view_count":"3901"} {"id":"47131352","title":"XMPPError: bad-request - modify smack 4.2.0","body":"\u003cp\u003eI am using Smack 4.2.0 and using server Mongoose IM.\u003c/p\u003e\n\n\u003cp\u003eError received while creating room. My server is configured for muc_light.\nThis is what i am doing.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e// Create the XMPP address (JID) of the MUC.\n EntityBareJid mucJid = null;\n try {\n mucJid = (EntityBareJid) JidCreate.bareFrom(\"testGp@muclight.xyz.com\");\n } catch (XmppStringprepException e) {\n e.printStackTrace();\n }\n MultiUserChatLightManager multiUserChatLightManager = MultiUserChatLightManager.getInstanceFor(connection);\n MultiUserChatLight multiUserChatLight = multiUserChatLightManager.getMultiUserChatLight(mucJid);\n\n // Create the room\n Resourcepart nickname = null;\n try {\n nickname = Resourcepart.from(\"testGp\");\n } catch (XmppStringprepException e) {\n e.printStackTrace();\n }\n Set\u0026lt;Jid\u0026gt; owners = JidUtil.jidSetFrom(new String[]{\"7@xyz.com\", \"45@xyz.com\"});\n ArrayList\u0026lt;Jid\u0026gt; arraylst = new ArrayList\u0026lt;\u0026gt;();\n arraylst.addAll(owners);\n // Message configurationsMessage = null;\n // try {\n // configurationsMessage = (Message) PacketParserUtils.parseStanza(messageWithSubjectChangeExample);\n // } catch (Exception e) {\n // e.printStackTrace();\n // }\n try {\n multiUserChatLight.create(String.valueOf(nickname), arraylst);\n //multiUserChatLight.create(String.valueOf(nickname),\"testGp\",customConfigs,arraylst);\n } catch (Exception e) {\n e.printStackTrace();\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eError received:-\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;iq from='testgp@muclight.xyz.com' to='7@xyz.com/Smack' type='error' xml:lang='en' id='21vBu-35'\u0026gt;\u0026lt;error code='400' type='modify'\u0026gt;\u0026lt;bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/\u0026gt;\u0026lt;/error\u0026gt;\u0026lt;/iq\u0026gt;\u0026lt;r xmlns='urn:xmpp:sm:3'/\u0026gt;\n\norg.jivesoftware.smack.XMPPException$XMPPErrorException: XMPP error reply received from testGp@xyz.wirelesstrek.com: XMPPError: bad-request - modify\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"1","creation_date":"2017-11-06 06:54:51.197 UTC","last_activity_date":"2017-11-06 06:54:51.197 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3729079","post_type_id":"1","score":"-1","tags":"android|chat|smack|multiuserchat|mongoose-im","view_count":"34"} {"id":"28506238","title":"Unimodular Matrix Exact Inverse Python","body":"\u003cp\u003enumpy has a method to invert matrices. However i have a matrix with huge integer entries and the matrix is unimodular, so the inverse is also an integer matrix. The error is too big just to use numpy to calculate it with float and then round the values. Is there a way to calculate the entries exact with integers or any other library?\u003c/p\u003e","accepted_answer_id":"28506606","answer_count":"1","comment_count":"0","creation_date":"2015-02-13 18:26:56.87 UTC","last_activity_date":"2015-02-13 19:20:36.537 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4555363","post_type_id":"1","score":"3","tags":"python|numpy","view_count":"223"} {"id":"47614563","title":"Delete dynamically created nodes in Angular2","body":"\u003cp\u003e\u003cstrong\u003eDynamically creating nodes:\u003c/strong\u003e \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e var div = $('#imgDiv');\n div.css(\"column-count\",\"5\");\n for (var i = 0; i \u0026lt; this.fileSize; i++)\n {\n var nav = $('\u0026lt;nav id = \"holder\"\u0026gt;\u0026lt;/nav\u0026gt;');\n var img = $('\u0026lt;img id=\"dynamic\"\u0026gt;').css(\"max-width\",\"200px\").css(\"max-height\",\"200px\").css(\"padding\",\"5px\"); \n var button = $('\u0026lt;button id=\"dynamicButton\" \u0026gt;Add to collection\u0026lt;/button\u0026gt;')\n img.attr('src', this.returnFile[i]);\n\n img.appendTo(nav);\n button.appendTo(nav);\n nav.appendTo(div);\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eDelete Nodes:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efor(var i = 0; i \u0026lt; this.fileSize; i++)\n {\n $('#imgDiv').closest('#holder').html('');\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eHTML:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;!--called from login-auth.html--\u0026gt;\n\u0026lt;div class ='mainDiv' *ngIf=\"afAuth.authState | async; let user; else errorNoUserLoggedIn\" \u0026gt;\n\n \u0026lt;div style=\"text-align:left\"\u0026gt;\n \u0026lt;input type=\"text\" #query\u0026gt;Enter search term: \n \u0026lt;button (click) = \"loadImage(query.value)\"\u0026gt;Search!\u0026lt;/button\u0026gt;\n \u0026lt;/div\u0026gt;\n\n \u0026lt;div style=\"text-align:right\" class=\"navbar\"\u0026gt;\n \u0026lt;button routerLink = '/login' (click) = \"logout()\"\u0026gt;Logout\u0026lt;/button\u0026gt;\n \u0026lt;/div\u0026gt;\n\n \u0026lt;br\u0026gt;\n \u0026lt;div class = \"imgDivClass\" id = \"imgDiv\" style=\"text-align:left\"\u0026gt;\u0026lt;/div\u0026gt;\n\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am trying to delete the nodes that I have created in my dynamically created nodes section. When I do something like \u003ccode\u003e$('#imgDiv').html('')\u003c/code\u003e it only deletes the src part of the image. The button and img tag are still there.\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2017-12-03 02:01:34.497 UTC","last_activity_date":"2017-12-03 02:01:34.497 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8981823","post_type_id":"1","score":"0","tags":"jquery|html|angular2-template","view_count":"8"} {"id":"8503327","title":"Difference between java.exe, javaw.exe and jvm.dll","body":"\u003cp\u003eWhat is the difference in running an application (for example, Eclipse) with java.exe, javaw.exe and jvm.dll? Also, does it make any difference in terms of performance?\u003c/p\u003e","accepted_answer_id":"8503524","answer_count":"2","comment_count":"1","creation_date":"2011-12-14 10:57:03.327 UTC","favorite_count":"6","last_activity_date":"2015-05-23 18:48:34.43 UTC","last_edit_date":"2015-05-23 18:48:34.43 UTC","last_editor_display_name":"","last_editor_user_id":"814702","owner_display_name":"","owner_user_id":"913369","post_type_id":"1","score":"25","tags":"java|jvm","view_count":"11196"} {"id":"6109417","title":"MVC Decimal Separator with multiple culture","body":"\u003cp\u003eI'm working with an application with multiple culture, and when i change culture 'pt' to 'en' the decimal separator change to. Have some way to fixing the decimal separator? \u003c/p\u003e\n\n\u003cp\u003ethanks.\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2011-05-24 11:03:08.097 UTC","favorite_count":"1","last_activity_date":"2011-05-24 11:34:51.093 UTC","last_edit_date":"2011-05-24 11:34:51.093 UTC","last_editor_display_name":"","last_editor_user_id":"178082","owner_display_name":"","owner_user_id":"511021","post_type_id":"1","score":"3","tags":".net|asp.net-mvc|globalization","view_count":"1422"} {"id":"34511820","title":"SQL insert Or update times out if large date in loop","body":"\u003cp\u003ei have some data with userid and date.\u003c/p\u003e\n\n\u003cp\u003eSometimes there is large datas i need to loop through and update the sql database but the database times out.\u003c/p\u003e\n\n\u003cp\u003eis there any better way i can do this please, sample code below.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eforeach($time[$re-\u0026gt;userid][$today] as $t){\n\n if(($re-\u0026gt;time \u0026gt;= $t-\u0026gt;in_from) \u0026amp;\u0026amp; ($re-\u0026gt;time \u0026lt; $t-\u0026gt;in_to)\n \u0026amp;\u0026amp; md5($t-\u0026gt;WorkDay.\"_in\".$re-\u0026gt;date) != $in){//in\n\n $tble = tools::sd(\"{$t-\u0026gt;WorkDay} in\");\n }\n\n if(($re-\u0026gt;time \u0026gt;= $t-\u0026gt;out_from) \u0026amp;\u0026amp; ($re-\u0026gt;time \u0026lt; $t-\u0026gt;out_to)\n \u0026amp;\u0026amp; md5($t-\u0026gt;WorkDay.\"_out\".$re-\u0026gt;date) != $out){//out\n\n $tble = tools::sd(\"{$t-\u0026gt;WorkDay} out\");\n\n if($tble =='nout'){\n $re-\u0026gt;date2 = tools::ndate($re-\u0026gt;date . \"- 1\");\n }\n }\n\n if(!empty($tble)){ \n $q = array(\n \"id\" =\u0026gt; $re-\u0026gt;userid\n , \"dt\" =\u0026gt; $re-\u0026gt;date2\n , \"{$tble}\" =\u0026gt; $re-\u0026gt;time\n );\n\n dump($q); // insert into sql\n }\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003edump function:::\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction dump($d ='')\n{\n if(!empty($d)){\n end($d); \n $tble = key($d); \n $d['ld'] = \"{$d['dt']} {$d[$tble]}\";\n\n $r = $GLOBALS['mssqldb']-\u0026gt;get_results(\"\n IF NOT EXISTS (select id,ld,dt,{$tble} from clockL \n WHERE id = '{$d['id']}' \n AND dt ='{$d['dt']}')\n INSERT INTO clockL (id,ld,dt,{$tble})\n VALUES ('{$d['id']}','{$d['ld']}','{$d['dt']}'\n ,'{$d[$tble]}')\n ELSE IF EXISTS (select id,{$tble} from clockL \n WHERE id = '{$d['id']}' \n AND dt ='{$d['dt']}'\n AND {$tble} = 'NOC'\n ) \n update clockL SET {$tble} ='{$d[$tble]}', ld ='{$d['ld']}' WHERE id = '{$d['id']}' \n AND dt ='{$d['dt']}' AND {$tble} ='NOC'\n \");\n\n //print_r($GLOBALS['mssqldb']);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThank You.\u003c/p\u003e","answer_count":"3","comment_count":"1","creation_date":"2015-12-29 13:11:29.217 UTC","last_activity_date":"2017-09-21 22:14:40.74 UTC","last_edit_date":"2017-09-22 17:44:54.74 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"2088945","post_type_id":"1","score":"-1","tags":"php|sql|sql-server|large-data","view_count":"50"} {"id":"25473885","title":"How to create a scaffold with differing controller and model names?","body":"\u003cp\u003eI'm making a versioned JSON API in rails, where the controllers also respond to HTML, meaning it can be accessed as a browser or through an app I'm developing. The controllers have the form Model::V1::UsersController (Model instead of API since they don't just respond to JSON), and I currently have the following in my routes.rb:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003enamespace :model, path: 'm', as: '' do\n # For objects in the model, accessible by JSON (through the app) or HTML (through the browser, using forms to send data to the server).\n\n scope module: 'v1', constraints: OrConstraint.new([APIConstraint.new(1), APIConstraint.new(:default)]) do\n resources :users do\n collection do\n post :sign_in\n end\n end\n end\nend\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI plan to add more models to my API, but how can I use scaffolding to do this? For example, to create a controller Model::V1::CommentsController, but using the Comment model, instead of Model::V1::Comments.\u003c/p\u003e\n\n\u003cp\u003eI've been trying to figure this out for hours, and googling for people with similar problems shows that a few people say not to use scaffolding at all in this case: I don't want to do this, as it would mean writing all the views myself, which would be very time-consuming. Apart from that, I can't find much. \u003cstrong\u003enifty-generators\u003c/strong\u003e was suggested somewhere, but it doesn't seem to be maintained anymore: no activity since 2012. I'm new to rails, and it might be that I've missed something quite obvious, but I find it surprising that not many others have had the same issue.\u003c/p\u003e\n\n\u003cp\u003eI've considered making my own generator, but looking at the source of \u003ca href=\"https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb\" rel=\"nofollow\"\u003ehttps://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb\u003c/a\u003e, it seems very complicated.\u003c/p\u003e\n\n\u003cp\u003eEDIT: I've just discovered that I can pass the --model-name parameter to the rails scaffold generator to achieve what I want, but for some reason it still tries to create a model with the same name as the controller. How can I change this? \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-08-24 16:38:08.23 UTC","last_activity_date":"2014-08-24 21:15:13.38 UTC","last_edit_date":"2014-08-24 19:47:13.193 UTC","last_editor_display_name":"","last_editor_user_id":"994031","owner_display_name":"","owner_user_id":"994031","post_type_id":"1","score":"0","tags":"ruby-on-rails|ruby-on-rails-4","view_count":"66"} {"id":"40250623","title":"WebSphere liberty web socket lost messages","body":"\u003cp\u003eI'm playing with web sockets on WebSphere Liberty 16.0.0.3 and seeing something odd. If I send a number of messages back to back using the \u003ccode\u003egetAsyncRemote.sendText\u003c/code\u003e method (say 4 in a row), there are times when 2 of the messages don't make it to the client application. It feels like I'm doing something wrong, but I can't see what the issue is.\nNote, if I switch to the serialized approach, \u003ccode\u003egetBasicRemote\u003c/code\u003e, things work as expected and all messages are received.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-10-25 22:14:41.54 UTC","last_activity_date":"2016-10-25 23:50:04.933 UTC","last_edit_date":"2016-10-25 22:43:11.477 UTC","last_editor_display_name":"","last_editor_user_id":"6392939","owner_display_name":"","owner_user_id":"7072080","post_type_id":"1","score":"1","tags":"java|java-ee|websocket|websphere-8","view_count":"60"} {"id":"41013910","title":"how to sort \"GROUP BY\" query result by Frequent values?","body":"\u003cp\u003ei write php application that it get name of the user browsers:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e+----------+------------+\n| name | browser |\n+----------+------------+\n| Puffball | firefox |\n| Chirpy | edge |\n| Whistler | chrome |\n| Slim | firefox |\n| Claws | edge |\n| Fluffy | chrome |\n| Fang | chrome |\n| Bowser | safari |\n| Buffy | chrome |\n+----------+------------+\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ei use this sql query to get browsers with \"GROUP BY\" and the result is:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$sql = \"SELECT * FROM views WHERE linkid = '$string' GROUP BY browser\";\n\narray (size=4)\n 0 =\u0026gt; string 'firefox (length=7)\n 1 =\u0026gt; string 'edge' (length=4)\n 2 =\u0026gt; string 'chrome' (length=6)\n 3 =\u0026gt; string 'safari' (length=6)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ei want to sort this result by Frequent value, like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003earray (size=4)\n 0 =\u0026gt; string 'chrome (length=6)\n 1 =\u0026gt; string 'edge' (length=4)\n 2 =\u0026gt; string 'firefox' (length=7)\n 3 =\u0026gt; string 'safari' (length=6)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003etanx!\u003c/p\u003e","accepted_answer_id":"41014512","answer_count":"2","comment_count":"3","creation_date":"2016-12-07 09:36:06.423 UTC","last_activity_date":"2016-12-07 10:11:42.927 UTC","last_edit_date":"2016-12-07 10:00:24.977 UTC","last_editor_display_name":"","last_editor_user_id":"4182320","owner_display_name":"","owner_user_id":"4182320","post_type_id":"1","score":"0","tags":"php|mysql|group-by","view_count":"38"} {"id":"15736123","title":"Rails, Devise, Heroku deleting user account from Console","body":"\u003cp\u003eI have some empty user accounts sitting in my production environment that I made as a test, that I'd like to delete now. They don't have any items that are attached to them, so what command do I run from the heroku console to delete these? Also, I access the heroku console by just typing 'heroku console', right?\u003c/p\u003e\n\n\u003cp\u003eI deleted the \"User Delete\" button from the devise view because I didn't want users to be able to delete their accounts... Figured this was the cleanest way.\u003c/p\u003e","accepted_answer_id":"15736133","answer_count":"1","comment_count":"0","creation_date":"2013-04-01 00:23:55.543 UTC","last_activity_date":"2013-04-01 00:25:34.533 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1410554","post_type_id":"1","score":"1","tags":"ruby-on-rails|heroku|devise","view_count":"735"} {"id":"31787248","title":"Sliding tabs inside actionbar tabs","body":"\u003cp\u003eI am trying to implement sliding tabs inside actionBar tabs just like flipboard. So one of the main tabs will have three tabs. Sub-tabs will scroll first and once all tabs get scrolled, then main tab comes into focus and will start scrolling.\u003c/p\u003e\n\n\u003cp\u003eI am attaching screenshot of flipBoard UI\u003ca href=\"https://i.stack.imgur.com/tHPGY.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/tHPGY.jpg\" alt=\"FlipBoard Tabs\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eHave anyone done this? Please help.\u003c/p\u003e","accepted_answer_id":"31851242","answer_count":"1","comment_count":"4","creation_date":"2015-08-03 12:26:51.84 UTC","favorite_count":"5","last_activity_date":"2015-08-06 09:21:03.287 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1288005","post_type_id":"1","score":"14","tags":"android|android-viewpager|flipboard|android-actionbar-tabs","view_count":"1108"} {"id":"21809501","title":"PDO Insert Error - execute(array());","body":"\u003cp\u003eI'm trying to do a registration system, and I'm getting this error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eFatal error: Uncaught exception 'PDOException' with message\n 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an\n error in your SQL syntax; check the manual that corresponds to your\n MySQL server version for the right syntax to use near\n ''=L\u0026amp;myPRwgOSB?V_execute(Array) #1 {main} thrown in\n /home/\u003cem\u003e*\u003c/em\u003e*/public_html/forum/register-cmd.php on line 58\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eand I have no clue why. Here's the code: What's wrong with it? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\ninclude('./includes/connect.php');\n/* START VARIABLES */\n$submit = $_POST['submit'];\n\n$username = clean($_POST['username']);\n\n$email = clean($_POST['email']);\n$repeatedemail = clean($_POST['remail']);\n\n$password = clean($_POST['password']);\n$repeatedpassword = clean($_POST['rpassword']);\n\n$year = (int) $_POST['year'];\n$day = (int) $_POST['day'];\n$months = array(\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\");\n\nif(in_array(ucwords($_POST['month']), $months)) {\n $dob = $_POST['month'] . \" \" . $day . \", \" . $year;\n} else {\n header('Location: register.php?error=nonexist');\n}\n\n$referrer = $_POST['referrer'];\n\n$recieve_emails = (int) $_POST['getemail'];\n$view_signatures = (int) $_POST['sig'];\n/* END VARIABLES */\nif(isset($username) \u0026amp;\u0026amp; isset($submit) \u0026amp;\u0026amp; isset($email) \u0026amp;\u0026amp; isset($repeatedemail) \u0026amp;\u0026amp; isset($password) \u0026amp;\u0026amp; isset($repeatedpassword) \u0026amp;\u0026amp; isset($year) \u0026amp;\u0026amp; isset($day) \u0026amp;\u0026amp; isset($_POST['month']) \u0026amp;\u0026amp; isset($recieve_emails) \u0026amp;\u0026amp; isset($view_signatures)) {\n if($email == $repeatedemail) {\n if($password == $repeatedpassword) {\n $check_user = $con-\u0026gt;prepare(\"SELECT * FROM users WHERE username = :username\");\n $check_user-\u0026gt;execute(array(\n \":username\" =\u0026gt; $username\n ));\n if($check_user-\u0026gt;rowCount() == 1) {\n header('Location: register.php?error=usernametaken');\n } else {\n $check_email = $con-\u0026gt;prepare(\"SELECT * FROM users WHERE email = :email\");\n $check_email-\u0026gt;execute(array(\n \":email\" =\u0026gt; $email\n ));\n if($check_email-\u0026gt;rowCount() == 1) {\n header('Location: register.php?error=emailtaken');\n } else {\n $salt = salt();\n\n $hashedPassword = sha1($pepper . $password . $salt);\n $insert = $con-\u0026gt;prepare(\"INSERT INTO users ('username', 'password', 'salt', 'email', 'dob', 'recieve_emails', 'view_signatures') VALUES (:username, :password, :salt, :email, :dob, :recieve_emails, :view_signatures)\");\n $insert-\u0026gt;execute(array(\n \":username\" =\u0026gt; $username,\n \":password\" =\u0026gt; $hashedPassword,\n \":salt\" =\u0026gt; $salt,\n \":email\" =\u0026gt; $email,\n \":dob\" =\u0026gt; $dob,\n \":recieve_emails\" =\u0026gt; $recieve_emails,\n \":view_signatures\" =\u0026gt; $view_signatures\n ));\n header('Location: index.php?success=registered');\n exit();\n }\n }\n } else {\n header('Location: register.php?error=nomatchpassword');\n }\n } else {\n header('Location: register.php?error=nomatchemail');\n }\n} else {\n header('Location: index.php');\n}\n?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"21809550","answer_count":"1","comment_count":"4","creation_date":"2014-02-16 09:33:39.937 UTC","last_activity_date":"2014-02-16 09:41:57.64 UTC","last_edit_date":"2014-02-16 09:41:57.64 UTC","last_editor_display_name":"","last_editor_user_id":"285587","owner_display_name":"","owner_user_id":"3186081","post_type_id":"1","score":"0","tags":"php|mysql","view_count":"47"} {"id":"18888087","title":"Circular dependency expected class-name before '{' token","body":"\u003cp\u003esorry in advance to start another one of those circular dependency threads but I tried almost everything and maybe a fresh pair of eyes can help.\nHow do I get this * compiled?\u003c/p\u003e\n\n\u003cp\u003eCARD.H\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#ifndef CARD_H\n#define CARD_H\n\n#include \u0026lt;string\u0026gt;\n#include \u0026lt;sstream\u0026gt;\n#include \u0026lt;irrKlang.h\u0026gt;\n#include \"Database.h\"\n\nusing namespace std;\nusing namespace irrklang;\n\nclass Card: public Database{ // problem expected class-name before '{' token\n public:\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eDATABASE.H\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#ifndef __DATABASE_H__\n#define __DATABASE_H__\n\n#include \u0026lt;string\u0026gt;\n#include \u0026lt;vector\u0026gt;\n#include \u0026lt;sqlite3.h\u0026gt;\n#include \u0026lt;wx/string.h\u0026gt;\n#include \u0026lt;irrKlang.h\u0026gt;\n#include \u0026lt;wx/file.h\u0026gt;\n\n#include \"Card.h\" // even though i include card.h\n\nusing namespace std;\nusing namespace irrklang;\n\nclass Card; // if i take this out, I get: 'Card' was not declared in this scope|\n\nclass Database\n{\npublic:\nvector\u0026lt;Card\u0026gt; queryC(wstring query);\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"2","creation_date":"2013-09-19 06:57:35.627 UTC","favorite_count":"1","last_activity_date":"2013-09-19 07:19:12.257 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2095482","post_type_id":"1","score":"-2","tags":"c++|circular-dependency","view_count":"248"} {"id":"10768892","title":"Change Phone Ringtone while ringing","body":"\u003cp\u003eI know that Android has a built-in system that lets the user choose a special ringtone for a single phonebook contact/group, but i have to change the ringtone dinamically while calling:\u003c/p\u003e\n\n\u003cp\u003eSo, I wrote a Service and load it at phone startup, to set a phone listener that captures incoming call, that saves the default phone ringtone (in a Service variable) and change the original ringtone with another one if necessary, then restore the orignal ringtone when the phone state returns idle. Well, i can save the original tone, set the new one, but can't hear the new ringtone, only the old:\u003c/p\u003e\n\n\u003cp\u003eTake a look at my code and keep in mind that, when the phone listener chooses if to change the original ringtone or not, the phone is \u003cstrong\u003ealready ringing.\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eSo, how can i change the ringtone while the phone is already ringing?\u003c/p\u003e\n\n\u003cp\u003eI have \u003ccode\u003eandroid.permission.WRITE_SETTINGS\u003c/code\u003e and \u003ccode\u003eandroid.permission.READ_PHONE_STATE\u003c/code\u003e permissions in my Manifest.\u003c/p\u003e\n\n\u003cp\u003eThe Service:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class CallFilterService extends Service {\n\n private Uri originalRingtoneUri;\n\n @Override\n public IBinder onBind(Intent arg0) {\n return null;\n }\n\n @Override\n public int onStartCommand(Intent intent, int flags, int startId) {\n TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);\n telephonyManager.listen(new CallFilterListener(this), PhoneStateListener.LISTEN_CALL_STATE);\n return START_STICKY;\n }\n\n public void saveOriginalRingtone() {\n originalRingtoneUri = RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.TYPE_RINGTONE);\n }\n\n public void restoreOriginalRingtone() {\n RingtoneManager.setActualDefaultRingtoneUri(context, RingtoneManager.TYPE_RINGTONE, originalRingtoneUri);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe PhoneListener:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class MyPhoneListener extends PhoneListener\n{\n private CallFilterService service;\n private Uri specialRingtoneUri;\n\n public CallFilterListener(CallFilterService service) {\n super();\n this.service = service;\n specialRingtoneUri = setSpecialRingtone(); \n }\n\n @Override\n public void onCallStateChanged(int state, String incomingNumber) {\n switch (state) {\n case TelephonyManager.CALL_STATE_RINGING: {\n service.saveOriginalRingtone();\n if (canChangeRingtone(incomingNumber)) {\n //When in this if block, the default phone ringtone is already playing.\n RingtoneManager.setActualDefaultRingtoneUri(context, RingtoneManager.TYPE_RINGTONE, specialRingtoneUri);\n }\n break;\n }\n case TelephonyManager.CALL_STATE_IDLE: \n {\n service.restoreOriginalRingtone();\n break;\n }\n default:\n break;\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"2","creation_date":"2012-05-26 18:47:55.53 UTC","last_activity_date":"2016-07-04 10:57:46.17 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"552224","post_type_id":"1","score":"0","tags":"android","view_count":"633"} {"id":"35606067","title":"Automatic login using beeline","body":"\u003cp\u003eI am using beeline as a client to access hive databases. Every time I use beeline, it asks me for the connection URL, username and password. Is there a way to set these parameters in a configuration file and load it automatically instead of re-typing them for each login ?\u003c/p\u003e","accepted_answer_id":"35608296","answer_count":"2","comment_count":"0","creation_date":"2016-02-24 15:24:21.993 UTC","last_activity_date":"2016-05-21 01:39:36.397 UTC","last_edit_date":"2016-03-21 01:31:35.553 UTC","last_editor_display_name":"","last_editor_user_id":"51167","owner_display_name":"","owner_user_id":"1551478","post_type_id":"1","score":"0","tags":"hadoop|hive|beeline","view_count":"303"} {"id":"42561254","title":"Spring Constructor Problems","body":"\u003cp\u003eI am having trouble setting up a constructor for a @service. \"url\" and \"template\" are used in many places in my code and wanted to initialize it in just one place. Here is the code,\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Service\npublic class RabbitMQServices {\n\n @Autowired\n public RabbitMQServices() {\n\n // Create RabbitMQ management url\n this.url = \"http://\" + rmqfqdn + \":\" + rmqmgmtport;\n\n // Create http template\nline 36 ==\u0026gt; this.template.getInterceptors()\n .add(new BasicAuthorizationInterceptor(rmqadminname,\n rmqadminpw));\n\n }\n\n // Create vhost\n private String createVhost(RabbitmqRepository repo) {\n\n // Create default parameters\n result = \"OK\";\n\n // Create service uri\n String uri = url + \"/api/vhosts/\" + repo.getTenantid() + \"-vh\";\n\n // Create header entity\n HttpHeaders header = new HttpHeaders();\n header.set(\"content-type\", \"application/json\");\n HttpEntity\u0026lt;String\u0026gt; entity = new HttpEntity\u0026lt;String\u0026gt;(header);\n\n try {\n\n // Go create vhost\n template.exchange(uri, HttpMethod.PUT, entity, String.class);\n\n } catch(Exception e) {\n\n result = \"FAIL: \" + e;\n }\n\n return result;\n }\n\n// Class variables\nString result;\nString tenantpw;\nString url;\nRestTemplate template;\n\n// RabbitMQ Server URI\n@Value(\"${rabbitmq.server.fqdn}\")\nprivate String rmqfqdn;\n\n// RabbitMQ Server Managment port\n@Value(\"${rabbitmq.server.management.port}\")\nprivate String rmqmgmtport;\n\n// RabbitMQ Server administrator name\n@Value(\"${rabbitmq.server.adminname}\")\nprivate String rmqadminname;\n\n// RabbitMQ Server administrator password\n@Value(\"${rabbitmq.server.adminpw}\")\nprivate String rmqadminpw;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am getting the following error,\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eCaused by: java.lang.NullPointerException: null\n at com.belcan.services.RabbitMQServices.\u0026lt;init\u0026gt;(RabbitMQServices.java:36) ~[bin/:na]\n at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_101]\n at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_101]\n at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_101]\n at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[na:1.8.0_101]\n at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142) ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\n ... 38 common frames omitted\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eLine 36 is the this.template line in the constructor,\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ethis.template.getInterceptors() ...\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"42563688","answer_count":"3","comment_count":"3","creation_date":"2017-03-02 16:50:25.113 UTC","last_activity_date":"2017-03-06 15:43:57.577 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2808834","post_type_id":"1","score":"-1","tags":"java|spring","view_count":"97"} {"id":"40163466","title":"Ajax returns with PHP","body":"\u003cp\u003eAlright so I am trying to put this thing together, but I do not understand what is the problem with this code. I am basically trying to return false in case name exists in the database, but no matter what ajax will just pass it as a \"success\"\u003c/p\u003e\n\n\u003cp\u003eHere is the code:\u003c/p\u003e\n\n\u003cp\u003eRunning the \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction checkName(username) {\n $.ajax({ \n url:\"assembly/handler.php\", \n type:\"POST\", \n data:{func:\"run_namecheck\", user_name:username}, \n success:function(data){\n return true;\n },\n error:function(data) {\n return false;\n }\n }); \n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe code is executed perfectly and it actually passed all the things it needs, and the PHP function does get called. \nPHP function bellow.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic function nameExists($name) {\n $handler = new sql();\n $sql = $handler-\u0026gt;connect();\n\n $sql-\u0026gt;real_escape_string($name);\n $name_final = ucfirst($name);\n\n $result = $sql-\u0026gt;query(\"SELECT ime FROM users WHERE ime='\".$name_final.\"'\");\n\n\n\n if($result-\u0026gt;num_rows != 0) return true;\n else {\n $handler-\u0026gt;log_write($name, \"login_fail\",\"NULL\");\n return false;\n }\n $sql-\u0026gt;close();\n return false;\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow the problem is success and the error. No matter what it will always be success. It doesn't like pay attention at when I return FALSE from the PHP at all and such.\u003c/p\u003e","accepted_answer_id":"40163547","answer_count":"5","comment_count":"0","creation_date":"2016-10-20 19:59:57.123 UTC","last_activity_date":"2016-10-20 21:22:50.993 UTC","last_edit_date":"2016-10-20 21:22:50.993 UTC","last_editor_display_name":"","last_editor_user_id":"2477990","owner_display_name":"","owner_user_id":"7045390","post_type_id":"1","score":"0","tags":"php|jquery|ajax","view_count":"49"} {"id":"9552451","title":"javascript regexp match against variable email domain","body":"\u003cp\u003eI am trying to have a clientside check, if an entered value:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eis a valid e-mailadres\u003c/li\u003e\n\u003cli\u003ehas the right domain name\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eI came up with following code, but it doesn't work:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar userinput = 'dirk@something.com';\nvar domain = 'somethingelse.com';\ndomain.replace('.', '\\.');\nvar pattern = new RegExp('/^[a-zA-Z0-9._-]+@'+domain+'$/');\nif(!pattern.test(userinput))\n {\n alert('not a valid e-mailadres, or the wrong domain!');\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnyone who can help me out? Many thanks!\u003c/p\u003e","accepted_answer_id":"9552490","answer_count":"4","comment_count":"0","creation_date":"2012-03-04 04:58:48.723 UTC","last_activity_date":"2012-03-04 05:16:05.34 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"851149","post_type_id":"1","score":"1","tags":"javascript|regex","view_count":"5264"} {"id":"29538985","title":"Cycle efficiency when comparing values (-1,1 vs 1,2)","body":"\u003cp\u003eI have a function that will return me one of 3 different values: 0, -1, 1 (or 0, 1, 2). \u003c/p\u003e\n\n\u003cp\u003eCondition1 is more likely than condition2, and condition2 more likely than non of the condition being true, hence the \u003ccode\u003eelseif\u003c/code\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction [A] = example(...)\nif condition1 == true\n A = 1;\nelseif condition2 == true\n A = -1;\nelse\n A = 0;\nend\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI need to check the value \u003ccode\u003eA\u003c/code\u003e, when doing that, will it be more efficient to see if A is positive or negative, or either 1 or 2?\u003c/p\u003e\n\n\u003cp\u003eExample 1:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif A \u0026gt; 0\n % Do something\nelseif A \u0026lt; 0\n % Do something else\nelse\n % Do nothing\nend\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eExample 2:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e if A == 1\n % Do something\n elseif A == 2\n % Do something else\n else\n % Do nothing\n end\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cem\u003eWitch example will be most efficient cycle wise?\u003c/em\u003e\u003c/p\u003e","answer_count":"1","comment_count":"5","creation_date":"2015-04-09 12:49:41.803 UTC","last_activity_date":"2015-04-09 21:08:04.913 UTC","last_edit_date":"2015-04-09 13:04:44.187 UTC","last_editor_display_name":"","last_editor_user_id":"4768993","owner_display_name":"","owner_user_id":"4768993","post_type_id":"1","score":"0","tags":"matlab","view_count":"37"} {"id":"7155920","title":"How to Pass Same Modal into Partial View from View","body":"\u003cp\u003eI have a strongly typed partial view #1, and i have another partial view #2 that is strongly typed with same model. i have referenced partial view #2 inside partial view #1, now i need to pass the same model from partial view #1 onto #2 how can i do so?\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eView#1\n @model Models.ContentModel.Model1\n @Html.Partial(\"../PartialViews/View#2\", ???????)\n\n\nView#2\n @model Models.ContentModel.Model1\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"7155968","answer_count":"1","comment_count":"0","creation_date":"2011-08-23 03:16:59.353 UTC","last_activity_date":"2012-06-29 23:09:50.257 UTC","last_edit_date":"2012-06-29 23:09:50.257 UTC","last_editor_display_name":"","last_editor_user_id":"727208","owner_display_name":"","owner_user_id":"788436","post_type_id":"1","score":"1","tags":"c#|asp.net-mvc|asp.net-mvc-3|razor","view_count":"126"} {"id":"46516183","title":"S3 CORS Configuration: restricting to specific domains has no affect?","body":"\u003cp\u003eI have a bucket on S3 with everything public, and the following CORS configuration:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"UTF-8\"?\u0026gt;\n\u0026lt;CORSConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"\u0026gt;\n\u0026lt;CORSRule\u0026gt;\n \u0026lt;AllowedOrigin\u0026gt;http://example.com\u0026lt;/AllowedOrigin\u0026gt;\n \u0026lt;AllowedMethod\u0026gt;GET\u0026lt;/AllowedMethod\u0026gt;\n \u0026lt;AllowedHeader\u0026gt;*\u0026lt;/AllowedHeader\u0026gt;\n\u0026lt;/CORSRule\u0026gt;\n\u0026lt;CORSRule\u0026gt;\n \u0026lt;AllowedOrigin\u0026gt;http://localhost:3333\u0026lt;/AllowedOrigin\u0026gt;\n \u0026lt;AllowedMethod\u0026gt;GET\u0026lt;/AllowedMethod\u0026gt;\n \u0026lt;AllowedHeader\u0026gt;*\u0026lt;/AllowedHeader\u0026gt;\n\u0026lt;/CORSRule\u0026gt;\n\u0026lt;/CORSConfiguration\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWith that configuration, I would expect to \u003cstrong\u003e\u003cem\u003eonly\u003c/em\u003e\u003c/strong\u003e be able to get objects when requesting from \u003ccode\u003ehttp://example.com\u003c/code\u003e or \u003ccode\u003ehttp://localhost:3333\u003c/code\u003e, and receive \u003ccode\u003e403\u003c/code\u003es when linking to urls in that bucket from other domains. As it stands, I can still link to audio and image files in that bucket from \u003ccode\u003ehttp://dev.example.com\u003c/code\u003e as well as \u003ccode\u003ehttp://localhost:4444\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eWhat am I doing wrong?\u003c/p\u003e","accepted_answer_id":"46517631","answer_count":"1","comment_count":"0","creation_date":"2017-10-01 19:39:08.83 UTC","favorite_count":"0","last_activity_date":"2017-10-01 22:50:45.903 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2416000","post_type_id":"1","score":"1","tags":"amazon-s3|cors","view_count":"83"} {"id":"8744486","title":"FLASH AS3: Delete keyframes programmatically","body":"\u003cp\u003e\u003cstrong\u003eHere's what i'm trying to do:\u003c/strong\u003e\nI have a slideshow of pictures with a simple fading transition. I do not have the source file and i'd like to extract all of the single pictures from the slideshow. I've imported the video into flash so that all of the images from the video are keyframes.\u003c/p\u003e\n\n\u003cp\u003eSo now, I have a movie with about 10,000 keyframes. I have a known interval of keyframes that I do not want (when the picture is on a frame by itself and it's not transitioning with another picture). \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eCan I:\u003c/strong\u003e\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eDelete an interval of keyframes\u003c/li\u003e\n\u003cli\u003eCreate a new movieclip/document/scene... with the keyframes that I want\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eAny suggestions would be very helpful! Thanks\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2012-01-05 14:52:34.97 UTC","last_activity_date":"2012-01-05 19:47:07.3 UTC","last_edit_date":"2012-01-05 14:58:48.29 UTC","last_editor_display_name":"","last_editor_user_id":"237885","owner_display_name":"","owner_user_id":"237885","post_type_id":"1","score":"2","tags":"flash|actionscript-3|video|actionscript|slideshow","view_count":"524"} {"id":"33910073","title":"angular $routeprovider endless optional param","body":"\u003cp\u003eI'm trying to create file \u0026amp; folder manager using angular-js.\u003cbr\u003e\nSo i need endless optional parameters for folderIds to handling this:\u003cbr\u003e\n\u003ccode\u003eexample.com/drive/1/2/3/4/5/...\u003c/code\u003e \u003c/p\u003e\n\n\u003cp\u003eDo we have something like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$routeprovider.when('/drive/[:folderId?]', {\n controller: 'driveCtrl',\n templateUrl: '/app/views/drive.html'\n})\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003einstead of this: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$routeprovider.when('/drive/:folderId1?/:folderId2?/:folderId3?/:folderId4?', {\n controller: 'driveCtrl',\n templateUrl: '/app/views/drive.html'\n})\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-11-25 06:46:33.273 UTC","last_activity_date":"2015-11-25 07:12:33.793 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1618861","post_type_id":"1","score":"0","tags":"javascript|angularjs|angularjs-routing|route-provider","view_count":"48"} {"id":"45516604","title":"create a JSON file from a csv by grouping fields","body":"\u003cp\u003eI am trying to create a json file from a csv file. I want to also group certain fields in the csv file and group them together in the json file,\nfollowing is the code i have so far, but i am not clear how i can group them.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom csv import DictReader\nimport json\njson_input_file=\"test.csv\"\njson_output_file=\"test.json\"\n\n\n# read csv for json conversion\ndef read_csv(file, json_file):\n csv_rows = []\n with open(json_input_file) as csvfile:\n _reader = csv.DictReader(csvfile)\n _title = _reader.fieldnames\n\n for _row in _reader:\n csv_rows.extend([{_title[i]:_row[_title[i]] for i in range(len(_title))}])\n write_json(csv_rows, json_file)\n# write json file\ndef write_json(data, json_file):\n with open(json_file, \"w\") as F:\n F.write(json.dumps(data, sort_keys=False, indent=4, separators=(',', ': '),encoding=\"utf-8\",ensure_ascii=False))\n# exec the conversion\nread_csv(json_input_file, json_output_file)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy csv file looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ebrand_x, x_type, x_color, brand_y, y_type, y_color\nx_code1, type1, green, y_code1, type200, orange\nx_code1, type1, red, y_code1, type200, pink\nx_code1, type1, black, y_code1, type200, yellow\nx_code2, type20, blue, y_code2, type201, blue\nx_code2, type20, red, y_code3, type202, black\nx_code3, type1, white, y_code3, type202, black\nx_code3, type1, blue, y_code3, type202, blue\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI trying to group color that is part of the brand and type\nfor example \ngroup all the color that belongs to x_code1 of brand_x and that is type1 of x_type, etc.\u003c/p\u003e\n\n\u003cp\u003eFollowing is the json output i am looking for:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[\n {\n \"brand_x\": \"x_code1\",\n \"brand_y\": \"y_code1\",\n \"x_type\": \"type1\",\n \"y_type\":\"type200\",\n \"x_type1_color\": [\n {\n \"x_color\": \"green\"\n },\n {\n \"x_color\": \"red\"\n },\n {\n \"x_color\": \"black\"\n }\n ],\n \"y_type200_color\":[\n {\n \"y_color\":\"orange\"\n },\n {\n \"y_color\": \"pink\"\n },\n {\n \"y_color\": \"yellow\"\n }\n ]\n }\n]\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"7","creation_date":"2017-08-04 23:05:09.56 UTC","favorite_count":"0","last_activity_date":"2017-08-05 00:28:43.58 UTC","last_edit_date":"2017-08-04 23:29:14.427 UTC","last_editor_display_name":"","last_editor_user_id":"8200800","owner_display_name":"","owner_user_id":"8200800","post_type_id":"1","score":"3","tags":"python","view_count":"105"} {"id":"23541324","title":"Panorama 360 degrees viewer with thumbnail slider to click and select dynamic images for previewing in 360 degrees panaromic viewer","body":"\u003cp\u003eI have used \u003ca href=\"http://mrdoob.github.com/three.js/examples/webgl_panorama_equirectangular.html\" rel=\"nofollow noreferrer\"\u003ehttp://mrdoob.github.com/three.js/examples/webgl_panorama_equirectangular.html\u003c/a\u003e for panoramic view. But i need to place a slider. By which when I click an image from the slider, the panorama image must be replaced with the current selected image and the panorama 360 degree must apply to the image. \nI can't show the website where I found such example, as there is no direct link. Below is an image to show example\n\u003cimg src=\"https://i.stack.imgur.com/aYQV4.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eAs seen in the image. There is a thumbnail image from which images are selected dynamically on click. Then the selected image is displayed in the preview which is a panorama slider. Is there any slider for this functionality. Please post the link.\u003c/p\u003e","answer_count":"0","comment_count":"1","creation_date":"2014-05-08 12:08:17.043 UTC","last_activity_date":"2014-05-08 12:08:17.043 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3499071","post_type_id":"1","score":"2","tags":"javascript|jquery|css3|jquery-plugins|panoramas","view_count":"1239"} {"id":"44251483","title":"Image Full in the screen","body":"\u003cblockquote\u003e\n \u003cp\u003eBlockquote\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003e[`\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ehello: anybody help me put this pic slide in full in all screens: http://xixicasa.com/portfolio/dorado-beach-east-2/\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003estatic footer and the height too, only change the width.\u003c/p\u003e\n\n\u003cp\u003e`]\u003ca href=\"https://i.stack.imgur.com/hmKMT.jpg\" rel=\"nofollow noreferrer\"\u003e1\u003c/a\u003e\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-05-29 23:41:02.74 UTC","last_activity_date":"2017-05-30 02:20:20.293 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6754853","post_type_id":"1","score":"-4","tags":"html|css","view_count":"17"} {"id":"6241753","title":"Mysql auto_increment proceed with lowest value","body":"\u003cp\u003eMy problem is: I have a table with an auto_increment column. When I insert some values, all is right.\nInsert first row : ID 1\nInsert second row : ID 2\u003c/p\u003e\n\n\u003cp\u003eNow I want to insert a row at ID 10.\u003c/p\u003e\n\n\u003cp\u003eMy problem is, that after this there are only rows inserted after ID 10 (which is the normal behaviour ).\u003c/p\u003e\n\n\u003cp\u003eBut I want that the database first fills up ID 3-9 before making that.\u003c/p\u003e\n\n\u003cp\u003eAny suggestions?\u003c/p\u003e\n\n\u003cp\u003eEDIT:\u003c/p\u003e\n\n\u003cp\u003eTo clarify: this is for an URL shortener I want to build for myself.\nI convert the id to a word(a-zA-z0-9) for searching, and for saving in the database I convert it to a number which is the ID of the table.\u003c/p\u003e\n\n\u003cp\u003eThe Problem is now: \nI shorten the first link (without a name) -\u003e ID is 1 and the automatically name is 1 converted to a-zA-Z0-9 which is a\u003c/p\u003e\n\n\u003cp\u003eNext the same happenes -\u003e ID is 2 and the name is b, which is 2 converted.\u003c/p\u003e\n\n\u003cp\u003eNext interesting, somebody want to name the link \u003ccode\u003etest\u003c/code\u003e -\u003e ID is \u003ccode\u003e4597691\u003c/code\u003e which is the converted \u003ccode\u003etest\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eNow if somebody adds another link with no name -\u003e ID is \u003ccode\u003e4597692 which\u003c/code\u003e would be \u003ccode\u003etesu\u003c/code\u003e because the number is converted.\u003c/p\u003e\n\n\u003cp\u003eI want that new rows will be automatically inserted at the last gap that was made (here 3)\u003c/p\u003e","accepted_answer_id":"6242295","answer_count":"5","comment_count":"8","creation_date":"2011-06-05 08:23:18.297 UTC","last_activity_date":"2011-06-05 10:18:09.82 UTC","last_edit_date":"2011-06-05 09:48:53.717 UTC","last_editor_display_name":"","last_editor_user_id":"781553","owner_display_name":"","owner_user_id":"781553","post_type_id":"1","score":"1","tags":"mysql|sql|auto-increment","view_count":"293"} {"id":"30476775","title":"Can't load data from the server using ajax call","body":"\u003cp\u003eI am pretty new to all of these technologies (php, knockout, and ajax). \u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eI am trying to load data from phpMyAdmin DB but it seems like my ajax\n call is not executed. The loadData function in my js is called in HTML\n and it controls the visibility of the table in my UI. Meaning, the\n table will be visible only when there I get data from the server.\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003e\u003cstrong\u003emy html\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;!DOCTYPE html\u0026gt;\n\u0026lt;html lang=\"en\"\u0026gt;\n\u0026lt;head\u0026gt;\n \u0026lt;title\u0026gt;Bootstrap Example\u0026lt;/title\u0026gt;\n \u0026lt;meta charset=\"utf-8\"\u0026gt;\n \u0026lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"\u0026gt;\n \u0026lt;link rel=\"stylesheet\" href=\"main.css\"\u0026gt;\n \u0026lt;script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"\u0026gt;\u0026lt;/script\u0026gt;\n \u0026lt;script src=\"http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js\"\u0026gt;\u0026lt;/script\u0026gt;\n \u0026lt;script type='text/javascript' src='knockout-2.2.0.js'\u0026gt;\u0026lt;/script\u0026gt;\n\n\u0026lt;/head\u0026gt;\n\u0026lt;body\u0026gt;\n\u0026lt;div class=\"container\" data-bind=\"load: loadData()\"\u0026gt;\n\n \u0026lt;table data-bind=\"visible: people().length \u0026gt; 0\" class=\"students\"\u0026gt;\n \u0026lt;thead\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;th\u0026gt;Name\u0026lt;/th\u0026gt;\n \u0026lt;th\u0026gt;Age\u0026lt;/th\u0026gt;\n \u0026lt;th\u0026gt;Remove\u0026lt;/th\u0026gt;\n \u0026lt;th\u0026gt;Update\u0026lt;/th\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/thead\u0026gt;\n \u0026lt;tbody data-bind=\"foreach: people\"\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;\n \u0026lt;span data-bind=\"text: name\"\u0026gt;\u0026lt;/span\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\n \u0026lt;span data-bind=\"text: age\"\u0026gt;\u0026lt;/span\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/tbody\u0026gt;\n \u0026lt;/table\u0026gt; \n\u0026lt;/div\u0026gt;\n\u0026lt;/body\u0026gt;\n\u0026lt;script type='text/javascript' src='studentapp.js'\u0026gt;\u0026lt;/script\u0026gt;\n\u0026lt;/html\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003ejs\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar personModel = function(id, name, age){\n var self = this; //caching so that it can be accessed later in a different context\n self.id = ko.observable(id); //unique id for the student (auto increment primary key from the database)\n self.name = ko.observable(name); //name of the student\n self.age = ko.observable(age);\n};\n\nvar model = function () {\nvar self = this;\nself.people = ko.observableArray([]);\n self.loadData = function () {\n //console.log(\"AHAHAHAH\");\n // alert(\"super\");\n //fetch existing student data from database$(document).ready(function() {\n $.getJSON(\"refresher_save.php\", function(data) {\n for(var x in data){\n //student details\n var id = data[x]['id'];\n var name = data[x]['name'];\n var age = data[x]['age'];\n\n //push each of the student record to the observable array for \n //storing student data\n self.people.push(new personModel(id, name, age)); \n }\n });\n};\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e};\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eko.applyBindings(new model());\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003ephp\u003c/strong\u003e \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\n$db = new mysqli('localhost', 'root', '', 'student');\n\n$action = (!empty($_POST['action'])) ? $_POST['action'] : ''; //action to be used(insert, delete, update, fetch)\n$student = (!empty($_POST['student'])) ? $_POST['student'] : ''; //an array of the student details\n\n//check if the student is not an empty string\n//and assigns a value to $name and $age if its not empty\nif(!empty($student)){\n $name = $student['name'];\n $age = $student['age']; \n}\n\nswitch($action){\n default:\n //only select student records which aren't deleted\n $students = $db-\u0026gt;query(\"SELECT * FROM students WHERE status = 1\");\n $students_r = array();\n\n while($row = $students-\u0026gt;fetch_array()){\n\n //default student data\n $id = $row['id'];\n $name = $row['name'];\n $age = $row['age'];\n\n //update status\n //its false by default since\n //this is only true if the user clicks\n //on the span\n $name_update = false;\n $age_update = false;\n\n //build the array that will store all the student records\n $students_r[] = array(\n 'id' =\u0026gt; $id, 'name' =\u0026gt; $name, 'age' =\u0026gt; $age\n );\n }\n\n echo json_encode($students_r); //convert the array to JSON string\n break;\n}\n?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan anyone help ?\u003c/p\u003e","answer_count":"1","comment_count":"16","creation_date":"2015-05-27 08:14:40.013 UTC","last_activity_date":"2015-07-13 21:20:05.15 UTC","last_edit_date":"2015-05-27 14:04:30.55 UTC","last_editor_display_name":"","last_editor_user_id":"3938789","owner_display_name":"","owner_user_id":"3938789","post_type_id":"1","score":"2","tags":"javascript|php|jquery|ajax|knockout.js","view_count":"300"} {"id":"36448885","title":"COUNT() and EXPLAIN row's count are getting different","body":"\u003cp\u003eIn Mysql, I have a table (employee_by_range). I am getting rows using \u003ccode\u003ecount\u003c/code\u003e and \u003ccode\u003eexplain\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cem\u003ewhen am i trying to get rows using \u003ccode\u003eCOUNT()\u003c/code\u003e, it's return \u003cstrong\u003e15880256\u003c/strong\u003e rows\u003c/em\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003emysql\u0026gt; select count(1) from test.employee_by_range;\n+----------+\n| count(1) |\n+----------+\n| 15880256 |\n+----------+\n1 row in set (4.80 sec)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cem\u003ewhen am i trying to get rows using \u003ccode\u003eEXPLAIN\u003c/code\u003e it's return \u003cstrong\u003e27912636\u003c/strong\u003e rows\u003c/em\u003e \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003emysql\u0026gt; explain select emp_id from test.employee_by_range;\n+----+-------------+-------------------+------+---------------+------+---------+------+----------+-------+\n| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |\n+----+-------------+-------------------+------+---------------+------+---------+------+----------+-------+\n| 1 | SIMPLE | employee_by_range | ALL | NULL | NULL | NULL | NULL | 27912636 | NULL |\n+----+-------------+-------------------+------+---------------+------+---------+------+----------+-------+\n1 row in set (0.00 sec)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhy both row's count are different ? \u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2016-04-06 10:50:04.193 UTC","last_activity_date":"2016-04-06 10:58:28.83 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2153834","post_type_id":"1","score":"0","tags":"mysql|count|explain","view_count":"50"} {"id":"43614929","title":"Language detection always returns 1 result","body":"\u003cp\u003eI'm having troubles with getting Language Detection to work. According to the documentation on \u003ca href=\"https://westus.dev.cognitive.microsoft.com/docs/services/TextAnalytics.V2.0/operations/56f30ceeeda5650db055a3c7\" rel=\"nofollow noreferrer\" title=\"Microsoft\u0026#39;s website\"\u003eMicrosoft's website\u003c/a\u003e I should be able to get multiple languages when the service is not sure about which language the input string was. However, I am always receiving only one language. In my example below I used \"Hallo\" which is \"Hello\" in both German and Dutch. Also with other words like \"Bier\" which is \"Beer\" in German and Dutch, the service gives only one result, despite the numberOfLanguages Query parameter value of 5.\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eAm I missing something?\u003c/li\u003e\n\u003cli\u003eIs the service malfunctioning?\u003c/li\u003e\n\u003cli\u003eCan someone provide an example which delivers multiple languages as a result?\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eThank you for all your help.\u003c/p\u003e\n\n\u003cp\u003eRequest:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ePOST https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/languages?numberOfLanguagesToDetect=5 HTTP/1.1\nContent-Type: application/json\nHost: westus.api.cognitive.microsoft.com\nOcp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••\n\n{\n \"documents\": [\n {\n \"id\": \"Test\",\n \"text\": \"Hallo\"\n }\n ]\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWith this response:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTransfer-Encoding: chunked\nx-ms-transaction-count: 0\nx-aml-ta-request-id: 4bb2e01e-59a1-4f66-bb31-8ca2c32d262b\nX-Content-Type-Options: nosniff\napim-request-id: 65a8d5f5-1394-43cf-89e1-83d7188cb81a\nStrict-Transport-Security: max-age=31536000; includeSubDomains; preload\nDate: Tue, 25 Apr 2017 15:18:34 GMT\nContent-Type: application/json; charset=utf-8\n\n{\n \"documents\": [\n {\n \"id\": \"Test\",\n \"detectedLanguages\": [\n {\n \"name\": \"German\",\n \"iso6391Name\": \"de\",\n \"score\": 1.0\n }\n ]\n }\n ],\n \"errors\": []\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"1","creation_date":"2017-04-25 15:26:51.773 UTC","last_activity_date":"2017-09-17 06:59:04.66 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1614580","post_type_id":"1","score":"1","tags":"microsoft-cognitive","view_count":"45"} {"id":"32872112","title":"cakephp 3 controller action -\u003e how to make it smart","body":"\u003cp\u003eI implementet a controller action in the maybe most unelegant way. How could this made better? Table classes are just like after \u003ccode\u003ebin/cake bake\u003c/code\u003e. I think the part where the Entity is created could be simplyfied very much. \u003c/p\u003e\n\n\u003cp\u003eWhat I'm doing:\nBooks \u003cem\u003e--belongsTo--\u003e\u003c/em\u003e Publishers \u003cem\u003e\u0026lt;--habtm--\u003e\u003c/em\u003e Publishernumbers\nWhen adding a Book to the database, the publishernumber is extracted from the ISBN number. This number is then linked to the publisher in a habtm relation. I need this to suggest the user some publishers when typing an isbn in the form.\u003c/p\u003e\n\n\u003cp\u003eThe code works for now, but in a year, only god will know what I did here. The first part is straightforward.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic function add()\n{\n $book = $this-\u0026gt;Books-\u0026gt;newEntity();\n $associations = ['associated' =\u0026gt;\n [ \n 'Tags',\n 'Publishers',\n 'Publishers.Publishernumbers'\n ]\n ];\n if ($this-\u0026gt;request-\u0026gt;is('post')) {\n $data= $this-\u0026gt;request-\u0026gt;data;\n\n\n $publisher = $this-\u0026gt;Books-\u0026gt;Publishers-\u0026gt;get(\n $this-\u0026gt;request-\u0026gt;data['publisher_id'], \n ['contain' =\u0026gt; ['Publishernumbers']]\n );\n unset($data['publisher_id']);\n\n $book-\u0026gt;publisher = $publisher;\n\n //extract group- and publishernumber from the ISBN\n $this-\u0026gt;loadComponent('Isbn.Isbn');\n $split = $this-\u0026gt;Isbn-\u0026gt;splitIsbn($this-\u0026gt;request-\u0026gt;data['isbn']);\n $publishernumber = $split[1].$split[2];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is the part where the mess begins. I think this could be done way more elegant.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e //check if the publisher contains already the $publishernumber\n //and if not, add it to the entity\n $new = true;\n foreach ($book-\u0026gt;publisher-\u0026gt;publishernumbers as $n){\n if ($n-\u0026gt;number == $publishernumber){\n $new = false;\n }\n }\n if ($new){\n $existingNumber = $this-\u0026gt;Books-\u0026gt;Publishers-\u0026gt;Publishernumbers\n -\u0026gt;findByNumber($publishernumber)\n -\u0026gt;first();\n if (!$existingNumber){\n\n //publishernumber does not exist in the database\n $pubnumber = $this-\u0026gt;Books-\u0026gt;Publishers-\u0026gt;Publishernumbers\n -\u0026gt;newEntity();\n $pubnumber = $this-\u0026gt;Books-\u0026gt;Publishers-\u0026gt;Publishernumbers\n -\u0026gt;patchEntity($pubnumber, ['number' =\u0026gt; $publishernumber]);\n $book-\u0026gt;publisher-\u0026gt;publishernumbers[] = $pubnumber;\n\n } else {\n\n //publishernumber exists in the database \n //but is not associated with the publisher\n $book-\u0026gt;publisher-\u0026gt;publishernumbers[] = $existingNumber;\n }\n $book-\u0026gt;publisher-\u0026gt;dirty('publishernumbers', true);\n }\n\n\n $book = $this-\u0026gt;Books-\u0026gt;patchEntity($book, $data, $associations);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSaving \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e if ($this-\u0026gt;Books-\u0026gt;save($book, $associations)){\n Cache::delete('exlibrisBooksIndex');\n $this-\u0026gt;Flash-\u0026gt;success(__('The book has been saved.'));\n return $this-\u0026gt;redirect(['action' =\u0026gt; 'index']);\n } else {\n $this-\u0026gt;Flash-\u0026gt;error(__('Error.'));\n }\n}\n$publishers = $this-\u0026gt;Books-\u0026gt;Publishers-\u0026gt;find('list')\n -\u0026gt;order('name')\n -\u0026gt;toArray();\n$this-\u0026gt;set(compact('book', 'publishers'));\n$this-\u0026gt;set('_serialize', ['book']);\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"3","creation_date":"2015-09-30 17:18:32.177 UTC","last_activity_date":"2015-09-30 17:18:32.177 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4953043","post_type_id":"1","score":"1","tags":"cakephp|cakephp-3.0|cakephp-3.1","view_count":"76"} {"id":"21768993","title":"Cocoa Webview no longer plays Java applets in OS X 10.9 with latest Oracle plugin","body":"\u003cp\u003eI have a 64-bit Cocoa Webview application that used to play Java applets using the Oracle Java plugin under OS X 10.7.3 - 10.9. At some point this stopped working, presumably with one of the updates to Webkit or the Oracle plugin. I am running the latest version of the OS, the plugin, and Xcode, with all updates. Everything is enabled (Java, plugins, etc.) for the Webview.\u003c/p\u003e\n\n\u003cp\u003eWhat happens now is that there is only blank space where an applet should appear, and there are no prompts or errors of any kind. I am testing with applets at the Oracle Java website and at javatester.org. I have tried a separate bare-bones Cocoa Webview app and it exhibits the same problem. This occurs regardless of server, applet, or plugin settings in System Preferences.\u003c/p\u003e\n\n\u003cp\u003eI am aware of the recent increased security issues with Java. I am able to get both Safari and Firefox to use the Oracle Java plugin on my system, but only if the browser preferences and the Oracle plugin preferences are managed properly.\u003c/p\u003e\n\n\u003cp\u003eFor example, if I set Firefox to \"always activate\" Java applets, I still have to enable Java for browsers in the plugin preferences AND add the necessary servers to the whitelist there. Safari lets you maintain the whitelist entirely within Safari if you want, but still requires the plugin preferences to be set to enable Java for browsers. This is all inconvenient, but at least it is understandable and workable.\u003c/p\u003e\n\n\u003cp\u003eInterestingly, if the plugin preferences are NOT set to enable Java for browsers, then both Safari and Firefox act just like my own app, displaying only blank space for the applet with no prompts or errors. This would seem to indicate that the plugin is somehow being prevented from loading in a standard Cocoa Webview.\u003c/p\u003e\n\n\u003cp\u003eFirefox is not Webkit-based, but Safari is. My guess is that either Safari handles all its own Java plugin interaction and Webkit no longer supports it, or there is some Webkit-specific configuration that must be performed which I can find no reference to. I can't try Chrome because it isn't 64-bit, which the Oracle plugin requires. I can't find any other 64-bit Cocoa Webview apps that will play applets with the latest Oracle plugin either.\u003c/p\u003e\n\n\u003cp\u003eAnybody have any ideas on how to get this working, or on why it doesn't? Anybody know of a 64-bit Cocoa Webview app other than Safari that will play Java applets using the latest OS X and Oracle plugin?\u003c/p\u003e","answer_count":"0","comment_count":"1","creation_date":"2014-02-14 01:07:39.59 UTC","favorite_count":"2","last_activity_date":"2014-02-14 01:07:39.59 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1382547","post_type_id":"1","score":"3","tags":"java|cocoa|applet|webkit|64bit","view_count":"273"} {"id":"24169056","title":"Why are variadic non-type templates not allowed as function arguments?","body":"\u003cpre\u003e\u003ccode\u003eint max(int n, int ... rest)\n{\n //Do stuff\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhy is something like this not allowed? If you want to create a function that accepts variadic function arguments, you are forced to use templates and typenames. However, even if you know that you will only accept arguments of a certain type (int in this case), why does C++ force you to do\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etemplate \u0026lt;typename ... N\u0026gt;\nint max(int n, N ... rest)\n{\n //Do stuff\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"8","creation_date":"2014-06-11 17:28:55.52 UTC","last_activity_date":"2014-06-12 11:00:04.423 UTC","last_edit_date":"2014-06-12 11:00:04.423 UTC","last_editor_display_name":"","last_editor_user_id":"3043539","owner_display_name":"","owner_user_id":"2612743","post_type_id":"1","score":"2","tags":"c++|templates|variadic-templates|variadic-functions|variadic","view_count":"84"} {"id":"40497610","title":"Remove data from arraylist of Objects","body":"\u003cp\u003eSo I have a program that is meant to store employee records such as ID#, name, start date, etc. When the user enter's an employee ID number and presses the remove button the arraylist should be searched and if that employee ID exists in the arraylist all of that employee's data should be deleted from the arraylist. I am able to add and display all of the data fine but I can't figure out how to search the arraylist for the ID number and then delete all of that employee's data. Any help with this would be appreciated. I have attached my code so far for the remove button, as well as some other code to show how the data is stored. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class EmployeeRecords extends javax.swing.JFrame {\nArrayList \u0026lt;employees\u0026gt; employees = new ArrayList \u0026lt;employees\u0026gt;();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e...\u003c/p\u003e\n\n\u003cp\u003eRemove button code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprivate void removeButtonActionPerformed(java.awt.event.ActionEvent evt) { \n int index;\n String id = idInput.getText();\n boolean idCheck = employees.contains(id);\n\n if (idCheck = true){\n index = employees.indexOf(id);\n employees.remove(index);\n }\n else {\n errorLabel.setText(\"Employee not found. Please try again.\");\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAdd button code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprivate void addButtonActionPerformed(java.awt.event.ActionEvent evt) { \n employees e;\n String id, firstName, lastName, salary, startDate;\n\n id = idInput.getText();\n firstName = firstInput.getText();\n lastName = lastInput.getText();\n salary = salaryInput.getText();\n startDate = dateInput.getText();\n\n e = new employees(id, firstName, lastName, salary, startDate);\n employees.add(e);\n} \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eEmployee Class:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass employees {\nString id, firstName, lastName, salary, startDate;\n\nemployees (String _id, String _firstName, String _lastName, String _salary, String _startDate) {\n id = _id;\n firstName = _firstName;\n lastName = _lastName;\n salary = _salary;\n startDate = _startDate;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e}\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2016-11-08 22:36:11.03 UTC","last_activity_date":"2016-11-09 00:17:57.553 UTC","last_edit_date":"2016-11-08 23:33:26.083 UTC","last_editor_display_name":"","last_editor_user_id":"6922789","owner_display_name":"","owner_user_id":"6922789","post_type_id":"1","score":"-2","tags":"java|database|arraylist","view_count":"132"} {"id":"16841844","title":"Unable to get correct data from canvas getImageData","body":"\u003cp\u003eThis is in continuation to question \u003ca href=\"https://stackoverflow.com/questions/16779437/how-to-get-pixel-data-from-canvas-which-contains-the-screenshot-generated-by-a-c/16783347\"\u003eHow to get pixel data from canvas which contains the screenshot generated by a chrome extension?\u003c/a\u003e and the source code is available here \u003ca href=\"https://github.com/whizzzkid/ColorHelper-Chrome/\" rel=\"nofollow noreferrer\"\u003ehttps://github.com/whizzzkid/ColorHelper-Chrome/\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eThe issue I am facing here is, the color I was expecting it to output is not correct and seems to be rather random values. Any help on this will be appreciated.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eactive = false; \nimgData = canvas = canvasContext = pixelData = \"\";\nchrome.extension.onMessage.addListener(function(request, sender, sendResponse) {\n if(request.action == 'toggle'){\n if(active){\n active = false;\n $('#colorInfoContainer').remove();\n console.log(active);\n }else{\n active = true;\n $('body').prepend(\"\u0026lt;div id=\\\"colorInfoContainer\\\" style=\\\"color: #000; text-align: center; top:0; width: 200px; position: fixed; left: 60%; margin-left: -100px; height: 15px; margin-top: -5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; background: #fff; padding: 5px 5px 5px; font: bold 14px Arial; border: 3px solid; z-index: 999999999999;\\\"\u0026gt;\u0026lt;div id=\\\"colorInfo\\\" style=\\\"display: block;\\\"\u0026gt;Color Info\u0026lt;/div\u0026gt;\u0026lt;/div\u0026gt;\");\n console.log(active);\n fill_canvas();\n }\n }\n});\n\nfunction fill_canvas(){\n if(active){\n chrome.extension.sendMessage({action: 'capture'}, function(response) {\n canvas = document.createElement('canvas');\n canvas.width= document.documentElement.clientWidth;\n canvas.height= document.documentElement.clientHeight;\n canvasContext = canvas.getContext('2d');\n var img = new Image();\n img.onload = function(){\n canvasContext.drawImage(img, 0, 0);\n } \n img.src = response.imageUrl;\n console.log(img.src);\n });\n }\n}\n\nfunction getPosition(element) {\n var xPosition = 0;\n var yPosition = 0;\n\n while(element) {\n xPosition += (element.offsetLeft - element.scrollLeft + element.clientLeft);\n yPosition += (element.offsetTop - element.scrollTop + element.clientTop);\n element = element.offsetParent;\n }\n return { x: xPosition, y: yPosition };\n}\n\n$(document).ready(function(){\n setInterval(fill_canvas,1000);\n $(window).mousemove(function(e) {\n if(active){\n //cache the position of canvas:\n var canvasPos = getPosition(canvas),\n dx = canvasPos.x,\n dy = canvasPos.y;\n //getting the correct color from pixels\n var x = e.clientX - dx,\n y = e.clientY - dy;\n //force x and y to stay within canvas:\n x = (x \u0026lt; 0) ? 0 : (x \u0026gt; canvas.width - 1) ? canvas.width - 1 : x;\n y = (y \u0026lt; 0) ? 0 : (y \u0026gt; canvas.height - 1) ? canvas.height - 1 : y;\n pixelData = canvasContext.getImageData(x, y, 1, 1).data;\n //console.log(canvasContext);\n //pixelData = canvasContext.getImageData(e.clientX,e.clientY, 1, 1).data;\n //console.log(x+','+y);\n console.log(pixelData);\n $('#colorInfoContainer').css('background-color','rgba('+pixelData[0]+', '+pixelData[1]+', '+pixelData[2]+', '+pixelData[3]+')')\n }\n });\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebackground.js\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003echrome.browserAction.onClicked.addListener(function(tab) {\n console.log('button clicked');\n chrome.tabs.sendMessage(tab.id, { action: 'toggle' });\n});\n\nchrome.extension.onMessage.addListener(function(request, sender, sendResponse) {\n if (request.action == 'capture') {\n chrome.tabs.captureVisibleTab(null, { 'format':'png' }, function(dataUrl) {\n sendResponse({ imageUrl: dataUrl });\n });\n }\n return true;\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe code mentioned above creates a div which should be of the same color as of the one under the mouse.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eEDITS: updated according to updates from @Ken - Abdias Software. But still fails. help needed!\u003c/strong\u003e\nCheers!\u003c/p\u003e","answer_count":"0","comment_count":"5","creation_date":"2013-05-30 16:54:34.327 UTC","last_activity_date":"2013-06-01 18:50:19.85 UTC","last_edit_date":"2017-05-23 11:43:15.797 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"1114922","post_type_id":"1","score":"0","tags":"javascript|html5|canvas|google-chrome-extension|html5-canvas","view_count":"310"} {"id":"3868223","title":"Null Issue with NeighboringCellInfo, CID and LAC","body":"\u003cp\u003eFor a while I was trying to get CellID and LAC of near base stations. Unfortunately I did not manage to do that. First option was to use:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eGsmCellLocation xXx = new GsmCellLocation(); \n CID = xXx.getCid(); \n LAC = xXx.getLac(); \n Toast output = Toast.makeText(getApplicationContext(), \"Base station LAC is \"+LAC+\"\\n\" \n +\"Base station CID is \" +CID, Toast.LENGTH_SHORT); \n output.show();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut in this case I receive -1 value (as I understand that means it is not a GSM, but when i check with isGSM it shows \"true\").\nAnother way I have found surfing the net (i updated it a bit)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic void GetID(){ \n List\u0026lt;NeighboringCellInfo\u0026gt; neighCell = null; \n TelephonyManager telManager = ( TelephonyManager )getSystemService(Context.TELEPHONY_SERVICE); \n neighCell = telManager.getNeighboringCellInfo(); \n for (int i = 0; i \u0026lt; neighCell.size(); i++) { \n try { \n NeighboringCellInfo thisCell = neighCell.get(i); \n int thisNeighCID = thisCell.getCid(); \n int thisNeighRSSI = thisCell.getRssi(); \n log(\" \"+thisNeighCID+\" - \"+thisNeighRSSI); \n } catch (NumberFormatException e) { \n e.printStackTrace();\n NeighboringCellInfo thisCell = neighCell.get(i); \n log(neighCell.toString()); \n } \n} \n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut in this case the application just crashes right after I press the execute button. Eclipse shows no errors. May be someone have any ideas how to fix my problems?\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eLogcat says: 10-05 22:53:27.923: ERROR/dalvikvm(231): Unable to open\n stack trace file '/data/anr/traces.txt': Permission denied\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eUsed permissions:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;uses-permission android:name=\"android.permission.READ_PHONE_STATE\" /\u0026gt;\n\u0026lt;uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\" /\u0026gt;\n\u0026lt;uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" /\u0026gt;\n\u0026lt;uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" /\u0026gt;\n\u0026lt;uses-permission android:name=\"android.permission.SEND_SMS\"\u0026gt;\u0026lt;/uses-permission\u0026gt;\n\u0026lt;uses-permission android:name=\"android.permission.RECEIVE_SMS\"\u0026gt;\u0026lt;/uses-permission\u0026gt;\n\u0026lt;uses-permission android:name=\"android.permission.ACCESS_COARSE_UPDATES\" /\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMay be the problem is that i forgot to include:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTelephonyManager telManager = ( TelephonyManager )getSystemService(Context.TELEPHONY_SERVICE);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eUpdate. I included row from above, crash is gone but now after I press the button nothing happens.\nUpdated source code.\u003c/p\u003e","accepted_answer_id":"3870117","answer_count":"3","comment_count":"4","creation_date":"2010-10-05 22:24:19.74 UTC","favorite_count":"1","last_activity_date":"2015-03-31 18:07:37.28 UTC","last_edit_date":"2013-08-13 12:07:43.357 UTC","last_editor_display_name":"","last_editor_user_id":"1003917","owner_display_name":"","owner_user_id":"458024","post_type_id":"1","score":"4","tags":"java|android","view_count":"8904"} {"id":"46313038","title":"How to restrict locale changing to some components within the android app?","body":"\u003cp\u003eThe app I am creating supports two language-English and Hindi.The app has many features related to google map.There is one feature which shows the current users around you based on your current location in google map.I am fetching user current location latitude,longitude and localityName and storing that in mysql server.So when user requests for the map view mentioned above my API endpoint returns all the users whose last known locality name is LIKE the location column's value in the DB.App is working fine for english language but for hindi, when fetching user's location it's returning the locality name in Hindi due to which ASCII characters are getting stored in the DB which PHP is not able to use LIKE operator to give the results. How to resolve this?\u003c/p\u003e\n\n\u003cp\u003eMy code to get location of the user-\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic void setLocation(){\n service = (LocationManager) getActivity().getSystemService(LOCATION_SERVICE);\n boolean enabled = service.isProviderEnabled(LocationManager.GPS_PROVIDER);\n if (!enabled) {\n Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);\n startActivity(intent);\n }\n Criteria criteria = new Criteria();\n provider = service.getBestProvider(criteria, false);\n try {\n Location location = service.getLastKnownLocation(provider);\n Geocoder gcd;\n List\u0026lt;Address\u0026gt; addresses;\n String address=\"\";\n if (location != null) {\n System.out.println(\"Provider \" + provider + \" has been selected.\");\n onLocationChanged(location);\n gcd = new Geocoder(getActivity(), Locale.getDefault());\n addresses = gcd.getFromLocation(location.getLatitude(),location.getLongitude(), 1);\n new SharedPrefManager(getActivity()).setlatitude((float)location.getLatitude());\n new SharedPrefManager(getActivity()).setLongitude((float)location.getLongitude());\n LatLng myLocation = new LatLng(location.getLatitude(), location.getLongitude());\n if(this.googleMap !=null){\n this.googleMap.addMarker(new MarkerOptions().position(myLocation).title(\"Your current Location\").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));\n this.googleMap.moveCamera(CameraUpdateFactory.newLatLng(myLocation));\n }\n\n } else {\n Toast.makeText(getActivity(),\"Location not Available\", Toast.LENGTH_SHORT).show();\n return;\n }\n if (addresses.size() \u0026gt; 0)\n address=addresses.get(0).getSubLocality()+\", \"+addresses.get(0).getLocality();\n\n new SharedPrefManager(getActivity()).setLocation(addresses.get(0).getLocality());\n locationText.setText(address);\n if(!getArguments().getBoolean(\"guest\"))\n setLocationToServer((float)location.getLatitude(),(float)location.getLongitude(),addresses.get(0).getLocality(),new Gson().fromJson(new SharedPrefManager(getActivity()).getDriverProfile(), DriverProfile.class).getUser_id());\n\n if(!getArguments().getBoolean(\"guest\"))\n getActivity().startService(new Intent(getActivity(),LocationService.class));\n\n }catch (SecurityException e){\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n } \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003evalue stored in MySQL DB \n\u003ca href=\"https://i.stack.imgur.com/Oowi4.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/Oowi4.png\" alt=\"value stored in MySQL DB\"\u003e\u003c/a\u003e\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-09-20 03:56:33.793 UTC","last_activity_date":"2017-09-20 03:56:33.793 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4728835","post_type_id":"1","score":"0","tags":"php|android|mysql|google-maps","view_count":"33"} {"id":"46135226","title":"SFML fps problems with window event polling","body":"\u003cp\u003eI've started messing around with C++ and SFML 2.4 and liking it so far but I have run into a frustrating performance issue with even trying to move a simple white rectangle around the screen. Moving the sprite around is very jittery and \"unplayable\" even when using the delta time. It seems to be caused by polling for window events. When removed, everything is smooth as butter but events cannot be read (of course). Is there a problem with what I'm doing or anything that I can do to fix this?\u003c/p\u003e\n\n\u003cp\u003eMinimal example:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#include \u0026lt;SFML/Graphics.hpp\u0026gt;\n\nint main(){\n sf::RenderWindow window(sf::VideoMode(500, 500), \"Testing\");\n\n sf::Image pixelBuffer;\n pixelBuffer.create(100, 100, sf::Color::White);\n sf::Texture pixelTexture;\n pixelTexture.loadFromImage(pixelBuffer);\n sf::Sprite pixelSprite;\n pixelSprite.setTexture(pixelTexture);\n\n sf::Clock clock;\n while(window.isOpen()){\n //Poll for events\n sf::Event event;\n while(window.pollEvent(event)){\n if(event.type == sf::Event::Closed){\n window.close();\n }\n }\n //Update the sprite\n float delta = clock.restart().asSeconds();\n pixelSprite.move(sf::Vector2f(50, 50) * delta);\n //Draw the sprite\n window.clear(sf::Color::Black);\n window.draw(pixelSprite);\n window.display();\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks!\u003c/p\u003e","accepted_answer_id":"46138282","answer_count":"1","comment_count":"9","creation_date":"2017-09-09 21:21:36.79 UTC","last_activity_date":"2017-09-10 07:23:05.713 UTC","last_edit_date":"2017-09-09 22:46:32.183 UTC","last_editor_display_name":"","last_editor_user_id":"7831628","owner_display_name":"","owner_user_id":"7831628","post_type_id":"1","score":"0","tags":"c++|sfml","view_count":"53"} {"id":"45763061","title":"Error building Ionic app: Failed to execute aapt (CordovaLib:processDebugResources)","body":"\u003cp\u003eI'm trying to use Ionic framework to build hybrid mobile apps but I'm facing the following problem since a few days.\u003c/p\u003e\n\n\u003cp\u003eWhen I want to build the application (which is actually a blank project), the command \"\u003cstrong\u003eionic cordova build android\u003c/strong\u003e\" returns this error (detailed logs below) when executing CordovaLib:processDebugResources task:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e/home/pi/android-sdk/build-tools/23.0.1/aapt: Syntax error: newline unexpected (expecting \")\")\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eI tried to reinstall many times Android SDK. I also tried differents versions of Android tools/platforms (23, 26) but it did nothing.\u003c/p\u003e\n\n\u003cp\u003eI didn't find on the web any solution to solve this problem.\nSo, if someone has an idea or already faced this problem and solved it, do not hesitate ;-)\u003c/p\u003e\n\n\u003cp\u003eThank you for your help.\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003e\u003cp\u003eDetailled logs when building the app:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e:CordovaLib:generateDebugBuildConfig UP-TO-DATE\n:CordovaLib:processDebugResources/home/pi/android-sdk/build-tools/23.0.1/aapt: 2:\n/home/pi/android-sdk/build-tools/23.0.1/aapt: Syntax error: newline unexpected (expecting \")\")\n\n FAILED\n\nFAILURE: Build failed with an exception.\n\n* What went wrong:\nExecution failed for task ':CordovaLib:processDebugResources'.\n\u0026gt; com.android.ide.common.process.ProcessException: Failed to execute aapt\n\n* Try:\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\n\nBUILD FAILED\n\nTotal time: 55.363 secs\nError: /home/pi/IonicPJ/platforms/android/gradlew: Command failed with exit code 1 Error output:\nPicked up _JAVA_OPTIONS: -Xmx256M\n/home/pi/android-sdk/build-tools/23.0.1/aapt: 2: /home/pi/android-sdk/build-tools/23.0.1/aapt: Syntax error:\nnewline unexpected (expecting \")\")\n\n\nFAILURE: Build failed with an exception.\n\n* What went wrong:\nExecution failed for task ':CordovaLib:processDebugResources'.\n\u0026gt; com.android.ide.common.process.ProcessException: Failed to execute aapt\n\u003c/code\u003e\u003c/pre\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eYou will find below different element concerning the components installed.\u003c/p\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003e\u003ccode\u003eIonic 3.8.1\nCordova 7.0.1\nGradle 4.1\nJAVA 8\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eI set the variables $JAVA_HOME, $ANDROID_HOME\nand added $ANDROID_HOME/tools and $ANDROID_HOME/platform-tools to $PATH variable\u003c/p\u003e\n\n\u003cp\u003eThis is the packages I installed via Android SDKManager:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Installed packages:\n Path | Version | Description | Location\n ------- | ------- | ------- | -------\n build-tools;23.0.1 | 23.0.1 | Android SDK Build-Tools 23.0.1 | build-tools/23.0.1/\n emulator | 26.1.3 | Android Emulator | emulator/\n extras;android;m2repository | 47.0.0 | Android Support Repository | extras/android/m2repository/\n extras;google;m2repository | 57 | Google Repository | extras/google/m2repository/\n patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/\n platform-tools | 26.0.0 | Android SDK Platform-Tools | platform-tools/\n platforms;android-23 | 3 | Android SDK Platform 23 | platforms/android-23/\n platforms;android-25 | 3 | Android SDK Platform 25 | platforms/android-25/\n tools | 26.0.2 | Android SDK Tools | tools/\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I run \"\u003cstrong\u003eionic cordova platform ls\u003c/strong\u003e\", I have:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003eInstalled platforms:\n android 6.2.3\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eAnd everything is running on a raspberry with Raspbian Jessie:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003eLinux raspberrypi 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux\u003c/code\u003e\u003c/p\u003e","answer_count":"0","comment_count":"1","creation_date":"2017-08-18 18:36:47.253 UTC","last_activity_date":"2017-08-18 18:36:47.253 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8485246","post_type_id":"1","score":"4","tags":"android|linux|cordova|gradle|ionic-framework","view_count":"701"} {"id":"5137229","title":"How to style a DIV's 2nd UL only","body":"\u003cp\u003eI am trying to get \u003ca href=\"http://cssdesk.com/bQTEf\" rel=\"nofollow\"\u003ehttp://cssdesk.com/bQTEf\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eto look like \u003ca href=\"http://i.stack.imgur.com/jhtEh.png\" rel=\"nofollow\"\u003ehttp://i.stack.imgur.com/jhtEh.png\u003c/a\u003e\u003c/p\u003e","accepted_answer_id":"5137245","answer_count":"1","comment_count":"3","creation_date":"2011-02-28 00:54:21.357 UTC","last_activity_date":"2011-02-28 12:49:14.283 UTC","last_edit_date":"2011-02-28 01:21:28.317 UTC","last_editor_display_name":"","last_editor_user_id":"636993","owner_display_name":"","owner_user_id":"636993","post_type_id":"1","score":"2","tags":"html|css|css3|selector","view_count":"92"} {"id":"7216755","title":"What is the meaning of \"from distinct vertex chains\" in this nearest neighbor algorithm?","body":"\u003cp\u003eThe following pseudo-code is from the first chapter of an online preview version of \u003cem\u003eThe Algorithm Design Manual\u003c/em\u003e (page 7 from \u003ca href=\"http://www.cs.sysu.edu.cn/~lxm/DSA/textbook/Skiena.-.TheAlgorithmDesignManual.pdf\"\u003ethis PDF\u003c/a\u003e).\u003c/p\u003e\n\n\u003cp\u003eThe example is of a flawed algorithm, but I still really want to understand it:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e[...] A different idea might be to repeatedly connect the closest pair of\n endpoints whose connection will not create a problem, such as\n premature termination of the cycle. Each vertex begins as its own\n single vertex chain. After merging everything together, we will end up\n with a single chain containing all the points in it. Connecting the\n final two endpoints gives us a cycle. At any step during the execution\n of this closest-pair heuristic, we will have a set of single vertices\n and vertex-disjoint chains available to merge. In pseudocode:\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cpre\u003e\u003ccode\u003eClosestPair(P)\n Let n be the number of points in set P.\n For i = 1 to n − 1 do\n d = ∞\n For each pair of endpoints (s, t) from distinct vertex chains\n if dist(s, t) ≤ d then sm = s, tm = t, and d = dist(s, t)\n Connect (sm, tm) by an edge\n Connect the two endpoints by an edge\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ePlease note that \u003ccode\u003esm\u003c/code\u003e and \u003ccode\u003etm\u003c/code\u003e should be \u003ccode\u003es\u003c/code\u003e\u003csub\u003e\u003ccode\u003em\u003c/code\u003e\u003c/sub\u003e and \u003ccode\u003et\u003c/code\u003e\u003csub\u003e\u003ccode\u003em\u003c/code\u003e\u003c/sub\u003e.\u003c/p\u003e\n\n\u003cp\u003eFirst of all, I don't understand what \"from distinct vertex chains\" would mean. Second, \u003ccode\u003ei\u003c/code\u003e is used as a counter in the outer loop, but \u003ccode\u003ei\u003c/code\u003e itself is never actually used anywhere! Could someone smarter than me please explain what's really going on here?\u003c/p\u003e","accepted_answer_id":"7216814","answer_count":"3","comment_count":"1","creation_date":"2011-08-27 19:14:45.103 UTC","favorite_count":"4","last_activity_date":"2015-04-20 20:49:27.08 UTC","last_edit_date":"2011-11-27 03:08:01.697 UTC","last_editor_display_name":"","last_editor_user_id":"468904","owner_display_name":"","owner_user_id":"527623","post_type_id":"1","score":"24","tags":"algorithm|graph-theory|pseudocode|nearest-neighbor","view_count":"2916"} {"id":"46287360","title":"Apache: ServerName, DocumentRoot and Directory on main config file and VirtualHosts files","body":"\u003cp\u003eYou might help me on these three questions. \u003c/p\u003e\n\n\u003cp\u003e1) Can I remove, i mean is it a good practice \u003cstrong\u003eremove DocumentRoot and Directory directives from Apache main configuration file\u003c/strong\u003e when it is set per virtual host configuration file? \u003c/p\u003e\n\n\u003cp\u003e2) I have the ServerName directive configured per virtual host, should I also set the ServerName on apache main configuration file? If so, \u003cstrong\u003eshould it be the same as the host machine meaning the hostname not the FQDN\u003c/strong\u003e as I have some VirtualHosts on that host? \u003c/p\u003e\n\n\u003cp\u003e3) How exactly apache choose to serve one VirtualHost over another? On my current scenario \u003cstrong\u003ewhen I try to access a virtual host when it is down\u003c/strong\u003e (configuration not loaded) \u003cstrong\u003eit is automatically redirected to the other\u003c/strong\u003e VirtualHost DocumentRoot. \u003cstrong\u003eSame happens\u003c/strong\u003e where both virtual hosts are loaded but I access using the IP instead of virtual host name. \u003c/p\u003e\n\n\u003cp\u003eMain configuration file: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eListen [host machine IP]:80\n\nServerName [host machine IP]:80\n\u0026lt;Directory /\u0026gt;\n AllowOverride none\n Require all denied\n\u0026lt;/Directory\u0026gt;\n\nDocumentRoot \"/var/www\"\n\n\u0026lt;Directory \"/var/www/html/\"\u0026gt;\n Options Indexes FollowSymLinks\n AllowOverride None\n Require all granted\n\u0026lt;/Directory\u0026gt;\n.\n.\n.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eFirst VirtualHost: mydomain.com \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;VirtualHost *:80\u0026gt; \n ServerName mydomain.com\n ServerAlias www.mydomain.com\n DocumentRoot \"/var/www/mydomain.com/html\"\n ServerAdmin adm@rmydomain.net\n ErrorLog \"/var/log/httpd/mydomain.com.log\"\n CustomLog \"/var/log/httpd/mydomain.com\" combined\n\n\u0026lt;Directory \"/var/www/mydomain.com/html/\"\u0026gt;\n DirectoryIndex index.php index.html\n Options FollowSymLinks\n AllowOverride All\n Require all granted\n\u0026lt;/Directory\u0026gt;\n\u0026lt;/VirtualHost\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSecond VirtualHost: mydomain**.net**\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;VirtualHost *:80\u0026gt;\n DocumentRoot \"/var/www/mydomain.net/html\"\n ServerName mydomain.net\n ServerAlias www.mydomain.net\n\n ServerAdmin adm@mydomain.net\n ErrorLog \"/var/log/httpd/mydomain.net_error.log\"\n CustomLog \"/var/log/httpd/mydomain.net_access.log\" combined\n\n\u0026lt;Directory \"/var/www/mydomain.net/html/\"\u0026gt;\n AuthType Basic\n AuthName \"Protegido\"\n AuthUserFile /etc/httpd/conf/htpasswd\n Require valid-user\n DirectoryIndex index.php index.html\n Options FollowSymLinks\n AllowOverride All\n\n\u0026lt;/Directory\u0026gt;\nRewriteEngine on\nRewriteCond %{SERVER_NAME} =www.mydomain.net [OR]\nRewriteCond %{SERVER_NAME} =mydomain.net\nRewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]\n\u0026lt;/VirtualHost\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThank you. \u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-09-18 20:05:35.647 UTC","last_activity_date":"2017-09-18 20:05:35.647 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4037786","post_type_id":"1","score":"1","tags":"apache|virtual-hosts","view_count":"35"} {"id":"34687053","title":"nav drawer fragment item fill parent","body":"\u003cp\u003eI'm trying to get the fragments within the nav drawer to fill the screen (match_parent) i.e. user selects settings inside drawer, settings frag opens filling the screen. However with my current layout the parent (main) activity with test button remains on screen i.e. the fragment is not filling the screen only a portion. I'm pretty new to working with frags and nag drawer, i'm sure its simple, any help appreciated.\u003c/p\u003e\n\n\u003cp\u003eMy activity layout xml with fragment container:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"utf-8\"?\u0026gt;\n\u0026lt;android.support.v4.widget.DrawerLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:app=\"http://schemas.android.com/apk/res-auto\"\nxmlns:tools=\"http://schemas.android.com/tools\"\nandroid:id=\"@+id/drawer_layout\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"match_parent\"\u0026gt;\n\n\u0026lt;LinearLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:orientation=\"vertical\"\u0026gt;\n\n \u0026lt;LinearLayout\n android:id=\"@+id/container_toolbar\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:orientation=\"vertical\"\u0026gt;\n\n \u0026lt;include\n android:id=\"@+id/toolbar\"\n layout=\"@layout/toolbar\" /\u0026gt;\n\n \u0026lt;/LinearLayout\u0026gt;\n\n \u0026lt;LinearLayout\n android:id=\"@+id/container_body\"\n android:orientation=\"vertical\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:layout_weight=\"1\" \u0026gt;\n\n \u0026lt;RelativeLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\u0026gt;\n\n \u0026lt;Button\n android:id=\"@+id/btn_category\"\n android:layout_width=\"100dp\"\n android:layout_height=\"100dp\"\n android:layout_centerInParent=\"true\"\n android:text=\"Movies\"\n /\u0026gt;\n \u0026lt;/RelativeLayout\u0026gt;\n\n \u0026lt;/LinearLayout\u0026gt;\n\n\u0026lt;/LinearLayout\u0026gt;\n\n\u0026lt;fragment\n android:id=\"@+id/fragment_navigation_drawer\"\n android:name=\"com.app.fragments.MainDrawerFragment\"\n android:layout_width=\"@dimen/nav_drawer_width\"\n android:layout_height=\"match_parent\"\n android:layout_gravity=\"start\"\n app:layout=\"@layout/fragment_main_navigation_drawer\"\n tools:layout=\"@layout/fragment_main_navigation_drawer\" /\u0026gt;\n\n\u0026lt;/android.support.v4.widget.DrawerLayout\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"34687837","answer_count":"1","comment_count":"0","creation_date":"2016-01-08 22:17:19.2 UTC","last_activity_date":"2016-01-08 23:32:01.557 UTC","last_edit_date":"2016-01-08 22:23:09.413 UTC","last_editor_display_name":"","last_editor_user_id":"559745","owner_display_name":"","owner_user_id":"1781163","post_type_id":"1","score":"0","tags":"android|android-layout|navigation-drawer","view_count":"79"} {"id":"2476015","title":"How to force firefox to use custom CSS for anchor tags that contain \"#\" or \"javascript:\"?","body":"\u003cp\u003eTo set your own colors for anchor, I know we can do this in UserContent.css:\n a { color:green!important; background-color: white!important; font-size: 1.2em!important; }\u003c/p\u003e\n\n\u003cp\u003eBut how to set a specific color for the anchor tag that references the same page (the \"#\" is in the url). Or if \"javascript:\" is in the ural of the anchor tag?\u003c/p\u003e","accepted_answer_id":"2476043","answer_count":"2","comment_count":"0","creation_date":"2010-03-19 09:00:16.877 UTC","last_activity_date":"2010-03-19 09:10:16.187 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"274200","post_type_id":"1","score":"2","tags":"css|firefox","view_count":"602"} {"id":"23190784","title":"There was an error launching the application while executing .Desktop file in ubuntu","body":"\u003cp\u003eI have written a desktop script but when i try to execute the \u003ccode\u003e.desktop\u003c/code\u003e file as executable file then it's showing an error \u003ccode\u003eThere was an error launching the application\u003c/code\u003e. I think, i have written the desktop file in correct format.\u003c/p\u003e\n\n\u003cp\u003eHere is the .desktop script Client Activity Monitor.Desktop\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[Desktop Entry]\nType=Application\nName=Client Activity Monitor\nTerminal=true\nExec=/home/harsh/Server/server.sh\nIcon=/home/harsh/Server/Server-icon.png \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is server.sh script file\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#!/bin/bash\ncd Server\n./refersh_server\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003erefresh_server is executable file. \nThank You\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2014-04-21 04:24:28.017 UTC","last_activity_date":"2014-04-21 04:24:28.017 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1709824","post_type_id":"1","score":"0","tags":"bash|ubuntu-13.04","view_count":"1201"} {"id":"6675737","title":"how can i define a cookie global?","body":"\u003cp\u003ei defined a cookie in a page like check.php and set it.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003esetcookie(\"u\",\"blue\",time() + 3600);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003enow i want to check that if it is set or no in another page like index.php.\u003c/p\u003e\n\n\u003cp\u003ei sure that cookie is set in check.php but when i check that in index.php with this code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif( isset($_COOKIE[\"u\"] ) )\n {\n echo \"correct\";\n } \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eit doesn't worked!!and if doesn't run?\nwhat is problem?if cookies worked only in that page that it defined?\u003c/p\u003e\n\n\u003cp\u003eEdit:\u003c/p\u003e\n\n\u003cp\u003ei change it to \u003ccode\u003esetcookie(\"u\",\"blue\",time() + 3600,'/', 'www.example.vcn.ir');\u003c/code\u003e\nbut has same problem.\u003c/p\u003e","accepted_answer_id":"6675759","answer_count":"1","comment_count":"0","creation_date":"2011-07-13 07:52:50.483 UTC","favorite_count":"1","last_activity_date":"2011-07-13 08:11:02.847 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"578462","post_type_id":"1","score":"1","tags":"php|cookies","view_count":"8076"} {"id":"23892755","title":"Angular transcluding attributes","body":"\u003cp\u003eI'm looking to pass through most of the attributes on my directive, like so:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e\u0026lt;my-directive name='test' \n type='select'\n ng-required\n ng-options=\"v for (k,v) in types\" /\u0026gt;\n\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eWhere name and type are specific to the directive and everything else is passed through to the directive template:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e\u0026lt;div class='parent'\u0026gt;\u0026lt;input name=\"hello\" ng-transclude /\u0026gt;\u0026lt;/div\u0026gt;\u003c/code\u003e - the input should be given an ng-required and ng-options.\u003c/p\u003e\n\n\u003cp\u003eHow do I do this?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-05-27 14:59:38.28 UTC","last_activity_date":"2014-05-27 15:49:03.19 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"446857","post_type_id":"1","score":"0","tags":"angularjs|angularjs-directive","view_count":"38"} {"id":"15445628","title":"MySQL counting gender instances","body":"\u003cp\u003eI have the following MySQL query.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eUSE demo;\nSELECT \n loc.name,\n sum(case cr_sex when 'F' then 1 else 0 end) as 'F#', \n sum(case cr_sex when 'M' then 1 else 0 end) as 'M#'\nFROM case_report_main as cr \nJOIN location as loc on cr.cr_name = loc.name\nGROUP BY loc.name\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethis works the way I want to, it counts each occurrence of each gender and groups it by the location name. But when I try to join it with another table\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eUSE demo;\nSELECT \n loc.name,\n sum(case cr_sex when 'F' then 1 else 0 end) as 'F#', \n sum(case cr_sex when 'M' then 1 else 0 end) as 'M#'\nFROM case_report_main as cr \nJOIN location as loc on cr.cr_name=loc.name\nJOIN map_polygons as mp on mp.polygon_name=loc.name\nGROUP BY loc.name\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethe values get completely messed up, returning thousands instead of the expected tens and hundreds. \u003c/p\u003e\n\n\u003cp\u003eI \u003cstrong\u003ethink\u003c/strong\u003e I understand the problem, the additional table increases the number of rows. I am not sure how to fix this though or if this is actually the problem. \u003c/p\u003e","accepted_answer_id":"15445656","answer_count":"2","comment_count":"0","creation_date":"2013-03-16 04:36:46.26 UTC","favorite_count":"1","last_activity_date":"2013-03-16 05:13:13.473 UTC","last_edit_date":"2013-03-16 04:44:00.977 UTC","last_editor_display_name":"","last_editor_user_id":"491243","owner_display_name":"","owner_user_id":"1849239","post_type_id":"1","score":"2","tags":"mysql|sql|select|join","view_count":"497"} {"id":"28977970","title":"Class cannot be cast to android.view.View$OnClickListener","body":"\u003cp\u003eI've some problems trying to do G+ Signin. I think the G+ button isn't working.\u003c/p\u003e\n\n\u003cp\u003eI've tried to clean the project too.\u003c/p\u003e\n\n\u003cp\u003eIDE: Android Studio 1.1.0\nPlay Services: 6.5.87\u003c/p\u003e\n\n\u003cp\u003eThx.\u003c/p\u003e\n\n\u003cp\u003e--\u003c/p\u003e\n\n\u003cp\u003eLoginActivity:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e package com.nimbus.podchest;\n\nimport android.os.Bundle;\n\nimport android.support.v4.app.FragmentActivity;\nimport android.view.View;\n\nimport com.google.android.gms.common.ConnectionResult;\nimport com.google.android.gms.common.SignInButton;\nimport com.google.android.gms.common.api.GoogleApiClient;\nimport com.google.android.gms.plus.Plus;\n\n\npublic class LoginActivity extends FragmentActivity implements GoogleApiClient.ConnectionCallbacks,\n GoogleApiClient.OnConnectionFailedListener {\n\n private GoogleApiClient mGoogleApiClient;\n private SignInButton SignInButton;\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_login);\n\n // Create a GoogleApiClient instance\n mGoogleApiClient = new GoogleApiClient.Builder(this)\n .addApi(Plus.API)\n .addScope(Plus.SCOPE_PLUS_LOGIN)\n .addConnectionCallbacks(this)\n .addOnConnectionFailedListener(this)\n .build();\n\n SignInButton = (SignInButton) findViewById(R.id.sign_in_button);\n\n SignInButton.setOnClickListener((android.view.View.OnClickListener) this);\n }\n\n\n public void onClick(View view) {\n if (view.getId() == R.id.sign_in_button) {\n mGoogleApiClient.connect();\n }\n }\n\n @Override\n protected void onStart() {\n super.onStart();\n mGoogleApiClient.connect();\n }\n\n @Override\n protected void onStop() {\n mGoogleApiClient.disconnect();\n super.onStop();\n\n }\n\n @Override\n public void onConnected(Bundle connectionHint) {\n // Connected to Google Play services!\n // The good stuff goes here.\n }\n\n @Override\n public void onConnectionSuspended(int cause) {\n // The connection has been interrupted.\n // Disable any UI components that depend on Google APIs\n // until onConnected() is called.\n }\n\n @Override\n public void onConnectionFailed(ConnectionResult result) {\n // This callback is important for handling errors that\n // may occur while attempting to connect with Google.\n //\n // More about this in the next section.\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eLogcat:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e03-10 23:58:26.747 10123-10123/com.nimbus.podchest E/AndroidRuntime﹕ FATAL EXCEPTION: main\n Process: com.nimbus.podchest, PID: 10123\n java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nimbus.podchest/com.nimbus.podchest.LoginActivity}: java.lang.ClassCastException: com.nimbus.podchest.LoginActivity cannot be cast to android.view.View$OnClickListener\n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2314)\n at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)\n at android.app.ActivityThread.access$800(ActivityThread.java:148)\n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)\n at android.os.Handler.dispatchMessage(Handler.java:102)\n at android.os.Looper.loop(Looper.java:135)\n at android.app.ActivityThread.main(ActivityThread.java:5312)\n at java.lang.reflect.Method.invoke(Native Method)\n at java.lang.reflect.Method.invoke(Method.java:372)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)\n Caused by: java.lang.ClassCastException: com.nimbus.podchest.LoginActivity cannot be cast to android.view.View$OnClickListener\n at com.nimbus.podchest.LoginActivity.onCreate(LoginActivity.java:25)\n at android.app.Activity.performCreate(Activity.java:5953)\n at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1128)\n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)\n            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)\n            at android.app.ActivityThread.access$800(ActivityThread.java:148)\n            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)\n            at android.os.Handler.dispatchMessage(Handler.java:102)\n            at android.os.Looper.loop(Looper.java:135)\n            at android.app.ActivityThread.main(ActivityThread.java:5312)\n            at java.lang.reflect.Method.invoke(Native Method)\n            at java.lang.reflect.Method.invoke(Method.java:372)\n            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)\n            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)\n03-11 00:00:13.565 11822-11822/com.nimbus.podchest E/AndroidRuntime﹕ FATAL EXCEPTION: main\n Process: com.nimbus.podchest, PID: 11822\n java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nimbus.podchest/com.nimbus.podchest.LoginActivity}: java.lang.ClassCastException: com.nimbus.podchest.LoginActivity cannot be cast to android.view.View$OnClickListener\n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2314)\n at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)\n at android.app.ActivityThread.access$800(ActivityThread.java:148)\n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)\n at android.os.Handler.dispatchMessage(Handler.java:102)\n at android.os.Looper.loop(Looper.java:135)\n at android.app.ActivityThread.main(ActivityThread.java:5312)\n at java.lang.reflect.Method.invoke(Native Method)\n at java.lang.reflect.Method.invoke(Method.java:372)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)\n Caused by: java.lang.ClassCastException: com.nimbus.podchest.LoginActivity cannot be cast to android.view.View$OnClickListener\n at com.nimbus.podchest.LoginActivity.onCreate(LoginActivity.java:35)\n at android.app.Activity.performCreate(Activity.java:5953)\n at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1128)\n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)\n            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)\n            at android.app.ActivityThread.access$800(ActivityThread.java:148)\n            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)\n            at android.os.Handler.dispatchMessage(Handler.java:102)\n            at android.os.Looper.loop(Looper.java:135)\n            at android.app.ActivityThread.main(ActivityThread.java:5312)\n            at java.lang.reflect.Method.invoke(Native Method)\n            at java.lang.reflect.Method.invoke(Method.java:372)\n            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)\n            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/p\u003e","accepted_answer_id":"28978007","answer_count":"1","comment_count":"3","creation_date":"2015-03-11 03:16:13.32 UTC","last_activity_date":"2015-03-11 12:31:01.957 UTC","last_edit_date":"2015-03-11 12:31:01.957 UTC","last_editor_display_name":"","last_editor_user_id":"2911458","owner_display_name":"","owner_user_id":"4334671","post_type_id":"1","score":"0","tags":"java|android","view_count":"1229"} {"id":"11713220","title":"UILongPressGestureReconizer Tag? - iPhone","body":"\u003cp\u003eI'm setting up a LPGR like so and I was wonder if I can create a tag in each LPGR. I need to do this so I know which of all my buttons is being pressed...\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eUILongPressGestureRecognizer *longpressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressHandler:)];\nlongpressGesture.minimumPressDuration = 2;\n[longpressGesture setDelegate:self];\n[pushButton addGestureRecognizer:longpressGesture];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd my method below...\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e- (void)longPressHandler:(UILongPressGestureRecognizer *)gestureRecognizer {\nNSLog(@\"longPressHandler\");\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI know you can't pass arguments via selectors, so I was wondering if I could assign a tag to the LPGR or if in the method I could grab the tag of the button that was using the LPGR? Is any of this possible\u003e?\u003c/p\u003e\n\n\u003cp\u003eEDIT:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eNSInteger *tag = [gestureRecognizer.view.tag];\nNSLog(@\"%@ longPressHandler\",tag);\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"11713286","answer_count":"2","comment_count":"0","creation_date":"2012-07-29 21:45:44.46 UTC","last_activity_date":"2012-07-29 22:46:06 UTC","last_edit_date":"2012-07-29 22:01:13.747 UTC","last_editor_display_name":"","last_editor_user_id":"1233794","owner_display_name":"","owner_user_id":"1233794","post_type_id":"1","score":"0","tags":"iphone|objective-c|ios|uibutton|uigesturerecognizer","view_count":"77"} {"id":"28192171","title":"jquery keyup delay is being ignored","body":"\u003cp\u003eOk perhaps someone could enlighten me as to what I am missing here guys. I have a text box which updates a jquery data table with ajax call based on user input. Obviously the desire is to only fire the ajax call when the user has finished typing. \u003c/p\u003e\n\n\u003cp\u003eHowever no matter what snippets I try from SO and elsewhere the timeout is ignored and the ajax fire immediately. I wonder if anyone might point me in the right direction.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e var timer;\n$(\"#search_query\").on('keyup', function() {\n clearInterval(timer); //clear any interval on key up\n timer = setTimeout(alert(\"test\"), 3000);\n});\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"28192206","answer_count":"2","comment_count":"0","creation_date":"2015-01-28 12:23:26.897 UTC","last_activity_date":"2015-01-28 12:33:08.683 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"965276","post_type_id":"1","score":"1","tags":"javascript|jquery|ajax|timeout|keyup","view_count":"186"} {"id":"7031148","title":"Setting up checkboxes dynamically in a layout","body":"\u003cp\u003eFor the past couple of days I have been racking my brain over how to exactly take each element in a number of string arrays and place them in checkboxes which would then be placed into a Linear Layout. Each time the user selects something from a radio button group (which is in one tab), the contents of these Linear Layouts (which are contained in an overarching Linear Layout) would be changed with respect to whichever radio button was selected. So it would go something like this:\u003c/p\u003e\n\n\u003cp\u003e[User selects something in this tab with radio buttons] -\u003e [This tab over here is updated]\u003c/p\u003e\n\n\u003cp\u003eThe tab in question: \u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003e\u003cp\u003e[Linear Layout]\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003e[Linear Layout]\n\u003cul\u003e\n\u003cli\u003e[x] String1\u003c/li\u003e\n\u003cli\u003e[x] String2\u003c/li\u003e\n\u003cli\u003e[x] String3\u003c/li\u003e\n\u003c/ul\u003e\u003c/li\u003e\n\u003c/ul\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eI have tried using a ListView, but the contents of each line of the list need to be easily selectable (hence using the checkboxes). I have thought of trying out the \u003ccode\u003eMergeAdapter\u003c/code\u003e but I would have to some how change the arrays that are fed to it each time there is an update (and I'm not using SQLite nor Cursors).\u003c/p\u003e\n\n\u003cp\u003eSo might anyone have a suggestion to remedy this problem?\u003c/p\u003e\n\n\u003cp\u003e[Edit] Sorry if my intent was not so clear. I have written an Adapter which takes in an array of strings and, if set to a ListView, will show put a checkbox in each line of the List. What I would like instead is to just make a checkbox with the text in it set to one of the elements of the array and added to one of the LinearLayouts. This would go through the complete array. This way, I would have multiple sets of checkboxes that the user can select from. The code (or pseudo code) would look something like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efor (int i = 0; i \u0026lt; someArrayAdapter.size; i++) {\n ListView.addView(someArrayAdapter.getView(i, someConverView, someGroupView));\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhere \u003ccode\u003esomeArrayAdapter\u003c/code\u003e is a custom adapter. I found I can't actually use \u003ccode\u003egetView()\u003c/code\u003e like that so I need to use some other method (which is why I'm asking here ;) ).\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2011-08-11 18:43:47.197 UTC","last_activity_date":"2011-08-12 00:54:44.867 UTC","last_edit_date":"2011-08-12 00:54:44.867 UTC","last_editor_display_name":"","last_editor_user_id":"832805","owner_display_name":"","owner_user_id":"832805","post_type_id":"1","score":"0","tags":"java|android|android-arrayadapter","view_count":"72"} {"id":"26680592","title":"Sort actual QMap by key","body":"\u003cp\u003eI have \u003ccode\u003eQMap\u0026lt;QString, MyClass*\u0026gt;\u003c/code\u003e. I need to sort it by key using natural comparison. \nI do: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003estd::map\u0026lt;QString, MyClass*\u0026gt; map = c.toStdMap();\nstd::sort(map.begin(), map.end(), strnatcmp1\u0026lt;std::pair\u0026lt;QString, MyClass*\u0026gt;\u0026gt;);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever, this does not even compile. And even if it did, as far as I understand, it would sort a \u003cem\u003ecopy\u003c/em\u003e of my original \u003ccode\u003eQMap\u003c/code\u003e. \u003c/p\u003e\n\n\u003cp\u003eIs there any way to sort my \u003ccode\u003eQMap\u003c/code\u003e by key with the function for comparison keys provided?\u003c/p\u003e","accepted_answer_id":"26695746","answer_count":"1","comment_count":"4","creation_date":"2014-10-31 17:47:42.837 UTC","last_activity_date":"2014-11-02 03:31:38.153 UTC","last_edit_date":"2014-11-02 03:31:38.153 UTC","last_editor_display_name":"","last_editor_user_id":"2682142","owner_display_name":"","owner_user_id":"2542738","post_type_id":"1","score":"1","tags":"c++|qt|sorting|qtcore|qmap","view_count":"2911"} {"id":"11633707","title":"match lines where a specified column range contains dot character and do not print the line if the pattern is found 8 times or more","body":"\u003cp\u003eI have a tab delimited file in which starting from columns 10-25 some of the values contain the \".\" character. I want to filter out lines which match the \".\" character, within this column column range,so that it does not print if it is found less than 8x times in columns 10-25 (i.e. less than 50% occurrence). \u003c/p\u003e\n\n\u003cp\u003eI have tried looking at similar posts and the closest I got to is by the user: lodge ( \u003ca href=\"https://stackoverflow.com/questions/6005794/match-lines-with-pattern-n-times-in-the-same-line\"\u003eMatch lines with pattern n times in the same line\u003c/a\u003e ) however, when I tried some of the commands it doesn't behave in a way that I need to.\u003c/p\u003e\n\n\u003cp\u003eFor example, the code below replaced everything with a dot...whilst I am aware it is because it is a global substitution, it seemed to work for lodge.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e awk '{ if (gsub(/./, \".\") \u0026gt;= 8) print }' merged.vcf \u0026gt; test.vcf \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is an example of my file (I only include up to column 11 in this example):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT AD0062-C AD0065-C\n 2L 560 . T C 30.65 PASS AC=3 GT:GQ:PL . .\n 2L 595 . G T 61.75 PASS AC=11 GT:GQ:PL . 0/1:13:132,0,10 \n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"11634235","answer_count":"1","comment_count":"1","creation_date":"2012-07-24 15:01:50.827 UTC","last_activity_date":"2012-07-24 15:45:31.383 UTC","last_edit_date":"2017-05-23 12:29:10.62 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"1458512","post_type_id":"1","score":"0","tags":"regex|linux|awk","view_count":"304"} {"id":"9972029","title":"How asp .net handles concurrent user requests?","body":"\u003cp\u003eThis is for looking for an answer to a question i faced in a technical discussion.\u003c/p\u003e\n\n\u003cp\u003eIn a travel booking website there were 50 ticket's available.\nNow only one more ticket left.2 users hitting the web server at the same time,\nconsidering Asp .net can handle concurrent requests.\u003c/p\u003e\n\n\u003cp\u003eq.\n1) How asp .net handles this requests?\u003c/p\u003e\n\n\u003cp\u003e2) There is a way for one of the user to get that last ticket.what is it?\u003c/p\u003e\n\n\u003cp\u003eI think understanding asp .net architecture deep is require to answer this question.\u003c/p\u003e\n\n\u003cp\u003ecan anyone give me some insight.\u003c/p\u003e\n\n\u003cp\u003eThanks\nSNA\u003c/p\u003e","answer_count":"2","comment_count":"1","creation_date":"2012-04-02 06:54:48.89 UTC","favorite_count":"3","last_activity_date":"2012-04-02 07:03:25.047 UTC","last_edit_date":"2012-04-02 07:03:25.047 UTC","last_editor_display_name":"","last_editor_user_id":"117077","owner_display_name":"","owner_user_id":"117077","post_type_id":"1","score":"3","tags":"asp.net","view_count":"1282"} {"id":"47544099","title":"Trying to understand what is happening in this Python Function","body":"\u003cpre\u003e\u003ccode\u003edef closest_centroid(points, centroids):\n \"\"\"returns an array containing the index to the nearest centroid for each point\"\"\"\n distances = np.sqrt(((points - centroids[:, np.newaxis])**2).sum(axis=2))\n return np.argmin(distances, axis=0)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan someone explain the exact working of this function? I currently got \u003ccode\u003epoints\u003c/code\u003e which looks like: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e31998888119 0.94 34\n23423423422 0.45 43\n....\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd so on. In this \u003ccode\u003enumpy\u003c/code\u003e array, \u003ccode\u003epoints[1]\u003c/code\u003e would be the long ID while \u003ccode\u003epoints[2]\u003c/code\u003e is \u003ccode\u003e0.94\u003c/code\u003e and \u003ccode\u003epoints[3]\u003c/code\u003e would be \u003ccode\u003e34\u003c/code\u003e for their first entry.\u003c/p\u003e\n\n\u003cp\u003eCentroids is just a random selection from this particular array:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef initialize_centroids(points, k):\n \"\"\"returns k centroids from the initial points\"\"\"\n centroids = points.copy()\n np.random.shuffle(centroids)\n return centroids[:k] \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow I want to get the Euclidean distance from the values of \u003ccode\u003epoints\u003c/code\u003e ignoring the first column of IDs and \u003ccode\u003ecentroids\u003c/code\u003e (once again ignoring the first column). I don't exactly understand the syntax from the line \u003ccode\u003edistances = np.sqrt(((points - centroids[:, np.newaxis])**2).sum(axis=2))\u003c/code\u003e. Why exactly are we summing across the third column, while there being a decleration for a new axis: \u003ccode\u003enp.newaxis\u003c/code\u003e? Also along what axis am I supposed to make the \u003ccode\u003enp.argmin\u003c/code\u003e work? \u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-11-29 02:29:57.727 UTC","last_activity_date":"2017-11-29 02:29:57.727 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"9023305","post_type_id":"1","score":"2","tags":"python|numpy|k-means|euclidean-distance","view_count":"38"} {"id":"7000256","title":"How to get unique results in JPA","body":"\u003cp\u003eI am using this JPA-Query (EclipseLink):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT e FROM Entity e GROUP BY e.label\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut i get all rows in my result instead of only the unique labels.\u003c/p\u003e\n\n\u003cp\u003eMy second approach was using DISTINCT like i did successfully in another function which counts the distinct values, but i don't know how apply this to get the Entities:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT COUNT(DISTINCT e.label) FROM Entity e\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"7000408","answer_count":"2","comment_count":"4","creation_date":"2011-08-09 17:27:27.897 UTC","last_activity_date":"2013-04-16 13:22:58.897 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"809002","post_type_id":"1","score":"3","tags":"java|jpa|eclipselink","view_count":"8656"} {"id":"2632503","title":"m.find(...) == m.end() - which is used, iterator or const_iterator","body":"\u003cp\u003estd::map find/end both provides const_iterator and iterator, e.g.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e iterator end ();\n const_iterator end () const\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eOut of curiosity,if I have a std::map , which will be called/compared here, an iterator or a const_iterator ? :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif(m.find(key) != m.end()) {\n ...\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd should I care ?\u003c/p\u003e","accepted_answer_id":"2632512","answer_count":"2","comment_count":"0","creation_date":"2010-04-13 19:18:07.843 UTC","favorite_count":"0","last_activity_date":"2010-04-13 19:19:51.35 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"157404","post_type_id":"1","score":"6","tags":"c++|templates|stl","view_count":"795"} {"id":"19326166","title":"Get youtube video time elapsed with new youtube API library","body":"\u003cp\u003eI want to play youtube videos using new Android Youtube API. I have download demo project from google (YouTubeAndroidAPIDemo) and this is the code I use to launch a video:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eIntent intent = YouTubeStandalonePlayer.createVideoIntent(this, getString(R.string.ID_DEVELOPER_KEY), \"cdgQpa1pUUE\", 0, true, false);\nstartActivityForResult(intent, 1);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis running the youtube video ok, but, when the user press back key, I want to know time elapsed (for example, the youtube video size is 3:01, but the user only have seen 50 seconds)\nHow can I know time elapsed?\nThanks! \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-10-11 19:53:18.17 UTC","last_activity_date":"2013-10-13 10:06:08.97 UTC","last_edit_date":"2013-10-11 19:55:24.13 UTC","last_editor_display_name":"","last_editor_user_id":"557179","owner_display_name":"","owner_user_id":"2143224","post_type_id":"1","score":"0","tags":"android|api|time|youtube|elapsed","view_count":"777"} {"id":"20138631","title":"as3 navigating thru an array of images","body":"\u003cp\u003eI have an array of images that I have loaded into a Loader array. However, I am wondering if this is using up lots of resources to keep on adding images on top of each other. \u003c/p\u003e\n\n\u003cp\u003eThe goal is when they press the screen it will go to the next image in the array and display it. When it reaches the end it will start over. They have a constant flow of fading images. Again, I am wondering does the addChild in this case keep on adding NEW images to the screen and eventually will have so many on top of each other that it will crash. The final out put is for a mobile app. Do I need to unload the previous image after the new one is loaded or is this not an issue? \u003c/p\u003e\n\n\u003cp\u003eHere is my working code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epackage com\n{\n\n import flash.display.MovieClip;\n import flash.display.Stage;\n import com.*;\n import flash.events.*;\n import flash.filesystem.File;\n\n import flash.net.*;\n import flash.display.*;\n import com.greensock.*;\n import com.greensock.easing.*;\n\n\n //////////////////\n public class pictures extends MovieClip\n {\n\n\n public var Images:Array = new Array();\n public var RandomImages:Array = new Array();\n public var c:int = 0;\n\n\n public function pictures()\n {\n loadImages(\"Joyful\",\"1\");\n this.addEventListener(MouseEvent.CLICK, displayImages);\n }\n\n\n\n public function loadImages(Decade:String,Mystery:String)\n {\n Images = [];\n RandomImages = [];\n var desktop:File = File.applicationDirectory.resolvePath(\"RosaryImages/\"+Decade+\"/\"+Mystery);\n var files:Array = desktop.getDirectoryListing();\n for (var i:uint = 0; i \u0026lt; files.length; i++)\n {\n RandomImages.push(\"RosaryImages/\"+Decade+\"/\"+Mystery+\"/\"+files[i].name);\n trace(RandomImages[i]);\n var my_loader:Loader = new Loader();\n my_loader.load(new URLRequest(File.applicationDirectory.url + RandomImages[i]));\n Images.push(my_loader);\n }\n displayImages();\n }\n\n\n\n public function displayImages(e:Event = null)\n {\n addChild(Images[c]);\n TweenMax.fromTo(Images[c],2, {alpha:0}, {alpha:1, ease:Quint.easeOut} );\n\n if (c \u0026lt; (Images.length) - 1)\n {\n c++;\n }\n else\n {\n c = 0;\n }\n\n\n }\n\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"1","creation_date":"2013-11-22 06:39:43.833 UTC","last_activity_date":"2013-11-22 08:45:22.983 UTC","last_edit_date":"2013-11-22 07:24:53.71 UTC","last_editor_display_name":"","last_editor_user_id":"894237","owner_display_name":"","owner_user_id":"894237","post_type_id":"1","score":"0","tags":"actionscript-3|loader","view_count":"147"} {"id":"20057519","title":"jQuery Masonry layout with two specific sizes","body":"\u003cp\u003eI'm creating a layout with Masonry that only has two sizes available: a small one and a larger one. However, I created a random selection and they aren't stacking together correctly. \u003c/p\u003e\n\n\u003cp\u003eHere is my HTML \u0026amp; JS: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"container\"\u0026gt;\n \u0026lt;div class=\"featured\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured small\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured small\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured small\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured small\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured small\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured small\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured small\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured small\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured small\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"featured small\"\u0026gt;\u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\n\u0026lt;script\u0026gt;\ndocReady( function() {\nvar $container = $('.container');\n $container.imagesLoaded(function(){\n $container.masonry({\n columnWidth: 225\n itemSelector: '.featured' \n isFitWidth: true\n });\n });\n});\n\u0026lt;/script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is my CSS:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e.container {\n background: #EEE;\n width:960px;\n margin-bottom:20px;\n}\n\n.featured {\n width:440px;\n height:440px;\n margin:10px;\n float:left;\n background:#09F;\n}\n\n.featured.small{ \n width:210px;\n height:210px;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'd like it if it had the same effect as this site: \u003ca href=\"http://tweetwall.apps.zappos.com/index.html\" rel=\"nofollow\"\u003eZappos Tweet Wall\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eBut I'm having trouble grasping how this library works. \u003c/p\u003e","accepted_answer_id":"20058647","answer_count":"1","comment_count":"2","creation_date":"2013-11-18 20:45:19.177 UTC","last_activity_date":"2013-11-18 21:48:19.66 UTC","last_edit_date":"2013-11-18 21:17:26.833 UTC","last_editor_display_name":"","last_editor_user_id":"2647290","owner_display_name":"","owner_user_id":"2647290","post_type_id":"1","score":"0","tags":"jquery|jquery-masonry","view_count":"156"} {"id":"42037582","title":"Explanation for in loop JavaScript","body":"\u003cp\u003eWho can explain how this for in loop works and why it's assign keys of object to array\u003c/p\u003e\n\n\u003cp\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-js lang-js prettyprint-override\"\u003e\u003ccode\u003evar o = {\r\n a: 1,\r\n b: 2,\r\n c: 3,\r\n d: 4\r\n};\r\nvar a = [],\r\n i = 0;\r\nfor (a[i++] in o);\r\nconsole.log(a);\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/p\u003e","answer_count":"1","comment_count":"10","creation_date":"2017-02-04 07:06:11.873 UTC","last_activity_date":"2017-02-04 07:26:19.027 UTC","last_edit_date":"2017-02-04 07:09:28.693 UTC","last_editor_display_name":"","last_editor_user_id":"295783","owner_display_name":"","owner_user_id":"7358930","post_type_id":"1","score":"0","tags":"javascript","view_count":"63"} {"id":"25509541","title":"Animate() doesn't work with scrollTop properly","body":"\u003cp\u003eI'm trying to make a script that scrolls the page automatically to the specific element when I scroll my mouse, but for some reason my animation gets repeated and the scroll goes back and forth.\u003c/p\u003e\n\n\u003cp\u003eEdit:\nI would like to point out that this doesn't happen if the page scrolls to the last element on the page, but if it scrolls to the second element it will bounce instantly back to the top.\u003c/p\u003e\n\n\u003cp\u003eHere's my jQuery:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$(document).ready(function(){\ncomp = 0;\ncurrent_scroll_position = $(window).scrollTop();\nconsole.log(\"CURRENT SCROLL POSITION = \" +current_scroll_position);\n\nsecond = $(\"#second\").offset().top;\n\n\n\n\n$(window).scroll(function(scroll_action){\n\n $('body').on({\n 'mousewheel': function(e) {\n e.preventDefault();\n e.stopPropagation();\n }\n });\n\n if(comp==0){\n\n console.log(\"COMP =\" +comp);\n comp++;\n\n new_scroll_position = $(window).scrollTop();\n\n console.log(\"YOU SCROLLED, NEW CURRENT POSITION IS :\" +new_scroll_position);\n\n if (new_scroll_position \u0026gt; current_scroll_position){ //scroll going down\n\n\n\n console.log(new_scroll_position +\" \u0026gt; \"+ current_scroll_position +\" GOING DOWN\");\n\n\n\n\n $('body').animate({\n\n scrollTop: second\n }, 500,\n function(){ //callback function for completed animation\n completed_animation_scroll = true;\n current_scroll_position = $(window).scrollTop();\n\n console.log(\" ANIMATING \");\n console.log(\"CURRENT SCROLL POSITION = \" +current_scroll_position);\n console.log(\"NEW SCROLL POSITION = \" +new_scroll_position);\n console.log(\"ANIMATION COMPLETED = \" +completed_animation_scroll);\n console.log(\" ******************* ************************ ******************\");\n\n $('body').unbind('mousewheel');\n comp = 0;\n\n\n\n\n });\n\n\n\n\n }\n else{\n\n console.log(new_scroll_position +\" \u0026gt; \"+ current_scroll_position +\" GOING DOWN\");\n\n $('body').animate({\n\n scrollTop: 0\n }, 500,\n function(){ //callback function for completed animation\n completed_animation_scroll = true;\n current_scroll_position = $(window).scrollTop();\n\n console.log(\" ANIMATING \");\n console.log(\"CURRENT SCROLL POSITION = \" +current_scroll_position);\n console.log(\"NEW SCROLL POSITION = \" +new_scroll_position);\n console.log(\"ANIMATION COMPLETED = \" +completed_animation_scroll);\n console.log(\" ******************* ************************ ******************\");\n\n $('body').unbind('mousewheel');\n comp = 0;\n\n\n\n\n });\n\n }\n }\n});\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eTry it:\n\u003ca href=\"http://jsfiddle.net/81t6w6zv/2/\" rel=\"nofollow\"\u003ehttp://jsfiddle.net/81t6w6zv/2/\u003c/a\u003e\u003c/p\u003e","accepted_answer_id":"25510284","answer_count":"1","comment_count":"1","creation_date":"2014-08-26 15:22:07.193 UTC","last_activity_date":"2014-08-26 16:08:22.203 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"656493","post_type_id":"1","score":"1","tags":"javascript|jquery|jquery-animate","view_count":"457"} {"id":"34330980","title":"How to Find ElementName of Parent View (XAML) in TargetObject of ChangePropertyAction WPF?","body":"\u003cp\u003eI'm having DataGrid, the Grid has a Filter Functioning. The Filter Icon Button is styled as DataGridColumnHeader in app.xaml and I attached the style to my DataGrid. If the Button gets Click, then it opens a Filter Popup to perform Filter. The Popup is designed in a Parent View XAML. \u003c/p\u003e\n\n\u003cp\u003eThe DataGrid View XAML inherits the Parent View XAML. Now I need to set the ElementName=autoFilter in Popup or ElementName=popFilter in Filter Icon Button. I Can't able to call the control using TargetObject of ChangePropertyAction in WPF. Kindly assist.\u003c/p\u003e\n\n\u003cp\u003eThe DataGrid View: gridView.xaml\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;DataGrid Name=\"EmpList\" ColumnHeaderStyle=\"{StaticResource FilterDataGridColumnHeader}\" AutoGenerateColumns=\"False\" ItemsSource=\"{Binding EmpList}\"\u0026gt;\n \u0026lt;DataGrid.Columns\u0026gt;\n \u0026lt;DataGridTextColumn Binding=\"{Binding Name}\" Header=\"Employee Name\" ElementStyle=\"{StaticResource DataGridElementStyle}\" /\u0026gt;\n \u0026lt;DataGridTextColumn Binding=\"{Binding Age}\" Header=\"Employee Age\" ElementStyle=\"{StaticResource DataGridElementStyle}\" /\u0026gt;\n \u0026lt;/DataGrid.Columns\u0026gt;\n\u0026lt;/DataGrid\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eParent View Contains Popup: MainView.xaml\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;Popup Name=\"popFilter\" Placement=\"Mouse\" StaysOpen=\"False\" Width=\"200\" IsOpen=\"{Binding IsPopupFilterOpen, Mode=TwoWay}\"\u0026gt;\n \u0026lt;i:Interaction.Triggers\u0026gt;\n \u0026lt;i:EventTrigger EventName=\"Opened\"\u0026gt;\n \u0026lt;ei:ChangePropertyAction TargetObject=\"{Binding ElementName=autofilter}\" PropertyName=\"Visibility\"/\u0026gt;\n \u0026lt;/i:EventTrigger\u0026gt;\n \u0026lt;i:EventTrigger EventName=\"Closed\"\u0026gt;\n \u0026lt;ei:ChangePropertyAction TargetObject=\"{Binding ElementName=autofilter}\" PropertyName=\"Visibility\"\u0026gt;\n \u0026lt;ei:ChangePropertyAction.Value\u0026gt;\n \u0026lt;Visibility\u0026gt;Collapsed\u0026lt;/Visibility\u0026gt;\n \u0026lt;/ei:ChangePropertyAction.Value\u0026gt;\n \u0026lt;/ei:ChangePropertyAction\u0026gt;\n \u0026lt;/i:EventTrigger\u0026gt;\n \u0026lt;/i:Interaction.Triggers\u0026gt;\n \u0026lt;Border Background=\"White\" BorderBrush=\"Gray\" BorderThickness=\"1,1,1,1\"\u0026gt;\n \u0026lt;StackPanel Margin=\"5,5,5,15\"\u0026gt;\n \u0026lt;TextBlock Text=\"Welcome to Popup Window\" /\u0026gt;\n \u0026lt;/StackPanel\u0026gt;\n \u0026lt;/Border\u0026gt;\n\u0026lt;/Popup\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eFilter Icon Button in ColumnHeaderStyle : app.xaml\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;Application.Resources\u0026gt;\n \u0026lt;Style TargetType=\"{x:Type DataGridColumnHeader}\" x:Key=\"FilterDataGridColumnHeader\"\u0026gt;\n \u0026lt;Setter Property=\"Template\"\u0026gt;\n \u0026lt;Setter.Value\u0026gt;\n \u0026lt;ControlTemplate TargetType=\"{x:Type DataGridColumnHeader}\"\u0026gt;\n \u0026lt;Grid\u0026gt;\n \u0026lt;Button Grid.Column=\"2\" Background=\"Yellow\"\u0026gt;\n \u0026lt;i:Interaction.Triggers\u0026gt;\n \u0026lt;i:EventTrigger EventName=\"MouseEnter\"\u0026gt;\n \u0026lt;ei:ChangePropertyAction TargetObject=\"{Binding ElementName=autofilter}\" PropertyName=\"Visibility\"\u0026gt;\n \u0026lt;ei:ChangePropertyAction.Value\u0026gt;\n \u0026lt;Visibility\u0026gt;Visible\u0026lt;/Visibility\u0026gt;\n \u0026lt;/ei:ChangePropertyAction.Value\u0026gt;\n \u0026lt;/ei:ChangePropertyAction\u0026gt;\n \u0026lt;/i:EventTrigger\u0026gt;\n \u0026lt;i:EventTrigger EventName=\"MouseLeave\"\u0026gt;\n \u0026lt;ei:ChangePropertyAction TargetObject=\"{Binding ElementName=autofilter}\" PropertyName=\"Visibility\"\u0026gt;\n \u0026lt;ei:ChangePropertyAction.Value\u0026gt;\n \u0026lt;Visibility\u0026gt;Collapsed\u0026lt;/Visibility\u0026gt;\n \u0026lt;/ei:ChangePropertyAction.Value\u0026gt;\n \u0026lt;/ei:ChangePropertyAction\u0026gt;\n \u0026lt;/i:EventTrigger\u0026gt;\n \u0026lt;i:EventTrigger EventName=\"Click\"\u0026gt;\n \u0026lt;ei:ChangePropertyAction TargetObject=\"{Binding ElementName=popFilter}\" PropertyName=\"IsOpen\"\u0026gt;\n \u0026lt;ei:ChangePropertyAction.Value\u0026gt;True\u0026lt;/ei:ChangePropertyAction.Value\u0026gt;\n \u0026lt;/ei:ChangePropertyAction\u0026gt;\n \u0026lt;/i:EventTrigger\u0026gt;\n\n \u0026lt;/i:Interaction.Triggers\u0026gt;\n \u0026lt;Grid\u0026gt;\n \u0026lt;Grid.ColumnDefinitions\u0026gt;\n \u0026lt;ColumnDefinition Width=\"20\"/\u0026gt;\n \u0026lt;ColumnDefinition/\u0026gt;\n \u0026lt;ColumnDefinition Width=\"20\"/\u0026gt;\n \u0026lt;/Grid.ColumnDefinitions\u0026gt;\n \u0026lt;ContentPresenter x:Name=\"contentPresenter\" Grid.Column=\"1\"/\u0026gt;\n \u0026lt;ContentControl x:Name=\"autofilter\" Visibility=\"Collapsed\" ContentTemplate=\"{StaticResource FilterButtonStyleKey}\" Margin=\"0 0 3 0\"/\u0026gt;\n \u0026lt;/Grid\u0026gt;\n \u0026lt;/Button\u0026gt;\n \u0026lt;/Grid\u0026gt;\n \u0026lt;/ControlTemplate\u0026gt;\n \u0026lt;/Setter.Value\u0026gt;\n \u0026lt;/Setter\u0026gt;\n \u0026lt;/Style\u0026gt;\n\u0026lt;/Application.Resources\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe Icon Button Image Key: FilterButtonStyleKey\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;DataTemplate x:Key=\"FilterButtonStyleKey\"\u0026gt;\n \u0026lt;Canvas Height=\"15.898\" Width=\"15.297\" HorizontalAlignment=\"Center\" VerticalAlignment=\"Center\" Background=\"Transparent\"\u0026gt;\n \u0026lt;Path Data=\"M16.0117,6.7368C18.3417,6.7368,20.6727,6.7358,23.0027,6.7378C23.5327,6.7378,23.5977,6.8308,23.6437,7.3438C23.7027,7.9958,23.4897,8.4748,23.0197,8.9548C21.4107,10.5968,19.8547,12.2888,18.2957,13.9788C18.1647,14.1208,18.1137,14.3828,18.1117,14.5898C18.0987,17.0608,18.1067,19.5308,18.0907,22.0018C18.0887,22.2158,18.0077,22.4968,17.8607,22.6158C17.7697,22.6878,17.4587,22.5408,17.2807,22.4368C16.3057,21.8718,15.3447,21.2788,14.3677,20.7148C14.0637,20.5408,13.9287,20.3278,13.9297,19.9728C13.9407,18.1778,13.9257,16.3848,13.9357,14.5908C13.9367,14.2698,13.8367,14.0388,13.6137,13.8058C12.1347,12.2548,10.6717,10.6898,9.2027,9.1298C9.0967,9.0168,8.9927,8.9018,8.8797,8.7958C8.4137,8.3608,8.2387,7.6118,8.4377,7.0158C8.5277,6.7478,8.7137,6.7358,8.9347,6.7368C10.0937,6.7388,11.2517,6.7378,12.4097,6.7378C13.6107,6.7378,14.8107,6.7378,16.0117,6.7368z\" Height=\"16.898\" Canvas.Left=\"-0.5\" StrokeStartLineCap=\"Round\" Stretch=\"Fill\" StrokeEndLineCap=\"Round\" Stroke=\"#FF323232\" StrokeThickness=\"1\" StrokeLineJoin=\"Round\" Canvas.Top=\"-0.5\" Width=\"16.297\"/\u0026gt;\n \u0026lt;Path Data=\"M14.2427,14.3921L17.9117,14.3921\" Height=\"1\" Canvas.Left=\"5.386\" StrokeStartLineCap=\"Round\" Stretch=\"Fill\" StrokeEndLineCap=\"Round\" Stroke=\"#FF323232\" StrokeThickness=\"1\" StrokeLineJoin=\"Round\" Canvas.Top=\"7.156\" Width=\"4.669\"/\u0026gt;\n \u0026lt;/Canvas\u0026gt;\n\u0026lt;/DataTemplate\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI need to show (Visibility:Visible) the Filter Icon Button while on Mouse Hover Event of the Corresponding Column or If user can click the Filter Icon Button then the Filter Popup gets opened and that time the Icon should show - Filter Popup IsOpen=True state. The Filter Icon Button should Collapsed while on Popup gets closed while on Icon Button Clicked otherwise Mouse Hover is not happened.\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eNote:\u003c/p\u003e\n \n \u003cp\u003eDesign the Datagrid in one XAML and the Filter Popup should be in Main\n View XAML, The DataGrid XAML inherits the Main View XAML.\u003c/p\u003e\n \n \u003cp\u003eThe Filter Icon is a Button designed in app.xaml and call the Style in\n the DataGrid.\u003c/p\u003e\n\u003c/blockquote\u003e","answer_count":"0","comment_count":"0","creation_date":"2015-12-17 09:27:55.573 UTC","favorite_count":"1","last_activity_date":"2015-12-17 09:27:55.573 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2900199","post_type_id":"1","score":"1","tags":"wpf|xaml|datagrid|datatrigger|interaction","view_count":"295"} {"id":"38999345","title":"BIGINT and INT comparison failure in spark sql","body":"\u003cp\u003eI have a Hive table with the following definition:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ecreate table testforerror (\n my_column MAP\u0026lt;BIGINT, ARRAY\u0026lt;String\u0026gt;\u0026gt;\n);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe table has the following records\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ehive\u0026gt; select * from testforerror;\nOK\n{16001:[\"0034000000a4WDAAA2\"]}\n{16001:[\"0034000000orWiFAAU\"]}\n{16001:[\"\",\"0034000000VgrHdAAJ\"]}\n{16001:[\"0034000000cS4tDAAS\"]}\n{15001:[\"0037000001a7ofgAAA\"]}\nTime taken: 0.067 seconds, Fetched: 5 row(s)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI have a query which filters records with key of the my_column. The query is as follows\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eselect * from testforerror where my_column[16001] is not null;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis query is executing fine from hive/beeline shell and producting the following records:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ehive\u0026gt; select * from testforerror where my_column[16001] is not null;\nOK\n{16001:[\"0034000000a4WDAAA2\"]}\n{16001:[\"0034000000orWiFAAU\"]}\n{16001:[\"\",\"0034000000VgrHdAAJ\"]}\n{16001:[\"0034000000cS4tDAAS\"]}\nTime taken: 2.224 seconds, Fetched: 4 row(s)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut however I get an error when trying to execute from spark sqlContext. The following is the error message:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003escala\u0026gt; val errorquery = \"select * from testforerror where my_column[16001] is not null\"\nerrorquery: String = select * from testforerror where my_column[16001] is not null\n\nscala\u0026gt; sqlContext.sql(errorquery).show()\norg.apache.spark.sql.AnalysisException: cannot resolve 'my_column[16001]' due to data type mismatch: argument 2 requires bigint type, however, '16001' is of int type.; line 1 pos 43\n at org.apache.spark.sql.catalyst.analysis.package$AnalysisErrorAt.failAnalysis(package.scala:42)\n at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1$$anonfun$apply$2.applyOrElse(CheckAnalysis.scala:65)\n at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1$$anonfun$apply$2.applyOrElse(CheckAnalysis.scala:57)\n at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformUp$1.apply(TreeNode.scala:335)\n at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformUp$1.apply(TreeNode.scala:335)\n at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:69)\n at org.apache.spark.sql.catalyst.trees.TreeNode.transformUp(TreeNode.scala:334)\n at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$5.apply(TreeNode.scala:332)\n at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$5.apply(TreeNode.scala:332)\n at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$4.apply(TreeNode.scala:281)\n at scala.collection.Iterator$$anon$11.next(Iterator.scala:328)\n at scala.collection.Iterator$class.foreach(Iterator.scala:727)\n at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)\n at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48)\n at scala.collection.mutable.ArrayBuffer.$plus$plus$eq(ArrayBuffer.scala:103)\n at scala.collection.mutable.ArrayBuffer.$plus$plus$eq(ArrayBuffer.scala:47)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAny pointers are very helpful, thanks.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-08-17 14:23:27.343 UTC","last_activity_date":"2016-08-17 15:11:07.683 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5948671","post_type_id":"1","score":"0","tags":"apache-spark|hive|apache-spark-sql","view_count":"341"} {"id":"26825496","title":"How to convert mouse position into css 3d transformed element position","body":"\u003cp\u003eAs shown in JSFiddle, when you move the mouse over the 3d transformed div, I tried to convert the mouse position into the css 3d transformed element space.\u003c/p\u003e\n\n\u003cp\u003eWhich means, the red spot should always be display at the exact position of the mouse. \u003c/p\u003e\n\n\u003cp\u003eHowever, the DIV html element doesn't have method getScreenCTM or getTransformToElement or matrixTransform which can be used to transform the point. Does anybody know how to achieve that?\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://jsfiddle.net/9cv2y0dp/\" rel=\"nofollow\"\u003ehttp://jsfiddle.net/9cv2y0dp/\u003c/a\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar tel = $('#transformed')[0];\nvar box = $('#box')[0];\ntel.style.transform \n = 'translate3d(100px,100px,0px) rotateY(45deg)';\nvar rect = tel.getBoundingClientRect();\n$('#transformed').bind('mousedown', function(e){\n var evt = e || event;\n var x = evt.clientX;\n var y = evt.clientY;\n $('#cursor')[0].style.left = (x - rect.left) + 'px';\n $('#cursor')[0].style.top = (y - rect.top) + 'px';\n box.innerHTML = (x - rect.left) + 'px\u0026lt;br/\u0026gt;' + (y - rect.top) + 'px';\n});\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"2","creation_date":"2014-11-09 06:03:03.753 UTC","favorite_count":"1","last_activity_date":"2014-11-09 10:54:42.397 UTC","last_edit_date":"2014-11-09 10:54:42.397 UTC","last_editor_display_name":"","last_editor_user_id":"1446179","owner_display_name":"","owner_user_id":"1446179","post_type_id":"1","score":"2","tags":"html|svg|3d|transform|cursor-position","view_count":"604"} {"id":"25662506","title":"I have trouble reading a particular array in a JSON feed","body":"\u003cp\u003eI use json_decode() to parse a json feed and everything works just fine until I come to the array (media) that keeps digits as key instead of letters. I have tryed everything but all I get is different errors when it comes to this array (media)\u003c/p\u003e\n\n\u003cp\u003eThe media array contains links to images and I just need the first image in every media array really. But the array can keep random digits in different order for the image links.\nBut the main problem is that I can't print this key, even if I know the name of it is \"10\" for example.\nMy second problem is that I never know the digits of the first image.\u003c/p\u003e\n\n\u003cp\u003eI would be very grateful if I can get help with this.\u003c/p\u003e\n\n\u003cp\u003eMy code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$data = json_decode($json_obj);\n\n\nforeach($data-\u0026gt;events as $event) {\n\necho $event-\u0026gt;eventDateTime.'\u0026lt;br\u0026gt;'; //works\necho $event-\u0026gt;eventId.'\u0026lt;br\u0026gt;'; //works\necho $event-\u0026gt;title-\u0026gt;eventTitleText.'\u0026lt;br\u0026gt;'; //works\necho strtoupper($event-\u0026gt;venue-\u0026gt;city).'\u0026lt;br\u0026gt;'; //works\necho $event-\u0026gt;venue-\u0026gt;title.'\u0026lt;br\u0026gt;'; //works\necho $event-\u0026gt;ticketing-\u0026gt;url.'\u0026lt;br\u0026gt;'; //works\n\necho $event-\u0026gt;media-\u0026gt;10.'\u0026lt;br\u0026gt;'; // Does NOT work\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBelow is a complete json feed that contains just 1 event.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e {\n\"meta\":{\n\"total\":117,\n\"locale\":\"en-US\",\n\"page\":1,\n\"rows\":1\n},\n\"events\":[\n{\n\"-----\":\"252975\",\n\"modifiedUTC\":\"2014-08-29T17:23:21\",\n\"locale\":\"en-US\",\n\"localeAvailable\":{\n\"1\":\"sv-SE\"\n},\n\"title\":{\n\"presentedBy\":null,\n\"headliners\":\"\u0026lt;a href=\\\"http:\\/\\/www....\\/artists\\/251396\\/djurgarden-hockey\\\"\u0026gt;Djurg\\u00e5rden Hockey\u0026lt;\\/a\u0026gt; - Eisb\\u00e4ren Berlin\",\n\"supporting\":null,\n\"supportingText\":null,\n\"tour\":\"Champions Hockey League\",\n\"eventTitle\":\"\u0026lt;a href=\\\"http:\\/\\/www....\\/artists\\/251396\\/djurgarden-hockey\\\"\u0026gt;Djurg\\u00e5rden Hockey\u0026lt;\\/a\u0026gt; - Eisb\\u00e4ren Berlin\",\n\"eventTitleText\":\"Djurg\\u00e5rden Hockey - Eisb\\u00e4ren Berlin\"\n},\n\"age\":null,\n\"currency\":\"SEK\",\n\"currencySymbol\":null,\n\"eventDateTime\":\"2014-09-05T20:05:00\",\n\"eventDateTimeZone\":\"Europe\\/Stockholm\",\n\"eventDateTimeUTC\":\"2014-09-05T18:05:00\",\n\"eventDateTimeISO\":\"2014-09-05T20:05:00+02:00\",\n\"dateOnly\":false,\n\"additionalDates\":[\n],\n\"doorDateTime\":null,\n\"doorDateTimeUTC\":null,\n\"announceDateTime\":\"2014-08-04T10:00:00\",\n\"announceDateTimeTimeZone\":\"Europe\\/Stockholm\",\n\"announceDateTimeUTC\":\"2014-08-04T08:00:00\",\n\"presaleDateTime\":null,\n\"presaleDateTimeTimeZone\":null,\n\"presaleDateTimeUTC\":null,\n\"presaleEndDateTime\":null,\n\"presaleEndDateTimeTimeZone\":null,\n\"presaleEndDateTimeUTC\":null,\n\"onsaleDateTime\":\"2014-08-06T09:00:00\",\n\"onsaleDateTimeTimeZone\":\"Europe\\/Stockholm\",\n\"onsaleDateTimeUTC\":\"2014-08-06T07:00:00\",\n\"ticketing\":{\n\"statusId\":1,\n\"status\":\"Buy Tickets\",\n\"callToAction\":\"Get your tickets today!\",\n\"callToActionEnabled\":false,\n\"url\":\"http:\\/\\/www....\\/events\\/252975\\/djurgarden-hockey-eisbaren-berlin-tickets\",\n\"eventUrl\":\"http:\\/\\/www....\\/events\\/252975\\/djurgarden-hockey-eisbaren-berlin-tickets\",\n\"ticketLinkExists\":true\n},\n\"ticketPrice\":\"120.00 kr - 170.00 kr\",\n\"doorPrice\":null,\n\"bio\":null,\n\"description\":null,\n\"minorCategoryId1\":\"34\",\n\"minorCategoryId2\":null,\n\"minorCategoryId3\":null,\n\"majorCategoryId1\":\"3\",\n\"majorCategoryId2\":null,\n\"majorCategoryId3\":null,\n\"venue\":{\n\"venueId\":\"101916\",\n\"locale\":\"en-US\",\n\"localeAvailable\":{\n\"1\":\"en-US\",\n\"2\":\"sv-SE\"\n},\n\"title\":\"Hovet\",\n\"address_line\":\"Globentorget 2, Stockholm, Sweden 121 27\",\n\"address\":\"Globentorget 2\",\n\"city\":\"Stockholm\",\n\"state\":null,\n\"postalCode\":\"121 27\",\n\"country\":\"Sweden\",\n\"url\":\"http:\\/\\/www....\\/venues\\/101916\\/hovet-stockholm-tickets\",\n\"urlSlug\":\"hovet-stockholm-tickets\",\n\"venueUrl\":\"http:\\/\\/www.globearenas.se\\/archive\\/pages\\/18711\\/hovet.aspx\",\n\"phone1\":\"0771-31 00 00\",\n\"phone2\":null,\n\"alias\":null,\n\"parking\":null,\n\"boxOffice\":null,\n\"directions\":null,\n\"longitude\":\"18.0808159\",\n\"latitude\":\"59.2941674\",\n\"timezone\":\"Europe\\/Stockholm\",\n\"ada\":null,\n\"keywords\":[\n],\n\"skinCode\":\"sga\",\n\"currency\":\"SEK\",\n\"media\":{\n\"10\":{\n\"media_id\":\"29254\",\n\"width\":318,\n\"height\":187,\n\"file_name\":\"http:\\/\\/........net\\/10-08172012-502e82fe803bf.jpeg\"\n},\n\"11\":{\n\"media_id\":\"29256\",\n\"width\":238,\n\"height\":140,\n\"file_name\":\"http:\\/\\/........net\\/11-08172012-502e82fe8f5a7.jpeg\"\n},\n\"14\":{\n\"media_id\":\"29258\",\n\"width\":608,\n\"height\":252,\n\"file_name\":\"http:\\/\\/........net\\/14-08172012-502e83abb9512.jpeg\"\n},\n\"12\":{\n\"media_id\":\"29255\",\n\"width\":134,\n\"height\":79,\n\"file_name\":\"http:\\/\\/........net\\/12-08172012-502e82fe88c58.jpeg\"\n}\n},\n\"links\":[\n{\n\"link_id\":976779,\n\"link_title\":null,\n\"link_type_id\":\"23\",\n\"link_href\":\"http:\\/\\/www.marriott.com\\/search\\/submitSearch.mi?searchType=InCity\u0026amp;formType=InCity\u0026amp;marriottBrands=BR\u0026amp;destinationAddress.city=Stockholm\u0026amp;destinationAddress.stateProvince=\u0026amp;destinationAddress.country=SE\"\n}\n]\n},\n\"tour\":[\n],\n\"promoters\":null,\n\"associations\":{\n\"performerIds\":[\n\"251396\"\n],\n\"headliners\":[\n{\n\"performerId\":\"251396\",\n\"locale\":\"en-US\",\n\"localeAvailable\":{\n\"1\":\"en-US\"\n},\n\"name\":\"Djurg\\u00e5rden Hockey\",\n\"minorCategoryText\":\"Hockey\",\n\"minorCategoryId\":\"34\",\n\"minorCategory1Id\":\"34\",\n\"minorCategory2Id\":null,\n\"minorCategory3Id\":null,\n\"minorCategoryUrl\":\"http:\\/\\/www....\\/browse\\/sports\\/hockey\",\n\"majorCategoryText\":\"Sports\",\n\"major_category_id\":\"3\",\n\"majorCategory1Id\":\"3\",\n\"majorCategory2Id\":null,\n\"majorCategory3Id\":null,\n\"majorCategoryUrl\":\"http:\\/\\/www....\\/browse\\/sports\",\n\"keywords\":[\n\"DIF\",\n\"Djurgarden\"\n],\n\"bio\":null,\n\"shortBio\":null,\n\"aliases\":null,\n\"url\":\"http:\\/\\/www....\\/artists\\/251396\\/djurgarden-hockey-tickets\",\n\"urlSlug\":\"djurgarden-hockey-tickets\",\n\"media\":{\n\"7\":{\n\"media_id\":\"149467\",\n\"width\":220,\n\"height\":220,\n\"file_name\":\"http:\\/\\/........net\\/djurgarden-hockey_11-26-13_7_5294e45990e1f.jpg\"\n},\n\"24\":{\n\"media_id\":\"149463\",\n\"width\":322,\n\"height\":322,\n\"file_name\":\"http:\\/\\/........net\\/djurgarden-hockey_11-26-13_24_5294e45974caa.jpg\"\n},\n\"6\":{\n\"media_id\":\"149465\",\n\"width\":238,\n\"height\":140,\n\"file_name\":\"http:\\/\\/........net\\/djurgarden-hockey_11-26-13_6_5294e459867f5.jpg\"\n},\n\"5\":{\n\"media_id\":\"149466\",\n\"width\":318,\n\"height\":187,\n\"file_name\":\"http:\\/\\/........net\\/djurgarden-hockey_11-26-13_5_5294e4598bec3.jpg\"\n},\n\"9\":{\n\"media_id\":\"149464\",\n\"width\":134,\n\"height\":79,\n\"file_name\":\"http:\\/\\/........net\\/djurgarden-hockey_11-26-13_9_5294e45981552.jpg\"\n}\n},\n\"events\":[\n],\n\"links\":[\n{\n\"link_id\":976320,\n\"link_title\":null,\n\"link_type_id\":\"13\",\n\"link_href\":\"https:\\/\\/twitter.com\\/difhockeyse\"\n},\n{\n\"link_id\":976321,\n\"link_title\":null,\n\"link_type_id\":\"12\",\n\"link_href\":\"https:\\/\\/www.facebook.com\\/DJURGARDEN\"\n}\n]\n}\n],\n\"supportingActs\":[\n]\n},\n\"media\":[\n],\n\"relatedMedia\":{\n\"1\":{\n\"media_id\":\"149466\",\n\"width\":318,\n\"height\":187,\n\"file_name\":\"http:\\/\\/........net\\/djurgarden-hockey_11-26-13_5_5294e4598bec3.jpg\"\n},\n\"2\":{\n\"media_id\":\"149465\",\n\"width\":238,\n\"height\":140,\n\"file_name\":\"http:\\/\\/........net\\/djurgarden-hockey_11-26-13_6_5294e459867f5.jpg\"\n},\n\"3\":{\n\"media_id\":\"149467\",\n\"width\":220,\n\"height\":220,\n\"file_name\":\"http:\\/\\/........net\\/djurgarden-hockey_11-26-13_7_5294e45990e1f.jpg\"\n},\n\"4\":{\n\"media_id\":\"149464\",\n\"width\":134,\n\"height\":79,\n\"file_name\":\"http:\\/\\/........net\\/djurgarden-hockey_11-26-13_9_5294e45981552.jpg\"\n},\n\"23\":{\n\"media_id\":\"149463\",\n\"width\":322,\n\"height\":322,\n\"file_name\":\"http:\\/\\/........net\\/djurgarden-hockey_11-26-13_24_5294e45974caa.jpg\"\n},\n\"17\":{\n\"media_id\":0,\n\"width\":\"678\",\n\"height\":\"399\",\n\"file_name\":\"http:\\/\\/dc1tv648rdvbu.....net\\/...\\/bundles\\/aeg...\\/images\\/defaults\\/1\\/1_678_399.png\"\n},\n\"18\":{\n\"media_id\":0,\n\"width\":\"564\",\n\"height\":\"564\",\n\"file_name\":\"http:\\/\\/dc1tv648rdvbu.....net\\/...\\/bundles\\/aeg...\\/images\\/defaults\\/1\\/1_564_564.png\"\n}\n},\n\"links\":[\n{\n\"link_id\":976321,\n\"link_title\":null,\n\"link_type_id\":\"12\",\n\"link_href\":\"https:\\/\\/www.facebook.com\\/DJURGARDEN\"\n},\n{\n\"link_id\":976320,\n\"link_title\":null,\n\"link_type_id\":\"13\",\n\"link_href\":\"https:\\/\\/twitter.com\\/difhockeyse\"\n}\n]\n}\n]\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"25662835","answer_count":"1","comment_count":"4","creation_date":"2014-09-04 09:58:07.127 UTC","last_activity_date":"2014-09-04 11:00:47.553 UTC","last_edit_date":"2014-09-04 11:00:47.553 UTC","last_editor_display_name":"","last_editor_user_id":"4007332","owner_display_name":"","owner_user_id":"4007332","post_type_id":"1","score":"0","tags":"php|arrays|json|foreach","view_count":"46"} {"id":"25900051","title":"Batch file Nesting findstr inside a loop","body":"\u003cp\u003eI'm trying to run the prntmngr.vbs script. I'm trying to find strings like Printer name, server name, etc. There are about 80-200 printers on each server\nI want it to pipe the information in a csv format.\u003c/p\u003e\n\n\u003cp\u003eI'm having trouble nesting the findstr's and loops to get the information. I've pieced together some things.\u003c/p\u003e\n\n\u003cp\u003erunning the vbs gives me every printer and its information.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eThe VBS outputs every printer in a block of information as follows. Theres about 80 printers on this one server. I'll worry about scoping out to other servers, as long as I can get it to output the information.\n\nServer name lak-print01\nPrinter name 1015_Q1\nShare name 1015_Q1\nDriver name HP LaserJet 4350 PCL 5e\nPort name IP_192.168.15.249\nComment Trust \u0026amp; Savings\nLocation 43rd \u0026amp; Meridian\nPrint processor HPCPP5r1\nData type RAW\nParameters\nAttributes 8776\nPriority 1\nDefault priority 0\nAverage pages per minute 0\nPrinter status Other\nExtended printer status Offline\nDetected error state Offline\nExtended detected error state Other\n\nServer name lak-print01\nPrinter name 1014_Q1\nShare name 1014_Q1\nDriver name Canon iR3225 PCL5e\nPort name IP_192.168.14.245\nComment CSR and Teller Printer\nLocation Summit\nPrint processor WinPrint\nData type RAW\nParameters\nAttributes 10824\nPriority 1\nDefault priority 0\nAverage pages per minute 0\nPrinter status Idle\nExtended printer status Unknown\nDetected error state Unknown\nExtended detected error state Unknown\n\nServer name lak-print01\nPrinter name 1011_Q3\nShare name 1011_Q3\nDriver name HP LaserJet 4200 PCL 6\nPort name IP_192.168.11.247\nComment HP LaserJet 4200 not being used can delete\nLocation Spanaway\nPrint processor HPZPP3xy\nData type RAW\nParameters\nAttributes 8778\nPriority 1\nDefault priority 0\nAverage pages per minute 0\nPrinter status Idle\nExtended printer status Unknown\nDetected error state Unknown\nExtended detected error state Unknown\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003efor instance I'd love the output to be a csv that outputs the example vbs to\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003elak-print01,1015_Q1,HP LaserJet 4350 PCL 5e,IP_192.168.15.249,Trust \u0026amp; Savings,43rd \u0026amp; Meridian,Other\nlak-print01,1014_Q1,Canon iR3225 PCL5e,IP_192.168.14.245,CSR and Teller Printer,Summit,Idle\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003epulling find strings for printer server, printer name, printer driver, port name, comment, location, status\u003c/p\u003e\n\n\u003cp\u003eIve gotten a working script\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@echo off\n\nSetLocal enabledelayedexpansion\n\ncscript prnmngr.vbs -l -s lak-print01 \u0026gt;test.csv\n\nfor /f \"tokens=3*\" %%i in ('findstr /i /c:\"Printer name\" /i /c:\"Server name\" /i /c:\"Printer status\" /i /c:\"Driver name\" test.csv') do @echo %%i, \nendlocal\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThat outputs\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e1005_Q2,\nHP,\nOther,\nstatus,\nlak-print01,\n1004_Q2,\nHP,\nIdle,\nstatus,\nlak-print01,\n1004_Q1,\nHP,\nIdle,\nstatus,\nlak-print01,\n1003_Q2,\nHP,\nIdle,\nstatus,\nlak-print01,\n1003_Q1,\nHP,\nIdle,\nstatus,\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhich is great, however its only pulling the first word of the driver name even with the wildcard in the tokens. Now I just have to figure out how to make it carriage return after a for loop is complete to start a new line with new set of data.\u003c/p\u003e","accepted_answer_id":"25903604","answer_count":"2","comment_count":"3","creation_date":"2014-09-17 20:45:35.857 UTC","last_activity_date":"2014-09-20 05:24:18.607 UTC","last_edit_date":"2014-09-18 01:04:16.397 UTC","last_editor_display_name":"","last_editor_user_id":"4051285","owner_display_name":"","owner_user_id":"4051285","post_type_id":"1","score":"0","tags":"batch-file|for-loop|findstr","view_count":"432"} {"id":"3416187","title":"WPF UserControl Container C# VS 2010","body":"\u003cp\u003eI have a problem because y want to create a UserControl that can have a functionality as a container. \u003c/p\u003e\n\n\u003cp\u003eI used the link:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://support.microsoft.com/kb/813450/en-us?fr=1\" rel=\"nofollow noreferrer\"\u003ehttp://support.microsoft.com/kb/813450/en-us?fr=1\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003ebut i suposed that this part don't work for WPF 4.0:\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003e[Designer(\"System.Windows.Forms.Design.ParentControlDesigner, System.Design\", typeof(IDesigner))]\u003c/strong\u003e \npublic class UserControl1 : System.Windows.Forms.UserControl\n{\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e ...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e}\u003c/p\u003e\n\n\u003cp\u003ePlease Help Me¡¡¡¡¡\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2010-08-05 15:12:35.613 UTC","last_activity_date":"2010-08-27 16:17:09.48 UTC","last_edit_date":"2010-08-27 16:17:09.48 UTC","last_editor_display_name":"","last_editor_user_id":"210916","owner_display_name":"","owner_user_id":"412101","post_type_id":"1","score":"0","tags":"c#|wpf|visual-studio-2010|user-controls","view_count":"797"} {"id":"24288382","title":"Grails application doesn't start in debug mode","body":"\u003cp\u003eA grails application i work on can not start on debug mode. During start up, the application waits endlessly after the first \"Running Grails application\" message. Waited for a very long time but no error message is given. What can i do to find the source of the problem? With debug mode turned off, project starts. Tried with grails 2.3.6 and 2.4.1.\u003c/p\u003e","accepted_answer_id":"24288437","answer_count":"1","comment_count":"0","creation_date":"2014-06-18 14:35:35.173 UTC","last_activity_date":"2014-06-18 14:38:06.8 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"268997","post_type_id":"1","score":"0","tags":"grails","view_count":"163"} {"id":"25287869","title":"Get text of the div that contains more than one characters","body":"\u003cp\u003eImagine we want to get the \u003cstrong\u003ediv,span,p,etc\u003c/strong\u003e of HTML page that the \u003cstrong\u003eclass\u003c/strong\u003e OR \u003cstrong\u003eID\u003c/strong\u003e name of that , contains some keywords like:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003eone\u003c/code\u003e \u0026amp; \u003ccode\u003etwo\u003c/code\u003e \u0026amp; \u003ccode\u003ethree\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eFor example i have this HTML :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"this_one\"\u0026gt;\n Need this !\n\u0026lt;/div\u0026gt;\n\u0026lt;div id=\"some_three\"\u0026gt;\n Need this again !\n\u0026lt;/div\u0026gt;\n\u0026lt;span id=\"two_this\"\u0026gt;\n Need again\n\u0026lt;/span\u0026gt;\n\u0026lt;p class=\"NOT\"\u0026gt;\nNot want this\n\u0026lt;/p\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI mean i want to get text inside of the special tags like (div,p,span) that the ID or CLASS of them , contains my words like (one,two,...)\u003c/p\u003e\n\n\u003cp\u003eHow to detect them? \u003c/p\u003e\n\n\u003cp\u003eFor example, with \u003ccode\u003esimpledom\u003c/code\u003e , or \u003ccode\u003ePHPDOM\u003c/code\u003e, or any way you want.\u003c/p\u003e","accepted_answer_id":"25289157","answer_count":"5","comment_count":"0","creation_date":"2014-08-13 13:44:28.767 UTC","last_activity_date":"2014-08-13 16:08:07.817 UTC","last_edit_date":"2014-08-13 13:50:17.573 UTC","last_editor_display_name":"","last_editor_user_id":"2379215","owner_display_name":"","owner_user_id":"3937636","post_type_id":"1","score":"0","tags":"php|html|css|dom|simpledom","view_count":"149"} {"id":"27861816","title":"Matrix factorization with ALS has very slow performance with implicit zeros for large matrices in R","body":"\u003cp\u003eI want to perform a Matrix factorization with alternating least squares (ALS) in R. While the code is working fine for small matrices, it is incredible slow for larger matrices. I would appreciate any help in speeding up the process. I am using RRopen 8.01, therefore it is already running on multiple cores using \u003ccode\u003eMKL\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eI am utilizing a binary matrix as implicit feedback matrix. Furthermore I implemented a weighting matrix.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e## Matrix Factorization with Alternating Least Squares\n## R is u * v binary matrix,\n## W is u * v weighting matrix\n## U is u * k user feature matrix, \n## V is v * k item feature matrix\n## u is the number of users,\n## v is the number of items,\n## k is the number of features\n## iter is the number of iterations\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is what I did:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# implicit feedback data matrix.\nR \u0026lt;- matrix(nr=2, nc=5, data=rbinom(2*5,1, prob=.2))\nW \u0026lt;- matrix(nr=2, nc=5, data=rbinom(2*5,7, prob=.2))\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI set the following parameter:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ek \u0026lt;- 20\nits \u0026lt;- 10\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCreate the initial matrices for users and items\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# initial users matrix.\nU \u0026lt;- matrix(nr= nrow(R), nc=k, data=5 *rnorm(nrow(R)*k))\n# initial items matrix.\nV \u0026lt;- matrix(nr=k, nc=ncol(R), data=5* rnorm(ncol(R)*k))\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd now I perform the Matrix Factorization with ALS\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ew.err \u0026lt;- NULL\nfor(iter in 1:its) {\n # update users\n for(i in 1:nrow(R)) {\n U[i,] \u0026lt;- t(solve(V %*% (diag(R[i,])%*% t(V)) + 0.1 * diag(k),\n as.vector(V %*% as.vector(t(W[i,])%*% diag(R[i,])))))\n }\n # update items\n for(j in 1:ncol(R)){\n V[,j] \u0026lt;- solve(t(U) %*% (diag(R[,j]) %*% U) + 0.1 * diag(k),\n t(U) %*% (diag(R[,j]) %*% W[, j]))\n }\n R.hat \u0026lt;- U %*% V\n w.err[iter] \u0026lt;- sum((R* (W-U%*%V))^2) \n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003ccode\u003eR.hat\u003c/code\u003e is the desired end matrix.\n\u003ccode\u003ew.err\u003c/code\u003e is just a control for the errors over the iterations. Nice for plotting :)\u003c/p\u003e\n\n\u003cp\u003eThe code as it is works fine. Just when I increase the number of rows and columns in \u003ccode\u003eR\u003c/code\u003e (and \u003ccode\u003eW\u003c/code\u003e), the performance decrease significantly. While it is fine for let's say \u003ccode\u003enr=200, nr=500\u003c/code\u003e, it is already running for two hours for \u003ccode\u003enr=2000, nr=5000\u003c/code\u003e(and not finished yet) on an 8 core 2.67 Ghz machine.\u003c/p\u003e\n\n\u003cp\u003eI didn't use the \u003ccode\u003eNMF\u003c/code\u003e or the \u003ccode\u003eNMFN\u003c/code\u003e package since negative values are possible, accordingly it is not an non-negative MF. \nDoes anyone has an idea how to increase performance? Maybe I am just stupid an my code is nonsense, i would be happy if you could point out improvements.\u003c/p\u003e\n\n\u003cp\u003eI looked for similar questions but couldn't find one. Maybe I just overlooked it.\u003c/p\u003e","answer_count":"0","comment_count":"1","creation_date":"2015-01-09 13:36:27.307 UTC","favorite_count":"1","last_activity_date":"2015-01-09 13:36:27.307 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4324993","post_type_id":"1","score":"1","tags":"r|performance|matrix|alternating|matrix-factorization","view_count":"480"} {"id":"2268335","title":"Need to convert an object to XML and getting an error","body":"\u003cp\u003e\u003cstrong\u003eI have this class:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;Serializable()\u0026gt; _\n\n Public Class Bonder\n ''' \u0026lt;summary\u0026gt;\n ''' General information\n ''' \u0026lt;/summary\u0026gt;\n ''' \u0026lt;remarks\u0026gt;\u0026lt;/remarks\u0026gt;\n Public BonderName As String\n Public Serial_Number As String\n Public System_Type As String\n Public DM_Version As String\n Public RTS_Build As String\n Public RTS_Label As String\n Public CPU_Boot_Rom As String\n Public BondHead_1 As String = \"\"\n Public BondHead_2 As String = \"\"\n Public IP1 As String\n Public IP2 As String\n Public LoadedLeadFrameSetup As String\n Public LoadedMagazineHandler As String\n Public LoadedProcessProgram As String\n\n ''' \u0026lt;summary\u0026gt;\n ''' Configuration Information\n ''' \u0026lt;/summary\u0026gt;\n ''' \u0026lt;remarks\u0026gt;\u0026lt;/remarks\u0026gt;\n Public ConfigurationKVP As New ArrayList\n\n\n ''' \u0026lt;summary\u0026gt;\n ''' Devices on the Bonder\n ''' \u0026lt;/summary\u0026gt;\n ''' \u0026lt;remarks\u0026gt;\u0026lt;/remarks\u0026gt;\n Public DevicesOnBonder As New ArrayList\n\n ''' \u0026lt;summary\u0026gt;\n ''' RTS server information\n ''' \u0026lt;/summary\u0026gt;\n ''' \u0026lt;remarks\u0026gt;\u0026lt;/remarks\u0026gt;\n Public ServerInfo As New ArrayList\n\n\n ''' \u0026lt;summary\u0026gt;\n ''' RTS Options selected\n ''' \u0026lt;/summary\u0026gt;\n ''' \u0026lt;remarks\u0026gt;\u0026lt;/remarks\u0026gt;\n Public Options As New ArrayList\n\nEnd Class`\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eThis is my code to serialize it and put it into XML format:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Dim serializer As XmlSerializer\n serializer = New XmlSerializer(currentBonderSetup.GetType)\n Dim tw As New StreamWriter(\"c:\\book1.xml\")\n serializer.Serialize(tw, currentBonderSetup)\n tw.Close()\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhere am I going wrong? I think the issue is from the ArrayLists but I dont know how to solve it. the ArrayLists contain other objects that to have the Serializeable attribute.\u003c/p\u003e\n\n\u003cp\u003eHere are the other classes \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;Serializable()\u0026gt; _\nPublic Class Configs\n Public Item As String\n Public Value As String\n\n Public Sub New(ByVal key As String, ByVal result As String)\n Item = key\n Value = result\n End Sub\n\nEnd Class\n\n\u0026lt;Serializable()\u0026gt; _\nPublic Class BonderDevices\n Public Device_Type As String\n Public Instance As String\n Public Board_Rev As String\n Public Software_Ver As String\n Public Status As String\n Public Data As String\n\nEnd Class\n\u0026lt;Serializable()\u0026gt; _\nPublic Class ServerInfo\n Public Type As String\n Public Value As String\nEnd Class\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"2268476","answer_count":"2","comment_count":"2","creation_date":"2010-02-15 19:15:54.763 UTC","last_activity_date":"2010-02-15 21:31:53.86 UTC","last_edit_date":"2010-02-15 19:33:12.663 UTC","last_editor_display_name":"","last_editor_user_id":"240405","owner_display_name":"","owner_user_id":"240405","post_type_id":"1","score":"0","tags":".net|xml|vb.net|xml-serialization","view_count":"2265"} {"id":"36136854","title":"select from sorted list in bash","body":"\u003cp\u003eI have a directory of mostly version numbers, and I'm trying to determine the one that is version-sorted just before another particular one.\u003c/p\u003e\n\n\u003cp\u003eThe background here, for fear of making this an XY problem, is that these version numbers are derived from git tags for web content, and we symlink the \u003ccode\u003epublic_html\u003c/code\u003e directory for the site's virtualhost to the versioned directory.\u003c/p\u003e\n\n\u003cp\u003eIt looks something like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edrwxr-xr-x 8 graham www 17 Oct 17 2013 v2.0.10\ndrwxr-xr-x 8 graham www 17 Oct 17 2013 v2.0.11\ndrwxrwxr-x 8 graham www 17 Aug 29 2013 v2.0.8\ndrwxr-xr-x 8 brian www 17 Oct 17 2013 v2.0.9\n...\ndrwxr-xr-x 9 graham www 21 Aug 5 2015 v4.19.0\ndrwxr-xr-x 10 graham www 19 Dec 17 2014 v4.2.0\ndrwxr-xr-x 9 brian www 21 Aug 10 2015 v4.20.0\ndrwxr-xr-x 9 brian www 21 Aug 10 2015 v4.20.0-fail\ndrwxr-xr-x 9 graham www 21 Aug 11 2015 v4.20.1\n...\ndrwxr-xr-x 9 graham www 19 Mar 14 11:00 v4.35.0\ndrwxr-xr-x 9 graham www 19 Mar 14 13:28 v4.36.0\ndrwxr-xr-x 9 graham www 19 Mar 16 10:58 v4.36.1\nlrwxr-xr-x 1 graham www 11 Mar 16 11:13 public_html -\u0026gt; v4.36.1\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe symlink may not always be pointing at the most recent version (for example if we had to back out of a change). My goal is to find the properly-named directory (i.e. we'd skip \u003ccode\u003e*-fail\u003c/code\u003e and the like) that is version sorted before the one that \u003ccode\u003epublic_html\u003c/code\u003e points to.\u003c/p\u003e\n\n\u003cp\u003eI'm in FreeBSD, so my \u003ccode\u003estat\u003c/code\u003e command works nicely like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eread target \u0026lt;\u0026lt;\u0026lt;\"$(stat -f'%Y' \"${base}/public_html\")\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIf you're in Linux, I gather you could get the same effect with something like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etarget=\"$(stat -c '%N' \"${base}/public_html\")\"\ntarget=\"${target#* -\u0026gt; ?}\"; target=\"${target%?}\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut from here, I'm not sure how I gather the version number. Note that I'm in FreeBSD, so my \u003ccode\u003esort\u003c/code\u003e command does not have a \u003ccode\u003e-V\u003c/code\u003e option. I've tried two methods.\u003c/p\u003e\n\n\u003cp\u003eThe first is to process a while loop on the directory contents:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eshopt -s extglob\nwhile read this; do\n [[ \"$this\" = \"$target\" ]] \u0026amp;\u0026amp; break\n previous=\"$this\" \ndone \u0026lt; $(ls -1d v+([0-9]).+([0-9]).+([0-9]) | sort -n -t . -k1,1 -k2,2 -k3,3)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe second is pretty similar, parsing an array instead:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eshopt -s extglob\na=( $(ls -1d v+([0-9]).+([0-9]).+([0-9]) | sort -n -t . -k1,1 -k2,2 -k3,3) )\nfor (( n=0; n\u0026lt;${#a[@]}; n++ )); do\n [[ \"${a[$n]}\" = \"$target\" ]] \u0026amp;\u0026amp; break\n previous=\"${a[$n]}\"\ndone\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhere both of these fall down is the \u003ccode\u003esort\u003c/code\u003e, in which the first field does not appear to be sorted. I suspect it's because it's not numeric (with \"v\" at the start, delimited by \".\"). Is there a way I can specify multiple delimiters, or otherwise \"ignore\" the \u003ccode\u003ev\u003c/code\u003e somehow?\u003c/p\u003e\n\n\u003cp\u003eOr is there a better way to handle this than using the external \u003ccode\u003esort\u003c/code\u003e command, which has non-portable options? Something internal to bash perhaps?\u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","answer_count":"3","comment_count":"0","creation_date":"2016-03-21 16:41:17.303 UTC","last_activity_date":"2016-03-21 20:19:37.377 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1172700","post_type_id":"1","score":"1","tags":"bash|sorting","view_count":"32"} {"id":"47501583","title":"List item height changes when item image is set","body":"\u003cp\u003eI want to have a list view with items that consist of an image thumbnail on the left and some text on the right. The list view is declared like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;ListView\n android:id=\"@+id/imageList\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\" /\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe item itself like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"utf-8\"?\u0026gt;\n\u0026lt;LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"?android:attr/listPreferredItemHeight\"\n android:orientation=\"horizontal\"\u0026gt;\n\n \u0026lt;ImageView\n android:id=\"@+id/imageView\"\n android:layout_width=\"0dp\"\n android:layout_height=\"match_parent\"\n android:layout_weight=\"1\"\n android:adjustViewBounds=\"false\"\n android:scaleType=\"fitCenter\"\n app:srcCompat=\"@mipmap/ic_cross\" /\u0026gt;\n\n \u0026lt;TextView\n android:id=\"@+id/textView\"\n android:layout_width=\"0dp\"\n android:layout_height=\"match_parent\"\n android:layout_weight=\"5\"\n android:gravity=\"center_vertical|start\"\n android:text=\"TextView\" /\u0026gt;\n\u0026lt;/LinearLayout\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow, at some point in my code I assign an adapter to a \u003ccode\u003eListView\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eval lv = findViewById\u0026lt;ListView\u0026gt;(R.id.imageList)\nlv.adapter = ImageListBinder(this, cachedImages!!)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd \u003ccode\u003eImageListBinder.getView\u003c/code\u003e looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eoverride fun getView(position: Int, convertView: View?, parent: ViewGroup?): View\n{\n val view = convertView ?: createView()\n val holder = view.tag as ViewHolder\n\n holder.textView.text = \"Some text\"\n val bmp = BitmapFactory.decodeFile(images[position].localPath.absolutePath)\n holder.imageView.setImageBitmap(bmp)\n\n return view\n}\n\nprivate fun createView() : View\n{\n val view = inflater.inflate(R.layout.list_row, null)\n view.tag = ViewHolder(view.findViewById(R.id.imageView), view.findViewById(R.id.textView))\n return view\n}\n\nprivate class ViewHolder(val imageView: ImageView, val textView: TextView)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe issue is that when those images get assigned to ImageViews, the height of the list item becomes equal to the original height of the image (so if I add the 100x1600 image to the list, the item height becomes 1600 pixels) despite the fact that \u003ccode\u003eLinearLayout\u003c/code\u003e's height is fixed and \u003ccode\u003eImageView\u003c/code\u003e's height is set to \u003ccode\u003ematch_parent\u003c/code\u003e:\n\u003ca href=\"https://i.stack.imgur.com/crmVB.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/crmVB.png\" alt=\"looong list items\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eWhat am I doing wrong here? How to make list item height to stay as specified?\u003c/p\u003e\n\n\u003cp\u003eI tried reading ImageView's height and width before calling the \u003ccode\u003esetImageBitmap\u003c/code\u003e, followed by resetting them after, that didn't help, I also tried setting the \u003ccode\u003eandroid:adjustViewBounds=\"false\"\u003c/code\u003e and \u003ccode\u003eandroid:scaleType=\"fitCenter\"\u003c/code\u003e which didn't change anything either. The only thing that worked so far was setting the \u003ccode\u003eandroid:layout_height=\"?android:attr/listPreferredItemHeight\"\u003c/code\u003e on the \u003ccode\u003eImageView\u003c/code\u003e, but I don't want to set image view height so hard. At least no until I understand why I see what I see now.\u003c/p\u003e","answer_count":"3","comment_count":"4","creation_date":"2017-11-26 22:16:28.387 UTC","last_activity_date":"2017-11-27 12:29:04.413 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"31782","post_type_id":"1","score":"1","tags":"android|listview|kotlin","view_count":"43"} {"id":"16779737","title":"Can not figure out the report of git blame","body":"\u003cp\u003eI am trying out \u003ccode\u003egit blame\u003c/code\u003e on a specific file. If I understand correctly it shows all modifications made to the file and by who.\u003cbr\u003e\nBut when I run the command the results do not appear in an orderly manner. I have to search the entries to figure out which was the last change by dates.\u003cbr\u003e\nWhat is the order that the results are reported? How could I get the report according to the order of modification?\u003c/p\u003e","accepted_answer_id":"16779777","answer_count":"2","comment_count":"0","creation_date":"2013-05-27 19:55:48.863 UTC","last_activity_date":"2013-05-27 23:29:48.623 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"384706","post_type_id":"1","score":"0","tags":"git","view_count":"173"} {"id":"15074997","title":"routes redirect in angularJS","body":"\u003cp\u003eSo I have got the usual routing thing, but now i would like to ask if i can redirect to a different page, but before this happens I would like to call a function.\u003c/p\u003e\n\n\u003cp\u003eThats what i have so far. but its not working properly.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ewhen('/person/remove/:Id', {\n resolve: {\n delay: function ($q, $route, person) {\n var currentIndex = $route.current.params.Id;\n var brochure = person.get(currentIndex);\n person.remove(brochure);\n }\n },\n redirectTo: '/person'\n})\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"15075660","answer_count":"2","comment_count":"0","creation_date":"2013-02-25 19:36:06.437 UTC","last_activity_date":"2013-02-25 20:15:30.31 UTC","last_edit_date":"2013-02-25 19:43:05.777 UTC","last_editor_display_name":"","last_editor_user_id":"491075","owner_display_name":"","owner_user_id":"1164646","post_type_id":"1","score":"0","tags":"javascript|angularjs","view_count":"739"} {"id":"43441683","title":"What is Swagger, Swashbuckle and Swashbuckle UI","body":"\u003cp\u003eThis is my understanding: \u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eSwagger is a notation/rules to write documentation. But why is it called a framework (like Angular/MVC)?\u003c/li\u003e\n\u003cli\u003eSwashbuckle is a program (JavaScript?) that generates the documentation (based on Swagger rules).\u003c/li\u003e\n\u003cli\u003eSwagger UI displays the documentation. It uses Swashbuckle to do this.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eIs this information correct? If not can someone explain in simple terms what Swagger, Swashbuckle, and Swashbuckle UI mean? \u003c/p\u003e\n\n\u003cp\u003eAlso, what do I lose as an API developer if I do not use this?\u003c/p\u003e","accepted_answer_id":"44031815","answer_count":"1","comment_count":"2","creation_date":"2017-04-16 20:13:57.343 UTC","last_activity_date":"2017-05-18 19:42:23.357 UTC","last_edit_date":"2017-05-18 19:42:23.357 UTC","last_editor_display_name":"","last_editor_user_id":"4560200","owner_display_name":"","owner_user_id":"1501191","post_type_id":"1","score":"0","tags":"swagger|swagger-ui|swashbuckle","view_count":"268"} {"id":"10079229","title":"For XMLparser in xCode, what string name do i test against?","body":"\u003cp\u003eI've been reading up on XML and still can't figure this part. It's complicated because there are more than one similar line. For this second line from the xml file how do i test the elementName? \"link\" doesn't work, nor \"preview\" nor lots of others i tried\u003c/p\u003e\n\n\u003cp\u003eXML file:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;link rel=\"alternate\" type=\"text/html\" href=\"http://itunes.apple.com/gb/app/do-not-press-the-red-button/id317885341?mt=8\u0026amp;amp;uo=2\"/\u0026gt;\n\n\u0026lt;link title=\"Preview\" rel=\"enclosure\" type=\"image/jpeg\" href=\"http://abc.jpg\" im:assetType=\"preview\"\u0026gt;\u0026lt;im:duration\u0026gt;0\u0026lt;/im:duration\u0026gt;\u0026lt;/link\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eXcode project:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003estatic NSString *kImageStr = @\"link\";\nif ([elementName isEqualToString:kImageStr]){\n //parse it\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethanks!\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-04-09 20:15:27.6 UTC","last_activity_date":"2012-04-09 20:44:18.157 UTC","last_edit_date":"2012-04-09 20:40:26.053 UTC","last_editor_display_name":"","last_editor_user_id":"456851","owner_display_name":"","owner_user_id":"368994","post_type_id":"1","score":"1","tags":"objective-c|ios|xml-parsing","view_count":"194"} {"id":"44972091","title":"laravel 5.4 how to write select from multi table query","body":"\u003cp\u003eHow am using laravel 5.4,\u003c/p\u003e\n\n\u003cp\u003eto write sql query to get data from multiple tables for below query\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eselect l.party_id,l.container_id,p.party_name from \n`tbl_container_lease` l, `tbl_partys` p \nwhere l.`party_id` = p.`id` and l.`user_id` = 5\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow am using this\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eContainerlease::whereHas('getpartys',function($q){})\n-\u0026gt;where('user_id','=',$user_id)\n-\u0026gt;get();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut it is getting too confuse to use \u003c/p\u003e\n\n\u003cp\u003eis there any better alternative to use this query by using model..\u003c/p\u003e","accepted_answer_id":"44973358","answer_count":"2","comment_count":"1","creation_date":"2017-07-07 13:31:24.027 UTC","last_activity_date":"2017-07-07 15:35:36.923 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3602846","post_type_id":"1","score":"2","tags":"php|mysql|laravel|laravel-5|laravel-5.4","view_count":"176"} {"id":"30320679","title":"Python boto bucket.list() return \"no element found'","body":"\u003cp\u003eI am trying to get the last file uploaded to AmazonS3. It seems the only way is to get all keys metadata, sort by date then load the right one by name.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003econn = S3Connection(access_key, secret_key, calling_format=OrdinaryCallingFormat())\n\nbucket = conn.get_bucket(bucket_name, validate=False)\n\nfor item in conn.make_request(\"HEAD\", bucket_name).getheaders():\n print('bucket header -\u0026gt;',item)\n\nboto.set_stream_logger('paws')\n\nfor current_key in bucket.list():\n print('in loop')\n print(current_key)\n #current_key = bucket.get_key(current_key.name)\n #print(current_key.get_metadata('revision'))\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is the console result :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ebucket header -\u0026gt; ('x-amz-id-2', '25NUgCAlVd2PMfzIgEI0bzpvNBkXasFL9cpxpf3wUJbxnLBCuf0VLf1wiul13Z2lF06qNwfF3ss=')\nbucket header -\u0026gt; ('x-amz-request-id', 'AF98E73E5BCF1838')\nbucket header -\u0026gt; ('Date', 'Tue, 19 May 2015 08:21:29 GMT')\nbucket header -\u0026gt; ('Last-Modified', 'Tue, 28 Oct 2014 11:30:14 GMT')\nbucket header -\u0026gt; ('ETag', '\"d41d8cd98f00b204e9800998ecf8427e\"')\nbucket header -\u0026gt; ('Accept-Ranges', 'bytes')\nbucket header -\u0026gt; ('Content-Type', 'application/octet-stream')\nbucket header -\u0026gt; ('Content-Length', '0')\nbucket header -\u0026gt; ('Server', 'AmazonS3')\n2015-05-19 10:21:25,180 paws [DEBUG]:path=/GA-Exports/Events_3112/\n2015-05-19 10:21:25,180 paws [DEBUG]:auth_path=/GA-Exports/Events_3112/\n2015-05-19 10:21:25,180 paws [DEBUG]:Method: GET\n2015-05-19 10:21:25,180 paws [DEBUG]:Path: /GA-Exports/Events_3112/\n2015-05-19 10:21:25,180 paws [DEBUG]:Data: \n2015-05-19 10:21:25,180 paws [DEBUG]:Headers: {}\n2015-05-19 10:21:25,183 paws [DEBUG]:Host: s3.amazonaws.com:443\n2015-05-19 10:21:25,183 paws [DEBUG]:Port: 443\n2015-05-19 10:21:25,183 paws [DEBUG]:Params: {}\n2015-05-19 10:21:25,183 paws [DEBUG]:establishing HTTPS connection: host=s3.amazonaws.com, kwargs={'timeout': 70, 'port': 443}\n2015-05-19 10:21:25,200 paws [DEBUG]:Token: None\n2015-05-19 10:21:25,200 paws [DEBUG]:StringToSign:\nGET\n\n\nTue, 19 May 2015 08:21:25 GMT\n/GA-Exports/Events_3112/\n2015-05-19 10:21:25,200 paws [DEBUG]:Signature:\nAWS [_accesskey_]:oIo0Qk6pCn+pMPzarqRs4Pb3AvE=\n2015-05-19 10:21:25,200 paws [DEBUG]:Final headers: {'Date': 'Tue, 19 May 2015 08:21:25 GMT', 'User-Agent': 'Boto/2.38.0 Python/3.4.3 Windows/8', 'Authorization': 'AWS [_accesskey_]:oIo0Qk6pCn+pMPzarqRs4Pb3AvE=', 'Content-Length': '0'}\n2015-05-19 10:21:25,669 paws [DEBUG]:Response headers: [('x-amz-id-2', 'FzO+CIljQO4DKnEusv0Lm/qns5C1hP+REZ0YlYp+TV+XlxT6AKLacHG//UWMOsKGz1vuuVIZ2t4='), ('x-amz-request-id', '52D92D3D21FFD93D'), ('Date', 'Tue, 19 May 2015 08:21:30 GMT'), ('Last-Modified', 'Tue, 28 Oct 2014 11:30:14 GMT'), ('ETag', '\"d41d8cd98f00b204e9800998ecf8427e\"'), ('Accept-Ranges', 'bytes'), ('Content-Type', 'application/octet-stream'), ('Content-Length', '0'), ('Server', 'AmazonS3')]\n2015-05-19 10:21:25,669 paws [DEBUG]:b''\nTraceback (most recent call last):\n File \"D:\\Python\\lib\\xml\\sax\\expatreader.py\", line 207, in feed\n self._parser.Parse(data, isFinal)\nxml.parsers.expat.ExpatError: no element found: line 1, column 0\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"C:\\Users\\Francois\\OneDrive\\IDE\\Workspace\\eclipse\\Python_test\\etltest.py\", line 33, in \u0026lt;module\u0026gt;\n for current_key in bucket.list():\n File \"D:\\Python\\lib\\site-packages\\boto\\s3\\bucketlistresultset.py\", line 34, in bucket_lister\n encoding_type=encoding_type)\n File \"D:\\Python\\lib\\site-packages\\boto\\s3\\bucket.py\", line 472, in get_all_keys\n '', headers, **params)\n File \"D:\\Python\\lib\\site-packages\\boto\\s3\\bucket.py\", line 406, in _get_all\n xml.sax.parseString(body, h)\n File \"D:\\Python\\lib\\xml\\sax\\__init__.py\", line 46, in parseString\n parser.parse(inpsrc)\n File \"D:\\Python\\lib\\xml\\sax\\expatreader.py\", line 107, in parse\n xmlreader.IncrementalParser.parse(self, source)\n File \"D:\\Python\\lib\\xml\\sax\\xmlreader.py\", line 125, in parse\n self.close()\n File \"D:\\Python\\lib\\xml\\sax\\expatreader.py\", line 217, in close\n self.feed(\"\", isFinal = 1)\n File \"D:\\Python\\lib\\xml\\sax\\expatreader.py\", line 211, in feed\n self._err_handler.fatalError(exc)\n File \"D:\\Python\\lib\\xml\\sax\\handler.py\", line 38, in fatalError\n raise exception\nxml.sax._exceptions.SAXParseException: \u0026lt;unknown\u0026gt;:1:0: no element found\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAlso the bucket.get_all_keys() raise the same exception...\u003c/p\u003e\n\n\u003cp\u003eIs it possible I have the permissions to get a specific file by name but not the permissions to list the bucket keys ?\u003c/p\u003e","accepted_answer_id":"30369635","answer_count":"1","comment_count":"0","creation_date":"2015-05-19 08:41:12.167 UTC","last_activity_date":"2015-05-21 09:22:50.257 UTC","last_edit_date":"2015-05-19 09:16:40.893 UTC","last_editor_display_name":"","last_editor_user_id":"4890728","owner_display_name":"","owner_user_id":"4890728","post_type_id":"1","score":"0","tags":"python|amazon-s3|boto","view_count":"500"} {"id":"35508650","title":"Countif loop on external excel sheets","body":"\u003cp\u003eCurrently i'm trying to consolidate the information from 3000 different xls sheets into one file.\u003c/p\u003e\n\n\u003cp\u003eThe master file looks like this\n\u003ca href=\"http://i.imgur.com/lQWxQxO.png\" rel=\"nofollow\"\u003ehttp://i.imgur.com/lQWxQxO.png\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eAll the other excels are contained in 1 folder like this. They are only 1 sheet each.\n\u003ca href=\"http://i.imgur.com/VxmaLCf.png\" rel=\"nofollow\"\u003ehttp://i.imgur.com/VxmaLCf.png\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eand lastly would be that the information inside the files are like this\u003c/p\u003e\n\n\u003cp\u003ehttp:// i.imgur.com/w3erGgN.png\u003c/p\u003e\n\n\u003cp\u003eI'm trying to count the number of \"pos\", \"neg\" and \"neu\" inside the files and consolidate on the master sheet and the current way i'm doing is to manually input countif codes while leaving the document open. Is there any other way to make it faster? I've tried sumproduct but it never works. it only returns 0 as i think it might be the wildcard problem.\u003c/p\u003e\n\n\u003cp\u003eI think the following code could be of use to me but I'm not sure how to code it such that it works accordingly.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSub RunCodeOnAllXLSFiles()\nDim lCount As Long\nDim wbResults As Workbook\nDim wbCodeBook As Workbook\nApplication.ScreenUpdating = False\nApplication.DisplayAlerts = False\nApplication.EnableEvents = False\n\nOn Error Resume Next\n Set wbCodeBook = ThisWorkbook\n With Application.FileSearch\n .NewSearch\n 'Change path to suit\n .LookIn = \"C:\\MyDocuments\\TestResults\"\n .FileType = msoFileTypeExcelWorkbooks\n 'Optional filter with wildcard\n '.Filename = \"Book*.xls\"\n If .Execute \u0026gt; 0 Then 'Workbooks in folder\n For lCount = 1 To .FoundFiles.Count 'Loop through all\n 'Open Workbook x and Set a Workbook variable to it\n Set wbResults = Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0)\n\n 'DO YOUR CODE HERE\n\n wbResults.Close SaveChanges:=False\n Next lCount\n End If\n End With\nOn Error GoTo 0\nApplication.ScreenUpdating = True\nApplication.DisplayAlerts = True\nApplication.EnableEvents = True\nEnd Sub\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ePlease help.\u003c/p\u003e","answer_count":"1","comment_count":"5","creation_date":"2016-02-19 15:16:50.487 UTC","last_activity_date":"2016-02-19 18:08:55.037 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5843545","post_type_id":"1","score":"-5","tags":"excel|vba|excel-vba","view_count":"76"} {"id":"42873688","title":"Instagram-like photo browser and a camera feature in android","body":"\u003cp\u003eI am developing one application, I am trying to develop same like instagram photo / video capture tool. I found very nice tutorial sample in iOS : \u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://github.com/ytakzk/Fusuma\" rel=\"noreferrer\"\u003ehttps://github.com/ytakzk/Fusuma\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eDoes anybody know something similar library for android as well? \u003c/p\u003e\n\n\u003cp\u003ePlease help. I have done with camera surfaceview. but its not stable, various devices have crashes.\u003c/p\u003e","answer_count":"0","comment_count":"1","creation_date":"2017-03-18 11:20:39.027 UTC","favorite_count":"4","last_activity_date":"2017-03-18 11:20:39.027 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4362863","post_type_id":"1","score":"5","tags":"android|camera|instagram|surfaceview|video-capture","view_count":"154"} {"id":"16669194","title":"What is wrong with the following jQuery","body":"\u003cp\u003eThe following jQuery does nothing.\nDid I miss a comma or something?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;script\u0026gt;\n$(\".link\u0026lt;? echo $counter; ?\u0026gt;\").click(function () {\n $('.sub').toggle(function () {\n $(\".sub\u0026lt;? echo $counter; ?\u0026gt;\").animate({\n height: ($(this).parent().height() * \u0026lt;? echo(count($$vari)); ?\u0026gt; ) + 20\n }, 1000);\n }, function () {\n $(\".sub\u0026lt;? echo $counter; ?\u0026gt;\").animate({\n height: 0\n }, 1000);\n });\n}); \n\u0026lt;/script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe console does not trow any error's and when I change the code to \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;script\u0026gt;\n$(\".link\u0026lt;? echo $counter; ?\u0026gt;\").click(function() {\n$(\".sub\u0026lt;? echo $counter; ?\u0026gt;\").animate({\nheight: ($(this).parent().height() * \u0026lt;? echo (count($$vari)); ?\u0026gt;) + 20\n}, 1000 );\n});\n\u0026lt;/script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe script works (except for the toggle ofcource)\u003c/p\u003e","accepted_answer_id":"16669244","answer_count":"2","comment_count":"1","creation_date":"2013-05-21 11:43:52.747 UTC","last_activity_date":"2013-05-21 11:52:48.42 UTC","last_edit_date":"2013-05-21 11:52:48.42 UTC","last_editor_display_name":"","last_editor_user_id":"1439904","owner_display_name":"","owner_user_id":"1439904","post_type_id":"1","score":"-1","tags":"jquery|click|jquery-animate|toggle","view_count":"59"} {"id":"28122494","title":"Poor Performance in Rails App","body":"\u003cp\u003eLooking for ways to improve the particularly bad performance I'm getting from my rails application. Here's the code from the page in question:\u003c/p\u003e\n\n\u003cp\u003enotifications_controller.rb\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass NotificationsController \u0026lt; ApplicationController\n def index\n @questions = Question.all.order(:updated_at =\u0026gt; :desc)\n @users = User.all\n @answers = Answer.all.order(:updated_at =\u0026gt; :desc)\n end\nend\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand here's the corresponding view. I know it's ugly but it's working.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div\u0026gt;\n\u0026lt;% if current_user %\u0026gt;\n \u0026lt;div class=\"notifications-added col-md-8\"\u0026gt;\n \u0026lt;h4 class=\"col-md-offset-2\"\u0026gt;Approvals \u0026amp;amp; Answers\u0026lt;/h4\u0026gt;\n \u0026lt;span class=\"text-center\"\u0026gt;\n \u0026lt;% current_user.questions.order(id: :desc).each do |question| %\u0026gt;\n \u0026lt;% if question.approved == true %\u0026gt;\n Your question, \u0026lt;%= link_to \"#{question.title}\", question_path(question) %\u0026gt;, has been \u0026lt;span class=\"notifications\"\u0026gt;approved.\u0026lt;/span\u0026gt;\u0026lt;br\u0026gt;\n \u0026lt;% end %\u0026gt;\n\n \u0026lt;% question.answers.each do |answer| %\u0026gt;\n \u0026lt;%= answer.user.name %\u0026gt; \u0026lt;span class=\"notifications\"\u0026gt;added an answer\u0026lt;/span\u0026gt; to your question, \u0026lt;%= link_to \"#{question.title}\", question_path(question) %\u0026gt;.\u0026lt;br\u0026gt;\n \u0026lt;% end %\u0026gt;\n \u0026lt;% end %\u0026gt;\n \u0026lt;/span\u0026gt;\n \u0026lt;/div\u0026gt;\n\n \u0026lt;div class=\"notifications-voted col-md-4\"\u0026gt;\n \u0026lt;h4 class=\"text-center\"\u0026gt;Votes\u0026lt;/h4\u0026gt;\u0026lt;span\u0026gt;\u0026lt;/span\u0026gt;\n \u0026lt;% current_user.answers.order(updated_at: :desc).each do |answer| %\u0026gt; \n \u0026lt;% @users.each do |user| %\u0026gt;\n \u0026lt;% if user.voted_up_on? answer %\u0026gt;\n \u0026lt;%= user.name %\u0026gt; \u0026lt;span class=\"notifications\"\u0026gt;upvoted\u0026lt;/span\u0026gt; your answer to \u0026lt;%= link_to \"#{Question.find(answer.question_id).title}\", question_path(answer.question_id) %\u0026gt;.\u0026lt;br\u0026gt;\n \u0026lt;% elsif user.voted_down_on? answer %\u0026gt;\n \u0026lt;%= user.name %\u0026gt; \u0026lt;span class=\"notifications\"\u0026gt;downvoted\u0026lt;/span\u0026gt; your answer to \u0026lt;%= link_to \"#{Question.find(answer.question_id).title}\", question_path(answer.question_id) %\u0026gt;. \u0026lt;br\u0026gt;\n \u0026lt;% end %\u0026gt;\n \u0026lt;% end %\u0026gt;\n \u0026lt;% end %\u0026gt; \n \u0026lt;/div\u0026gt; \n \u0026lt;% end %\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI think I'm just sorting too much. The page is taking a long time to load. What's the low hanging fruit for improving my performance? Any thoughts? Thanks in advance.\u003c/p\u003e","answer_count":"2","comment_count":"1","creation_date":"2015-01-24 05:08:25.753 UTC","last_activity_date":"2015-01-24 14:11:46.443 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1378252","post_type_id":"1","score":"0","tags":"ruby-on-rails|performance|sorting","view_count":"70"} {"id":"2643821","title":"Playing video in a Customview like iPad feature","body":"\u003cp\u003eWhen we call MPMoviePlayerController.play method, the movie player is opened and the video is played in a separate full screen. is it possible to play a video in a custom view, that is I have an image added on a view, when this image is clicked, the image has to be removed and the video has to play there itself as the feature in iPad.\u003c/p\u003e","accepted_answer_id":"2705672","answer_count":"2","comment_count":"0","creation_date":"2010-04-15 08:43:32.933 UTC","last_activity_date":"2010-04-24 18:34:46.56 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"75504","post_type_id":"1","score":"1","tags":"iphone","view_count":"337"} {"id":"23512869","title":"tooltip plugin with selectors","body":"\u003cp\u003ehow can I use tooltip plugin with JQuery selector? \nI used this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;span class=\"tooltip\" title=\"You can use letters\"\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut I want to write it with selectors, I did this: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;script\u0026gt;\n $('#name1').ready(function() {\n Tipped.create('#name1', 'create-tooltip');\n });\n\n\n \u0026lt;/script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut it does'nt work, can anyone help me with it?\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2014-05-07 08:40:45.387 UTC","last_activity_date":"2014-05-07 08:43:40.407 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3223551","post_type_id":"1","score":"0","tags":"javascript|jquery","view_count":"33"} {"id":"17590586","title":"How can I extract both static data and formulae from excel?","body":"\u003cp\u003eI am looking to extract both data and formulae from excel files. For example if there was an excel file with the following in cells A1, A2, A3:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e2 3 5\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhere 5 was a calculated field with the formula\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e=(A1 + A2)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat would be the best tool/approach to extract data and formulae in such a way that I get the static data and the calculated fields (and the relationship between them)? \u003c/p\u003e","accepted_answer_id":"17590746","answer_count":"1","comment_count":"1","creation_date":"2013-07-11 10:06:19.187 UTC","last_activity_date":"2013-07-12 05:07:48.693 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"779526","post_type_id":"1","score":"1","tags":"excel","view_count":"85"} {"id":"26157825","title":"jquery smart banner ios 7 doesn't show","body":"\u003cp\u003eI have problem with jquery smart banner for ios 7.\u003c/p\u003e\n\n\u003cp\u003eI see smart banner on my website for ios app (from iphone), but when i click close it disappear which is ok.\nBut when i clear cache and cookies it still doesn't show.\u003c/p\u003e\n\n\u003cp\u003eAny solution for this? What to do to again show?\u003c/p\u003e\n\n\u003cp\u003eThank you.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-10-02 09:18:55.433 UTC","last_activity_date":"2014-10-17 07:11:08.7 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3788491","post_type_id":"1","score":"0","tags":"jquery|smartbanner","view_count":"553"} {"id":"13224935","title":"Execute Javascript automatically?","body":"\u003cp\u003eI have this script that greys out the entire website and brings up a dialogue box when the text 'showPopUp' is clicked. My question is how can i get this script to execute automatically on page load?\u003c/p\u003e\n\n\u003cp\u003eScript:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;script type=\"text/javascript\"\u0026gt;\n function showPopUp(el) {\n var cvr = document.getElementById(\"cover\")\n var dlg = document.getElementById(el)\n cvr.style.display = \"block\"\n dlg.style.display = \"block\"\n if(document.body.style.overflow = \"hidden\") {\n cvr.style.width = \"1024\"\n cvr.style.height = \"100\u0026amp;#37;\"\n }\n }\n\n function closePopUp(el) {\n var cvr = document.getElementById(\"cover\")\n var dlg = document.getElementById(el)\n cvr.style.display = \"none\"\n dlg.style.display = \"none\"\n document.body.style.overflowY = \"scroll\"\n }\n\u0026lt;/script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"3","comment_count":"1","creation_date":"2012-11-05 01:45:33.34 UTC","last_activity_date":"2012-11-05 01:54:21.45 UTC","last_edit_date":"2012-11-05 01:47:37.35 UTC","last_editor_display_name":"","last_editor_user_id":"298479","owner_display_name":"","owner_user_id":"1789563","post_type_id":"1","score":"0","tags":"javascript","view_count":"92"} {"id":"22615555","title":"Android - Turning on \"Don't keep activities\" in Android Developer options duplicates my FragmentActivity","body":"\u003cp\u003eI was getting an error from a few users of my application that when clicking a listItem from my MainActivity would take them to a DetailActivity (which is the desired outcome), but if they press back or up, they would see a MainActivity that had everything duplicated (listView, menuItems). Someone suggested that maybe the activity is being killed because of memory so I went into Developer Options on my phone and turned on \"Don't keep activities\". This allowed me to replicate the problem. Now I have to figure out why everything is duplicated, but I'm a little stuck with which direction to go into. It's not like I'm creating the menu and layout in my onResume(). I'm doing everything in onCreate(). Does anyone have any suggestions on gracefully recovering from an activity that is not kept?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eEDIT 1:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eIn response to the comment from @Tomer Mor\u003c/p\u003e\n\n\u003cp\u003eI have three activities total. A -\u003e B-\u003e C\u003c/p\u003e\n\n\u003cp\u003eMainActivity in this case is B and DetailActivity is C. My activity A is a \"LoginActivity\" that get's finish()'d after I successfully \"login\".\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eEDIT 2:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eIf it helps, my MainActivity is a FragmentActivity.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eEDIT 3:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eIn response to @Doctoror Drive. My MainActivity extends FragmentActivity. MainActivity adds MyFragment.java \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Override\nprotected void onCreate(Bundle savedInstanceState) {\n\n super.onCreate(savedInstanceState);\n\n setUpActionBar();\n Toast.makeText(this, this.getClass().getSimpleName(), 1).show();\n setContentView(R.layout.my_placement);\n\n myFragment = new MyFragment();\n\n FragmentManager fragmentManager = getSupportFragmentManager();\n FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();\n fragmentTransaction.add(R.id.fragment_container, myFragment);\n\n fragmentTransaction.commit();\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI put a log inside of my onCreate of \u003ccode\u003eMainActivity extends FragmentActivity\u003c/code\u003e and it get's called \u003cstrong\u003eONCE.\u003c/strong\u003e I put a \u003ccode\u003eLog.d()\u003c/code\u003e in my \u003ccode\u003eonCreateOptionsMenu()\u003c/code\u003e of of \u003ccode\u003eMyFragment.java\u003c/code\u003e and it shows \u003cstrong\u003eTWICE!\u003c/strong\u003e So it IS being called twice, but I'm not sure how if it's only being created once.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eEDIT 4:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e03-24 14:17:37.038: E/MainActivity(26486): onCreate hit!\n03-24 14:17:37.048: D/SherlockFragmentActivity(26486): [supportInvalidateOptionsMenu]\n03-24 14:17:37.048: D/SherlockFragmentActivity(26486): [invalidateOptionsMenu]\n03-24 14:17:37.048: D/ActionBarSherlock(26486): [dispatchInvalidateOptionsMenu]\n03-24 14:17:37.048: E/MyFragment(26486): onActivityCreated!\n03-24 14:17:37.048: D/SherlockFragmentActivity(26486): [supportInvalidateOptionsMenu]\n03-24 14:17:37.048: D/SherlockFragmentActivity(26486): [invalidateOptionsMenu]\n03-24 14:17:37.048: D/ActionBarSherlock(26486): [dispatchInvalidateOptionsMenu]\n03-24 14:17:37.048: E/MyFragment(26486): onActivityCreated!\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eEDIT 5:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Override\npublic void onActivityCreated(Bundle savedInstanceState) {\n savedInstanceState=null;\n super.onActivityCreated(savedInstanceState);\n\n setHasOptionsMenu(true);\n\n adapter = AnimalList.getAnimalAdapter();\n setListAdapter(adapter);\n\n\n\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"3","creation_date":"2014-03-24 16:48:07.387 UTC","favorite_count":"1","last_activity_date":"2014-03-25 16:26:37.567 UTC","last_edit_date":"2014-03-25 16:26:37.567 UTC","last_editor_display_name":"user2676468","owner_display_name":"user2676468","post_type_id":"1","score":"1","tags":"java|android|android-layout|android-listview|android-activity","view_count":"1886"} {"id":"44200497","title":"Send with PHP one million emails to one million users","body":"\u003cp\u003eFor a project I'm building on my own, I'm looking for a technical solution to send one million emails (maybe 4 or 5 times with different call of actions) to one million users. I saw that in all the cases I'll have to pay and select a provider (SMTP) and pay by the number of mail I'll need to send. But I have few questions : \u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eWill the mail be sent from our server ? \u003c/li\u003e\n\u003cli\u003eIs it technically possible to send 1 million email in \u0026lt; 24 hours ? \u003c/li\u003e\n\u003cli\u003eThis is something we can't do on our own without being blacklisted from email providers ? \u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eThanks in advance for your clarifications. \u003c/p\u003e","accepted_answer_id":"44200838","answer_count":"1","comment_count":"3","creation_date":"2017-05-26 11:30:10.74 UTC","last_activity_date":"2017-05-26 11:46:36.453 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3586346","post_type_id":"1","score":"-3","tags":"php|email|smtp|send","view_count":"84"} {"id":"22491773","title":"Deduce function type of overloaded function based on argument types","body":"\u003cp\u003eSuppose there is an overloaded function:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evoid overloaded(int) {}\nvoid overloaded(void) {}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBecause I don't want to (or can) write down the full function signature (like \u003ccode\u003evoid(int)\u003c/code\u003e or \u003ccode\u003evoid(void)\u003c/code\u003e) I need to get this signature using only the function name (\u003ccode\u003eoverloaded\u003c/code\u003e) and\nits argument type(s) (\u003ccode\u003eint\u003c/code\u003e or \u003ccode\u003evoid\u003c/code\u003e).\u003c/p\u003e\n\n\u003cp\u003eI tried several approaches using \u003ccode\u003edecltype\u003c/code\u003e and friends, but unfortunately to no success.\u003c/p\u003e\n\n\u003cp\u003eSo, in short, I need something like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ecout \u0026lt;\u0026lt; typeid(\n get_overload(overloaded,(int)0))::type /* where the magic happens */\n .name() \u0026lt;\u0026lt; endl;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"2","creation_date":"2014-03-18 21:48:59.03 UTC","last_activity_date":"2014-03-19 10:34:27.02 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1116364","post_type_id":"1","score":"0","tags":"c++|templates|c++11|overloading|overload-resolution","view_count":"132"} {"id":"28290067","title":"jquery popup submit the form in post method","body":"\u003cp\u003eHere is my form\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;form method=\"POST\" action=\"adddriverprocess.php\" enctype=\"multipart/form-data\"\u0026gt;\n\u0026lt;...\u0026gt;\n\u0026lt;...\u0026gt;\n\u0026lt;/form\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt works good in the submit \u003ccode\u003e\u0026lt;input type=\"submit\" value=\"Submit\"/\u0026gt;\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eI am trying to have the jquery popup in it, where by pressing the form should do the \u003ccode\u003epost\u003c/code\u003e action.\u003c/p\u003e\n\n\u003cp\u003eSo, i had this jquery button\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;a href=\"javascript:;\" id=\"\u0026lt;?php echo url();?\u0026gt;/adddriverprocess.php\" class=\"btnActivation\"\u0026gt;\u0026lt;button class=\"delete-btn btn-sm\"\u0026gt;\u0026lt;span class=\"icon\"\u0026gt;\u0026lt;/span\u0026gt;\u0026lt;/button\u0026gt;\u0026lt;/a\u0026gt;\u0026lt;/td\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWith\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$('.btnActivation').click(fnActivation);\n function fnActivation() {\n var url =$(this).attr(\"id\");\n $(\"#dialog-confirms\").html(\"Are you sure you want to submit this form ?\");\nvar buttonsConfig = [\n {\n text: \"Yes\",\n \"class\": \"ok\",\n click: function() {\n $(this).dialog('close');\n window.location.href=url;\n }\n },\n {\n text: \"Cancel\",\n \"class\": \"cancel\",\n click: function() {\n $(this).dialog('close');\n }\n }\n];\n $(\"#dialog-confirms\").dialog({\n resizable: false,\n modal: true,\n title: \"Ma$na Taxi\",\n height: 250,\n width: 400,\n buttons: buttonsConfig,\n });\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe popup comes good, but when i press the ok button it takes me to the adddriverprocess but in \u003ccode\u003eget\u003c/code\u003e method but i want it to do in \u003ccode\u003epost\u003c/code\u003e method with the datas that is filled in the name.\u003c/p\u003e\n\n\u003cp\u003eHow can i do this ?\u003c/p\u003e","accepted_answer_id":"28290285","answer_count":"1","comment_count":"2","creation_date":"2015-02-03 01:50:41.677 UTC","last_activity_date":"2015-02-03 02:19:16.403 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4047397","post_type_id":"1","score":"1","tags":"javascript|php|jquery|html|forms","view_count":"603"} {"id":"5408080","title":"PHP function to match key in a range of values","body":"\u003cp\u003eI have a array with the \u003ccode\u003elvl=\u0026gt;xp\u003c/code\u003e correspondance and I would make a function that return the lvl for a specific xp. like \u003ccode\u003e$lvl = getLvlOf(15084); //return 5\u003c/code\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$lvl_correspondance = array(\n 1=\u0026gt;100,\n 2=\u0026gt;520,\n 3=\u0026gt;2650,\n 4=\u0026gt;6588,\n 5=\u0026gt;12061,\n 6=\u0026gt;23542,\n ...\n n=\u0026gt;xxxxxx\n);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI search the easyest and ressourceless way to do it.\u003c/p\u003e\n\n\u003cp\u003eSorry for my poor english :(\u003c/p\u003e","accepted_answer_id":"5408179","answer_count":"5","comment_count":"0","creation_date":"2011-03-23 15:58:55.963 UTC","last_activity_date":"2011-03-23 16:18:28.737 UTC","last_edit_date":"2011-03-23 16:05:29.533 UTC","last_editor_display_name":"","last_editor_user_id":"664157","owner_display_name":"","owner_user_id":"664157","post_type_id":"1","score":"1","tags":"php|arrays|function","view_count":"720"} {"id":"25147077","title":"Android terms Window and Display","body":"\u003cp\u003eOkay so I don't understand the difference between a display and a window in the context of android. These terms are used in different situations but like I don't know the actual distinction between them.\u003c/p\u003e","answer_count":"0","comment_count":"4","creation_date":"2014-08-05 19:46:27.407 UTC","last_activity_date":"2014-08-05 19:46:27.407 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3843164","post_type_id":"1","score":"1","tags":"android|view|window","view_count":"75"} {"id":"19531921","title":"Why android cannot ? DES mp4 encryption decryption success in desktop but failed an Android","body":"\u003cp\u003eI would like to implement a module for mp4 file encryption and decryption using DES .\u003c/p\u003e\n\n\u003cp\u003eIt succeeds and decrypted file can play identically to the original sound track in desktop application but cannot in Android ? why ? \u003c/p\u003e\n\n\u003cp\u003eThe below is my code\n(Module)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprivate static final String key = \"v@!#1SF5~6A5XZE3\";\n\n public static void encrypt(InputStream is, OutputStream os) throws Throwable {\n encryptOrDecrypt(key, Cipher.ENCRYPT_MODE, is, os);\n}\n\npublic static void decrypt(InputStream is, OutputStream os) throws Throwable {\n encryptOrDecrypt(key, Cipher.DECRYPT_MODE, is, os);\n}\n\npublic static void encryptOrDecrypt(String key, int mode, InputStream is, OutputStream os) throws Throwable {\n\n DESKeySpec dks = new DESKeySpec(key.getBytes());\n SecretKeyFactory skf = SecretKeyFactory.getInstance(\"DES\");\n SecretKey desKey = skf.generateSecret(dks);\n Cipher cipher = Cipher.getInstance(\"DES\"); \n\n if (mode == Cipher.ENCRYPT_MODE) {\n cipher.init(Cipher.ENCRYPT_MODE, desKey);\n CipherInputStream cis = new CipherInputStream(is, cipher);\n doCopy(cis, os);\n } else if (mode == Cipher.DECRYPT_MODE) {\n cipher.init(Cipher.DECRYPT_MODE, desKey);\n CipherOutputStream cos = new CipherOutputStream(os, cipher);\n doCopy(is, cos);\n }\n}\n\n public static void doCopy(InputStream is, OutputStream os) throws IOException {\nbyte[] bytes = new byte[8192];\nint numBytes;\nwhile ((numBytes = is.read(bytes)) != -1) {\n os.write(bytes, 0, numBytes);\n}\nos.flush();\nos.close();\nis.close();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e}\u003c/p\u003e\n\n\u003cp\u003eApplication (Encryption) : \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003estopService(new Intent(AlaramScheduleActivity.this, RecordService.class));\n File instanceRecordDirectory = new File(Environment.getExternalStorageDirectory() + File.separator + \"Test\");\n if(instanceRecordDirectory.exists()){ \n FileInputStream fis = new FileInputStream(instanceRecordDirectory.getAbsolutePath() + File.separator + \"test.mp4\");\n FileOutputStream fos = new FileOutputStream(instanceRecordDirectory.getAbsolutePath() + File.separator + \"etest.mp4\");\n AESClientEncodeDecode.encrypt(fis, fos);\n } \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eApplication (Decrpytion): \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eFile instanceRecordDirectory = new File(Environment.getExternalStorageDirectory() + File.separator + \"Test\");\n File decryptF = null;\n if(instanceRecordDirectory.exists()){\n\n FileInputStream fis2 = new FileInputStream(instanceRecordDirectory.getAbsolutePath() + File.separator + \"etest.mp4\");\n FileOutputStream fos2 = new FileOutputStream(instanceRecordDirectory.getAbsolutePath() + File.separator + \"dtest.mp4\");\n AESClientEncodeDecode.decrypt(fis2, fos2);\n\n }\n\n decryptF = new File(instanceRecordDirectory.getAbsolutePath() + File.separator + \"dtest.mp4\");\n if(decryptF.exists()){ \n Intent intent = new Intent(Intent.ACTION_VIEW); \n intent.setDataAndType(Uri.fromFile(decryptF), \"audio/*\"); \n startActivity(intent); \n }else{\n toast(\"Recordings does not exists\");\n }\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"4","creation_date":"2013-10-23 02:49:54.457 UTC","last_activity_date":"2013-10-23 02:49:54.457 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"683482","post_type_id":"1","score":"0","tags":"android|encryption|des","view_count":"178"} {"id":"429777","title":"ORA-28579: network error during callback from external procedure agent","body":"\u003cp\u003eHas anyone seen this error when trying to call an external C function from an Oracle query? I'm using Oracle 10g and get this error every time I try to call one of the two functions in the library. A call to the other function returns fine every time, though the function that works is all self-contained, no calls to any OCI* functions.\u003c/p\u003e\n\n\u003cp\u003eHere's the stored procedure that is used to call the failing C code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eCREATE OR REPLACE PROCEDURE index_procedure(text in clob, tokens in out nocopy clob, location_needed in boolean)\nas language c\nname \"c_index_proc\"\nlibrary lexer_lib\nwith context\nparameters\n(\n context,\n text,\n tokens,\n location_needed\n);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAny help would be appreciated. Everything I've found on this error message says that the action to take is: Contact Oracle customer support.\u003c/p\u003e\n\n\u003cp\u003eEdit: I've narrowed it down to the point that I know that there is a segfault deep in libclntsh after I call OCILobTrim (to truncate it down to 0 length) on the tokens clob. Here is the code I've been using to call this procedure.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edeclare text CLOB; tokens CLOB;\nbegin\ndbms_lob.createtemporary(tokens, TRUE);\ndbms_lob.append(tokens, 'token');\ndbms_lob.createtemporary(text, TRUE);\ndbms_lob.append(text, '\u0026lt;BODY\u0026gt;Test Document\u0026lt;/BODY\u0026gt;');\nindex_procedure(text, tokens, FALSE);\ndbms_output.put_line(tokens);\nend;\n/\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs there something wrong with this setup that might be causing OCILobTrim problems?\u003c/p\u003e","accepted_answer_id":"448222","answer_count":"2","comment_count":"0","creation_date":"2009-01-09 21:17:56.593 UTC","last_activity_date":"2011-01-07 13:31:22.44 UTC","last_edit_date":"2009-01-12 17:44:32.76 UTC","last_editor_display_name":"Ryan Ahearn","last_editor_user_id":"75","owner_display_name":"Ryan Ahearn","owner_user_id":"75","post_type_id":"1","score":"0","tags":"oracle|oracle10g|external-process","view_count":"6776"} {"id":"35173819","title":"Request body too large causing connection reset in Go","body":"\u003cp\u003eI have a simple multipart form which uploads to a Go app. I wanted to set a restriction on the upload size, so I did the following:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunc myHandler(rw http.ResponseWriter, request *http.Request){ \n request.Body = http.MaxBytesReader(rw, request.Body, 1024)\n err := request.ParseMultipartForm(1024)\n if err != nil{\n // Some response.\n } \n} \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhenever an upload exceeds the maximum size, I get a connection reset like the following:\n\u003ca href=\"https://i.stack.imgur.com/ewWMg.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/ewWMg.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eand yet the code continues executing. I can't seem to provide any feedback to the user. Instead of severing the connection I'd prefer to say \"You've exceeded the size limit\". Is this possible?\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2016-02-03 10:01:57.663 UTC","last_activity_date":"2016-02-03 14:43:11.58 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"822779","post_type_id":"1","score":"2","tags":"go|multipartform-data","view_count":"319"} {"id":"13378073","title":"In a windows 8 app, when clicking on a group, how to show a page that has clickable tiles","body":"\u003cp\u003eI have a windows 8 grid app, however, when I click on a group, I don't want the GroupDetailPage. Instead, I need a page that has multiple tiles which are clickable links.\nSomething similar to the app store, when you click a particular group, say Games, you get all the games, arranged in a grid and it is a clickable link.\u003c/p\u003e\n\n\u003cp\u003eAny help is very much appreciated.\u003c/p\u003e\n\n\u003cp\u003ethanks in advance\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-11-14 11:36:42.863 UTC","last_activity_date":"2012-11-14 14:00:28.473 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1640707","post_type_id":"1","score":"0","tags":"microsoft-metro","view_count":"74"} {"id":"46464745","title":"Show last id of database in PDO","body":"\u003cp\u003eI am trying to get the last id number of Database. But It's showing only 0.\nI am learning PDO. Can anyone tell me how can I do it? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif($_SERVER['REQUEST_METHOD']=='POST'){\n $sql = \"SELECT * FROM tablename\";\n $stmt = $pdo-\u0026gt;prepare($sql);\n $stmt-\u0026gt;execute();\n $row = $stmt -\u0026gt;fetch();\n $showid = $pdo-\u0026gt;lastInsertId();\n echo $showid;\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"8","creation_date":"2017-09-28 08:42:39.147 UTC","last_activity_date":"2017-09-28 14:06:03.277 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3253216","post_type_id":"1","score":"0","tags":"php|mysql|pdo","view_count":"57"} {"id":"10546593","title":"Understanding custom abs function in JavaScript","body":"\u003cp\u003eI hope my logic isn't flawed but I'm reading the Definitive Guide to JavaScript and I don't understand how this custom abs function works...\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction abs(x) {\n if (x \u0026gt;= 0) {\n return x;\n } else {\n return -x;\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI recrafted it using a ternary operator in an attempt to understand it...\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar res = (x \u0026gt;= 0) ? x : -x;\nreturn res;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e... but I still don't get how it works.\u003c/p\u003e\n\n\u003cp\u003eSay I use -10 as x, how does it return +10? How does the sign reverse?\u003c/p\u003e","accepted_answer_id":"10546619","answer_count":"4","comment_count":"2","creation_date":"2012-05-11 06:37:25.133 UTC","last_activity_date":"2012-05-11 06:54:01.443 UTC","last_edit_date":"2012-05-11 06:54:01.443 UTC","last_editor_display_name":"","last_editor_user_id":"1140038","owner_display_name":"","owner_user_id":"1140038","post_type_id":"1","score":"-2","tags":"javascript|math|ternary-operator","view_count":"163"} {"id":"2795404","title":"Authentication and authorization for RESTfull API (java jersery)","body":"\u003cp\u003eimplementing service something similar with tinyurl or bit.ly, I'm would like to expose service as API, I'm using java and jersey as RESTfull service implementation. \u003c/p\u003e\n\n\u003cp\u003eI'm looking for simplest way for authentification of users who use API, OAuth is first thing coming in mind, but the problem is I don't need this 3 iteration calls with request token query, than access token query with callback url passing. I just need to give user ability to invoke api with no additional security calls to my server.\u003c/p\u003e","accepted_answer_id":"2798692","answer_count":"2","comment_count":"2","creation_date":"2010-05-08 19:56:27.023 UTC","favorite_count":"6","last_activity_date":"2010-05-09 18:34:57.327 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"306025","post_type_id":"1","score":"6","tags":"java|security|rest|oauth|jersey","view_count":"8052"} {"id":"40448306","title":"Running an executable jar file using Eclipse","body":"\u003cp\u003eI have a project file which includes a jar file(monix.jar) and some data(models, plugins, ...). Developers didn't provide source code of it and I need to run it.\nI'm working in the eclipse env and I tried this steps:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eextracted it in my eclipse workspace(it was extracted under a folder named monix)\u003c/li\u003e\n\u003cli\u003ein the eclipse:Run \u003e External Tools \u003e External tools Configurations\u003c/li\u003e\n\u003cli\u003eset location in the Main tab to: D:\\eclipse workspace\\monix\\data\\gate\\plugins\\ANNIE\\build.xml (and ofcourse I tried this path too: D:\\Program Files Project\\Java\\bin\\java.exe) by Brows File System button.\u003c/li\u003e\n\u003cli\u003ethen set Working Directory to the path of project folder. D:\\eclipse workspace\\monix by Brows File System button.\u003c/li\u003e\n\u003cli\u003eDevelopers have provided a syntax for running it ($ ./monix inputDirectory outputDirectory) so I set Arguments according to this syntax ($ ./monix D:\\monixinputs D:\\monixoutput)\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eWhen I run it, there is an error:\nException occurred executing command line.\nCannot run program \"D:\\eclipse workspace\\monix\\data\\gate\\plugins\\ANNIE\\build.xml\" (in directory \"D:\\eclipse workspace\\monix\"): CreateProcess error=193, %1 is not a valid Win32 application\u003c/p\u003e\n\n\u003cp\u003eI'm totally confused and really need your help,Thanks in advance.\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2016-11-06 10:32:12.123 UTC","last_activity_date":"2016-11-06 21:09:49.24 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"908887","post_type_id":"1","score":"0","tags":"java|eclipse|jar","view_count":"1803"} {"id":"29507226","title":"How to narrow down a class types using generic?","body":"\u003cp\u003eMy question is does it possible to write such a class:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class Storage{\n protected Map\u0026lt;String, ? extends Serializable\u0026gt; properties = new HashMap\u0026lt;\u0026gt;();\n\n public \u0026lt;T extends Serializable\u0026gt; void put(String name , T value){\n properties.put(name, value);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand when try to use it like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eStorage s = new Storage();\nList\u0026lt;String\u0026gt; list = new ArrayList\u0026lt;\u0026gt;();\ns.put(\"name\", list);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThrough code above seems legit to me, it does not compile.\nI was looking into generics FAQ but can't find a solution, maybe it's not possible at all?\u003c/p\u003e\n\n\u003cp\u003eHere is compilation error\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eError: where T is a type-variable: T extends Serializable declared\nin method \u0026lt;T\u0026gt;put(String,T) where CAP#1 is a fresh type-variable: CAP#1\nextends Serializable from capture of ? extends Serializable\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"29507266","answer_count":"2","comment_count":"4","creation_date":"2015-04-08 06:11:05.37 UTC","last_activity_date":"2015-04-08 08:33:33.44 UTC","last_edit_date":"2015-04-08 08:33:33.44 UTC","last_editor_display_name":"","last_editor_user_id":"211001","owner_display_name":"","owner_user_id":"211001","post_type_id":"1","score":"0","tags":"java|generics","view_count":"289"} {"id":"42301485","title":"What do you call this style of error checking of legacy vs new code?","body":"\u003cp\u003eI'm refactoring legacy code and need to confirm I'm not breaking. It's not currently structured for unit testing, partly because many of the functions output to the GPU, rather than returning values.\u003c/p\u003e\n\n\u003cp\u003eI came up with a technique that seems to be working well for me and I'm sure I haven't invented it and am wondering if it has a name so that I can research it. \u003c/p\u003e\n\n\u003cp\u003eWhat I have is legacy code that calculates some values:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evoid foo() {\n int bar1 = //some legacy code\n int bar2 = //some legacy code\n int bar3 = //some legacy code\n baz(bar1, bar2, bar3)\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI introduce a preprocessor directive that does a \"legacy vs. new\" comparison:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evoid foo() {\n#if TESTING_AGAINST_LEGACY\n int legacy_bar1 = //some legacy code\n int legacy_bar2 = //some legacy code\n int legacy_bar3 = //some legacy code\n#endif\n int bar1 = //some new code\n int bar2 = //some new code\n int bar3 = //some new code\n#if TESTING_AGAINST_LEGACY\n assert (legacy_bar1 == bar1);\n assert (legacy_bar2 == bar2);\n assert (legacy_bar3 == bar3);\n#endif\n baz(bar1, bar2, bar3)\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe above uses only the new code, but tests intermediate results against the old code. The directive can be shut off at any time and deleted eventually.\u003c/p\u003e\n\n\u003cp\u003eIt's obviously not as good as unit testing, but if I were refactoring to unit test, would likely introduce this to ensure my refactoring didn't break anything.\u003c/p\u003e\n\n\u003cp\u003eDoes this approach have a name?\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-02-17 15:20:54.57 UTC","last_activity_date":"2017-02-17 16:23:30.46 UTC","last_edit_date":"2017-02-17 16:23:30.46 UTC","last_editor_display_name":"","last_editor_user_id":"2079612","owner_display_name":"","owner_user_id":"2079612","post_type_id":"1","score":"0","tags":"unit-testing|error-handling","view_count":"17"} {"id":"14336813","title":"Static cast in a template","body":"\u003cp\u003eI have a template with this static cast operator:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eoperator Vector2\u0026lt;float\u0026gt;() const\n{\n return Vector2\u0026lt;float\u0026gt;(x, y);\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis implies to me that if I cast as a float, it will return a float variant of the class, even if \u003ccode\u003ex\u003c/code\u003e and \u003ccode\u003ey\u003c/code\u003e are integers from an integer variant. But apparently not so:\u003c/p\u003e\n\n\u003cp\u003eAs a test:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eVector2\u0026lt;float\u0026gt;position=static_cast\u0026lt;float\u0026gt;(Vector2\u0026lt;int\u0026gt;(5,5));\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI get the compiler error for *No matching conversion for static_cast from Vector2 to float*.\u003c/p\u003e\n\n\u003cp\u003eYet, the conversion is specified above, is it not, as a static cast overload?\u003c/p\u003e","accepted_answer_id":"14336864","answer_count":"1","comment_count":"3","creation_date":"2013-01-15 11:32:24.053 UTC","last_activity_date":"2013-01-15 11:35:58.297 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3758484","post_type_id":"1","score":"0","tags":"c++","view_count":"1023"} {"id":"34384819","title":"Service not always restarting, can't get logs","body":"\u003cp\u003eI have a service which sends the user's location to the database every minute. It works for the most part, restarting several times as required. But eventually it will stop and not restart. I have managed to work out that when it dies all together it tries to restart but fails.\u003c/p\u003e\n\n\u003cp\u003eIt stops at random times and takes days to happen, so how could I go about getting the logs from when it happens so I can debug?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-12-20 19:16:53.373 UTC","last_activity_date":"2015-12-20 19:53:45.803 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3757721","post_type_id":"1","score":"1","tags":"android|service","view_count":"24"} {"id":"12251732","title":"What was the reason to abandoned Beagle, high CPU usage or high RAM usage?","body":"\u003cp\u003eI'm planning a new software for search local text documents (PDF, odt, txt, doc...) AND I would use some code from the abandoned Beagle.\u003c/p\u003e\n\n\u003cp\u003eBut I'm afraid because I didn't know the reasons why was abandoned...\u003c/p\u003e\n\n\u003cp\u003eAnyone remember it or can advice me?\u003c/p\u003e\n\n\u003cp\u003eI think beagle was a good LUCENE.NET implementation. What was wrong with it?\u003c/p\u003e","accepted_answer_id":"12254133","answer_count":"1","comment_count":"0","creation_date":"2012-09-03 17:01:41.32 UTC","last_activity_date":"2012-09-03 21:31:00.157 UTC","last_edit_date":"2012-09-03 21:31:00.157 UTC","last_editor_display_name":"","last_editor_user_id":"690958","owner_display_name":"","owner_user_id":"690958","post_type_id":"1","score":"1","tags":"mono|lucene|lucene.net","view_count":"130"} {"id":"15967934","title":"How to find the source of ora-01031 insufficient privileges when executing a test on a ref cursor with utPLSQL?","body":"\u003cp\u003eI'm doing research on unit testing in PLSQL. I set up a test database with some tables and packages with functions and procedures. Currently I'm giving the test framework 'utPLSQL' a try but stumbled upon an error when testing on a ref cursor. I can run all of my tests but the result of the test on the ref cursor says \"ora-01031 insufficient privileges\", that's all I get. How can I find the source of this error? Or does anyone encountered the same problem? The installation of utPLSQL was successful and all the other functionality of the test framework works.\u003c/p\u003e\n\n\u003cp\u003eThis is the procedure I want to test:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eFUNCTION F_Get_Customers_RefCurs(P_LASTNAME IN VARCHAR2)\nRETURN cust_refcur\nIS\ncust_result cust_refcur;\nBEGIN\n OPEN cust_result FOR\n SELECT *\n FROM CUSTOMERS\n WHERE LASTNAME = P_LASTNAME\n ORDER BY email ASC;\n return(cust_result);\nEND F_Get_Customers_RefCurs;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI have declared cust_refcur in the spec of the package which contains my function as following:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTYPE cust_refcur IS REF CURSOR;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd this is the test:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ePROCEDURE ut_F_Get_Customers_RefCurs\nIS\nparams utplsql_util.utplsql_params;\nBEGIN\n utPLSQL_Util.reg_In_Param (1,\n 'Tester',\n params);\n UTASSERT.eq_refc_query ('Get customers on last name is successful (refcursor)',\n 'PK_ORDERS.F_GET_CUSTOMERS_REFCURS',\n params,\n 0,\n 'SELECT customerid, firstname, lastname, email, password\n FROM CUSTOMERS\n WHERE LASTNAME = ''Tester''\n ORDER BY email ASC');\nEND;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"16001215","answer_count":"3","comment_count":"8","creation_date":"2013-04-12 09:40:13.27 UTC","last_activity_date":"2013-10-02 00:30:53.003 UTC","last_edit_date":"2013-04-12 11:36:19.56 UTC","last_editor_display_name":"","last_editor_user_id":"2273737","owner_display_name":"","owner_user_id":"2273737","post_type_id":"1","score":"1","tags":"unit-testing|plsql","view_count":"790"} {"id":"32780622","title":"CORBA location forward and Network Address Translation","body":"\u003cp\u003eI'm using CORBA to access a Java server from a Java client. (Currently I'm using the OpenORB implementation.) Everything works fine so far.\u003c/p\u003e\n\n\u003cp\u003eWhen I want to change my network setup and have the server behind a router that does \u003cstrong\u003eNetwork Address Translation\u003c/strong\u003e, I get a connection problem. Here is what happens:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eClient -\u0026gt; Server: GPIO 1.0 Request is_a\nServer -\u0026gt; Client: GPIO 1.0 Reply: Location Forward: 192.168.1.101:9999\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBecause the server does not know its external IP address in the new setup, the location forward fails.\u003c/p\u003e\n\n\u003cp\u003eIs there a way to disable this \u003cstrong\u003eLocation Forward\u003c/strong\u003e \"feature\"?\u003c/p\u003e\n\n\u003cp\u003eThanks a lot!\u003c/p\u003e\n\n\u003cp\u003eEDIT: I found that this happens only when using the Corbaloc Name service, not when connecting with an IOR directly\u003c/p\u003e","answer_count":"0","comment_count":"6","creation_date":"2015-09-25 10:56:03.193 UTC","last_activity_date":"2015-09-28 15:09:04.44 UTC","last_edit_date":"2015-09-28 15:09:04.44 UTC","last_editor_display_name":"","last_editor_user_id":"1989887","owner_display_name":"","owner_user_id":"1989887","post_type_id":"1","score":"0","tags":"java|corba|nat","view_count":"157"} {"id":"4217389","title":"Real time transcoding of multiple RTMP-Streams","body":"\u003cp\u003eI am very frustrated after talking to many companies doing live-streaming or selling streaming-products and I hope someone could get me to the right direction.\u003c/p\u003e\n\n\u003cp\u003eHere is my problem:\u003c/p\u003e\n\n\u003cp\u003eWe are broadcasting sportevents live to the internet via flash media encoder. \nAt the event locations we mostly have just 2 mbit upstream. So at the moment we are streaming with about 1mbit rate. \nBut we need also streams for mobile-devices and a stream for users without fast internet. So we want 2 more streams with lower-bitrates, but we can't get this through the 2mbit...\nI am looking for a solutiuon which can transcode about a 1mbit (and maybe in the future a 1.5mbit) livestream in to two (or more) lower-bitrate streams. The solution should be scalable, because sometimes we have 7 events at one day on different locations, so there could be 7 input-streams.\nI've searched the net for hardware transcoders, but didn't find a stable solution and I've tested also transcoding with ffmpeg, but it seems to get problems with timing and key-frames for bitrate switching.\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eDoes anyone know a hardware or software solution for this problem? \u003c/li\u003e\n\u003cli\u003eHas anyone done something own like that with ffmpeg or other tools on the cloud (amazon ec2 etc.)?\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eThanks!\nJan\u003c/p\u003e","accepted_answer_id":"5292868","answer_count":"3","comment_count":"2","creation_date":"2010-11-18 16:51:02.077 UTC","favorite_count":"1","last_activity_date":"2011-03-19 16:01:14.017 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"421103","post_type_id":"1","score":"1","tags":"flash|ffmpeg|rtmp|transcoding|transcode","view_count":"2069"} {"id":"13646016","title":"Cross Platform App IBM Worklight","body":"\u003cp\u003eI am using IBM Worklight MEAP for developing Cross Platform application but when I build my project I got following error\u003c/p\u003e\n\n\u003cp\u003e[2012-11-30 18:31:47] iphone build failed: com.worklight.builder.exception.WorklightBuildRuntimeException: Resource Manager - Problem reading info.plist file /Users/ipcmac/Documents/workspace_IndigoNew/MYNew/apps/NewApp/iphone/native/MYNewNewAppIphone-Info.plist (No such file or directory) Nested exception: /Users/ipcmac/Documents/workspace_IndigoNew/MYNew/apps/NewApp/iphone/native/MYNewNewAppIphone-Info.plist (No such file or directory)\u003c/p\u003e\n\n\u003cp\u003e[2012-11-30 18:32:20] android build failed: com.worklight.builder.exception.WorklightBuildRuntimeException: Resource Manager - Error while reading XML file: /Users/ipcmac/Documents/workspace_IndigoNew/MYNew/apps/NewApp/android/native/AndroidManifest.xml (No such file or directory) Nested exception: /Users/ipcmac/Documents/workspace_IndigoNew/MYNew/apps/NewApp/android/native/AndroidManifest.xml (No such file or directory)\n[2012-11-30 18:32:20] A core eclipse exception has occurred: Failed to read project description file from location '/Users/ipcmac/Documents/workspace_IndigoNew/MYNew/apps/NewApp/android/native/.project'.\u003c/p\u003e\n\n\u003cp\u003eSo any one have solution for this ????\u003c/p\u003e","accepted_answer_id":"13657434","answer_count":"1","comment_count":"1","creation_date":"2012-11-30 13:15:30.43 UTC","last_activity_date":"2012-12-01 07:35:46.643 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1201736","post_type_id":"1","score":"1","tags":"eclipse|cross-platform|ibm|ibm-mobilefirst","view_count":"983"} {"id":"3466621","title":"issue in retriving the height and width","body":"\u003cp\u003eI have developed an application in the blackberry in which it have to be build in any model of blackberry, the application in which i have developed does not show some icon which are in border, can any body help how to get the height and width of the mobile in the blackberry\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2010-08-12 10:12:50.257 UTC","last_activity_date":"2010-08-12 10:25:17.343 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"347001","post_type_id":"1","score":"0","tags":"eclipse|blackberry","view_count":"43"} {"id":"45929116","title":"Swift: Problems with custom UIView.transition?","body":"\u003cp\u003eOk, I have looked through \u003ca href=\"https://developer.apple.com/videos/play/wwdc2013/218/\" rel=\"nofollow noreferrer\"\u003ehttps://developer.apple.com/videos/play/wwdc2013/218/\u003c/a\u003e and SO questions similarly trying to make custom transitions with a tab bar controller and its viewcontrollers but Im running into confusion after figuring out the main steps here.\u003c/p\u003e\n\n\u003cp\u003eI need to know how (meaning example code would be really helpful) to call a custom \u003ccode\u003eUIView.transition\u003c/code\u003e OR just have a custom \u003ccode\u003eoption\u003c/code\u003e in \u003ccode\u003eUIView.transition\u003c/code\u003e. I need to use this to make a sliding/modal -mimicking transition between tabs in my tab bar controller.\u003c/p\u003e\n\n\u003cp\u003eThe only way I can get a transition to happen is using the below function (this makes them dissolve):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunc tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -\u0026gt; Bool {\n\n if selectedViewController == nil || viewController == selectedViewController {\n return false\n }\n\n let fromView = selectedViewController!.view\n let toView = viewController.view\n\n UIView.transition(from: fromView!, to: toView!, duration: 0.3, options: [.transitionCrossDissolve], completion: nil)\n\n return true\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd calling it manually here where I programmatically chnage the \u003ccode\u003e*selectedIndex*\u003c/code\u003e for my tab controller:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e//SWITCHES BUTTON -------------------------------------------\n func switchTab(index: Int)\n\n {\n //transition\n self.tabBarController(self, shouldSelect: (viewControllers?[index])!)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI have read about and tried making a custom class \u003ccode\u003eUIViewControllerAnimatedTransitioning\u003c/code\u003e but don't know how this would fit in programmatically here - \u003c/p\u003e\n\n\u003cp\u003emy attempts passing my tab bar controller and the \u003ccode\u003etoView\u003c/code\u003e and \u003ccode\u003efromView\u003c/code\u003einto the custom class result in nothing happening/animating. That is why Ive resorted to UIView.transition here.\u003c/p\u003e\n\n\u003cp\u003eHow can I make a custom \u003ccode\u003eUIView.transition\u003c/code\u003e? What can I do here? \u003c/p\u003e","accepted_answer_id":"45929810","answer_count":"1","comment_count":"0","creation_date":"2017-08-29 00:40:27.827 UTC","last_activity_date":"2017-08-29 02:26:23.467 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3781199","post_type_id":"1","score":"0","tags":"ios|swift|swift3|uiview|uiviewanimationtransition","view_count":"55"} {"id":"47390016","title":"ASP.NET Web API custom post action not working","body":"\u003cp\u003eSo I have a GebruikerController in my API. Gebruiker is dutch for User, what this controller does is that it logs the user in, gets list of users, adds users and get a specific user. But I have encountered a problem when I introduced my own custom post method for a simple login function. Whenever I send some data from PostMan to the function I get the following response:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e{\"id\":[\"The value 'login' is not valid.\"]}\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eI access it with this url:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e\u003ca href=\"http://localhost:52408/api/gebruikers/login\" rel=\"nofollow noreferrer\"\u003ehttp://localhost:52408/api/gebruikers/login\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003ethis is my controller:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[Produces(\"application/json\")]\n[Route(\"api/Gebruikers\")]\npublic class GebruikersController : Controller\n{\n private readonly flowerpowerContext _context;\n\n public GebruikersController(flowerpowerContext context)\n {\n _context = context;\n }\n\n // GET: api/Gebruikers\n [HttpGet]\n public IEnumerable\u0026lt;Gebruiker\u0026gt; GetGebruiker()\n {\n return _context.Gebruiker;\n }\n\n // GET: api/Gebruikers/5\n [HttpGet(\"{id}\")]\n public async Task\u0026lt;IActionResult\u0026gt; GetGebruiker([FromRoute] int id)\n {\n if (!ModelState.IsValid)\n {\n return BadRequest(ModelState);\n }\n\n var gebruiker = await _context.Gebruiker.SingleOrDefaultAsync(m =\u0026gt; m.Id == id);\n\n if (gebruiker == null)\n {\n return NotFound();\n }\n\n return Ok(gebruiker);\n }\n\n [Route(\"api/gebruikers/login\")]\n [HttpPost]\n public async Task\u0026lt;IActionResult\u0026gt; PostLogin([FromBody] string email, [FromBody] string password)\n {\n if(!ModelState.IsValid)\n {\n return BadRequest(ModelState);\n }\n\n if(GebruikerVerify(email, password))\n {\n var gebruiker = await _context.Gebruiker.FirstOrDefaultAsync((g) =\u0026gt; (g.GebruikerEmail == email \u0026amp;\u0026amp; g.GebruikerWachtwoord == password));\n return Ok(gebruiker);\n }\n else\n {\n return BadRequest(\"invalid data\");\n }\n }\n\n // PUT: api/Gebruikers/5\n [HttpPut(\"{id}\")]\n public async Task\u0026lt;IActionResult\u0026gt; PutGebruiker([FromRoute] int id, [FromBody] Gebruiker gebruiker)\n {\n if (!ModelState.IsValid)\n {\n return BadRequest(ModelState);\n }\n\n if (id != gebruiker.Id)\n {\n return BadRequest();\n }\n\n _context.Entry(gebruiker).State = EntityState.Modified;\n\n try\n {\n await _context.SaveChangesAsync();\n }\n catch (DbUpdateConcurrencyException)\n {\n if (!GebruikerExists(id))\n {\n return NotFound();\n }\n else\n {\n throw;\n }\n }\n\n return NoContent();\n }\n\n // POST: api/Gebruikers\n [HttpPost]\n public async Task\u0026lt;IActionResult\u0026gt; PostGebruiker([FromBody] Gebruiker gebruiker)\n {\n if (!ModelState.IsValid)\n {\n return BadRequest(ModelState);\n }\n\n _context.Gebruiker.Add(gebruiker);\n await _context.SaveChangesAsync();\n\n return CreatedAtAction(\"GetGebruiker\", new { id = gebruiker.Id }, gebruiker);\n }\n\n // DELETE: api/Gebruikers/5\n [HttpDelete(\"{id}\")]\n public async Task\u0026lt;IActionResult\u0026gt; DeleteGebruiker([FromRoute] int id)\n {\n if (!ModelState.IsValid)\n {\n return BadRequest(ModelState);\n }\n\n var gebruiker = await _context.Gebruiker.SingleOrDefaultAsync(m =\u0026gt; m.Id == id);\n if (gebruiker == null)\n {\n return NotFound();\n }\n\n _context.Gebruiker.Remove(gebruiker);\n await _context.SaveChangesAsync();\n\n return Ok(gebruiker);\n }\n\n private bool GebruikerExists(int id)\n {\n return _context.Gebruiker.Any(e =\u0026gt; e.Id == id);\n }\n\n private bool GebruikerVerify(string email, string wacthwoord)\n {\n if(_context.Gebruiker.Any(e =\u0026gt; e.GebruikerEmail == email))\n {\n Gebruiker gebruiker = _context.Gebruiker.FirstOrDefault(e =\u0026gt; e.GebruikerEmail == email);\n if(wacthwoord == gebruiker.GebruikerWachtwoord)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n else\n {\n return false;\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethe following code is my login code, which can also be seen in the code above.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e [Route(\"api/gebruikers/login\")]\n [HttpPost]\n public async Task\u0026lt;IActionResult\u0026gt; PostLogin([FromBody] string email, [FromBody] string password)\n {\n if(!ModelState.IsValid)\n {\n return BadRequest(ModelState);\n }\n\n if(GebruikerVerify(email, password))\n {\n var gebruiker = await _context.Gebruiker.FirstOrDefaultAsync((g) =\u0026gt; (g.GebruikerEmail == email \u0026amp;\u0026amp; g.GebruikerWachtwoord == password));\n return Ok(gebruiker);\n }\n else\n {\n return BadRequest(\"invalid data\");\n }\n }\n\n private bool GebruikerVerify(string email, string wacthwoord)\n {\n if(_context.Gebruiker.Any(e =\u0026gt; e.GebruikerEmail == email))\n {\n Gebruiker gebruiker = _context.Gebruiker.FirstOrDefault(e =\u0026gt; e.GebruikerEmail == email);\n if(wacthwoord == gebruiker.GebruikerWachtwoord)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n else\n {\n return false;\n }\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm fairly new to this and I'm clueless about what I'm doing wrong here. Can someone please help me with this?\u003c/p\u003e","accepted_answer_id":"47390406","answer_count":"1","comment_count":"5","creation_date":"2017-11-20 10:37:04.723 UTC","favorite_count":"0","last_activity_date":"2017-11-21 08:09:56.753 UTC","last_edit_date":"2017-11-21 08:09:56.753 UTC","last_editor_display_name":"","last_editor_user_id":"6003092","owner_display_name":"","owner_user_id":"6003092","post_type_id":"1","score":"1","tags":"c#|asp.net-core|asp.net-core-webapi|asp.net-core-routing","view_count":"46"} {"id":"36965912","title":"Prestashop cloud : How do i resize the image container to best fit the image i have?","body":"\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/2gvRJ.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/2gvRJ.png\" alt=\"Product details page\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eAny idea how do i change the size of container so that image gets fit into the container? Also i need to do some customization to 'Add to cart' button. \u003c/p\u003e\n\n\u003cp\u003eHow do i do all this with prestashop cloud?\u003c/p\u003e\n\n\u003cp\u003eIs it possible with cloud or i will have to switch to local code version for this?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-05-01 11:04:09.46 UTC","last_activity_date":"2016-05-02 07:09:17.473 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5285062","post_type_id":"1","score":"0","tags":"prestashop","view_count":"182"} {"id":"20860202","title":"Hosting an ASP.net application on a subfolder","body":"\u003cp\u003eI got a hosting space with Godaddy and I have multiple domain names referring to the same host space.\u003c/p\u003e\n\n\u003cp\u003eOne of the application is an ASP.net and is located in a subfolder with the domain name related referring to that subfolder.\u003c/p\u003e\n\n\u003cp\u003eSo \u003ccode\u003ewww.mydomain.com\u003c/code\u003e is referring to \u003ccode\u003e\u0026lt;hosting-space-root\u0026gt;\\myapp\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eI found that sometimes the application is correctly handling redirections:\ne.g. \u003ccode\u003ewww.mydomain.com/Default.aspx\u003c/code\u003e links to \u003ccode\u003ewww.mydomain.com/Other.aspx\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eBut some other times, the links jumps to a url similar to:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ewww.mydomain.com/myapp/Other.aspx\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhich works fine with no errors, but doesn't look nice.\u003c/p\u003e\n\n\u003cp\u003eWhat is the reason for that and how to handle it?\u003c/p\u003e\n\n\u003cp\u003eThe application is non-MVC and is actually a very simple one. Do I need to do rerouting and/or implement IHttpModule? Or is there a simple configuration to tell ASP.net that is your root folder use it?\u003c/p\u003e","accepted_answer_id":"20884638","answer_count":"1","comment_count":"4","creation_date":"2013-12-31 16:21:21.66 UTC","last_activity_date":"2014-01-02 13:59:51.99 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3149741","post_type_id":"1","score":"1","tags":"asp.net|redirect|subfolder|reroute","view_count":"688"} {"id":"5373909","title":"Add a query var at the end of WordPress url","body":"\u003cp\u003ei've been searching for two hours looking for this specific questions, but still no luck.\u003cbr\u003e\nI am writing a simple plugin to switch themes on the fly.\u003cbr\u003e\nSo i would like to add a query_var at the end of the WordPress url. \u003c/p\u003e\n\n\u003cp\u003eFrom:\n\u003ca href=\"http://somedomain.com/?p=1\" rel=\"nofollow\"\u003ehttp://somedomain.com/?p=1\u003c/a\u003e\u003cbr\u003e\nTo:\n\u003ca href=\"http://somedomain.com/?p=1\" rel=\"nofollow\"\u003ehttp://somedomain.com/?p=1\u003c/a\u003e\u003cstrong\u003e\u0026amp;theme=abcd\u003c/strong\u003e \u003c/p\u003e\n\n\u003cp\u003eI would like to rewrite all url in that page to add \u0026amp;theme=abcd so my plugin will know which theme should be rendered. \u003c/p\u003e\n\n\u003cp\u003eI rather use query_var rather than store it in cookie. \u003c/p\u003e\n\n\u003cp\u003eAny help is really appreciated. \u003c/p\u003e\n\n\u003cp\u003eThanks \u003c/p\u003e\n\n\u003cp\u003eIvan\u003c/p\u003e","accepted_answer_id":"5373992","answer_count":"2","comment_count":"0","creation_date":"2011-03-21 04:47:01.957 UTC","last_activity_date":"2011-03-21 05:00:46.477 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"583879","post_type_id":"1","score":"0","tags":"wordpress|url-rewriting","view_count":"717"} {"id":"46148547","title":"Issue with connection to MSSQL from PHP","body":"\u003cp\u003eI'm having problems putting data into MSSQL with PHP - I get this error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003esqlsrv_query() expects parameter 1 to be resource, boolean given in [path] on line 13\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eI can't really see where the problem is, or if I have a syntax error.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\n $host = \"127.0.0.1\"; \n $dbusername = \"humid\"; \n $dbpassword = \"humid\"; \n $db = \"test\";\n $t = $_GET['t'];\n $h = $_GET['h'];\n\n\n $connectionInfo = array(\"UID\" =\u0026gt; $dbusername, \"PWD\" =\u0026gt; $dbpassword, \"Database\" =\u0026gt; $db) or die(\"Couldnt connect to server\");\n $dbconnect = sqlsrv_connect($host, $connectionInfo);\n $sql = \"INSERT INTO historic VALUES(NULL,$t,$h,CURRENT_TIMESTAMP)\";\n sqlsrv_query($dbconnect, $sql);\n?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eANY help would be greatly appreciated! I'm not familiar with MSSQL, only MySQL\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003cp\u003eOkay, now I've enabled error messages, and I've got this one now:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eArray ( [0] =\u003e Array ( [0] =\u003e 42000 [SQLSTATE] =\u003e 42000 [1] =\u003e 126 [code] =\u003e 126 [2] =\u003e [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Invalid pseudocolumn \"$t\". [message] =\u003e [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Invalid pseudocolumn \"$t\". ) ) \u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eHowever, I have no idea what that could be? Is it because $t is a SQL syntax that I don't know of? Long story short, I'm building a temp and humid logging device from an Arduino, and I need it to post the values into a DB (using PHP) - the syntax for the PHP looks like this:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003etest.php?t=1\u0026amp;h=2\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eWhat have i done wrong now? When testing it on my MySQL server private, it all worked fine \u003e_\u0026lt;\u003c/p\u003e\n\n\u003cp\u003e-- edit, solution found! --\u003c/p\u003e\n\n\u003cp\u003eOkay, I found the solution, I'm not sure if any of the other answers had a direct fix, however. MSSQL apparently doesn't accept \"NULL\" like MySQL does. But that was ofc. the last thing i edited, so I'm not sure if there were any errors in the prior code. Hoever, below is the final (and working) code. Arduino posts and everything. Eureka!\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\n $host = \"WDKTO560\\TEST\"; \n $dbusername = \"humid\"; \n $dbpassword = \"humid\"; \n $db = \"test\";\n $t = $_GET['t'];\n $h = $_GET['h'];\n\n\n\n $connectionInfo = array(\"UID\" =\u0026gt; $dbusername, \"PWD\" =\u0026gt; $dbpassword, \"Database\" =\u0026gt; $db) or die(\"Couldnt connect to server\");\n $dbconnect = sqlsrv_connect($host, $connectionInfo);\n $sql = \"INSERT INTO historic (temperature, humidity, date) VALUES($t,$h,CURRENT_TIMESTAMP)\";\n sqlsrv_query($dbconnect, $sql) or die( print_r( sqlsrv_errors(), true));\n?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"46222518","answer_count":"3","comment_count":"1","creation_date":"2017-09-11 05:10:49.2 UTC","last_activity_date":"2017-09-14 15:03:30.26 UTC","last_edit_date":"2017-09-11 07:26:43.76 UTC","last_editor_display_name":"","last_editor_user_id":"8294951","owner_display_name":"","owner_user_id":"8294951","post_type_id":"1","score":"0","tags":"php|sql-server","view_count":"53"} {"id":"16162583","title":"Tomorrow theme for Emacs shows Chinese charaters as blocks","body":"\u003cp\u003eI installed \u003ca href=\"https://github.com/chriskempson/tomorrow-theme\" rel=\"nofollow\"\u003eTomorrow theme\u003c/a\u003e into my Emacs24 using melpa.\u003c/p\u003e\n\n\u003cp\u003eChinese characters appeared as blocks in comments while showing the correct characters in other places.\u003c/p\u003e\n\n\u003cp\u003eThe default font in my .emacs is like following:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e(set-default-font \"Menlo-12\")\n(setq default-frame-alist '(font . \"Menlo-12\"))\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"16174121","answer_count":"1","comment_count":"2","creation_date":"2013-04-23 06:37:30.49 UTC","last_activity_date":"2013-04-28 07:19:25.903 UTC","last_edit_date":"2013-04-28 07:19:25.903 UTC","last_editor_display_name":"","last_editor_user_id":"1002760","owner_display_name":"","owner_user_id":"1002760","post_type_id":"1","score":"4","tags":"emacs","view_count":"182"} {"id":"44094031","title":"How to get currentIndex of an delegateItem in a TreeView","body":"\u003cp\u003eHellow,\u003c/p\u003e\n\n\u003cp\u003eWhen using \u003ccode\u003edelegate\u003c/code\u003e on a \u003ccode\u003eColumn\u003c/code\u003e, how could I know the index of the \u003ccode\u003eCell\u003c/code\u003e or \u003ccode\u003eRow\u003c/code\u003e selected if the user clicks on the \u003ccode\u003edelegateItem\u003c/code\u003e ? \u003c/p\u003e\n\n\u003cp\u003eHere is an example. The second \u003ccode\u003eColumn\u003c/code\u003e is a \u003ccode\u003eMouseArea\u003c/code\u003e and I want to \u003ccode\u003eexpand\u003c/code\u003e the \u003ccode\u003ecurrentIndex\u003c/code\u003e when the user clicks on the \u003ccode\u003eMouseArea\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTreeView {\n id: view\n TableViewColumn {\n title: \"Name\"\n role: \"fileName\"\n width: 300\n }\n TableViewColumn {\n title: \"Permissions\"\n role: \"filePermissions\"\n width: 100\n delegate : MouseArea {\n id:mous\n onClicked {\n //get indexMouseArea\n view.expand(indexMouseArea)\n }\n }\n }\n model: fileSystemModel\n\n onExpanded {\n console.log(\"expanded :\" + index)\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"44128451","answer_count":"1","comment_count":"1","creation_date":"2017-05-21 06:56:50.063 UTC","last_activity_date":"2017-05-23 07:31:09.857 UTC","last_edit_date":"2017-05-21 07:02:05.943 UTC","last_editor_display_name":"","last_editor_user_id":"6407883","owner_display_name":"","owner_user_id":"6407883","post_type_id":"1","score":"0","tags":"qt|indexing|treeview|qml|qt-quick","view_count":"96"} {"id":"44029544","title":"Issue on Moving (Animating) Background From Current To Selected List","body":"\u003cp\u003eCan you please take a look at this demo and let me know how I can animate(slide/ move) the red background to from the current active button to selected button? \u003c/p\u003e\n\n\u003cp\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-css lang-css prettyprint-override\"\u003e\u003ccode\u003e.container .btn-group .active \r\n{ background-color: red ; color: white; }\u003c/code\u003e\u003c/pre\u003e\r\n\u003cpre class=\"snippet-code-html lang-html prettyprint-override\"\u003e\u003ccode\u003e\u0026lt;script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"\u0026gt;\u0026lt;/script\u0026gt;\r\n\u0026lt;link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\" integrity=\"sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u\" crossorigin=\"anonymous\"\u0026gt;\r\n\u0026lt;div class=\"container\"\u0026gt;\r\n\r\n \u0026lt;div class=\"btn-group\" data-toggle=\"buttons\"\u0026gt;\r\n \u0026lt;label class=\"btn btn-default active\"\u0026gt;\r\n \u0026lt;input type=\"radio\"\u0026gt;One\r\n \u0026lt;/label\u0026gt;\r\n \u0026lt;label class=\"btn btn-default\"\u0026gt;\r\n \u0026lt;input type=\"radio\"\u0026gt;Two\r\n \u0026lt;/label\u0026gt;\r\n \u0026lt;label class=\"btn btn-default\"\u0026gt;\r\n \u0026lt;input type=\"radio\"\u0026gt;Three\r\n \u0026lt;/label\u0026gt;\r\n \u0026lt;label class=\"btn btn-default\"\u0026gt;\r\n \u0026lt;input type=\"radio\"\u0026gt;Four\r\n \u0026lt;/label\u0026gt;\r\n \u0026lt;label class=\"btn btn-default\"\u0026gt;\r\n \u0026lt;input type=\"radio\"\u0026gt;Five\r\n \u0026lt;/label\u0026gt;\r\n\r\n\u0026lt;/div\u0026gt;\r\n\u0026lt;/div\u0026gt;\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/p\u003e","answer_count":"0","comment_count":"1","creation_date":"2017-05-17 15:49:59.193 UTC","last_activity_date":"2017-05-17 15:49:59.193 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1066197","post_type_id":"1","score":"0","tags":"jquery|css|css3","view_count":"18"} {"id":"44294741","title":"Why would C# linq to sql return the same exact record","body":"\u003cp\u003eSo I have this Entity Framework query in which the \u003ccode\u003eSELECT\u003c/code\u003e statement which i can copy and run in sql server \u003ccode\u003ectx.MainOrders\u003c/code\u003e returns 2 very different records. \u003c/p\u003e\n\n\u003cp\u003eHowever when i run this LINQ query with \u003ccode\u003e.AsEnumerable()\u003c/code\u003e and \u003ccode\u003e.Select(z =\u0026gt; new MainOrder()\u003c/code\u003e i'm getting the EXACT SAME record twice! :/\u003c/p\u003e\n\n\u003cp\u003eThis class is a POCO \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e public class MainOrder\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is my query\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic List\u0026lt;MainOrder\u0026gt; GetMainOrder(string hashString)\n {\n try\n {\n using (var ctx = new ClearContext())\n {\n var query = ctx.MainOrders\n .Where(z =\u0026gt; z.MainId == queryHashMain)\n .AsEnumerable()\n .Select(z =\u0026gt; new MainOrder()\n {\n Email = z.Email,\n AuthorizationFirstName = z.AuthorizationFirstName,\n AuthorizationLastName = z.AuthorizationLastName,\n Btn = z.Btn,\n AccountNumber = z.AccountNumber,\n UtilityTypeName = z.UtilityTypeName\n }).ToList();\n return query;\n\n\n\n return new List\u0026lt;MainOrder\u0026gt;();\n\n }\n }\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"44295963","answer_count":"1","comment_count":"8","creation_date":"2017-05-31 21:11:13.383 UTC","favorite_count":"1","last_activity_date":"2017-05-31 23:01:53.17 UTC","last_edit_date":"2017-05-31 21:35:36.31 UTC","last_editor_display_name":"user6321478","owner_display_name":"user6321478","post_type_id":"1","score":"-1","tags":"c#|sql-server|entity-framework|linq|ef-code-first","view_count":"44"} {"id":"33785657","title":"C#, DataGridView And DataTable","body":"\u003cp\u003eI have a small problem. I have never used DataTable or Datagridview before. With success i add a column names but when it comes to add row, all values are adding in one column. Here's the code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eStreamReader sr = new StreamReader(filename);\n DataTable table = new DataTable();\n string [] datarow;\n\n colt = sr.ReadLine();\n string[] columns = colt.Split(';');\n Count = columns.Length;\n\n foreach (string c in columns)\n {\n Table1.Columns.Add(\"Column\", c);\n table.Columns.Add(c, typeof(String));\n }\n\n while (!sr.EndOfStream)\n {\n rowt = sr.ReadLine();\n datarow = rowt.Split(';');\n\n foreach (string a in datarow)\n { \n table.Rows.Add(a);\n Table1.Rows.Add(a);\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"1","creation_date":"2015-11-18 16:44:06.017 UTC","last_activity_date":"2015-11-18 23:21:37.683 UTC","last_edit_date":"2015-11-18 17:36:45.767 UTC","last_editor_display_name":"","last_editor_user_id":"229666","owner_display_name":"","owner_user_id":"5577614","post_type_id":"1","score":"0","tags":"c#|row|add","view_count":"64"} {"id":"37633550","title":"Python embeddable zip","body":"\u003cp\u003eWith the 3.5.0 release, \u003ca href=\"https://www.python.org/\" rel=\"noreferrer\"\u003ePython.org\u003c/a\u003e has introduced a distribution billed as \u003cem\u003eembeddable zip file\u003c/em\u003e.\u003c/p\u003e\n\n\u003cp\u003eUnfortunately the zipped file comes without a help file (not even a readme). The \u003ca href=\"https://www.python.org/downloads/windows\" rel=\"noreferrer\"\u003edownload page\u003c/a\u003e on Python.org just lists it among the downloads. \u003c/p\u003e\n\n\u003cp\u003eApparently this is a portable Python distribution. It is anyway quite different in structure and size from the standard distribution using the installer. \u003c/p\u003e\n\n\u003cp\u003eI realised that it is possible to install pip with \u003ca href=\"https://bootstrap.pypa.io/get-pip.py\" rel=\"noreferrer\"\u003eget-pip.py\u003c/a\u003e and, thanks to pip, it is a breeze to add many other application packages, though I am still unable to add Tkinter (adjust slashes according to your shell):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ecurl https://www.python.org/ftp/python/3.x.x/python-3.x.x-embed-amd64.zip \u0026gt; epython.zip\nunzip -o epython.zip -d env1\ncurl -L https://bootstrap.pypa.io/get-pip.py\u0026gt;env1/get-pip.py\nenv1/python env1/get-pip.py\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAdd what you need, e.g \u003ca href=\"https://www.djangoproject.com\" rel=\"noreferrer\"\u003edjango\u003c/a\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eenv1/python -m pip install django \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eGiven the size (6.5 Mega for the 3.5.1-x64), I think that it can be convenient as a means to create isolated environments.\u003c/p\u003e\n\n\u003cp\u003eIn fact the general Python \u003ca href=\"https://docs.python.org/3.5/using/windows.html#embedded-distribution\" rel=\"noreferrer\"\u003edocumentation\u003c/a\u003e says that \u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003ethe embedded distribution is (almost) fully isolated from the user’s system, including environment variables, system registry settings, and installed package\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eGiven this, in Windows there are now two isolated Python environments, the second being the standard\n\u003ca href=\"https://pypi.python.org/pypi/virtualenv\" rel=\"noreferrer\"\u003eVirtualenv\u003c/a\u003e. The same process in Virtualenv is like follows:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evirtualenv env2\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand for django it would be: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eenv2/Scripts/python -m pip install django \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eComparing the contents of \u003ccode\u003eenv1\u003c/code\u003e and \u003ccode\u003eenv2\u003c/code\u003e, they appear to have the same files. The only significant difference is \u003ca href=\"https://wiki.python.org/moin/TkInter\" rel=\"noreferrer\"\u003eTkinter1\u003c/a\u003e, which is anyway not much significant for desktop apps.\u003c/p\u003e\n\n\u003cp\u003eWhich is the difference between Python Virtualenv and Python embeddable?\u003c/p\u003e\n\n\u003cp\u003eSpecifically, which is the difference between the isolated web app created with the embeddable zip (\u003ccode\u003eenv1\u003c/code\u003e) and Virtualenv (\u003ccode\u003eenv2\u003c/code\u003e)?\u003c/p\u003e","accepted_answer_id":"37634202","answer_count":"1","comment_count":"1","creation_date":"2016-06-04 18:16:43.313 UTC","favorite_count":"4","last_activity_date":"2017-05-24 22:38:09.35 UTC","last_edit_date":"2016-06-05 21:25:11.18 UTC","last_editor_display_name":"","last_editor_user_id":"1851270","owner_display_name":"","owner_user_id":"1851270","post_type_id":"1","score":"13","tags":"python|python-3.x|pip","view_count":"5665"} {"id":"10195013","title":"How to convert audio binary on server from iPhone POST request?","body":"\u003cp\u003eI have a working POST request that will send a CAF audio file (recorded on the iPhone with AVAudioRecorder) to a web server -- the request itself is structured similarly to \u003ca href=\"https://stackoverflow.com/questions/9549219/send-an-audio-file-and-json-string-in-ios\"\u003eSend an audio FILE and JSON string in iOS\u003c/a\u003e. \u003c/p\u003e\n\n\u003cp\u003eThe server correctly receives the file, but I'm having trouble converting it into a format that will play directly in a browser. In addition to every audio/iPhone/server post I could find on stack overflow, I've looked into ffmpeg and HTML5 audio as well, but couldn't find clear instructions on how to convert the received audio binary to a browser-playable format. Essentially, I need to understand how to accomplish Arun's server-side suggestion \u003ca href=\"https://stackoverflow.com/questions/7750329/how-to-send-audio-file-through-http-post-to-a-server-from-ios\"\u003ehere\u003c/a\u003e.\u003c/p\u003e\n\n\u003cp\u003eI know that Audacity, Soundbooth, etc. will allow you to use the raw data and save it as another format, but I need this to be done programmatically on the server. If there are any suggestions they would be very much appreciated! Thank you.\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2012-04-17 16:15:24.243 UTC","last_activity_date":"2012-04-17 16:15:24.243 UTC","last_edit_date":"2017-05-23 12:27:50.287 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"1339250","post_type_id":"1","score":"1","tags":"iphone|ios|audio","view_count":"646"} {"id":"30812000","title":"Font changes to Times New Roman when pasting into MS Word, depending on markup used","body":"\u003cp\u003eLet's consider this simple table markup with Bootstrap's \u003ccode\u003etable\u003c/code\u003e class\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div\u0026gt;\n \u0026lt;div\u0026gt;\n \u0026lt;table class=\"table\"\u0026gt;\n \u0026lt;tbody\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;th\u0026gt;Some row\u0026lt;/th\u0026gt;\n \u0026lt;td\u0026gt;Some value\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/tbody\u0026gt;\n \u0026lt;/table\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\n \u0026lt;table class=\"table\"\u0026gt;\n \u0026lt;tbody\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;th\u0026gt;Some row\u0026lt;/th\u0026gt;\n \u0026lt;td\u0026gt;Some value\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/tbody\u0026gt;\n \u0026lt;/table\u0026gt;\n \u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSee it at \u003ca href=\"http://www.bootply.com/fracz/c8qvwDhf29\" rel=\"nofollow noreferrer\"\u003eBootply\u003c/a\u003e.\u003c/p\u003e\n\n\u003cp\u003eWhen you select both tables and paste them into MS Word, the font of the text is \u003cem\u003eTimes New Roman\u003c/em\u003e:\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/OduWU.jpg\" alt=\"Times new roman font\"\u003e\u003c/p\u003e\n\n\u003cp\u003eHowever, when I remove the table-wrapping divs (see \u003ca href=\"http://www.bootply.com/DuYhig2Ehn\" rel=\"nofollow noreferrer\"\u003eBootply\u003c/a\u003e), select them both and copy paste to MS Word, it is pasted as \u003cem\u003eHelvetica\u003c/em\u003e.\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/Ob7cm.jpg\" alt=\"Helvetica font\"\u003e\u003c/p\u003e\n\n\u003cp\u003eWhy? I don't see any differences in its CSS styling.\u003c/p\u003e","answer_count":"0","comment_count":"4","creation_date":"2015-06-12 20:54:37.887 UTC","last_activity_date":"2015-06-12 20:58:10.153 UTC","last_edit_date":"2015-06-12 20:58:10.153 UTC","last_editor_display_name":"","last_editor_user_id":"878514","owner_display_name":"","owner_user_id":"878514","post_type_id":"1","score":"0","tags":"html|css|twitter-bootstrap|fonts|ms-word","view_count":"87"} {"id":"31544064","title":"audio+video processing module in kurento","body":"\u003cp\u003e\u003ca href=\"http://www.kurento.org/\" rel=\"noreferrer\"\u003eKurento\u003c/a\u003e has lots of examples of writing kms-filter modules that process video frames, but none that show how to process audio+video. Additionally, \u003ccode\u003ekurento-module-scaffold.sh\u003c/code\u003e seems to only generate module projects that receive a \u003ccode\u003ecv::Mat\u003c/code\u003e or a \u003ccode\u003eGstVideoFrame\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eKurento itself says\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eAs a differential feature, Kurento Media Server also provides advanced\n media processing capabilities involving computer vision, video\n indexing, augmented reality and \u003cstrong\u003espeech analysis\u003c/strong\u003e.\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eso it seems like it should be possible, but I can't see any way to get at the audio in their API.\u003c/p\u003e\n\n\u003cp\u003eSo my question is: can this be done? If so, how?\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2015-07-21 16:00:29.41 UTC","favorite_count":"2","last_activity_date":"2015-07-21 22:56:49.777 UTC","last_edit_date":"2015-07-21 22:56:49.777 UTC","last_editor_display_name":"","last_editor_user_id":"64046","owner_display_name":"","owner_user_id":"89218","post_type_id":"1","score":"6","tags":"webrtc|kurento","view_count":"274"} {"id":"12309836","title":"What Does This Piece Of PHP do? (password decryption)","body":"\u003cblockquote\u003e\n \u003cp\u003e\u003cstrong\u003ePossible Duplicate:\u003c/strong\u003e\u003cbr\u003e\n \u003ca href=\"https://stackoverflow.com/questions/9143101/can-i-md5sha1password\"\u003eCan I md5(sha1(password))?\u003c/a\u003e \u003c/p\u003e\n\u003c/blockquote\u003e\n\n\n\n\u003cpre\u003e\u003ccode\u003e$pass = md5($_POST[\"pass\"].sha1($_POST[\"pass\"]))\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI saw this somewhere and was confused. Does this read a password and decrypt it using sha1 then md5 or reverse? Or is there some other things that I'm missing?\u003c/p\u003e","answer_count":"4","comment_count":"7","creation_date":"2012-09-06 23:30:11.267 UTC","last_activity_date":"2012-09-07 00:27:09.45 UTC","last_edit_date":"2017-05-23 12:12:14.7 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"1115155","post_type_id":"1","score":"0","tags":"php|passwords|md5|sha1|encryption","view_count":"173"} {"id":"13637276","title":"Architecture for having both a mobile and regular site?","body":"\u003cp\u003eI've been asked to develop a mobile version of an existing site and I'm curious about the best way to set everything up. \u003c/p\u003e\n\n\u003cp\u003eDoes it make more sense to create two separate versions of the site: one for mobile one regular? If I do this are there any common techniques for synchronizing the content on both sites?\u003c/p\u003e\n\n\u003cp\u003eOr should I just create a second version of the CSS that targets \u003ccode\u003ehandheld\u003c/code\u003e media types?\u003c/p\u003e","accepted_answer_id":"13637315","answer_count":"1","comment_count":"4","creation_date":"2012-11-30 00:34:18.223 UTC","favorite_count":"2","last_activity_date":"2012-11-30 00:38:52.687 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"226897","post_type_id":"1","score":"1","tags":"html|css|mobile|web","view_count":"83"} {"id":"39121374","title":"open incoming UDP port in android mobile phone","body":"\u003cp\u003eFor a certain test I need to make a P2P connection between two mobile devices (running android). I can get assign a publicly routable static ips for the mobile devices. I need to know whether is it possible to open a UDP port inside a device for which the other device can directly push content?\u003c/p\u003e","accepted_answer_id":"39122479","answer_count":"1","comment_count":"0","creation_date":"2016-08-24 10:55:48.743 UTC","last_activity_date":"2016-08-24 11:47:36.44 UTC","last_edit_date":"2016-08-24 11:13:17.03 UTC","last_editor_display_name":"","last_editor_user_id":"893542","owner_display_name":"","owner_user_id":"893542","post_type_id":"1","score":"0","tags":"android|mobile|udp|p2p","view_count":"496"} {"id":"27033840","title":"Changing the GCC Code. How to test the addition of newly added features?","body":"\u003cp\u003eI am learning compilers and want to make changes of my own to GCC parser and lexer. Is there any testing tool or some another way available which let me change gcc code and test it accordingly.\u003c/p\u003e\n\n\u003cp\u003eI tried changing the lexical analysis file but now I am stuck because I don't know how to compile these files. I tried the compilation using other GCC compiler but show errors. I even tried \u003cstrong\u003econfigure and make\u003c/strong\u003e but doing this with every change does not seems efficient.\u003c/p\u003e\n\n\u003cp\u003eThe purpose of these changes is just learning and I have to consider GCC only as this is the only compiler my instructor allowed.\u003c/p\u003e","accepted_answer_id":"27035621","answer_count":"2","comment_count":"4","creation_date":"2014-11-20 07:15:08.913 UTC","last_activity_date":"2014-11-20 09:32:14.46 UTC","last_edit_date":"2014-11-20 09:24:54.417 UTC","last_editor_display_name":"","last_editor_user_id":"1128183","owner_display_name":"","owner_user_id":"1128183","post_type_id":"1","score":"1","tags":"gcc|compiler-construction|gnu|compiler-optimization|gcc4.7","view_count":"58"} {"id":"25451195","title":"CCLabelTTF set automatically the font size","body":"\u003cp\u003eIs there a way to set automatically the font size of a CCLabelTTF text in base of the length of the string? \nbecause I have a number that increment and if it gets too big collides with a close image...\u003c/p\u003e","accepted_answer_id":"25453555","answer_count":"1","comment_count":"0","creation_date":"2014-08-22 16:04:13.43 UTC","last_activity_date":"2014-08-22 18:37:58.383 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1763004","post_type_id":"1","score":"0","tags":"ios|cocos2d-iphone|cclabelttf","view_count":"127"} {"id":"17170492","title":"Maven-like structure in Dart seems impossible","body":"\u003cp\u003eI created a little sample on GitHub to test the integration of Dart into a Maven-like structure:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://github.com/MikeMitterer/dart-WebUIDifferentViews\" rel=\"nofollow\"\u003ehttps://github.com/MikeMitterer/dart-WebUIDifferentViews\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eWhat I did:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003e\u003cp\u003eI turned off the build-script because I could not find an option for the out-Folder.\nSo I generated the \u003ccode\u003esrc/main/webapp\u003c/code\u003e folder on the command line:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edart --package-root=packages/ packages/web_ui/dwc.dart --out \\\n src/main/webapp/src/main/dart/app.html\n\u003c/code\u003e\u003c/pre\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eOK - works so far, but I had to create the \u003ccode\u003epackages\u003c/code\u003e folder in \u003ccode\u003ewebapp\u003c/code\u003e by hand. (\u003ccode\u003eln -s ../../../packages\u003c/code\u003e).\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eSome \u003ccode\u003ehref\u003c/code\u003e links are wrong in \u003ccode\u003eapp.html\u003c/code\u003e. For example,\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;link rel=\"stylesheet\" href=\"../dart/assets/app.css\"\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eshould point to \u003ccode\u003e../assets/app.css\u003c/code\u003e.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eNext I tried to debug the whole thing.\u003c/p\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eIt failed because the debugger was not able to find the right source directory.\u003c/p\u003e\n\n\u003cp\u003eAny solutions?\u003c/p\u003e","answer_count":"1","comment_count":"4","creation_date":"2013-06-18 13:41:54.917 UTC","last_activity_date":"2014-08-18 04:53:42.13 UTC","last_edit_date":"2013-06-18 18:24:33.947 UTC","last_editor_display_name":"","last_editor_user_id":"1427098","owner_display_name":"","owner_user_id":"504184","post_type_id":"1","score":"2","tags":"dart|dart-webui","view_count":"547"} {"id":"7799036","title":"Optimizing multiple SELECTs","body":"\u003cpre\u003e\u003ccode\u003eSELECT \n (SELECT COUNT(*) FROM votes WHERE votes.vote = 1) AS upvotes,\n (SELECT COUNT(*) FROM votes WHERE votes.vote = -1) AS downvotes,\nFROM votes WHERE link = \u0026lt;linkid\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eStraight up question; how could this be optimized? I can't think of any better way to do it but I'm bad at MySQL.\u003c/p\u003e\n\n\u003cp\u003eThanks for any responses!\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eEDIT:\u003c/strong\u003e To make things clear: I want it to return one row with two columns; \u003ccode\u003eupvotes\u003c/code\u003e and \u003ccode\u003edownvotes\u003c/code\u003e\u003c/p\u003e","accepted_answer_id":"7799062","answer_count":"6","comment_count":"4","creation_date":"2011-10-17 20:16:42.62 UTC","last_activity_date":"2011-10-17 20:48:48.163 UTC","last_edit_date":"2011-10-17 20:48:48.163 UTC","last_editor_display_name":"user2058002","owner_display_name":"user2058002","post_type_id":"1","score":"1","tags":"mysql|sql|optimization|select","view_count":"126"} {"id":"15722243","title":"How to make a Calculator that add automaticly","body":"\u003cp\u003eIn Java, NetBeans, I'm trying to make a calculator that adds automatically when you press a button. So for example when you hit 1 the previous amount on the calculator is added by 1. If you hit 2 the previous amount is added by 2. etc. \u003c/p\u003e\n\n\u003cp\u003eint a = 3;\u003c/p\u003e\n\n\u003cp\u003eHowever on the display.setText(a + display); it comes up with the error that they have to be strings, so how do I add 2 strings together?\u003c/p\u003e\n\n\u003cp\u003eIn theory it should be 3 as display is = to 0.\u003c/p\u003e\n\n\u003cp\u003eHow would I display the value of both the numbers?\u003c/p\u003e","accepted_answer_id":"15722278","answer_count":"2","comment_count":"2","creation_date":"2013-03-30 18:57:23.73 UTC","favorite_count":"1","last_activity_date":"2013-03-31 20:02:46.57 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2227571","post_type_id":"1","score":"2","tags":"java|string|netbeans|int|settext","view_count":"451"} {"id":"33976443","title":"Make windows form appear in a Unity game","body":"\u003cp\u003eI downloaded a game which is based on unity engine, and I programmed a windows form which reads the log file the game creates in realtime and do somethings with the data.\u003c/p\u003e\n\n\u003cp\u003eIs there a way to kind of inject the form into the game?\nI mean the form will appear as-is inside the game.\u003c/p\u003e\n\n\u003cp\u003eThanks for all :)\u003c/p\u003e","accepted_answer_id":"33980896","answer_count":"1","comment_count":"3","creation_date":"2015-11-28 21:05:00.573 UTC","last_activity_date":"2015-11-29 14:48:11.763 UTC","last_edit_date":"2015-11-29 14:48:11.763 UTC","last_editor_display_name":"","last_editor_user_id":"2910943","owner_display_name":"","owner_user_id":"3857607","post_type_id":"1","score":"0","tags":"c#|windows|forms|unity3d|code-injection","view_count":"695"} {"id":"37394235","title":"Elegant Python loop for parsing flat XML","body":"\u003cp\u003eI am parsing an XML file in Python3 using lxml.objectify:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;root\u0026gt;\n \u0026lt;object_header\u0026gt;\u0026lt;/object_header\u0026gt;\n \u0026lt;object_details\u0026gt;\u0026lt;/object_details\u0026gt;\n \u0026lt;object_details\u0026gt;\u0026lt;/object_details\u0026gt;\n \u0026lt;object_header\u0026gt;\u0026lt;/object_header\u0026gt;\n \u0026lt;object_details\u0026gt;\u0026lt;/object_details\u0026gt;\n \u0026lt;object_header\u0026gt;\u0026lt;/object_header\u0026gt;\n\u0026lt;/root\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNote that sometimes the object does not have attributes.\u003c/p\u003e\n\n\u003cp\u003eThe way I am currently parsing this (which works but is inelegant) is by the following:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom lxml import objectify, etree\nroot = objectify.parse(xmlFile).getroot()\nelems = [el for el in root.iterchildren()]\n# data is list of objects\ndata = []\n# Have to instantiate outside of for loop in case last object has not details.\nobjectDetails = ''\n# Don't store first object right away.\nfirstObject = True\n# Iterate through each XML element.\nfor elem in elems:\n if elem.tag == 'object_header':\n # Remember object header info.\n object = storeHeaderInfo(objectDetails)\n # Skip saving if first object, need to grab object details.\n if firstObject == True:\n # Don't skip again, in case object has no details.\n firstObject = False\n continue\n # Save object, already grabbed object details.\n data.append(object)\n else:\n # Process object details in \u0026lt;object_details\u0026gt; tag.\n objectDetails += etree.tostring(elem)\n# Save last object.\nobject = storeHeaderInfo(objectDetails)\ndata.append(object)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat I don't like is how I have to code storing the object twice. Once for each object in the for loop, and then again for the last object.\u003c/p\u003e\n\n\u003cp\u003eIs there a more pythonic or elegant way of doing this?\u003c/p\u003e","accepted_answer_id":"37394434","answer_count":"1","comment_count":"0","creation_date":"2016-05-23 14:53:02.55 UTC","favorite_count":"1","last_activity_date":"2016-05-23 15:03:15.31 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"564514","post_type_id":"1","score":"1","tags":"python|xml|python-3.x|for-loop|lxml","view_count":"177"} {"id":"29710394","title":"Call method a JS file that includes my file","body":"\u003cp\u003eParent file : Parent.js\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eexports.execute = function execute(request) {\n var result = executeChild(request); // Will not work as the executeChild function is not in this file.\n return \"Hi!\";\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eChild file : Child1.js\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ecommon = require('common');\nexecute = common.execute;\nfunction executeChild(request) {\n return \"Hello1\";\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eChild file : Child2.js\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ecommon = require('common');\nexecute = common.execute;\nfunction executeChild(request) {\n return \"Hello2\";\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAll the users of API call the \u003cstrong\u003eexecute\u003c/strong\u003e method and they have no idea about the Parent child (\u003cem\u003eOK may be its not a real Parent child relationship\u003c/em\u003e) relationship. \u003cstrong\u003eHow to make this function call (execute child) work.\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eNodeJs is used to execute this.\u003c/p\u003e\n\n\u003cp\u003eI would try to update the functions in the child files as a last resort and not before.\u003c/p\u003e","accepted_answer_id":"29715912","answer_count":"1","comment_count":"3","creation_date":"2015-04-17 22:21:49.527 UTC","last_activity_date":"2015-04-18 10:17:17.22 UTC","last_edit_date":"2015-04-17 22:26:52.367 UTC","last_editor_display_name":"","last_editor_user_id":"1630327","owner_display_name":"","owner_user_id":"1630327","post_type_id":"1","score":"1","tags":"javascript|node.js","view_count":"80"} {"id":"26996951","title":"Pass object trough function","body":"\u003cp\u003eHi I am trying to pass a PHP object as parameter trough a function but I get the following errors:\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eNotice: Trying to get property of non-object\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eCall to a member function create() on a non-object\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$mollie = new Mollie_API_Client;\n$mollie-\u0026gt;setApiKey(\"0000\"); \n\nadd_action( 'init', 'gtp_mollie_payment_submit' );\nfunction gtp_mollie_payment_submit( $mollie ) {\n\n if( isset( $_POST['checkout_submit'] ) ) {\n\n $payment = $mollie-\u0026gt;payments-\u0026gt;create(array(\n \"amount\" =\u0026gt; 10.00,\n \"description\" =\u0026gt; \"My first API payment\",\n \"redirectUrl\" =\u0026gt; \"https://webshop.example.org/order/12345/\",\n \"method\" =\u0026gt; Mollie_API_Object_Method::IDEAL,\n ));\n }\n\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"30760058","answer_count":"1","comment_count":"5","creation_date":"2014-11-18 14:41:19.863 UTC","last_activity_date":"2015-06-10 14:57:44.74 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2427969","post_type_id":"1","score":"0","tags":"php|function|object|parameters","view_count":"65"} {"id":"27600158","title":"remote javascript debug web application galaxy tab","body":"\u003cp\u003eI'am trying to debug a web application using this tutorial: \u003ca href=\"https://developer.chrome.com/devtools/docs/remote-debugging\" rel=\"nofollow\"\u003ehttps://developer.chrome.com/devtools/docs/remote-debugging\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eWhen I go to chrome://inspect I can't found my device in the list\u003c/p\u003e\n\n\u003cp\u003eCan you help me please\u003c/p\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","accepted_answer_id":"27601342","answer_count":"1","comment_count":"0","creation_date":"2014-12-22 09:49:15.503 UTC","last_activity_date":"2014-12-22 10:58:16.84 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3484404","post_type_id":"1","score":"0","tags":"android|debugging","view_count":"76"} {"id":"18138377","title":"Ajax + PHP validation and call Javascript function inside PHP validation","body":"\u003cp\u003eBasically, I'm trying to call a Javascript function inside a PHP script when using Ajax.\u003c/p\u003e\n\n\u003cp\u003eJavaScript:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;script type=\"text/javascript\"\u0026gt;\n function Validate() {\n hr = new XMLHttpRequest();\n name = document.getElementById('name').value;\n\n hr.open('POST', 'validator.php', true);\n hr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n\n hr.onreadystatechange = function() {\n if ( hr.readyState == 4 \u0026amp;\u0026amp; hr.status == 200 ) {\n document.getElementById('message').innerHTML = hr.responseText;\n }\n }\n hr.send('name=' + name);\n }\n\n function disable() {\n document.getElementById('message').innerHTML = '';\n }\n\u0026lt;/script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHTML:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div id=\"message\"\u0026gt;\u0026lt;/div\u0026gt;\nName: \u0026lt;input type=\"text\" id=\"name /\"\u0026gt;\n\u0026lt;input type=\"button\" onclick=\"Validate();\" value=\"Validate\" /\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ePHP: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php \n $name = $_POST['name']; \n if ( !empty( $name ) ) {\n if ( $name == 'Tom' ) {\n echo \"\u0026lt;script\u0026gt;alert('Hello Tom, Welcome Back')\u0026lt;/script\u0026gt;\";\n } else {\n echo 'You are not Tom';\n }\n } else {\n echo 'Please enter a name.';\n }\n?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eEverything works fine except calling the Javascript function inside PHP \u003ccode\u003eecho \u0026lt;script\u0026gt;alert()\u0026lt;/script\u0026gt;\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eWhat I think the problem here is because I declared \u003ccode\u003ehr.responseText\u003c/code\u003e, as a result, the javascript I want to show has returned into text. But what should I do to solve this problem?\u003c/p\u003e\n\n\u003cp\u003eAny help would be appreciated.\u003c/p\u003e","accepted_answer_id":"18138836","answer_count":"3","comment_count":"0","creation_date":"2013-08-09 00:23:14.287 UTC","last_activity_date":"2016-02-23 19:24:33.403 UTC","last_edit_date":"2013-08-09 01:35:39.11 UTC","last_editor_display_name":"","last_editor_user_id":"799478","owner_display_name":"","owner_user_id":"2650951","post_type_id":"1","score":"0","tags":"php|javascript|jquery|ajax|validation","view_count":"706"} {"id":"37227031","title":"How to save and then retrieve all window variables in JS?","body":"\u003cp\u003ethe JS script uses: \u003ccode\u003ewindow.opener.variables\u003c/code\u003e since variables are stored on the windows that opened the popup.\u003c/p\u003e\n\n\u003cp\u003eMy goal is to avoid to use the popup, but keep the script as it is. \u003c/p\u003e\n\n\u003cp\u003eIdea1: I try to save the window object into localStorage and retrieve it \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003elocalStorage.setItem('win', window)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand the use\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ewindow.opener = localStorage.getItem('win')\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eProblem : localStorage.setItem('win', window) does not save the global variables.\u003c/p\u003e\n\n\u003cp\u003eLooks like Object.keys(window) can help here... but no idea how to store its values.\u003c/p\u003e","answer_count":"0","comment_count":"5","creation_date":"2016-05-14 13:06:16.633 UTC","last_activity_date":"2016-05-14 13:06:16.633 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"300675","post_type_id":"1","score":"1","tags":"javascript","view_count":"36"} {"id":"1954755","title":"Mono Winforms application in Linux: some text is not displayed","body":"\u003cp\u003e\u003cstrong\u003eIn general,\u003c/strong\u003e I have been having difficulties porting my .NET Windows Forms applications created in Visual Studio 2008 to Mono/Linux. The problem is that sometimes, some types of text do not get displayed; where I expect to see text there is just emptiness or illegible marks. On one Ubuntu machine, all the text was displayed correctly except the text in dialog boxes from MessageBox.Show, which looked like tiny illegible black marks. On another Ubuntu machine, that same program worked fine. But then I upgraded that machine from Ubuntu 9.4 to 9.10: now the text of Checkboxes and Labels does not show up, but the text inside Textboxes and Tab labels does show up.\u003c/p\u003e\n\n\u003cp\u003e\u003cem\u003eWhen you are porting an application to Mono/Linux and you have text display difficulties, how do you debug it? What are your general strategies?\u003c/em\u003e\u003c/p\u003e\n\n\u003cp\u003eAm I missing fonts, and how do I figure out which fonts are missing?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eMore specifically:\u003c/strong\u003e I made a small program in Visual Studio that just had a tab control with two tab pages, and a label in each one. It works fine in Visual Studio, but in Mono/Linux the text of the tabs gets displayed while the labels' text does not get displayed.\u003c/p\u003e\n\n\u003cp\u003eI am using Ubuntu 9.10, and I have installed these relevant packages: mono-gmcs libusb-1.0-0-dev mono-2.0-devel libmono-winforms2.0-cil.\u003c/p\u003e\n\n\u003cp\u003eHere is the command I used to compile the program:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003egmcs -unsafe -debug -target:exe -out:EventTest.exe\n./Form1.cs ./Form1.Designer.cs ./Program.cs\n-r:/usr/lib/mono/2.0/System.dll\n-r:/usr/lib/mono/2.0/System.Core.dll\n-r:/usr/lib/mono/2.0/System.Drawing.dll\n-r:/usr/lib/mono/2.0/System.Windows.Forms.dll\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I ran it with MONO_LOG_LEVEL=DEBUG, I got several error messages:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e(./EventTest.exe:8395): Mono-WARNING **: The request to load the assembly\nmscorlib v1.0.5000.0 was remapped to v2.0.0.0\n(./EventTest.exe:8395): Mono-WARNING **: The request to load the assembly\nSystem.Windows.Forms v1.0.5000.0 was remapped to v2.0.0.0\n(./EventTest.exe:8427): Mono-WARNING **: DllImport unable to load library\n'lib/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon:\ncannot open shared object file: No such file or directory'.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhy would it try to load version 1.0 when I explicitly compiled with version 2.0?\nWhy would it try to load Carbon (isn't that a Max OS thing?)\nI'll give the whole log if you want to see it.\u003c/p\u003e\n\n\u003cp\u003eThere was also a log message about not being able to find \"libgdi32\". I add a symbolic link using the command below, and that removed the error message but didn't seem to affect the application's other problems.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003esudo ln -s /usr/lib/wine/gdi32.dll.so /usr/lib/libgdi32.so\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"1954837","answer_count":"1","comment_count":"0","creation_date":"2009-12-23 19:12:25.857 UTC","last_activity_date":"2009-12-23 19:27:16.723 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"28128","post_type_id":"1","score":"1","tags":"c#|winforms|ubuntu|mono|ubuntu-9.10","view_count":"1876"} {"id":"23609841","title":"Is it bad to register more classes than needed with autofac?","body":"\u003cp\u003eI would like to use a common Autofac module in several different web projects.\u003c/p\u003e\n\n\u003cp\u003eOne of these projects does not require all the classes registered in my common module (it uses about half of them). My guess was that if a class is registered but never called, it will not be resolved and so it will not use up extra memory. \u003c/p\u003e\n\n\u003cp\u003eIs this ok or bad practice ? Thanks\u003c/p\u003e","accepted_answer_id":"23611202","answer_count":"2","comment_count":"2","creation_date":"2014-05-12 13:02:25.807 UTC","last_activity_date":"2014-05-12 15:22:08.74 UTC","last_edit_date":"2014-05-12 15:22:08.74 UTC","last_editor_display_name":"","last_editor_user_id":"264697","owner_display_name":"","owner_user_id":"1875786","post_type_id":"1","score":"1","tags":"c#|dependency-injection|ioc-container|autofac","view_count":"158"} {"id":"14900116","title":"Excel update columns, cell values","body":"\u003cp\u003eSo here is what I am trying to do:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e1) Look-up A2 value in Column C.\n2) The rows in Column C where A:2 value exists, then the respective cell in D will get the value\n of B. If it does not exists then D will have a value of 0.\n\nthe formula im using in D2 is something like =LOOKUP(A2,C:C,REPLACE WITH B) and if not exists then b2 = 0\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am able to use a match but dont know how to replace with the correct value\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/jqfaw.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e","accepted_answer_id":"14900308","answer_count":"1","comment_count":"4","creation_date":"2013-02-15 17:30:48.927 UTC","last_activity_date":"2013-02-15 20:32:22.453 UTC","last_edit_date":"2013-02-15 19:40:35.233 UTC","last_editor_display_name":"","last_editor_user_id":"1440586","owner_display_name":"","owner_user_id":"1440586","post_type_id":"1","score":"0","tags":"excel","view_count":"2641"} {"id":"31881267","title":"ACSL contract for strstr","body":"\u003cp\u003eI'm trying to write a specification for a C function that searches the first occurrence of a string in another string (practically the strstr function of string.h).\u003c/p\u003e\n\n\u003cp\u003eThe first problem i encountered is that i can't prove loop invariants and i think that there's something wrong in the way i use strlen (axiomatic defined in __fc_string_axiomatic.h)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#include\u0026lt;string.h\u0026gt;\n/*@ \n requires valid_string(s1);\n requires valid_string(s2);\n\n*/\nchar *strfind (const char *s1, const char *s2) {\n if (*s2 == 0) \n return s1;\n /*@ \n loop invariant 0 \u0026lt;= s1 - \\at(s1,Pre) \u0026lt;= strlen(\\at(s1,Pre));\n */\n while (*s1) { \n const char *rs1 = s1;\n const char *rs2 = s2;\n /*@ \n loop invariant 0 \u0026lt;= rs1 - s1 \u0026lt;= strlen(s1);\n loop invariant 0 \u0026lt;= rs2 - s2 \u0026lt;= strlen(s2);\n */\n while (*rs1 \u0026amp;\u0026amp; *rs2 \u0026amp;\u0026amp; (*rs1 == *rs2)) { \n rs1++; \n rs2++; \n }\n if (*rs2 == 0) \n return s1;\n s1++;\n }\n return 0;\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"1","creation_date":"2015-08-07 15:19:50.047 UTC","last_activity_date":"2015-08-07 22:20:57.03 UTC","last_edit_date":"2015-08-07 17:31:45.303 UTC","last_editor_display_name":"","last_editor_user_id":"5058889","owner_display_name":"","owner_user_id":"5058889","post_type_id":"1","score":"1","tags":"c|string|strstr|frama-c","view_count":"118"} {"id":"25003562","title":"WebBrowser control in WinForm using C# not playing video","body":"\u003cp\u003eI am writing HTML from a WinForm to a WebBrowser control. I initialize the control by navigating to \u003ccode\u003eabout:blank\u003c/code\u003e. The issue I am having is trying to display a video in the application's folder. The HTML I am writing is below\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;video controls style='width: 200px;height: 151px;'\u0026gt;\n \u0026lt;source src='C:\\Users\\SomeUser\\MyAppFolder\\Media\\media.mp4' type='video/mp4'\u0026gt;\n \u0026lt;object data='C:\\Users\\SomeUser\\MyAppFolder\\Media\\media.mp4'\u0026gt;\n \u0026lt;embed src='C:\\Users\\SomeUser\\MyAppFolder\\Media\\media.mp4' type='video/mp4'\u0026gt;\n \u0026lt;/object\u0026gt;\n\u0026lt;/video\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis WinForm is using .NET 4.0 and needs to be compatible with WinXp. I can see that the HTML would fall to the \u003ccode\u003eembed\u003c/code\u003e tag. If I put an html page in the app folder and open it with IE using only \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;embed src='C:\\Users\\SomeUser\\MyAppFolder\\Media\\media.mp4'\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI get the ActiveX warning \u003ccode\u003eInternet Explorer restricted this webpage from running scripts or ActiveX controls\u003c/code\u003e and there is a button to allow blocked content, which I am guessing is the problem within the control. Is it possible to work around this? \u003c/p\u003e","answer_count":"0","comment_count":"6","creation_date":"2014-07-28 20:15:47.237 UTC","last_activity_date":"2014-07-30 09:51:32.793 UTC","last_edit_date":"2014-07-30 09:51:32.793 UTC","last_editor_display_name":"","last_editor_user_id":"562282","owner_display_name":"","owner_user_id":"52051","post_type_id":"1","score":"0","tags":"c#|.net|winforms","view_count":"736"} {"id":"15697516","title":"Mac OS installer package with Readme file containing images","body":"\u003cp\u003eI'm trying to set \u003ccode\u003e\u0026lt;readme\u0026gt;\u003c/code\u003e tag in Distribution.xml part of the package to contain something which may contain images. For now I've tried \u003cstrong\u003ertfd\u003c/strong\u003e and \u003cstrong\u003epdf\u003c/strong\u003e; for \u003cstrong\u003ertfd\u003c/strong\u003e it compains that it can't open the file because of permissions lack and \u003cstrong\u003epdf\u003c/strong\u003e is displayed as plain text. \nSo the question is: how to use something that may contain images with Distribution.xml\u003c/p\u003e","accepted_answer_id":"15714851","answer_count":"2","comment_count":"2","creation_date":"2013-03-29 04:46:46.607 UTC","last_activity_date":"2014-05-08 17:01:59.22 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"643393","post_type_id":"1","score":"2","tags":"osx|productbuild","view_count":"412"} {"id":"23615020","title":"How to update field to longest string of multiple tables/rows?","body":"\u003cp\u003eI'm trying to merge the \"best\" data from two tables into the first table, but I can't figure out how to select the best data inside the set statement.\u003c/p\u003e\n\n\u003cp\u003eIn this case, \"best\" data means \"longest\". Table1 has unique IDs, but Table2 has duplicates of the ID. The information is essentially the same, but I want the fields with the longest strings from Table1 or Table2, possibly not all from the same row.\u003c/p\u003e\n\n\u003cp\u003eI tried this first, but of course, merge fails when there are two matching rows in Table2:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eUSE DatabaseName\nMERGE Table1 AS a\nUSING Table2 AS b1\nON a.[ID-unique] LIKE b1.[ID-not-unique]\nWHEN MATCHED THEN UPDATE\nSET a.[Field1] =\n CASE \n WHEN a.[Field1] IS NULL\n THEN b1.[Field1]\n WHEN LEN(a.[Field1]) \u0026lt; LEN(b1.[Field1])\n THEN b1.[Field1]\n ELSE a.[Field1] END,\na.[Field2] =\n CASE\n WHEN a.[Field2] IS NULL\n THEN b1.[Field2]\n WHEN LEN(a.[Field2]) \u0026lt; LEN(b1.[Field2])\n THEN b1.[Field2]\n ELSE a.[Field2] END;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI used something like this elsewhere to select the longest string, but I get errors when I try to include it as the \"THEN\" statement:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT [Field] FROM Table2 b2\nWHERE \n LEN([Field])\n = \n (\n SELECT MAX(LEN([Field]))\n FROM [Table2] AS b3\n WHERE b2.[ID-not-unique] = b3.[ID-not-unique]\n )\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"23615151","answer_count":"2","comment_count":"0","creation_date":"2014-05-12 17:13:57.083 UTC","last_activity_date":"2014-05-12 17:41:08.06 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3403230","post_type_id":"1","score":"2","tags":"sql|tsql","view_count":"50"} {"id":"46182117","title":"Accessing a dataframe column with index","body":"\u003cp\u003eI have dataframe with A,B,C as its columns. I have set an index on it using \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edf.set_index('A')\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow I want to filter rows using a condition statement like\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edf[df.loc['A'] == '10001']\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis gives me the following error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eKeyError: 'the label [A] is not in the [index]'\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow do I apply a condition on the column I have set as an index?\u003c/p\u003e","accepted_answer_id":"46182956","answer_count":"2","comment_count":"3","creation_date":"2017-09-12 17:13:03.173 UTC","last_activity_date":"2017-09-12 18:10:18.073 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4169985","post_type_id":"1","score":"0","tags":"python|pandas|dataframe|indexing","view_count":"26"} {"id":"28823082","title":"angularjs: Better way to use ngModel.$asynValidators","body":"\u003cp\u003eI just want to asked if there's a better way to improve my user validation codes. \u003c/p\u003e\n\n\u003cp\u003edirective.js\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eangular.module('installApp')\n.directive('usernameValidator', function ($q, $timeout, $http) {\n return {\n require: 'ngModel',\n link: function(scope, element, attrs, ngModel) {\n\n ngModel.$asyncValidators.username = function(modelValue, viewValue) {\n return $http.post('../api/v1/checkUsers', {user: {'username':viewValue}}).then(\n function(response){\n scope.checkUsers = response.data;\n var deferred = $q.defer();\n $timeout(function() {\n if(scope.checkUsers['status'] == 404){\n deferred.reject();\n }else{\n deferred.resolve();\n }\n }, 2000);\n return deferred.promise;\n }); \n };\n }\n }\n });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eaccounts.html\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;form name=\"myForm\" ng-submit=\"submit()\"\u0026gt;\n \u0026lt;div\u0026gt;\n \u0026lt;label\u0026gt;Username: \u0026lt;input type=\"text\" ng-model=\"signup.username\" name=\"username\" required username-validator\u0026gt;\n \u0026lt;/label\u0026gt;\n \u0026lt;div ng-if=\"myForm.username.$dirty\"\u0026gt;\n \u0026lt;div ng-messages=\"myForm.username.$error\" class=\"validation-error\"\u0026gt;\n \u0026lt;div ng-message=\"required\"\u0026gt;Username required\u0026lt;/div\u0026gt;\n \u0026lt;div ng-message=\"username\"\u0026gt;Username already in use\u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div ng-messages=\"myForm.username.$pending\" class=\"validation-pending\"\u0026gt;\n \u0026lt;div ng-message=\"username\"\u0026gt;Checking username availability... \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\n \u0026lt;label\u0026gt;Password: \u0026lt;input type=\"password\" ng-model=\"signup.password\" name=\"password\" required\u0026gt;\u0026lt;/label\u0026gt;\n \u0026lt;div ng-messages=\"myForm.password.$error\" ng-if=\"myForm.password.$dirty\" class=\"validation-error\"\u0026gt;\n \u0026lt;div ng-message=\"required\"\u0026gt;Password required\u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;button type=\"submit\" ng-disabled=\"myForm.$invalid || myForm.$pending\"\u0026gt;Submit\u0026lt;/button\u0026gt;\n \u0026lt;/form\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe above code is perfectly working fine, but there is a doubt in my mind on how can I improve it in a better way. I've seen many examples and I noticed they didn't used mostly the if/ else condition. Please help\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-03-03 02:30:09.833 UTC","last_activity_date":"2015-07-03 18:27:37.123 UTC","last_edit_date":"2015-03-03 04:56:37.953 UTC","last_editor_display_name":"","last_editor_user_id":"4535540","owner_display_name":"","owner_user_id":"4535540","post_type_id":"1","score":"0","tags":"html|angularjs-directive|angularjs-ng-model","view_count":"122"} {"id":"29216509","title":"Can I get Google top 10 autocomplete words in Java(Android)","body":"\u003cp\u003eIs it possible to get the top 10 autocomplete words from google search? \nI need this to work like this example:\nI type a word in google search, example:\u003ccode\u003eear\u003c/code\u003e and google is returning suggestions so you can complete your query, example returning words: \u003ccode\u003eear wax, ear piercing, ear infection\u003c/code\u003e etc.. So I would like to get the top 10 returning words from google in JAVA\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2015-03-23 17:24:56.107 UTC","last_activity_date":"2015-03-23 17:43:01.013 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1892622","post_type_id":"1","score":"-1","tags":"java|android|google-api|httprequest","view_count":"228"} {"id":"3573535","title":"Function to split and cut the string and print in PHP","body":"\u003cp\u003eI want to know the function that can perform the following operation\u003c/p\u003e\n\n\u003cp\u003e$str = \"uploads/file/file1.jpg\";\u003c/p\u003e\n\n\u003cp\u003ei want to slash the initial of the string uploads/file/ and just want to return file1.jpg as value. \u003c/p\u003e\n\n\u003cp\u003ei tried using str_replace(), \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$str = \"uploads/file/file1.jpg\";\n\n$str2 = str_replace(\"uploads/file\",\" \", $str);\n\necho $str;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethis is not working, where i am going wrong?\u003c/p\u003e\n\n\u003cp\u003eEDIT : Silly me i was not noticing that i was trying to echo $str, sorry for this. it is working for me now.\u003c/p\u003e\n\n\u003cp\u003eBTW i want to know which method is better the above one or the basename();\u003c/p\u003e","accepted_answer_id":"3573552","answer_count":"3","comment_count":"1","creation_date":"2010-08-26 08:56:23.317 UTC","last_activity_date":"2010-08-26 09:04:38.023 UTC","last_edit_date":"2010-08-26 09:01:54.427 UTC","last_editor_display_name":"","last_editor_user_id":"396476","owner_display_name":"","owner_user_id":"396476","post_type_id":"1","score":"0","tags":"php","view_count":"100"} {"id":"6559095","title":"URL Rewriting Question in Apache","body":"\u003cp\u003eI am doing a php project but I am not good at url_rewrite module in apache and I wanna learn how to achieve this kind of url rewrite here:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ehttp://www.something.com/press/release/something_1/\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003ccode\u003e01\u003c/code\u003e will be \u003ccode\u003eid\u003c/code\u003e of the press_release so that part will be dynamic part. \u003ccode\u003esomething\u003c/code\u003e is also dynamic but not included in query_string part. This url is converted to the one below:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ehttp://www.something.com/press/release/press_detail.php?rid=1\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan somebody show me how to write the url_rewrite rule for this conversion.\u003c/p\u003e","accepted_answer_id":"6559138","answer_count":"1","comment_count":"0","creation_date":"2011-07-02 19:21:49.837 UTC","last_activity_date":"2011-07-02 21:28:14.47 UTC","last_edit_date":"2011-07-02 21:28:14.47 UTC","last_editor_display_name":"","last_editor_user_id":"21234","owner_display_name":"","owner_user_id":"44852","post_type_id":"1","score":"2","tags":"php|apache|url-rewriting","view_count":"80"} {"id":"35132500","title":"Do int8_t, int16_t, int32_t and int64_t have same respective ranges on different C++ compilers?","body":"\u003cp\u003eOr this is dependent on the 16 bit, 32 bit, etc. compiler?\u003c/p\u003e\n\n\u003cp\u003eAlso, are these data types valid in C, C# or Java?\u003c/p\u003e","accepted_answer_id":"35132669","answer_count":"3","comment_count":"0","creation_date":"2016-02-01 14:03:46.307 UTC","last_activity_date":"2016-02-01 14:49:17.03 UTC","last_edit_date":"2016-02-01 14:34:43.483 UTC","last_editor_display_name":"","last_editor_user_id":"745750","owner_display_name":"","owner_user_id":"5138448","post_type_id":"1","score":"3","tags":"c++|range","view_count":"1234"} {"id":"3645845","title":"Glossy Button in VB.Net?","body":"\u003cp\u003eHow to make glossy button in Vb.Net?\u003c/p\u003e\n\n\u003cp\u003eor\u003c/p\u003e\n\n\u003cp\u003ehow change button background on mouseover?\u003c/p\u003e","answer_count":"2","comment_count":"1","creation_date":"2010-09-05 11:09:01.473 UTC","last_activity_date":"2014-09-14 18:19:15.6 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"437641","post_type_id":"1","score":"-1","tags":"vb.net|button","view_count":"1159"} {"id":"32150930","title":"A Way in Knitr to Copy a Chunk?","body":"\u003cp\u003eKnitr Mavens,\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eBackground\u003c/strong\u003e: Using knitr to report a report with many embedded graphs. In the body of the report, all that's appropriate is the graph, not the code.\u003c/p\u003e\n\n\u003cp\u003eFor example:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e```{r graph_XYZ_subset, echo = FALSE, message = TRUE, \n fig.cap = \"Text that explains the graph\"}\n\ngraph.subset \u0026lt;- ggplot() + ...\n\n```\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis part works just fine.\u003c/p\u003e\n\n\u003cp\u003eHowever, there is a need to display the key parts of the code (\u003cem\u003ee.g.,\u003c/em\u003e key statistical analyses and key graph generations)...but \u003cstrong\u003ein an Addendum\u003c/strong\u003e.\u003c/p\u003e\n\n\u003cp\u003eWhich leads to this question: is there a way to copy a knitr chunk from the early parts of a script to a later part?\u003c/p\u003e\n\n\u003cp\u003eTo ensure accuracy, it's ideal that the code in the Addendum list (display) all the code that was actually executed in the report.\u003c/p\u003e\n\n\u003cp\u003eFor example:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# ADDENDUM - Code Snippets\n\n### Code to Generate Subset Graph\n\n\\\\SOMEHOW COPY the code from graph_XYZ_subset to here without executing it.\n\n### Code to Compute the Mean of Means of the NN Factors\n\n\\\\Copy another knitr chunk which computes the mean of means, etc.\n\n### And So On...\n\n\\\\Copy chunks till done\n\n* * * * * * * * \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAny ideas? Is there a way in knitr to perform these types of chunk copies?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-08-22 00:02:28.2 UTC","last_activity_date":"2015-08-22 14:57:39.55 UTC","last_edit_date":"2015-08-22 10:02:28.597 UTC","last_editor_display_name":"","last_editor_user_id":"3184785","owner_display_name":"","owner_user_id":"1347555","post_type_id":"1","score":"4","tags":"r|knitr|reproducible-research","view_count":"122"} {"id":"41876781","title":"PHP email form validating doesn","body":"\u003cp\u003eI'm kinda new in PHP and I've created a form that should validate data and submit an error if any field is blank or incorrect. It doesn't tho. Even if email is wrong or any field is empty and the errors are shown it still sends an email. And the headers are not showing in the message. The only case when the errors are shown and the mail isn't send is the case when all fields are empty. Here's the code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\n$NameErr = $EmailErr = $SubErr = $MessErr = \"\";\n$Name = $Email = $Subject = $Message = \"\";\n$header = \"From: \" . $Email . \"Name: \" . $Name . \"\\r\\n\";\n$header .= \"Content-Type: text/plain\";\n$To = \"xxx@gmail.com\";\n\nif ($_SERVER[\"REQUEST_METHOD\"] == \"POST\") {\n if (empty($_POST[\"Name\"])) {\n $NameErr = \"Name is required\";\n } else {\n $Name = test_input($_POST[\"Name\"]);\n if (!preg_match(\"/^[a-zA-Z ]*$/\", $Name)) {\n $NameErr = \"Only letters and white space allowed!\";\n }\n }\n if (empty($_POST[\"Email\"])) {\n $EmailErr = \"Email is required\";\n } else {\n $Email = test_input($_POST[\"Email\"]);\n if (!filter_var($Email, FILTER_VALIDATE_EMAIL)) {\n $EmailErr = \"Invalid email format\";\n }\n }\n if (empty($_POST[\"Subject\"])) {\n $SubErr = \"Subject is required\";\n } else {\n $Subject = test_input($_POST[\"Subject\"]);\n }\n if (empty($_POST[\"Message\"])) {\n $MessErr = \"Message is required\";\n } else {\n $Message = test_input($_POST[\"Message\"]);\n }\n}\n\nfunction test_input($data) {\n $data = trim($data);\n $data = stripslashes($data);\n $data = htmlspecialchars($data);\n return $data;\n}\n?\u0026gt;\n\n\u0026lt;form method=\"post\" action=\"\u0026lt;?php echo htmlspecialchars($_SERVER[\"PHP_SELF\"]); ?\u0026gt;\"\u0026gt;\n \u0026lt;p\u0026gt;\u0026lt;input class=\"w3-input w3-padding-16\" type=\"text\" placeholder=\"Name\" name=\"Name\"\u0026gt;\u0026lt;/p\u0026gt;\n \u0026lt;span class=\"error\"\u0026gt; \u0026lt;?php echo $NameErr; ?\u0026gt;\u0026lt;/span\u0026gt;\n \u0026lt;p\u0026gt;\u0026lt;input class=\"w3-input w3-padding-16\" type=\"text\" placeholder=\"Email\" name=\"Email\"\u0026gt;\u0026lt;/p\u0026gt;\n \u0026lt;span class=\"error\"\u0026gt; \u0026lt;?php echo $EmailErr; ?\u0026gt;\u0026lt;/span\u0026gt;\n \u0026lt;p\u0026gt;\u0026lt;input class=\"w3-input w3-padding-16\" type=\"text\" placeholder=\"Subject\" name=\"Subject\"\u0026gt;\u0026lt;/p\u0026gt;\n \u0026lt;span class=\"error\"\u0026gt; \u0026lt;?php echo $SubErr; ?\u0026gt;\u0026lt;/span\u0026gt;\n \u0026lt;p\u0026gt;\u0026lt;input class=\"w3-input w3-padding-16\" type=\"text\" placeholder=\"Message\" name=\"Message\"\u0026gt;\u0026lt;/p\u0026gt;\n \u0026lt;span class=\"error\"\u0026gt; \u0026lt;?php echo $MessErr; ?\u0026gt;\u0026lt;/span\u0026gt;\n \u0026lt;p\u0026gt;\n \u0026lt;button class=\"w3-btn w3-grey w3-padding-large w3-hover-green\" type=\"submit\" value=\"Submit\" name=\"pressed\"\u0026gt;\n \u0026lt;i class=\"fa fa-paper-plane\"\u0026gt;\u0026lt;/i\u0026gt; SEND MESSAGE\n \u0026lt;/button\u0026gt;\n \u0026lt;/p\u0026gt;\n\u0026lt;/form\u0026gt;\n\u0026lt;?php\nif (isset($_POST[\"pressed\"])) {\n if (empty($NameErr \u0026amp;\u0026amp; $SubErr \u0026amp;\u0026amp; $MessErr \u0026amp;\u0026amp; $EmailErr)) {\n mail($To, $Subject, $Message, $header);\n echo \"Email sent.\";\n } else {\n echo \"Error.\";\n }\n}\n?\u0026gt; \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan you help me? Error validating is on and it doesn't show me any errors.\u003c/p\u003e","answer_count":"3","comment_count":"2","creation_date":"2017-01-26 15:19:44.733 UTC","last_activity_date":"2017-01-26 16:29:08.663 UTC","last_edit_date":"2017-01-26 15:35:11.107 UTC","last_editor_display_name":"","last_editor_user_id":"2101939","owner_display_name":"","owner_user_id":"7429928","post_type_id":"1","score":"-1","tags":"php|forms|validation|email","view_count":"70"} {"id":"29641253","title":"Replace any word that starts with n F or a f with *","body":"\u003cp\u003eQuestion:\nWrite a program that reads a text file called \"naughty.txt\" and creates another file called \"nice.txt\" that is exactly the same, except for one thing: every word that begins with the letter F or f is replaced by a string of stars that are the same length as the removed word.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eNote! Our univesity has their own libraries created that allow us to basically just use \"library.h\" and be able to code.\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eMy Code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#include \"library.h\"\n\nstruct mytype{string word;};\n\nvoid replace(mytype array[], int size)\n{\n ifstream fin(\"naughty.txt\");\n if(fin.fail())\n {\n cout \u0026lt;\u0026lt; \"Error opening file \"\u0026lt;\u0026lt; endl;\n exit(1);\n }\n else {\n while(!fin.eof())\n {\n for(int i = 0; i \u0026lt; size; i++)\n {\n if(array[i].word ==\"f\" || array[i + 1].word == \"F \")\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eFixed Code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#include \"library.h\"\n\nstruct mytype{string words;};\n\nvoid read(mytype array[], int size)\n{\n ifstream fin(\"naughty.txt.txt\");\n if(fin.fail())\n {\n cout \u0026lt;\u0026lt; \"Input file didn't open.\" \u0026lt;\u0026lt; endl;\n }\n\n else \n {\n ofstream fout(\"nice.txt\");\n for(int i = 0; i \u0026lt; size; i++)\n {\n fin \u0026gt;\u0026gt; array[i].words;\n if(array[i].words == \"f\" || array[i].words == \"F\") \n {\n int length = array[i].words.length();\n int j = 1;\n while(j \u0026lt; length)\n {\n fout \u0026lt;\u0026lt; \"*\";\n j++;\n }\n }\n fout \u0026lt;\u0026lt; array[i].words;\n }\n }\n\n}\n\n\n\nvoid main()\n{\n int size = 1000;\n mytype array[1000];\n read(array, size);\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe problem is that my file called naughty.txt has this in it\" We don't like fried pickles or fried anything.\"\u003c/p\u003e\n\n\u003cp\u003eMy nice.txt file is outputting \"wedon'tlikefriendpicklesorfriedanything\"\u003c/p\u003e\n\n\u003cp\u003eThird Edit:\n #include \"library.h\"\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003estruct mytype{string words;};\n\nvoid read(mytype array[], int size)\n{\n ifstream fin(\"naughty.txt\");\n if(fin.fail())\n {\n cout \u0026lt;\u0026lt; \"Input file didn't open.\" \u0026lt;\u0026lt; endl;\n }\n\n else \n {\n ofstream fout(\"nice.txt\");\n for(int i = 0; i \u0026lt; size; i++)\n {\n fin \u0026gt;\u0026gt; array[i].words;\n if(array[i].words[0] == 'f' || array[i].words[0] == 'F') \n {\n int length = array[i].words.length();\n int j = array[i].words.find_first_of(\"f\" );\n while(j \u0026lt; length)\n {\n fout \u0026lt;\u0026lt; \"*\";\n j++;\n }\n }\n\n else if(i \u0026gt; 0){\n fout \u0026lt;\u0026lt; ' ';\n fout \u0026lt;\u0026lt; array[i].words \u0026lt;\u0026lt; \" \";}\n }\n }\n\n}\n\n\n\nvoid main()\n{\n int size = 1000;\n mytype array[1000];\n read(array, size);\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eData in the file \"nice.txt\" is We don't like ***** fried pickles or anything ***** fried \u003c/p\u003e","answer_count":"2","comment_count":"31","creation_date":"2015-04-15 03:46:11.54 UTC","last_activity_date":"2015-04-15 11:26:22.33 UTC","last_edit_date":"2015-04-15 11:26:22.33 UTC","last_editor_display_name":"","last_editor_user_id":"4790055","owner_display_name":"","owner_user_id":"4790055","post_type_id":"1","score":"-5","tags":"c++","view_count":"116"} {"id":"27573392","title":"Grunt and Rails","body":"\u003cp\u003eI'm working on using a Grunt workflow to manage my assets in my Rails app rather than Sprockets.\u003c/p\u003e\n\n\u003cp\u003eSo far, I have my apps JS and CSS both being concatenated and minified into \u003ccode\u003epublic/assets/javascripts/application.js\u003c/code\u003e and \u003ccode\u003epublic/assets/stylesheets/application.css\u003c/code\u003e respectively.\u003c/p\u003e\n\n\u003cp\u003eAnd also have my Bower components JS and CSS being concatenated and minified into \u003ccode\u003epublic/assets/javascripts/vendor.js\u003c/code\u003e and \u003ccode\u003epublic/assets/stylesheets/vendor.css\u003c/code\u003e respectively.\u003c/p\u003e\n\n\u003cp\u003eFonts and Images from Bower components are then copied into \u003ccode\u003epublic/assets/(images|fonts)\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eThis is all well and good but now I need the references to fonts/images within those files to be updated to reflect their new location.\u003c/p\u003e\n\n\u003cp\u003eI have looked at cssmin and yes it rewrites file references but I cannot get the file path to change depending upon the type of file being referenced.\u003c/p\u003e\n\n\u003cp\u003eAny ideas on how I can do this?\u003c/p\u003e\n\n\u003cp\u003eAlso, I ahve been reading about Grunt plugins which can read your view files and use those to minify and concatenate files and update the and tags in the views for you.\u003c/p\u003e\n\n\u003cp\u003eSurely I can't do that in a Rails app? Is there a way I can deal with this in Rails?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-12-19 20:25:55.527 UTC","last_activity_date":"2014-12-22 15:28:57.993 UTC","last_edit_date":"2014-12-22 15:03:36.267 UTC","last_editor_display_name":"","last_editor_user_id":"1125496","owner_display_name":"","owner_user_id":"1125496","post_type_id":"1","score":"0","tags":"ruby-on-rails|gruntjs|assets|bower|grunt-contrib-cssmin","view_count":"309"} {"id":"35594466","title":"why error when double use \"ln -s sourceDirA DestanationDirB\"","body":"\u003cp\u003e1.when I use \"ln -s workspace workspace2\" at first time \nevery is ok\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edrwxr-xr-x 2 root root 4096 2月 24 13:49 workspace\nlrwxrwxrwx 1 root root 9 2月 24 13:38 workspace2 -\u0026gt; workspace\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e2.when I double link, use \"ln -s workspace workspace2\" tiwce,\n then I \"cd workspace\",found a workspace is in workspace\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[root@xxxxxxxx workspace]#ls -al\n\ndrwxr-xr-x 2 root root 4096 2月 24 13:49 .\ndr-xr-x---. 6 root root 4096 2月 24 13:38 ..\n-rw-r--r-- 1 root root 0 2月 24 13:27 test.php\nlrwxrwxrwx 1 root root 9 2月 24 13:49 workspace -\u0026gt; workspace\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ewhy?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-02-24 06:04:34.723 UTC","last_activity_date":"2016-02-24 06:28:14.253 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5507621","post_type_id":"1","score":"0","tags":"shell","view_count":"14"} {"id":"40262826","title":"Stack requires same package for each project due to .ghci","body":"\u003cp\u003eSince recently i started using imports in my \u003ccode\u003e.ghci\u003c/code\u003e file to colorize my code. Since Stack uses a separate set of libraries for each project i now have to require \u003ccode\u003eHsColour\u003c/code\u003e for each project. Even though \u003ccode\u003eHsColour\u003c/code\u003e is not actually used by the code in the project. How can i let \u003ccode\u003estack ghci\u003c/code\u003e make use of the same \u003ccode\u003eHsColour\u003c/code\u003e each time without interfering with the project libraries? If this is not possible, is there an alternative to this problem?\u003c/p\u003e","answer_count":"0","comment_count":"8","creation_date":"2016-10-26 12:52:37.07 UTC","last_activity_date":"2016-10-26 12:52:37.07 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1833322","post_type_id":"1","score":"1","tags":"haskell|haskell-stack","view_count":"48"} {"id":"28617421","title":"How can a java console program and a gui communicate","body":"\u003cp\u003eI Have two programs a.jar and b.jar, b.jar is a console application that i can't change, a.jar is a gui application that needs to send commands to b.jar that will then be interpreted there. a.jar also needs to receive the output of b.jar. I usually run b.jar in command prompt and type the commands for the program to run in command prompt and and it responds. I want to use a.jar to launch, listen to, and talk to (sent commands to) b.jar \u003c/p\u003e","answer_count":"3","comment_count":"7","creation_date":"2015-02-19 21:37:29.17 UTC","favorite_count":"1","last_activity_date":"2016-01-14 20:58:58.193 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4088794","post_type_id":"1","score":"-1","tags":"java|jar","view_count":"250"} {"id":"5216428","title":"database example in android","body":"\u003cp\u003eI am new to android.I want to have a sample code program of saving database in sd card of android..Can anybody guide me...\u003c/p\u003e\n\n\u003cp\u003eThanks in advance\nTushar \u003c/p\u003e","accepted_answer_id":"5216463","answer_count":"2","comment_count":"3","creation_date":"2011-03-07 06:08:19.27 UTC","favorite_count":"1","last_activity_date":"2012-10-22 10:54:47.83 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"475349","post_type_id":"1","score":"-1","tags":"android","view_count":"1621"} {"id":"39027384","title":"How to increase the performance of inserting data into the database?","body":"\u003cp\u003eI use PostgreSQL 9.5 (and a newest JDBC driver - 9.4.1209), JPA 2.1 (Hibernate), EJB 3.2, CDI, JSF 2.2 and Wildfly 10. I've to insert a lot of data into the database (about 1 mln - 170 mln entities). The number of entities depends on a file which user will add to the form on the page.\u003c/p\u003e\n\n\u003ch1\u003eWhat is the problem?\u003c/h1\u003e\n\n\u003cp\u003eThe problem is the execution time of inserting data into the database which is very slow. The execution time is growing every calling of the \u003ccode\u003eflush()\u003c/code\u003e method. I've put the \u003ccode\u003eprintln(...)\u003c/code\u003e method to know how fast the execution of the \u003ccode\u003eflush\u003c/code\u003e method is. For the first ~4 times (400000 entities), I receive result of the \u003ccode\u003eprintln(...)\u003c/code\u003e method every ~20s. Later, the execution time of the \u003ccode\u003eflush\u003c/code\u003e method is incredibly slow and it's still growing.\u003c/p\u003e\n\n\u003cp\u003eOf course, if I delete the \u003ccode\u003eflush()\u003c/code\u003e and \u003ccode\u003eclear()\u003c/code\u003e methods, I receive result of the \u003ccode\u003eprintln(...)\u003c/code\u003e method every 1s BUT when I approach to the 3 mln entities, I also receive the exception:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003ejava.lang.OutOfMemoryError: GC overhead limit exceeded\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003ch1\u003eWhat have I done so far?\u003c/h1\u003e\n\n\u003cul\u003e\n\u003cli\u003eI've tried with the Container-Managed Transactions and the Bean-Managed Transactions as well (look at the code below).\u003c/li\u003e\n\u003cli\u003eI don't use the \u003ccode\u003eauto_increment\u003c/code\u003e feature for the PK ID. I add the IDs manually in the bean code.\u003c/li\u003e\n\u003cli\u003eI've also tried to change the number of the entities to flush (at the moment 100000).\u003c/li\u003e\n\u003cli\u003eI've tried to set the same number of the entities like in the \u003ccode\u003ehibernate.jdbc.batch_size\u003c/code\u003e property. It didn't help, the execution time was much slower.\u003c/li\u003e\n\u003cli\u003eI've tried to experiment with the properties in the \u003ccode\u003epersistence.xml\u003c/code\u003e file. For example, I added the \u003ccode\u003ereWriteBatchedInserts\u003c/code\u003e property but indeed I don't know if it could help.\u003c/li\u003e\n\u003cli\u003eThe PostgreSQL is running on the SSD but the data are stored on the HDD because the data could be to big in the future. But I've tried to move my PostgreSQL data to the SSD and the result is the same, nothing has changed.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eThe question is: \u003cstrong\u003eHow can I increase the performance of inserting data into database?\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eHere's the structure of my table:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e column_name | udt_name | length | is_nullable | key\n---------------+-------------+--------+-------------+--------\nid | int8 | | NO | PK\nid_user_table | int4 | | NO | FK\nstarttime | timestamptz | | NO |\ntime | float8 | | NO |\nsip | varchar | 100 | NO |\ndip | varchar | 100 | NO |\nsport | int4 | | YES |\ndport | int4 | | YES |\nproto | varchar | 50 | NO |\ntotbytes | int8 | | YES |\ninfo | text | | YES |\nlabel | varchar | 10 | NO |\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere's part of the EJB bean (\u003cstrong\u003efirst version\u003c/strong\u003e) where I insert the data into the database:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Stateless\npublic class DataDaoImpl extends GenericDaoImpl\u0026lt;Data\u0026gt; implements DataDao {\n\n /**\n * This's the first method which is executed. \n * The CDI bean (controller) calls this method.\n * @param list - data from the file.\n * @param idFK - foreign key.\n */\n public void send(List\u0026lt;String\u0026gt; list, int idFK) {\n\n if(handleCSV(list,idFK)){\n //...\n }\n else{\n //...\n }\n }\n\n /**\n * The method inserts data into the database.\n */\n @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)\n private boolean handleCSV(List\u0026lt;String\u0026gt; list, int idFK){\n\n try{\n\n long start=0;\n Pattern patternRow=Pattern.compile(\",\");\n\n for (String s : list) {\n\n if(start!=0){\n\n String[] data=patternRow.split(s); \n\n //Preparing data...\n\n DataStoreAll dataStore=new DataStoreAll();\n DataStoreAllId dataId=new DataStoreAllId(start++, idFK); \n dataStore.setId(dataId);\n\n //Setting the other object fields... \n\n entityManager.persist(dataStore); \n\n if(start%100000==0){\n System.out.println(\"Number of entities: \"+start);\n entityManager.flush();\n entityManager.clear(); \n }\n }\n else start++;\n } \n\n } catch(Throwable t){\n\n CustomExceptionHandler exception=new CustomExceptionHandler(t);\n return exception.persist(\"DDI\", \"handleCSV\");\n }\n\n return true;\n }\n\n @Inject\n private EntityManager entityManager;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eInstead of using the Container-Managed Transactions, I've tried to use Bean-Managed Transactions either (\u003cstrong\u003esecond version\u003c/strong\u003e):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Stateless\n@TransactionManagement(TransactionManagementType.BEAN)\npublic class DataDaoImpl extends GenericDaoImpl\u0026lt;Data\u0026gt; {\n /**\n * This's the first method which is executed. \n * The CDI bean (controller) calls this method.\n * @param list - data from the file.\n * @param idFK - foreign key.\n */\n public void send(List\u0026lt;String\u0026gt; list, int idFK) {\n\n if(handleCSV(list,idFK)){\n //...\n }\n else{\n //...\n }\n }\n\n /**\n * The method inserts data into the linkedList collection.\n */\n private boolean handleCSV(List\u0026lt;String\u0026gt; list, int idFK){\n\n try{\n\n long start=0;\n Pattern patternRow=Pattern.compile(\",\");\n List\u0026lt;DataStoreAll\u0026gt; entitiesAll=new LinkedList\u0026lt;\u0026gt;();\n\n for (String s : list) {\n\n if(start!=0){\n\n String[] data=patternRow.split(s); \n\n //Preparing data...\n\n DataStoreAll dataStore=new DataStoreAll();\n DataStoreAllId dataId=new DataStoreAllId(start++, idFK); \n dataStore.setId(dataId);\n\n //Setting the other object fields... \n\n entitiesAll.add(dataStore);\n\n if(start%100000==0){\n\n System.out.println(\"Number of entities: \"+start);\n saveDataStoreAll(entitiesAll); \n }\n }\n else start++;\n }\n\n } catch(Throwable t){\n\n CustomExceptionHandler exception=new CustomExceptionHandler(t);\n return exception.persist(\"DDI\", \"handleCSV\");\n }\n\n return true;\n }\n\n /**\n * The method commits the transaction.\n */\n private void saveDataStoreAll(List\u0026lt;DataStoreAll\u0026gt; entities) throws EntityExistsException,IllegalArgumentException,TransactionRequiredException,PersistenceException,Throwable {\n\n Iterator\u0026lt;DataStoreAll\u0026gt; iter=entities.iterator();\n\n ut.begin(); \n\n while(iter.hasNext()){\n\n entityManager.persist(iter.next());\n iter.remove();\n entityManager.flush();\n entityManager.clear();\n }\n\n ut.commit();\n }\n\n @Inject\n private EntityManager entityManager;\n\n @Inject\n private UserTransaction ut;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere's my \u003ccode\u003epersistence.xml\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"UTF-8\"?\u0026gt;\n\u0026lt;persistence version=\"2.1\"\n xmlns=\"http://xmlns.jcp.org/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"\n http://xmlns.jcp.org/xml/ns/persistence\n http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd\"\u0026gt;\n \u0026lt;persistence-unit name=\"primary\"\u0026gt;\n \u0026lt;jta-data-source\u0026gt;java:/PostgresDS\u0026lt;/jta-data-source\u0026gt;\n \u0026lt;properties\u0026gt;\n \u0026lt;property name=\"hibernate.show_sql\" value=\"false\" /\u0026gt;\n \u0026lt;property name=\"hibernate.jdbc.batch_size\" value=\"50\" /\u0026gt; \n \u0026lt;property name=\"hibernate.order_inserts\" value=\"true\" /\u0026gt;\n \u0026lt;property name=\"hibernate.order_updates\" value=\"true\" /\u0026gt;\n \u0026lt;property name=\"hibernate.jdbc.batch_versioned_data\" value=\"true\"/\u0026gt;\n \u0026lt;property name=\"reWriteBatchedInserts\" value=\"true\"/\u0026gt; \n \u0026lt;/properties\u0026gt;\n \u0026lt;/persistence-unit\u0026gt;\n\u0026lt;/persistence\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIf I forgot to add something, tell me about it and I'll update my post.\u003c/p\u003e\n\n\u003ch1\u003eUpdate\u003c/h1\u003e\n\n\u003cp\u003eHere's the controller which calls \u003ccode\u003eDataDaoImpl#send(...)\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Named\n@ViewScoped\npublic class DataController implements Serializable {\n\n @PostConstruct\n private void init(){\n\n //...\n }\n\n /**\n * Handle of the uploaded file.\n */\n public void handleFileUpload(FileUploadEvent event){\n\n uploadFile=event.getFile();\n\n try(InputStream input = uploadFile.getInputstream()){\n\n Path folder=Paths.get(System.getProperty(\"jboss.server.data.dir\"),\"upload\");\n\n if(!folder.toFile().exists()){\n if(!folder.toFile().mkdirs()){\n folder=Paths.get(System.getProperty(\"jboss.server.data.dir\"));\n }\n }\n\n String filename = FilenameUtils.getBaseName(uploadFile.getFileName()); \n String extension = FilenameUtils.getExtension(uploadFile.getFileName());\n filePath = Files.createTempFile(folder, filename + \"-\", \".\" + extension);\n\n //Save the file on the server.\n Files.copy(input, filePath, StandardCopyOption.REPLACE_EXISTING);\n\n //Add reference to the unconfirmed uploaded files list.\n userFileManager.addUnconfirmedUploadedFile(filePath.toFile());\n\n FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, \"Success\", uploadFile.getFileName() + \" was uploaded.\"));\n\n } catch (IOException e) {\n\n //...\n }\n }\n\n /**\n * Sending data from file to the database.\n */\n public void send(){\n\n //int idFK=...\n\n //The model includes the data from the file and other things which I transfer to the EJB bean.\n AddDataModel addDataModel=new AddDataModel(); \n //Setting the addDataModel fields... \n\n try{\n\n if(uploadFile!=null){\n\n //Each row of the file == 1 entity.\n List\u0026lt;String\u0026gt; list=new ArrayList\u0026lt;String\u0026gt;();\n\n Stream\u0026lt;String\u0026gt; stream=Files.lines(filePath);\n list=stream.collect(Collectors.toList());\n\n addDataModel.setList(list);\n }\n\n } catch (IOException e) {\n\n //...\n } \n\n //Sending data to the DataDaoImpl EJB bean.\n if(dataDao.send(addDataModel,idFK)){\n\n userFileManager.confirmUploadedFile(filePath.toFile());\n\n FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, \"The data was saved in the database.\", \"\"));\n } \n }\n\n private static final long serialVersionUID = -7202741739427929050L;\n\n @Inject\n private DataDao dataDao;\n\n private UserFileManager userFileManager;\n private UploadedFile uploadFile;\n private Path filePath;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch1\u003eUpdate 2\u003c/h1\u003e\n\n\u003cp\u003eHere's the updated EJB bean where I insert the data into the database:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Stateless\n@TransactionManagement(TransactionManagementType.BEAN)\npublic class DataDaoImpl extends GenericDaoImpl\u0026lt;Data\u0026gt; {\n\n /**\n * This's the first method which is executed. \n * The CDI bean (controller) calls this method.\n * @param addDataModel - object which includes path to the uploaded file and other things which are needed.\n */ \n public void send(AddDataModel addDataModel){\n\n if(handleCSV(addDataModel)){\n //...\n }\n else{\n //...\n }\n }\n\n /**\n * The method inserts data into the database.\n */\n private boolean handleCSV(AddDataModel addDataModel){\n\n PreparedStatement ps=null;\n Connection con=null;\n\n FileInputStream fileInputStream=null;\n Scanner scanner=null; \n\n try{\n\n con=ds.getConnection();\n con.setAutoCommit(false);\n\n ps=con.prepareStatement(\"insert into data_store_all \"\n + \"(id,id_user_table,startTime,time,sIP,dIP,sPort,dPort,proto,totBytes,info) \"\n + \"values(?,?,?,?,?,?,?,?,?,?,?)\");\n\n long start=0; \n\n fileInputStream=new FileInputStream(addDataModel.getPath().toFile());\n scanner=new Scanner(fileInputStream, \"UTF-8\");\n\n Pattern patternRow=Pattern.compile(\",\"); \n Pattern patternPort=Pattern.compile(\"\\\\d+\");\n\n while(scanner.hasNextLine()) {\n\n if(start!=0){\n\n //Loading a row from the file into table.\n\n String[] data=patternRow.split(scanner.nextLine().replaceAll(\"[\\\"]\",\"\"));\n\n //Preparing datetime.\n\n SimpleDateFormat simpleDateFormat=new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\"); \n GregorianCalendar calendar=new GregorianCalendar();\n calendar.setTime(simpleDateFormat.parse(data[1]));\n calendar.set(Calendar.MILLISECOND, Integer.parseInt(Pattern.compile(\"\\\\.\").split(data[1])[1])/1000);\n\n //Preparing an entity\n\n ps.setLong(1, start++); //id PK\n ps.setInt(2, addDataModel.getIdFk()); //id FK\n ps.setTimestamp(3, new Timestamp(calendar.getTime().getTime())); //datetime\n ps.setDouble(4, Double.parseDouble(data[2])); //time\n ps.setString(5, data[3]); //sip\n ps.setString(6, data[4]); //dip\n\n if(!data[5].equals(\"\") \u0026amp;\u0026amp; patternPort.matcher(data[5]).matches()) ps.setInt(7, Integer.parseInt(data[5])); //sport\n else ps.setNull(7, java.sql.Types.INTEGER);\n\n if(!data[6].equals(\"\") \u0026amp;\u0026amp; patternPort.matcher(data[6]).matches()) ps.setInt(8, Integer.parseInt(data[6])); //dport\n else ps.setNull(8, java.sql.Types.INTEGER);\n\n ps.setString(9, data[7]); //proto\n\n if(!data[8].trim().equals(\"\")) ps.setLong(10, Long.parseLong(data[8])); //len\n else ps.setObject(10, null);\n\n if(data.length==10 \u0026amp;\u0026amp; !data[9].trim().equals(\"\")) ps.setString(11, data[9]); //info\n else ps.setString(11, null);\n\n ps.addBatch();\n\n if(start%100000==0){\n System.out.println(\"Number of entity: \"+start);\n\n ps.executeBatch();\n ps.clearParameters();\n ps.clearBatch();\n con.commit(); \n }\n }\n else{\n start++;\n scanner.nextLine();\n }\n }\n\n if (scanner.ioException() != null) throw scanner.ioException();\n\n } catch(Throwable t){\n\n CustomExceptionHandler exception=new CustomExceptionHandler(t);\n return exception.persist(\"DDI\", \"handleCSV\");\n } finally{\n\n if (fileInputStream!=null)\n try {\n fileInputStream.close();\n } catch (Throwable t2) {\n CustomExceptionHandler exception=new CustomExceptionHandler(t2);\n return exception.persist(\"DDI\", \"handleCSV.Finally\");\n }\n if (scanner != null) scanner.close();\n }\n\n return true;\n }\n\n @Inject\n private EntityManager entityManager;\n\n @Resource(mappedName=\"java:/PostgresDS\") \n private DataSource ds;\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"39027620","answer_count":"2","comment_count":"3","creation_date":"2016-08-18 20:57:31.937 UTC","last_activity_date":"2016-08-23 12:13:18.053 UTC","last_edit_date":"2016-08-22 17:46:37.247 UTC","last_editor_display_name":"","last_editor_user_id":"3616467","owner_display_name":"","owner_user_id":"3616467","post_type_id":"1","score":"2","tags":"performance|postgresql|hibernate|jpa|ejb","view_count":"325"} {"id":"22289184","title":"Replacing vector values in R based on a list (hash)","body":"\u003cp\u003eI have a dataframe, one column of which is names. In a later phase of analysis, I will need to merge with other data by this name column, and there are a few names which vary by source. I'd like to clean up my names using a hash (map) of names-\u003ecleaned names. I've found several references to using R lists as hashes (e.g., \u003ca href=\"https://stackoverflow.com/questions/2858014/working-with-dictionaries-lists-in-r/2863121\"\u003ethis question on SE\u003c/a\u003e), but I can't figure out how to extract values for keys in a vector only as they occur. So for example, \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026gt; players=data.frame(names=c(\"Joe\", \"John\", \"Bob\"), scores=c(9.8, 9.9, 8.8))\n\u0026gt; xref = c(\"Bob\"=\"Robert\", \"Fred Jr.\" = \"Fred\")\n\u0026gt; players$names\n[1] Joe John Bob \nLevels: Bob Joe John\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhereas \u003ccode\u003eplayers$names\u003c/code\u003e gives a vector of names from the original frame, I need the same vector, only with any values that occur in \u003ccode\u003exref\u003c/code\u003e replaced with their equivalent (lookup) values; my desired result is the vector \u003ccode\u003eJoe John Robert\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eThe closest I've come is:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026gt; players$names %in% names(xref)\n[1] FALSE FALSE TRUE\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhich correctly indicates that only \"Bob\" in \u003ccode\u003eplayers$names\u003c/code\u003e exists in the \"keys\" (names) of \u003ccode\u003exref\u003c/code\u003e, but I can't figure out how to extract the value for that name and combine it with the other names in the vector that don't belong to \u003ccode\u003exref\u003c/code\u003e as needed.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003enote\u003c/strong\u003e: in case it's not completely clear, I'm pretty new to R, so if I'm approaching this in the wrong fashion, I'm happy to be corrected, but my core issue is essentially as stated: I need to clean up some incoming data \u003cem\u003ewithin R\u003c/em\u003e by replacing some incoming values with known replacements and keeping all other values; further, the map of original-\u003ereplacement should be stored as \u003cem\u003edata\u003c/em\u003e (like xref), not as code.\u003c/p\u003e","answer_count":"3","comment_count":"0","creation_date":"2014-03-09 22:40:36.277 UTC","last_activity_date":"2017-07-12 18:21:59.083 UTC","last_edit_date":"2017-05-23 11:46:50.607 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"1024817","post_type_id":"1","score":"3","tags":"r","view_count":"1104"} {"id":"2207204","title":"Modal popup shown at the bottom of the page","body":"\u003cp\u003eI'm using asp.net ajax, with modal popup extender in a web page. The popup appears fine in Firefox and Google Chrome, but it shown at the bottom of the page in IE8. I tried to control the appearance through JavaScript:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar Image1_ModalPopupExtender = $find(\"Image1_ModalPopupExtender\");\nImage1_ModalPopupExtender.set_X(100);\nImage1_ModalPopupExtender.set_Y(100);\nImage1_ModalPopupExtender.show();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand it works in FF and Chr, but still no luck in IE8... any idea? \u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2010-02-05 12:43:02.037 UTC","last_activity_date":"2010-02-07 08:27:46.267 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"11464","post_type_id":"1","score":"1","tags":"asp.net-ajax|internet-explorer-8|modalpopupextender","view_count":"1986"} {"id":"44432325","title":"Offload App remove what in iOS 11","body":"\u003cp\u003eI just installed iOS 11 beta and I noticed that Offload App, By offloading app what will be remove \u003cstrong\u003eShared Directory\u003c/strong\u003e or \u003cstrong\u003eUser Default\u003c/strong\u003e or remove both or other than this ?\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/TqLj2.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/TqLj2.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\nLooking for suggestions.\u003c/p\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","answer_count":"3","comment_count":"0","creation_date":"2017-06-08 09:49:43.173 UTC","last_activity_date":"2017-06-11 08:24:51.987 UTC","last_edit_date":"2017-06-08 10:42:25.177 UTC","last_editor_display_name":"","last_editor_user_id":"671060","owner_display_name":"","owner_user_id":"671060","post_type_id":"1","score":"1","tags":"ios|iphone|offloading|ios11","view_count":"210"} {"id":"9590365","title":"Can't ignore a file in Mercurial Commit (TortoiseHG)","body":"\u003cp\u003eI've been using Mercurial for more than a year. Now, I added a new .Net project to it. I chose to ignore all the BIN / OBJ folders in the Solution folder and everything went well. I used masks to ignore entire folders or the right click -\u003e Ignore command to ignore particular files.\u003c/p\u003e\n\n\u003cp\u003eNow, all of the sudden, I can't see the Ignore command any more! Normally, it should appear upon right-clicking a file. It doesn't. I also tried ignoring the file manually by adding this line in the .hgignore file:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eClient/eTimeKeepLoading.png\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut all that did was to (as you can see in the image below) mark my .hgignore file for commit, but the damn PNG file is still in the list. What's wrong with this guy? ::- D.\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/tNNgP.png\" alt=\"I don\u0026#39;t see the \u0026quot;Ignore\u0026quot; command\"\u003e\u003c/p\u003e","accepted_answer_id":"9590519","answer_count":"1","comment_count":"0","creation_date":"2012-03-06 19:19:51.76 UTC","last_activity_date":"2012-03-06 19:39:14.583 UTC","last_edit_date":"2012-03-06 19:39:14.583 UTC","last_editor_display_name":"","last_editor_user_id":"230430","owner_display_name":"","owner_user_id":"230430","post_type_id":"1","score":"5","tags":"version-control|mercurial|tortoisehg|ignore|hgignore","view_count":"1765"} {"id":"38703865","title":"Oboe JS only returning data when server stream dies","body":"\u003cp\u003eI've set up an oboe JS stream that's streaming JSON from a server. When I start listening on the stream I don't get any data, but as soon as I kill the server I get all the expected nodes. I'm guessing Oboe is caching before it returns. Here's the oboe code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eoboe(options /*url*/)\n .node('*', function(data) {\n console.log(data);\n })\n .path('*', function(data) {\n console.log(data);\n })\n .done(function(things) {\n console.log('we got it', things);\n // we got it\n }).fail(function() { \n console.log('fail!')\n });\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"4","creation_date":"2016-08-01 16:35:21.593 UTC","last_activity_date":"2016-08-02 13:03:41.86 UTC","last_edit_date":"2016-08-02 13:03:41.86 UTC","last_editor_display_name":"","last_editor_user_id":"3117409","owner_display_name":"","owner_user_id":"383152","post_type_id":"1","score":"0","tags":"json|streaming|jsonstream|oboe.js","view_count":"60"} {"id":"26360157","title":"avoid dead locks in recursive web calls on rails 3","body":"\u003cp\u003elet's say I've sent a get request to some action in some controller in rails.\u003c/p\u003e\n\n\u003cp\u003eand in that action I'm sending requests to get web pages from another server. \nfor example : \u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003eopen(\"http://example.com/myexample.xml\")\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003ewhen i call this function using \u003ccode\u003elocalhost\u003c/code\u003e as a parameter the site requests it self so the server goes in a dead lock state and stops\u003c/p\u003e\n\n\u003cp\u003eany ideas to get page of \u003ccode\u003elocalhost\u003c/code\u003e without making the requests queued on the main thread ?\u003c/p\u003e\n\n\u003cp\u003ethe same problem happens when the main thread sleeps or get busy to process a request and another request comes to the server ... it waits till the first request is finished.\u003c/p\u003e\n\n\u003cp\u003eany solutions for that ?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-10-14 11:52:13.147 UTC","last_activity_date":"2014-10-14 12:17:25.917 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2065215","post_type_id":"1","score":"1","tags":"ruby-on-rails|ruby|ruby-on-rails-3|webserver","view_count":"49"} {"id":"11537555","title":"Loading Google Street View Image API by panorama ID rather than location","body":"\u003cp\u003eThe Street View image API, as \u003ca href=\"https://developers.google.com/maps/documentation/streetview/\" rel=\"noreferrer\"\u003edocumented here\u003c/a\u003e, gives static images for a particular location. However, it does not accept a panorama ID parameter for loading specific panoramas.\u003c/p\u003e\n\n\u003cp\u003eRecent additions to Google Maps' Street View imagery have been \"off the map\", and only accessible via the panorama id (the panoid URL parameter), such as \u003ca href=\"https://maps.google.com/maps?t=m\u0026amp;hl=en\u0026amp;ll=36.732625,138.462174\u0026amp;z=17\u0026amp;layer=c\u0026amp;cbll=36.732633,138.462177\u0026amp;cbp=13,120.39,,0,17.04\u0026amp;panoid=-_0l0tU3lKz0JtaEsqJk7w\" rel=\"noreferrer\"\u003ethese hot-tub monkeys\u003c/a\u003e or \u003ca href=\"https://maps.google.com/maps?q=North+5th+and+Bedford+in+brooklyn\u0026amp;hl=en\u0026amp;sll=37.0625,-95.677068\u0026amp;sspn=35.768112,86.572266\u0026amp;hnear=Bedford+Ave+%26+N+5th+St,+Brooklyn,+Kings,+New+York+11211\u0026amp;t=m\u0026amp;layer=c\u0026amp;cbll=40.717571,-73.963103\u0026amp;panoid=dvn5EBkjcD0NPCE_Fqp2fw\u0026amp;cbp=12,252.03,,1,0\u0026amp;ie=UTF8\u0026amp;hq=\u0026amp;ll=40.717571,-73.963103\u0026amp;spn=0.003326,0.006706\u0026amp;z=18\u0026amp;vpsrc=0\" rel=\"noreferrer\"\u003ethis donkey\u003c/a\u003e. If you remove the panoid from the URL then the \u003ca href=\"https://maps.google.com/maps?t=m\u0026amp;hl=en\u0026amp;ll=36.732625,138.462174\u0026amp;z=17\u0026amp;layer=c\u0026amp;cbll=36.732633,138.462177\u0026amp;cbp=13,120.39,,0,17.04\u0026amp;panoid=\" rel=\"noreferrer\"\u003emonkeys don't load\u003c/a\u003e. For comparison, this \u003ca href=\"https://maps.google.com/maps?t=h\u0026amp;hl=en\u0026amp;ll=36.552295,-118.761381\u0026amp;z=19\u0026amp;layer=c\u0026amp;cbll=36.552371,-118.761633\u0026amp;cbp=12,75.73768037238169,,1,5.095531419705196\" rel=\"noreferrer\"\u003epicture of a tree\u003c/a\u003e doesn't need the panoid to load the streetview panorama.\u003c/p\u003e\n\n\u003cp\u003eThis same behaviour is seen when loading these panoramas via the API. The \u003ca href=\"https://developers.google.com/maps/documentation/javascript/reference#StreetViewPanorama\" rel=\"noreferrer\"\u003eGoogle Maps API docs\u003c/a\u003e has the following to say about the panoid: \u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eReturns the current panorama ID for the Street View panorama. This id is stable within the browser's current session only.\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eHowever, as shown above with the monkeys the panorama id is not tied to the current session. \u003c/p\u003e\n\n\u003cp\u003eMy problem is that the Google Street View Image API doesn't accept the panoid, so there is no way I can find to get a static image of the monkeys. The \u003ca href=\"http://maps.googleapis.com/maps/api/streetview?size=482x323\u0026amp;location=36.552371,-118.761633\u0026amp;fov=40\u0026amp;heading=75.73768037238169\u0026amp;pitch=-5.09553141971\u0026amp;sensor=false\" rel=\"noreferrer\"\u003estatic image of the tree\u003c/a\u003e works, but I get \"no imagery\" for \u003ca href=\"http://maps.googleapis.com/maps/api/streetview?size=482x323\u0026amp;location=36.732633,138.462177\u0026amp;fov=40\u0026amp;heading=75.73768037238169\u0026amp;pitch=-5.09553141971\u0026amp;sensor=false\" rel=\"noreferrer\"\u003ethe monkeys\u003c/a\u003e.\u003c/p\u003e\n\n\u003cp\u003eWhy are these streetviews not available on the API by location, and is there a way to load static images from the panorama ID? \u003c/p\u003e","answer_count":"3","comment_count":"0","creation_date":"2012-07-18 08:47:46.72 UTC","favorite_count":"3","last_activity_date":"2016-12-14 09:16:38.607 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"263090","post_type_id":"1","score":"5","tags":"google-maps|google-static-maps|google-street-view","view_count":"4714"} {"id":"15097539","title":"How to receive binary data from a request in TIdHTTPWebBrokerBridge?","body":"\u003cp\u003eI'm using Indy to build both a client and server application using HTTP. On the Client, I'm using \u003ccode\u003eTIdHTTP\u003c/code\u003e and on the server I'm using \u003ccode\u003eTIdHTTPWebBrokerBridge\u003c/code\u003e with a web module. I need the Client to be able to post any type of data via a Stream to the Server. This is done through a universal command I have called \u003ccode\u003e/set?Key=API_KEY\u0026amp;Name=FILE_NAME\u003c/code\u003e where \u003ccode\u003eKey\u003c/code\u003e is the API Key for authentication and \u003ccode\u003eName\u003c/code\u003e is the name of the file being posted.\u003c/p\u003e\n\n\u003cp\u003eOn the client, I am posting the data like so:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction TInnoCloudClient.SetData(const Name: String; AStream: TStream): Bool;\nvar\n U: String;\nbegin\n U:= FServerURL; //Base URL of Server\n if Copy(U, Length(U)-1, 1) \u0026lt;\u0026gt; '/' then\n U:= U + '/';\n U:= U + 'get?Key='+Encode(FAPIKey);\n U:= U + '\u0026amp;Name='+Encode(Name);\n try\n FWeb.Post(U, AStream);\n except\n on e: exception do begin\n //Handle Exception\n end;\n end;\nend;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis function is supposed to save the data inside \u003ccode\u003eAStream\u003c/code\u003e to a file on the server with the filename of \u003ccode\u003eName\u003c/code\u003e. On the Server end, however, in the request handler, I see no corresponding \u003ccode\u003eTStream\u003c/code\u003e property in the Request which I can read this from.\u003c/p\u003e\n\n\u003cp\u003eIn the Server, how do I acquire the data which I sent as a \u003ccode\u003eTStream\u003c/code\u003e descendant? I don't need to know how to save it or handle the request, just how do I obtain this Stream from the Request (\u003ccode\u003eTWebRequest\u003c/code\u003e)?\u003c/p\u003e","accepted_answer_id":"15098306","answer_count":"1","comment_count":"0","creation_date":"2013-02-26 19:25:16.833 UTC","favorite_count":"1","last_activity_date":"2013-02-28 18:45:04.137 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"988445","post_type_id":"1","score":"0","tags":"delphi|delphi-xe2|indy|indy10|httpserver","view_count":"1567"} {"id":"924524","title":"Fastest way to draw bitmasked images in OpenGL","body":"\u003cp\u003eWith modern hardware, what is the fastest way to draw an image with a \"bitmask\", i.e., a mask that specifies whether a given pixel will be drawn or not (this could be extracted from \"magic pink\" pixels, for example) using OpenGL?\u003c/p\u003e\n\n\u003cp\u003eShould I just use alpha blending and set invisible pixels to a=0?\nShould I use the old \"AND black/white mask then OR image on black bg\" technique?\nShould I use the alpha pass test?\nShould I use a shader?\u003c/p\u003e\n\n\u003cp\u003eThis matters because I'm planning on drawing massive quantities of such images - as much as I can afford to.\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2009-05-29 05:32:53.813 UTC","last_activity_date":"2012-08-14 14:04:46.397 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6203","post_type_id":"1","score":"0","tags":"optimization|opengl","view_count":"494"} {"id":"7003435","title":"How to get JQuery realtime value of a input field?","body":"\u003cpre\u003e\u003ccode\u003evar len = 160 - $(this).val.length;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI get same value foreach key press on target input..\u003c/p\u003e","accepted_answer_id":"7003458","answer_count":"2","comment_count":"0","creation_date":"2011-08-09 21:50:11.463 UTC","last_activity_date":"2017-11-17 15:11:57.193 UTC","last_edit_date":"2017-11-17 15:11:57.193 UTC","last_editor_display_name":"","last_editor_user_id":"769677","owner_display_name":"","owner_user_id":"769677","post_type_id":"1","score":"1","tags":"jquery","view_count":"2517"} {"id":"44107334","title":"CouchDB fails to start after applying Windows 10 Creators Update","body":"\u003cp\u003eI'm running CouchDB 2.0 on Windows for development purposes. After applying the Windows 10 Creators Update, the CouchDB service doesn't start anymore. When I try to start it manually, I get a generic \"unable to start service\" error message.\u003c/p\u003e","accepted_answer_id":"44107335","answer_count":"1","comment_count":"0","creation_date":"2017-05-22 07:44:26.417 UTC","last_activity_date":"2017-06-02 05:22:27.777 UTC","last_edit_date":"2017-06-02 05:22:27.777 UTC","last_editor_display_name":"","last_editor_user_id":"219187","owner_display_name":"","owner_user_id":"219187","post_type_id":"1","score":"3","tags":"windows|service|windows-10|couchdb","view_count":"975"} {"id":"37802329","title":"What is the function of Spring Session?","body":"\u003cp\u003eA simple question, what is the use of Spring session where I can do a login with session using spring security? \nWhat feature can spring session offer?\u003c/p\u003e","accepted_answer_id":"37806400","answer_count":"1","comment_count":"0","creation_date":"2016-06-14 03:10:19.66 UTC","last_activity_date":"2016-06-14 08:08:48.577 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3120251","post_type_id":"1","score":"0","tags":"spring|spring-security|spring-session","view_count":"241"} {"id":"40726514","title":"Does Spring automatically Autowire constructor args in java bean definitions?","body":"\u003cp\u003eLet's say I have the following bean definitions\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Bean\npublic Beehive beehive(ArrayList\u0026lt;Bee\u0026gt; bees) {\n return new Beehive(bees);\n}\n\n@Bean\npublic ArrayList\u0026lt;Bee\u0026gt; bees() {\n return new ArrayList\u0026lt;Bee\u0026gt;();\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWould the \u003ccode\u003ebees\u003c/code\u003e in the \u003ccode\u003ebeehive\u003c/code\u003e bean method be Autowired in?\u003c/p\u003e\n\n\u003cp\u003eI am asking because I have an application that is behaving like this without using the \u003ccode\u003e@Autowired\u003c/code\u003e annotation, and want be make sure I understand what's going on.\u003c/p\u003e","accepted_answer_id":"40726858","answer_count":"1","comment_count":"4","creation_date":"2016-11-21 18:00:10.75 UTC","last_activity_date":"2016-11-21 18:27:11.033 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4186564","post_type_id":"1","score":"2","tags":"java|spring","view_count":"536"} {"id":"47452723","title":"Python download files from FTP ignoring the missing ones","body":"\u003cp\u003eI've a list of numbers on csv file like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e1\n2\n3\n4\n5\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd an ftp server with files named like those numbers:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e1.jpg\n2.jpg\n4.jpg\n5.jpg\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e( 3.jpg is missing )\u003c/p\u003e\n\n\u003cp\u003eI want to download all the files of the FTP if the filename is on that csv list.\u003c/p\u003e\n\n\u003cp\u003eOn my code i can successfully download the files but when it tryes to download a missing file on FTP the program crashes with:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eurllib2.URLError: \u0026lt;urlopen error ftp error: [Errno ftp error] 550 Can't change directory to 3.jpg: No such file or directory\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ePython code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#!/usr/bin/python\n# -*- coding: utf-8 -*-\nimport urllib2, shutil\nimport pandas as pd\nimport numpy as np\nfrom ftplib import FTP\nFTP_server = 'ftp://user:pass@server.com/'\nftp = FTP_server+'the/path/to/files/'\nclass Test:\n def Get(self):\n data = pd.read_csv('test.csv',encoding='utf-8',delimiter=';')\n #data['REF'].replace('', np.nan, inplace=True)\n #data.dropna(subset=['REF'], inplace=True)\n data['REF'] = data['REF'].astype(int)\n new_data = data['REF']\n for ref in new_data:\n file = str(ref)+str('.jpg')\n ftpfile = urllib2.urlopen(ftp+file)\n localfile = open(file, 'wb')\n shutil.copyfileobj(ftpfile, localfile)\n\nTry = Test()\nTry.Get()\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm trying to make an if inside the for loop but i can't get it working, someone can give me some idea or tip plz?\u003c/p\u003e","accepted_answer_id":"47452884","answer_count":"1","comment_count":"0","creation_date":"2017-11-23 10:05:19.387 UTC","last_activity_date":"2017-11-23 10:12:50.587 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7757577","post_type_id":"1","score":"0","tags":"python|python-2.7","view_count":"16"} {"id":"20682969","title":"What replaced the method clone(Serializable)","body":"\u003cp\u003eI would like to know and understand what exacly replaced the metod BaseService.clone(Serializable).\u003c/p\u003e\n\n\u003cp\u003eI Have this code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e if (type == 1) {\n evenement = (Evenemen) clone(evenement);\n evenement.setCdtype(TypeEvenement.toString());\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere \u003ccode\u003eevenement\u003c/code\u003e is a class with strings, integers and arrays.\u003c/p\u003e\n\n\u003cp\u003eand eclipse tell me that warning:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eThe method clone(Serializable) from the type BaseService is deprecated\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eSo my question is what replaced the clone method?\u003c/p\u003e\n\n\u003cp\u003eI have tried searchig for a solution but everywhere, I just read to put a \u003ccode\u003e@SuppressWarnings(\"deprecation\")\u003c/code\u003e, I dont want to do that.\u003c/p\u003e","accepted_answer_id":"20683093","answer_count":"1","comment_count":"0","creation_date":"2013-12-19 13:25:41.07 UTC","last_activity_date":"2013-12-19 13:59:05.95 UTC","last_edit_date":"2013-12-19 13:59:05.95 UTC","last_editor_display_name":"","last_editor_user_id":"3115634","owner_display_name":"","owner_user_id":"3115634","post_type_id":"1","score":"1","tags":"java|gwt|clone","view_count":"49"} {"id":"43485454","title":"JSON.net JObject Adds as GrandChild instead of Direct Child","body":"\u003cp\u003eIf there was a Cast or partial copy from JObject to JProperty I would not be asking this question.\u003c/p\u003e\n\n\u003cp\u003eA JObject.AddAsChild(otherJObj) would also work if it existed.\u003c/p\u003e\n\n\u003cp\u003eThe following snippet produces a GrandChild FavoriteFruit property but I desire a Direct Child FavoriteFruit. The FavoriteFruit.FavoriteFruit double deep property is not what I am trying to do.\u003c/p\u003e\n\n\u003cp\u003eI control all the code in my situation.\u003c/p\u003e\n\n\u003cp\u003eThe detail that makes the most obvious solution not work in my case is that I only get the final JObject to represent “FavoriteFruit” – I do not have runtime access to what generated that specific Favorite Fruit JObject instance. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e JObject childFavoritFruitJObj = new JObject(); // child JObject\n if (true)\n {\n JProperty childFruitNameJProp = new JProperty(\"FruitName\", \"Pear\");\n JObject childFruitInfoJObj = new JObject();\n childFruitInfoJObj.Add(childFruitNameJProp);\n childFavoritFruitJObj.Add(\"FavoriteFruit\", childFruitInfoJObj);\n // only JObject childFavoritFruitJObj remains in scope\n }\n\n JObject parentPersonTopJObj = new JObject(); // Final Parent JObject\n JProperty parentPersonNameJProp = new JProperty(\"PersonName\", \"John Doe\");\n\n parentPersonTopJObj.Add(parentPersonNameJProp);\n parentPersonTopJObj.Add(\"FavoriteFruit\", childFavoritFruitJObj); // INCORRECT \n\n Console.WriteLine(parentPersonTopJObj.ToString());\n\n // Final Result - Not As Desired\n // There are TWO \"FavoriteFruit\" Objects\n // FavoriteFruit is a GRAND CHILD not a Child as wanted\n // {\n // \"PersonName\": \"John Doe\",\n // \"FavoriteFruit\": {\n // \"FavoriteFruit\": {\n // \"FruitName\": \"Pear\"\n // }\n // }\n // }\n //\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eThis next code is the Accepted Solution for this specific case.\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e // This is the undesired BAD scenario - this was the original question\n parentPersonTopJObj.Add(\"FavoriteFruit\", childFavoritFruitJObj);\n\n // This is the accepted SOLUTION proposed below by Sailesh \n JProperty propFirst = null;\n propFirst = (JProperty)childFavoritFruitJObj.First;\n parentPersonTopJObj.Add(propFirst);\n\n // the above works in my specific case as I am guarnteed \n // a single property name at the top of my JObject. If you had \n // multiple Properties at the top this would not work.;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe Overloaded \u003ccode\u003e.Add\u003c/code\u003e Operator has a single param property version that does not create the grand child scenario. More importantly Sailesh showed me how to get the JToken Object out with \u003ccode\u003e.First\u003c/code\u003e \u003c/p\u003e","accepted_answer_id":"43485672","answer_count":"1","comment_count":"2","creation_date":"2017-04-19 02:46:12.777 UTC","last_activity_date":"2017-04-19 04:59:33.593 UTC","last_edit_date":"2017-04-19 04:59:33.593 UTC","last_editor_display_name":"","last_editor_user_id":"2080879","owner_display_name":"","owner_user_id":"2080879","post_type_id":"1","score":"0","tags":"c#|json.net","view_count":"70"} {"id":"38892362","title":"Ruby on Rails - Set how many image show per page","body":"\u003cp\u003eIn my application, I have \u003ccode\u003ePost\u003c/code\u003e \u0026amp; \u003ccode\u003eSlide\u003c/code\u003e models. \u003ccode\u003ePost\u003c/code\u003e \u003ccode\u003ehas many :slides\u003c/code\u003e, and I use \u003ccode\u003enested_forms\u003c/code\u003e to add \u003cstrong\u003eslides to posts\u003c/strong\u003e.\u003c/p\u003e\n\n\u003cp\u003eWhat I have now is, on the \u003cstrong\u003epost page\u003c/strong\u003e I can show all the \u003ccode\u003eslides\u003c/code\u003e that belong to the post. \u003c/p\u003e\n\n\u003cp\u003e\u003cem\u003eI use \u003ccode\u003e@post.slides.each do |slide|\u003c/code\u003e\u003c/em\u003e\u003c/p\u003e\n\n\u003cp\u003eBy using \u003ccode\u003e#each\u003c/code\u003e I show all the slides on same page. What I want to achieve is to be able to set how many \u003ccode\u003eslides\u003c/code\u003e I want to show per page.\u003c/p\u003e\n\n\u003cp\u003e\u003cem\u003eExample:\u003c/em\u003e A post has \u003cstrong\u003e20 slides\u003c/strong\u003e, and I set \u003cstrong\u003e5 slides\u003c/strong\u003e each page. It only show 5 slide per page with a Next button to the next 5 etc and the URL would for instance be \u003ccode\u003edomain.com/posts-title/1\u003c/code\u003e, \u003ccode\u003edomain.com/posts-title/2\u003c/code\u003e ect.\u003c/p\u003e\n\n\u003cp\u003e\u003cem\u003e(I have already the next button)\u003c/em\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eany method without using pagination is much appreciated\u003c/strong\u003e\u003c/p\u003e","accepted_answer_id":"38894170","answer_count":"1","comment_count":"3","creation_date":"2016-08-11 09:25:51.89 UTC","last_activity_date":"2016-08-11 11:42:15.88 UTC","last_edit_date":"2016-08-11 11:42:15.88 UTC","last_editor_display_name":"","last_editor_user_id":"6589814","owner_display_name":"","owner_user_id":"6589814","post_type_id":"1","score":"0","tags":"ruby-on-rails|ruby|each","view_count":"92"} {"id":"42625070","title":"Fetch the input field value from external site window","body":"\u003cp\u003eI am using a script to open an external url which then generates a code. I need to copy that code use in my JS code. Here is the code.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar _url = myExtUrl + '?id=' + user_ID';\nvar newwin = window.open(_url, \"windowname1\", 'width=800, height=600,location=1'); \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe external url is 3rd party site. It takes the user id and then generates a code and show it on the page in an input field.\u003c/p\u003e\n\n\u003cp\u003eI need that code from the input field.\u003c/p\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-03-06 11:58:02.227 UTC","last_activity_date":"2017-03-06 11:58:02.227 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"426376","post_type_id":"1","score":"0","tags":"javascript","view_count":"14"} {"id":"10007779","title":"loading Hierarchy in NSMutableData","body":"\u003cp\u003eIs there Hierarchy system in NSMutableData? If so, how do i load information in a hierarchy manner?\nExample\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e//Create path to saving location\nNSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);\nNSString *documentsDirectory = [paths objectAtIndex:0];\n\nNSMutableData *gameData;\nNSKeyedUnarchiver *decoder;\nNSString *documentPath = [documentsDirectory stringByAppendingPathComponent:@\"tierSave.dat\"];\ngameData = [NSData dataWithContentsOfFile:documentPath];\n//end\n\n//start loading\n for(NSArray* firstData in gameData){\n\n decoder = [[NSKeyedUnarchiver alloc] initForReadingWithData:gameData];\n\n int level1 = [decoder decodeIntegerForKey:level1];\n }\n//end\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever in for(NSArray* firstData in gameData), the compiler tells me that gameData will not respond to count because it is a NSMutableData instead of NSMutableArray etc, How do i exactly re-implement the code above?\u003c/p\u003e","accepted_answer_id":"10007843","answer_count":"1","comment_count":"0","creation_date":"2012-04-04 08:48:57.11 UTC","last_activity_date":"2012-04-04 11:15:59.473 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1190829","post_type_id":"1","score":"1","tags":"iphone|objective-c|xcode","view_count":"138"} {"id":"43018606","title":"Download image from Firebase storage","body":"\u003cp\u003eI'm trying to create an app and got problem with downloading images to display. I uploaded 3 Images to my Firebase storage. I want to display them in my application. I have 3 cards in my app(just for now, would add in the future) and I want to display an image in each one. This is what I have so far:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e export class Image {\n\n public cameraImage: String;\n private fireStorage = firebase.storage();\n private gsRef = this.fireStorage.refFromURL('gs://my-bucket-name/');\n constructor(public http: Http) {\n }\n\n selectImage(): Promise\u0026lt;any\u0026gt;{\n return new Promise(resovle=\u0026gt;{\n let cameraOptions = {\n sourceType: ,\n destinationType: Camera.DestinationType.DATA_URL,\n quality: 100,\n targetWidth: 320,\n targetHeight: 240,\n encodingType: Camera.EncodingType.JPEG,\n correctOrientation: true\n };\n\n Camera.getPicture(cameraOptions).then((data)=\u0026gt;{\n this.cameraImage = \"data:image/jpeg;base64,\"+data;\n resovle(this.cameraImage);\n });\n });\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow can I set my sourceType to get the downloadUrl of each image and display it on my app?\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-03-25 16:02:20.393 UTC","last_activity_date":"2017-03-25 16:02:20.393 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7337616","post_type_id":"1","score":"0","tags":"firebase|ionic-framework|firebase-storage","view_count":"242"} {"id":"1303794","title":"How is debugging achieved in a lazy functional programming language?","body":"\u003cp\u003eI'd like to know how debugging is achieved in a lazy functional language.\u003cbr\u003e\nCan you use breakpoints, print statements and traditional techniques? Is this even a good idea?\u003cbr\u003e\nIt is my understanding that pure functional programming does not allow side-effects, with the exception of monads.\u003cbr\u003e\nOrder of execution is also not guaranteed.\u003cbr\u003e\nWould you have to program a monad for every section of code you want to test? \nI'd like some insight into this question from someone more experienced in this area. \u003c/p\u003e","accepted_answer_id":"1324927","answer_count":"5","comment_count":"0","creation_date":"2009-08-20 03:29:31.103 UTC","favorite_count":"15","last_activity_date":"2012-10-19 20:21:54.827 UTC","last_edit_date":"2009-08-20 11:17:07.603 UTC","last_editor_display_name":"","last_editor_user_id":"19299","owner_display_name":"","owner_user_id":"110834","post_type_id":"1","score":"25","tags":"debugging|functional-programming|lazy-evaluation","view_count":"3080"} {"id":"47467946","title":"Python (Kivy) - Check Value of Checkbox from .kv in python","body":"\u003cp\u003eI have a checkbox in my .kv file, and I want to disable a text input associated with it when the box is not checked.\u003c/p\u003e\n\n\u003cp\u003eMy .py Code\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif self.ids.checkbox.active==False:\n self.ids.input.disabled==True\nelse:\n self.ids.input.disabled==False\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy .kv Code\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTextInput:\n id: input\n text: \"2fbd3320a168d5c2e35\"\n pos_hint: {\"x\":0.1, \"y\":0.4}\n size_hint: 0.5,0.05\n background_disabled_normal: \"\"\n\n CheckBox:\n id: checkbox\n pos_hint: {\"x\":0.6, \"y\":0.4}\n size_hint: 0.05,0.05\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI do not know how to go about doing this, the .py code must be in a function, but checkboxes do not harbor the on_release attribute.\u003c/p\u003e","accepted_answer_id":"47473518","answer_count":"1","comment_count":"0","creation_date":"2017-11-24 07:05:22.55 UTC","last_activity_date":"2017-11-24 12:44:59.06 UTC","last_edit_date":"2017-11-24 07:49:06.78 UTC","last_editor_display_name":"","last_editor_user_id":"8665299","owner_display_name":"","owner_user_id":"8665299","post_type_id":"1","score":"1","tags":"python-2.7|kivy|kivy-language","view_count":"14"} {"id":"40398410","title":"the entity name must immediately follow the '\u0026' in the entity reference. javascript","body":"\u003cp\u003eI am trying to make an Ajax call in my \u003ccode\u003eThymeleaf\u003c/code\u003e page. So here is the code\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;script\u0026gt;\n function getTodayRequest(){\n console.log(\"here is today\");\n var xhttp=new XMLHttpRequest();\n xhttp.onreadystatechange=function(){\n if(this.readyState==4 \u0026amp;\u0026amp; this.status==200){\n document.getElementById(\"received\").innerHTML=\n this.responseText;\n }\n };\n xhttp.open(\"GET\",\"URI\",true);\n }\n\n\u0026lt;/script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo it complins with the error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ethe entity name must immediately follow the '\u0026amp;' in the entity reference. java\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand i have changed the \u003ccode\u003e\u0026amp;\u003c/code\u003e with \u003ccode\u003e\u0026amp;amp;\u003c/code\u003e and now it looks like:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif(this.readyState==4 \u0026amp;amp;\u0026amp;amp; this.status==200)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut now again it complains with:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eUncaught SyntaxError: Unexpected token ;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIn the second \u003ccode\u003e\u0026amp;amp;\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eHow can i handle it?\u003c/p\u003e","answer_count":"1","comment_count":"4","creation_date":"2016-11-03 09:52:13.233 UTC","last_activity_date":"2016-11-03 10:34:17.31 UTC","last_edit_date":"2016-11-03 09:56:33.337 UTC","last_editor_display_name":"","last_editor_user_id":"4891079","owner_display_name":"","owner_user_id":"2380115","post_type_id":"1","score":"0","tags":"javascript|html|thymeleaf","view_count":"431"} {"id":"21885003","title":"iOS: UTF8 Decoding problems with NSString","body":"\u003cp\u003eI have a bug in my code when my query have characters like \u003ccode\u003e'á', 'é', 'ñ'\u003c/code\u003e...\u003c/p\u003e\n\n\u003cp\u003eI have to parse the NSString to \"c string\", and characters like \u003ccode\u003e\"ñ\"\u003c/code\u003e are decoded to \u003ccode\u003e\"\\xc3\\xb1\"\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eMy code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e NSString *querySchoolClass = [NSString stringWithFormat: @\"Select id FROM country where name like 'España';\"];\n const char *queryEncoding = [querySchoolClass cStringUsingEncoding: NSUTF8StringEncoding];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI get no results with the query \u003ccode\u003e\"Select id FROM country where name like 'Espa\\xc3\\xb1a';\"\u003c/code\u003e because the table contains \u003ccode\u003e\"España\"\u003c/code\u003e. I am using SQLite with UTF-8.\u003c/p\u003e\n\n\u003cp\u003eAny suggestions?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-02-19 15:27:57.593 UTC","last_activity_date":"2014-02-19 15:37:59.25 UTC","last_edit_date":"2014-02-19 15:34:26.453 UTC","last_editor_display_name":"","last_editor_user_id":"1272394","owner_display_name":"","owner_user_id":"865249","post_type_id":"1","score":"0","tags":"ios|sqlite|utf-8|character-encoding","view_count":"436"} {"id":"44585656","title":"display content from custom post type by month","body":"\u003cp\u003eI have a custom post type called \"\u003cstrong\u003eevents\u003c/strong\u003e\".\u003c/p\u003e\n\n\u003cp\u003eI wanted to make a list of months from a year that is clickable and then when click it will display all the post content from that month.\u003c/p\u003e\n\n\u003cp\u003eSo whenever I click on a month for example I clicked on \"january\" of 2017.\u003c/p\u003e\n\n\u003cp\u003eIt will show all posts from that month under it. example below\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/wJngf.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/wJngf.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI have here a code which lists the months but links are not working\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\nglobal $wpdb;\n$limit = 0;\n$year_prev = null;\n$months = $wpdb-\u0026gt;get_results(\"SELECT DISTINCT MONTH( post_date ) AS month , YEAR( post_date ) AS year, COUNT( id ) as post_count FROM $wpdb-\u0026gt;posts WHERE post_status = 'publish' and post_date \u0026lt;= now( ) and post_type = 'events' GROUP BY month , year ORDER BY post_date ASC\");\nforeach($months as $month) :\n $year_current = $month-\u0026gt;year;\n if ($year_current != $year_prev){\n if ($year_prev != null){?\u0026gt;\n\n \u0026lt;?php } ?\u0026gt;\n\n \u0026lt;div class=\"archive-year\"\u0026gt;\u0026lt;strong\u0026gt;\u0026lt;?php echo $month-\u0026gt;year; ?\u0026gt;\u0026lt;/strong\u0026gt;\u0026lt;/div\u0026gt;\n\n \u0026lt;?php } ?\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;a href=\"#\"\u0026gt;\u0026lt;span class=\"archive-month\"\u0026gt;\u0026lt;?php echo date_i18n(\"F\", mktime(0, 0, 0, $month-\u0026gt;month, 1, $month-\u0026gt;year)) ?\u0026gt;\u0026lt;/span\u0026gt;\u0026lt;/a\u0026gt;\u0026lt;/div\u0026gt;\n\u0026lt;?php $year_prev = $year_current;\n\nif(++$limit \u0026gt;= 18) { break; }\n\nendforeach; ?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003esorry but I do not know how this works, thanks in advance\u003c/p\u003e","answer_count":"2","comment_count":"2","creation_date":"2017-06-16 09:27:02.997 UTC","last_activity_date":"2017-06-16 11:08:56.62 UTC","last_edit_date":"2017-06-16 09:35:19.567 UTC","last_editor_display_name":"","last_editor_user_id":"1749212","owner_display_name":"","owner_user_id":"1749212","post_type_id":"1","score":"0","tags":"javascript|php|jquery|wordpress","view_count":"40"} {"id":"7571337","title":"how to compare two objects in generic implementation?","body":"\u003cp\u003eI have a \u003cstrong\u003egeneric\u003c/strong\u003e class which will be \u003ccode\u003eLong\u003c/code\u003e, \u003ccode\u003eFloat\u003c/code\u003e, \u003ccode\u003eInteger\u003c/code\u003e and \u003ccode\u003eString\u003c/code\u003e types. In the cases of \u003ccode\u003eNumber\u003c/code\u003e (\u003ccode\u003eLong\u003c/code\u003e, \u003ccode\u003eFloat\u003c/code\u003e and \u003ccode\u003eInteger\u003c/code\u003e), I want to \u003cstrong\u003ecompare\u003c/strong\u003e two of them to see which one is bigger or smaller. Is it possible?\u003c/p\u003e","accepted_answer_id":"7571404","answer_count":"3","comment_count":"0","creation_date":"2011-09-27 15:03:31.963 UTC","favorite_count":"1","last_activity_date":"2011-09-27 15:21:17.31 UTC","last_edit_date":"2011-09-27 15:13:35.567 UTC","last_editor_display_name":"","last_editor_user_id":"697449","owner_display_name":"","owner_user_id":"117039","post_type_id":"1","score":"2","tags":"java|generics","view_count":"1415"} {"id":"13466230","title":"Add second time series to charts.PerformanceSummary()","body":"\u003cp\u003eI am displaying my backtested strategy with the \u003ccode\u003echarts.PerformanceSummary()\u003c/code\u003e function from Performance Analytics. I would like to add a second graph on to the top chart to see how my backtested strategy compares with a benchmark. So for e.g., my current code is:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003elibrary(PerformanceAnalytics)\nlibrary(quantmod)\n\nmyEnv \u0026lt;- new.env()\ngetSymbols(c(\"AAPL\",\"GOOG\"), src = \"yahoo\", from = \"2004-04-01\", to = \"2012-09-30\", env = myEnv)\nindex \u0026lt;- do.call(merge, c(eapply(myEnv, Ad), all=TRUE))\n\nindex.ret \u0026lt;- (index / lag(index,1) - 1)[-1,]\n\ncharts.PerformanceSummary(index.ret[,1])\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI would like to add \u003ccode\u003eindex.ret[,2]\u003c/code\u003e series to the \"Cumulative Return\" chart, but retain the \"Daily Return\" and \"Drawdown\" charts for \u003ccode\u003eindex.ret[,1]\u003c/code\u003e. I am thinking something along the lines of \u003ccode\u003epoints()\u003c/code\u003e, as per the base plot function.\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2012-11-20 03:38:19.797 UTC","last_activity_date":"2012-11-20 03:52:07.103 UTC","last_edit_date":"2012-11-20 03:52:07.103 UTC","last_editor_display_name":"","last_editor_user_id":"967840","owner_display_name":"","owner_user_id":"1583516","post_type_id":"1","score":"0","tags":"r|xts|performanceanalytics","view_count":"265"} {"id":"6064987","title":"Using map reduce in CouchDB to output fewer rows","body":"\u003cp\u003eLets say you have two document types, \u003cem\u003ecustomers\u003c/em\u003e and \u003cem\u003eorders\u003c/em\u003e. A \u003cem\u003ecustomer\u003c/em\u003e document contains basic information like name, address etc. and \u003cem\u003eorders\u003c/em\u003e contain all the order information each time a customer orders something. When storing the documents, the type = order or the type = customer.\u003c/p\u003e\n\n\u003cp\u003eIf I do a map function over a set of 10 customers and 30 orders it will output 40 rows. Some rows will be customers, some will be orders.\u003c/p\u003e\n\n\u003cp\u003eThe question is, how do I write the reduce, so that the order information is \u003cem\u003e\"stuffed\"\u003c/em\u003e inside of the rows that has the customer information? So it will return 10 rows (10 customers), but all the relevant orders for each customer. \u003c/p\u003e\n\n\u003cp\u003eBasically I don't want separate records on the output, I want to combine them (orders into one customer row) and I think reduce is the way?\u003c/p\u003e","accepted_answer_id":"6066433","answer_count":"1","comment_count":"0","creation_date":"2011-05-19 21:17:12.113 UTC","favorite_count":"10","last_activity_date":"2012-05-23 10:07:09.14 UTC","last_edit_date":"2012-05-23 10:07:09.14 UTC","last_editor_display_name":"","last_editor_user_id":"211116","owner_display_name":"","owner_user_id":"451516","post_type_id":"1","score":"14","tags":"database|join|map|couchdb|reduce","view_count":"2814"} {"id":"28794058","title":"Error report from Google Play, Database import error","body":"\u003cp\u003eIf I understand correctly something is wrong on the splash, something with importing database. What could it be? It works fine on some of the devices. I tried to delete importing database at the splash but then no data from database is shown later in app.\u003c/p\u003e\n\n\u003cp\u003eI got this error on my google play error report:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e java.lang.Error: Error copying database\nat com.ribicinc.ugani.DataBaseHelper.createDataBase(DataBaseHelper.java:61)\nat com.ribicinc.ugani.Splash.importdb(Splash.java:66)\nat com.ribicinc.ugani.Splash.onCreate(Splash.java:27)\nat android.app.Activity.performCreate(Activity.java:5104)\nat android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)\nat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)\nat android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)\nat android.app.ActivityThread.access$600(ActivityThread.java:141)\nat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)\nat android.os.Handler.dispatchMessage(Handler.java:99)\nat android.os.Looper.loop(Looper.java:137)\nat android.app.ActivityThread.main(ActivityThread.java:5041)\nat java.lang.reflect.Method.invokeNative(Native Method)\nat java.lang.reflect.Method.invoke(Method.java:511)\nat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)\nat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)\nat dalvik.system.NativeStart.main(Native Method)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is also my splash code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epackage com.ribicinc.ugani;\n\nimport android.app.Activity;\nimport android.content.Intent;\nimport android.database.SQLException;\nimport android.graphics.LightingColorFilter;\nimport android.os.Bundle;\nimport android.view.Menu;\nimport android.view.MenuItem;\nimport android.widget.ProgressBar;\n\nimport java.io.IOException;\n\n\npublic class Splash extends Activity {\n private final int DURATION = 3000;\n private Thread mSplashThread;\n\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_splash);\n importdb();\n\n ProgressBar pBar2 = (ProgressBar)findViewById(R.id.progress);\n pBar2.getIndeterminateDrawable().setColorFilter(new LightingColorFilter(0x80deea, 0x80deea));\n\n\n mSplashThread = new Thread() {\n\n @Override\n public void run() {\n synchronized (this) {\n try {\n wait(DURATION);\n } catch (InterruptedException e) {\n } finally {\n finish();\n Intent intent = new Intent(getBaseContext(),\n Main.class);\n startActivity(intent);\n }\n }\n }\n\n };\n mSplashThread.start();\n\n\n }\n\n\n @Override\n public boolean onCreateOptionsMenu(Menu menu) {\n // Inflate the menu; this adds items to the action bar if it is present.\n getMenuInflater().inflate(R.menu.menu_splash, menu);\n return true;\n }\n\n public void importdb(){\n //import database*\n try {\n DataBaseHelper myDbHelper = new DataBaseHelper(this);\n myDbHelper = new DataBaseHelper(this);\n try {\n myDbHelper.createDataBase();\n\n } catch (IOException ioe) {\n throw new Error(\"Napaka!\");\n }\n try {\n myDbHelper.openDataBase();\n }catch(SQLException sqle){\n throw sqle;\n }\n }catch(SQLException sqle){\n\n }\n\n //import database*\n }\n\n\n\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n // Handle action bar item clicks here. The action bar will\n // automatically handle clicks on the Home/Up button, so long\n // as you specify a parent activity in AndroidManifest.xml.\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"10","creation_date":"2015-03-01 13:26:36.23 UTC","last_activity_date":"2015-03-01 13:26:36.23 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4606960","post_type_id":"1","score":"0","tags":"android|database|runtime-error","view_count":"36"} {"id":"32234770","title":"Android, Progress Bar not displaying before method execute?","body":"\u003cp\u003eI have a progress bar that I change from \u003ccode\u003eView.GONE\u003c/code\u003e to \u003ccode\u003eView.VISIBLE\u003c/code\u003e, just before I call a method \u003ccode\u003ewriteFile()\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eSomething like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eonButtonPress(){\n mProgressBar.setVisibility(View.VISIBLE);\n writeFile();\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe method \u003ccode\u003ewriteFile()\u003c/code\u003e can take a few seconds (lots of data parsing), but requires additional actions taken by the user afterwards, and thus is not performed on a background thread. This is to avoid the user navigating elsewhere within the app, and then being presented with a pop-up, or redirected, for something they thought they were done with.\u003c/p\u003e\n\n\u003cp\u003eMy problem is that the Progress Bar does not display until the \u003ccode\u003ewriteFile()\u003c/code\u003e method is complete, and then briefly pops up for a split second before the user is redirected elsewhere.\u003c/p\u003e\n\n\u003cp\u003eIf I comment-out the method call, then the ProgressBar appears immediately and spins indefinitely, so I know the bar is working properly.\u003c/p\u003e\n\n\u003cp\u003eHow can I ensure the progress bar pops up \u003cem\u003eFIRST\u003c/em\u003e, and then the \u003ccode\u003ewriteFile()\u003c/code\u003e method is called after? \u003c/p\u003e\n\n\u003cp\u003eThanks in advance.\u003c/p\u003e\n\n\u003cp\u003eAdditionally:\u003c/p\u003e\n\n\u003cp\u003eI don't have a lot of experience (exactly none!) with asynctasks, and so am not sure if this is the route I need to take. The behaviour I am looking for is the progress bar to pop up when the user presses the button, and remain on the screen until the method is complete. I don't want the user to navigate around the app during this time.\u003c/p\u003e","answer_count":"1","comment_count":"6","creation_date":"2015-08-26 19:07:31.803 UTC","last_activity_date":"2015-08-26 19:14:38.007 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3170465","post_type_id":"1","score":"-1","tags":"android|android-asynctask|android-progressbar","view_count":"220"} {"id":"15412040","title":"menu with text, graphic and separator","body":"\u003cp\u003eI have a c# / asp.net web site that needs a menu system.\u003c/p\u003e\n\n\u003cp\u003eI was looking at the intrinsic asp:menu, but it does not seem to account for these requirements....\u003c/p\u003e\n\n\u003cp\u003eText that is over a graphic and a graphic to indicate a separator between each menu choices.\u003c/p\u003e\n\n\u003cp\u003eIt also has to use a different color to denote the menu choice that is currently active.\u003c/p\u003e\n\n\u003cp\u003eThis is a single level menu only - based on a master page design (menu is on master page), menu choices are on content pages.\u003c/p\u003e\n\n\u003cp\u003eDoes anyone have a free tool that can accomplish this?\u003c/p\u003e\n\n\u003cp\u003ethanks\u003c/p\u003e","answer_count":"3","comment_count":"2","creation_date":"2013-03-14 14:28:41.307 UTC","last_activity_date":"2015-11-04 15:28:46.087 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"382140","post_type_id":"1","score":"1","tags":"c#|asp.net","view_count":"1151"} {"id":"43159771","title":"Cannot compile javascript using d3 to typescript on Visual Studio 2017","body":"\u003cp\u003eI am trying to convert an existing web page which uses JavaScript and d3 to work with Typescript using Visual Studio 2017 as an IDE. The first problem I encountered was that VS 2017 no longer supports \"HTML application built with Typescript\" - so I built one in VS 2015 and copied it across. All I really wanted was an empty environment into which I could add my form and my JavaScript code. Having got this far, I discovered that I needed to import a typings file for d3, so I added that, so my resulting code looked like this:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/I9Sv5.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/I9Sv5.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI found that I was still getting the following errors:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/6Cu1X.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/6Cu1X.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003e\u003cp\u003esaying that I was missing --allowJs. After a bit of searching it appeared that I could resolve the problem by setting up a file called tsconfig.json in my top project folder. I set it up as follows:\u003c/p\u003e\n\n\u003cp\u003e{\n\"compileOnSave\": false,\n\"buildOnSave\": false,\n\"allowJs\": true\n} \u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003ebut I am still getting the same error. Now I am stuck! What am I doing wrong?\u003c/p\u003e\u003c/li\u003e\n\u003c/ul\u003e","answer_count":"0","comment_count":"8","creation_date":"2017-04-01 17:13:07.25 UTC","last_activity_date":"2017-04-01 17:13:07.25 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1981098","post_type_id":"1","score":"0","tags":"javascript|typescript|d3.js","view_count":"141"} {"id":"32987422","title":"How to tell if my shared preferences already has a specific value","body":"\u003cp\u003eSo I have some shared preferences:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e public SharedPreferences prefs = this.getSharedPreferences(\"com.example.me1jmo.insult_generator\", Context.MODE_PRIVATE);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd I am adding new key value pairs to it like so:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eint number = prefs.getAll().size();\n int newkey = ++number;\n String newkeystring = \"\" + newkey;\n prefs.edit().putString(newkeystring,saved).commit();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever I don't want to add a string that has already been added. So I want to check that the string I am adding is not already a value in my shared preferences. What would be the best way to go about this?\u003c/p\u003e\n\n\u003cp\u003e(or could I just switch my values and keys around and check that I don't already have that key in my shared preferences)\u003c/p\u003e","accepted_answer_id":"32987502","answer_count":"1","comment_count":"2","creation_date":"2015-10-07 08:32:54.433 UTC","last_activity_date":"2015-10-07 08:44:02.697 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5392484","post_type_id":"1","score":"0","tags":"java|android|key|sharedpreferences|value","view_count":"631"} {"id":"25703157","title":"Meteor 0.9.1: ReferenceError: SimpleSchema is not defined","body":"\u003cp\u003eAfter deciding to create a new project and start fresh and then checkout the code for a separate project (that was in a working state) I'm getting the following error with simple-schema. This schema was working so its likely that an update has broken it in some respect.\u003c/p\u003e\n\n\u003cp\u003eCan anyone suggest what I need to do to sort this?\u003c/p\u003e\n\n\u003cp\u003eTerminal output:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$ meteor\n[[[[[ ~/puzzle ]]]]]\n\n=\u0026gt; Started proxy.\n=\u0026gt; Started MongoDB. \nW20140906-10:30:37.252(-7)? (STDERR) \nW20140906-10:30:37.339(-7)? (STDERR) /home/me/.meteor/packages/meteor-tool/.1.0.27.11fuo6h++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173\nW20140906-10:30:37.339(-7)? (STDERR) throw(ex);\nW20140906-10:30:37.340(-7)? (STDERR) ^\nW20140906-10:30:37.340(-7)? (STDERR) ReferenceError: SimpleSchema is not defined\nW20140906-10:30:37.341(-7)? (STDERR) at app/lib/schema-Account-Type.js:5:26\nW20140906-10:30:37.341(-7)? (STDERR) at app/lib/schema-Account-Type.js:25:3\nW20140906-10:30:37.341(-7)? (STDERR) at /home/me/puzzle/.meteor/local/build/programs/server/boot.js:161:10\nW20140906-10:30:37.342(-7)? (STDERR) at Array.forEach (native)\nW20140906-10:30:37.342(-7)? (STDERR) at Function._.each._.forEach (/home/graeme/.meteor/packages/meteor-tool/.1.0.27.11fuo6h++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)\nW20140906-10:30:37.342(-7)? (STDERR) at /home/me/puzzle/.meteor/local/build/programs/server/boot.js:82:5\n=\u0026gt; Exited with code: 8\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSchema:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eAccountType = new Meteor.Collection(\"AccountType\");\n\nSchema = {};\n\nSchema.AccountType = new SimpleSchema({\n\n accountType: {\n type: String,\n allowedValues: ['test', 'live']\n\n },\n\n createdBy: {\n type: String,\n autoValue: function(){ return this.userId }\n }\n\n});\n\n\nSimpleSchema.debug = true;\nAccountType.attachSchema(Schema.AccountType);\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-09-06 17:55:25.957 UTC","last_activity_date":"2014-09-08 15:50:15.383 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1532669","post_type_id":"1","score":"0","tags":"meteor","view_count":"1622"} {"id":"6037084","title":"Python data structure for sparse list of x/y co-ordinates","body":"\u003cp\u003eConsider list of x/y co-ordinates and a byte 'count'. x/y will have a range of perhaps 0 to 5000 which is 25 million cells.\u003c/p\u003e\n\n\u003cp\u003eHowever the data will be quite sparsely populated, there will be at most a few thousand entries and the majority of co-ordinates will have zero entries.\u003c/p\u003e\n\n\u003cp\u003eThe structure will be occasionally looked up/added to (e.g. if there is something in x=5 and y=10 then ++) but more frequently converted into a list of x/y/count (sorting is not important)\u003c/p\u003e\n\n\u003cp\u003eThe fastest data structure is for lookup is obviously a 2d array, but you're looking at 24 MB of memory or so and the iteration to output a list could be expensive. For disk storage you could implement gif style compression where a 0 byte followed by another byte indicates x empty cells and anything else is a cell value - but this doesn't help the memory situation.\u003c/p\u003e\n\n\u003cp\u003eA dictionary of dictionary's would probably be a good balance between lookup/iteration speed and memory usage.\u003c/p\u003e\n\n\u003cp\u003eAre there any other suitable data structures I should be considering (either built in to Python, existing libraries or more general data structures?\u003c/p\u003e","accepted_answer_id":"6037133","answer_count":"3","comment_count":"2","creation_date":"2011-05-17 21:01:22.547 UTC","last_activity_date":"2011-05-17 21:08:45.71 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"20198","post_type_id":"1","score":"3","tags":"python|data-structures","view_count":"989"} {"id":"28180549","title":"How to user user input variables in Build file?","body":"\u003cp\u003eprompted for user entry by I'm new to ant and I was wondering if it would be possible to create a global variable in the build file so that I can use it repeatedly throughout the file itself.\u003c/p\u003e\n\n\u003cp\u003eFor example, if the command were 'ant a', I would be able to use that value 'a' throughout the build file (for example in a file path i.e C:/test/a).\u003c/p\u003e\n\n\u003cp\u003eThe reason I want to know how to do this is because there are multiple values like 'a' (lets say all the letters in the alphabet), and instead of copying and pasting the same code 26 times, I would be able to have 1 piece of code that takes different values (depending on what the user enters). In java you are able to have a variable storing the user input, and use that variable throughout the code (same idea here).\u003c/p\u003e\n\n\u003cp\u003eI tried searching for this but wasn't sure how to word it.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eUPDATE\u003c/strong\u003e\nWith the help of some people I managed to solve what I needed.\nSo I managed to use Input Task to kind of fix my problem. I prompted the user for an entry by using the following command:\u003c/p\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003cp\u003eThen I can just use the value entered by the user anywhere i want by simply writing ${hold.it}. For example in a file path \"C:/go/to/${hold.it}\"\u003c/p\u003e","accepted_answer_id":"28180748","answer_count":"1","comment_count":"0","creation_date":"2015-01-27 21:40:44.63 UTC","last_activity_date":"2015-01-28 18:51:16.63 UTC","last_edit_date":"2015-01-28 18:51:16.63 UTC","last_editor_display_name":"","last_editor_user_id":"4447208","owner_display_name":"","owner_user_id":"4447208","post_type_id":"1","score":"0","tags":"variables|ant|build","view_count":"236"} {"id":"42628595","title":"How to set title for header section from the properties of INDEXPATH.ROW","body":"\u003cp\u003ei get a response from API like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[{\n \"name\":\"apple\"\n \"type\": \"Fruit\"\n \"taste\": sweet\n\n }\n {\n \"name\":\"lemon\"\n \"type\": \"Fruit\"\n \"taste\": \"not tasty\"\n }]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand now i want to set the title of the section as \u003cstrong\u003ename\u003c/strong\u003e of UITable view.\u003c/p\u003e\n\n\u003cp\u003efor this i have called this in my view controller as:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e var modelclass = [FruitsModelclass]()\n\n override func viewDidLoad()\n{\nself.loaddata()\n}\n\nfunc loaddata()\n{\n //here i have called the API and sucessfully get the response in data and assign as\n\n self.modelclass = data\n self.tableView.reloadData()\n }\n\n override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -\u0026gt; UITableViewCell? {\n let cell = tableView!.dequeueReusableCellWithIdentifier(\"cell\", forIndexPath: indexPath!) as FruitCell\n let model = self.Modeldata[indexpath.row]\n cell.textlabel.text = model.name\n return cell\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethis is how i set the \u003cstrong\u003ename\u003c/strong\u003e to cell.How can i set this to my headerSection..??there are alot of json objects in my Api its not fixed one. Here i have presented only two in can anyone help me out..??\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2017-03-06 14:50:07.37 UTC","last_activity_date":"2017-03-07 01:27:33.69 UTC","last_edit_date":"2017-03-07 01:27:33.69 UTC","last_editor_display_name":"","last_editor_user_id":"6680583","owner_display_name":"","owner_user_id":"7254718","post_type_id":"1","score":"0","tags":"ios|swift|uitableview","view_count":"239"} {"id":"46804891","title":"React Native SQLite wrapper for trigonometric function support such cos, acos ,sin etc in queries","body":"\u003cp\u003eI am using react-native-sqlite-storage wrapper for my data storage in react native ios app.i have a requirement of fetching nearby location data based on current location which can be achieved using distance finding formula haversine formula for which trigonometric functions are used.But SQLite does not support trigonometric function(acos,cos,sin) etc and getting error acos function not found while using in a query. \nAny help would be appreciated!\nThanks!\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-10-18 07:30:43.383 UTC","last_activity_date":"2017-10-18 09:14:26.2 UTC","last_edit_date":"2017-10-18 09:14:26.2 UTC","last_editor_display_name":"","last_editor_user_id":"2896098","owner_display_name":"","owner_user_id":"2896098","post_type_id":"1","score":"0","tags":"ios|objective-c|sqlite|react-native","view_count":"17"} {"id":"31968190","title":"Linking to ffmpeg libraries fails while installing OpenCV","body":"\u003cp\u003eFFMpeg 2.7.2 and all necessary \u003ccode\u003elibav*\u003c/code\u003e libraries are installed on my Ubuntu 14.04 machine. However, when I try to install OpenCV 2.4.11 (with FFMpeg enabled), I get the following error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/usr/bin/ld: cannot find -lavcodec\n/usr/bin/ld: cannot find -lswresample\n/usr/bin/ld: cannot find -lavutil\n/usr/bin/ld: cannot find -lavformat\n/usr/bin/ld: cannot find -lavcodec\n/usr/bin/ld: cannot find -lswresample\n/usr/bin/ld: cannot find -lavutil\n/usr/bin/ld: cannot find -lavformat\ncollect2: error: ld returned 1 exit status\nmake[2]: *** [bin/opencv_annotation] Error 1\nmake[1]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/all] Error 2\nmake: *** [all] Error 2\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI already tried pointing \u003ccode\u003eLD_LIBRARY_PATH\u003c/code\u003e and \u003ccode\u003ePKG_CONFIG_PATH\u003c/code\u003e to the locations which contain the FFmpeg libraries. I also tried with OpenCV 3.0 and obtained the same error.\u003c/p\u003e\n\n\u003cp\u003eIt seems that there is some kind of incompatibility between these versions of FFMpeg and OpenCV. Is there a workaround for this? \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eEDIT:\u003c/strong\u003e\nFor example \u003ccode\u003elocate libavcodec.a\u003c/code\u003e outputs:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/home/guel/cvpr2014/bin/dependencies/ffmpeg-2.4/libavcodec/libavcodec.a\n/home/guel/cvpr2014/bin/dependencies/lib/libavcodec.a\n/home/guel/cvpr2014/bin/dependencies/opencv-2.4.9/3rdparty/lib/libavcodec.a\n/home/guel/ffmpeg_build/lib/libavcodec.a\n/home/guel/git/ffmpeg/libavcodec/libavcodec.a\n/home/guel/mplayer/ffmpeg/libavcodec/libavcodec.a\n/home/guel/projects/mpegflow/dependencies/opencv-2.4.11/3rdparty/lib/libavcodec.a\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo, I have it in multiple places. Is that bad?\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2015-08-12 14:31:21.43 UTC","last_activity_date":"2015-08-12 15:04:12.57 UTC","last_edit_date":"2015-08-12 15:04:12.57 UTC","last_editor_display_name":"","last_editor_user_id":"2778860","owner_display_name":"","owner_user_id":"2778860","post_type_id":"1","score":"0","tags":"opencv|ffmpeg|linker-errors","view_count":"800"} {"id":"28855900","title":"Get the Trim Area of a PDF with PDF.js?","body":"\u003cp\u003eI'm playing about with PDF.js, and can't seem to find a solution to my problem.\u003c/p\u003e\n\n\u003cp\u003eI have a PDF with a trim area and bleed, I need to get the trim area so that I can crop the PDF image data in HTML canvas.\u003c/p\u003e\n\n\u003cp\u003eI see that Acrobat has javascript that can return the Trim based on getPageBox(\"Trim\"). Is there any equivalent in PDF.js? \nI cant seem to find a reference when inspecting the Javascript PDF Object in the console.\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2015-03-04 13:37:56.817 UTC","last_activity_date":"2017-03-24 02:53:57.23 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1398096","post_type_id":"1","score":"0","tags":"javascript|html5|pdf|trim|pdf.js","view_count":"478"} {"id":"14254716","title":"Streaming log files to remote client","body":"\u003cp\u003eI have a Java app running on a remote server (debian linux). The app logs runtime informations to files.\u003c/p\u003e\n\n\u003cp\u003eOnce in a while, the support needs to analyze the logs using a client tool (not running on the server, but on the support's desktop). The tool then needs remote access to\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eold log files on the server\u003c/li\u003e\n\u003cli\u003ethe current log file (growing in real time)\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eI'm searching a good (=standard, flexible, secure, well debugged etc) way to stream these past and present log messages to my client tool.\u003c/p\u003e\n\n\u003cp\u003eHow would go about doing this? \u003c/p\u003e\n\n\u003cp\u003eDoes a library exist, which provides this service?\u003c/p\u003e\n\n\u003cp\u003eCan syslog be adapted to do this?\u003c/p\u003e\n\n\u003cp\u003eEdit: For privacy reasons, the log files should be stored on the remote server only and not generally sent to a central logging service.\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2013-01-10 09:39:13.727 UTC","favorite_count":"1","last_activity_date":"2013-01-10 11:11:16.173 UTC","last_edit_date":"2013-01-10 11:11:16.173 UTC","last_editor_display_name":"","last_editor_user_id":"76024","owner_display_name":"","owner_user_id":"76024","post_type_id":"1","score":"2","tags":"java|linux|logging|stream|syslog","view_count":"1145"} {"id":"17369301","title":"App_Code folder created automatically in published website","body":"\u003cp\u003eI have a MVC4 App created in VS 2010 with Umbraco 6 too and I've created a web deploy project which is used by my Team City CI server to deploy my website to a CI environment for testing. \u003c/p\u003e\n\n\u003cp\u003eOn the CI server the first time I load the homepage (or any page) it loads perfectly fine. However the act of loading a page creates a App_Code folder on my CI server, and after that I get the message \"The directory '/App_Code/' is not allowed because the application is precompiled\". Removing the App_Code folder means that it once again works for one page load and the folder is created again.\u003c/p\u003e\n\n\u003cp\u003eRemoving the PrecompiledApp.config file causes my site to not load with a YSOD stating \"Object reference not set to an instance of an object.\" at the following point in the stack trace \"Umbraco.Web.UmbracoModule.BeginRequest(HttpContextBase httpContext) +25\"\u003c/p\u003e\n\n\u003cp\u003eTo be clear, I don't have an App_Code folder in my project, and I don't want or need one. All I want is for it to stop creating one automatically upon page load! I've used Umbraco in VS and deployed in the same way many times before, just not with Umbraco 6 and in an MVC project. \u003c/p\u003e\n\n\u003cp\u003eAny ideas why App_Code is being automatically created and what I can do to stop it?\u003c/p\u003e\n\n\u003cp\u003eMany Thanks\u003c/p\u003e\n\n\u003cp\u003eRichard\u003c/p\u003e","answer_count":"3","comment_count":"0","creation_date":"2013-06-28 16:20:55.373 UTC","favorite_count":"2","last_activity_date":"2014-10-21 22:28:01.797 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2532462","post_type_id":"1","score":"7","tags":"asp.net-mvc-4|umbraco|app-code","view_count":"2616"} {"id":"4774576","title":"Contact details window in ms access?","body":"\u003cp\u003eI'm currently using the MS Access 2010 template for contacts. I've modified it to do a multiple criteria search, but it's still the same.\nWhat I'd like to know is how to modify the contact details window that opens when you click \"open\".\u003c/p\u003e\n\n\u003cp\u003eBasically, I want it to open the window, but then I want to add two buttons to go to the next person without having to close the window and reopen another one. I've added the buttons, but the window opened is for a specific ID, so it won't go to the next record.\u003c/p\u003e\n\n\u003cp\u003eDoes anybody know how to open the contact details window for a specific contact but still be able to go through all of them? (them being the contacts given after the search)\u003c/p\u003e\n\n\u003cp\u003eEDIT:\u003c/p\u003e\n\n\u003cp\u003eOk, i've just tried to create a clone, but all i get is a error \"3251 - this operation is not supported for this type of object. I'm relatively new to VBA code, so its kind of hard to find the issues, but i'm guessing it has something to do with type of recordset (DAO or ADO). Here is what i have:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ePrivate Sub txtOpen_Click()\n\nDoCmd.OpenForm \"Contact Details\", , , , , acHidden\n With Forms![Contact Details]\n .Recordset = Me.Recordset.Clone\n .RecordsetClone.FindFirst \"[ID]=\" \u0026amp; Me!ID\n If Not .NoMatch Then\n .Bookmark = .RecordsetClone.Bookmark\n End If\n End With\n\nEnd Sub\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm currently looking into it though!\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2011-01-23 15:25:39.967 UTC","last_activity_date":"2011-01-25 18:59:36.357 UTC","last_edit_date":"2011-01-25 18:59:36.357 UTC","last_editor_display_name":"","last_editor_user_id":"406942","owner_display_name":"","owner_user_id":"406942","post_type_id":"1","score":"0","tags":"ms-access|macros","view_count":"310"} {"id":"37065253","title":"How would I save the data to a .csv file","body":"\u003cp\u003eI have made a program based on a maths quiz and have saved the data of the files to a .txt file. If I wanted to save the files in a .csv file would i just chnage .txt to .csv? Here is my code :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport time\nimport math \nimport random#I am using this to allow me to randomly pick the symbol operation and to randomly generate numbers\nprint(\"Title:Arithmetic Quiz\")#Tells the user what the program is.\nprint(\"*************************************************************\")#This is a line to make the presentation clearer to the user.\n#The code below shows the user an introduction of what the program is about.\nprint(\"This program will ask you to complete the arithmetic quiz.\")\nprint(\"The program has 10 questions. You will recieve feedback after.\")\nprint(\"____________________________________________________________\")\n#The line above prints a line across the page.\nwhile True:#This creates an infinity loop\n UserName = input(\"What is your name?:\")#Ask the user for there name.\n if not UserName.isalpha():#This is used to check if the user name is anything else apart from alphabetical letters.\n print(\"Error!Please enter your name using letters. \") #warning if wrong if wrong input given\n continue#Continues with the code when correct input given.\n else:#It breaks out of the while loop and proceeds with the quiz\n break\nClassSelection= input(\"Please enter what Class you are in?:1, 2 or 3\")\nClassChosen=0\nwhile ClassChosen==0:\n if ClassSelection==\"1\":\n ClassChosen=1\n elif ClassSelection==\"2\":\n ClassChosen=1\n elif ClassSelection==\"3\":\n ClassChosen=1\n else:\n print(\"You must write 1, 2, or 3.\")\n ClassSelection=input(\"Enter the class you are in\")\n\n\nprint(UserName,\" welcome to the Arithmetic Quiz.\")#Welcomes the user to the quiz.\nprint(\"____________________________________________\")\nprint(\"The quiz will begin in 3 seconds\")\ntime.sleep(2)\nfor i in range(0,3):# range between \n print (3 - i)#counts down by one\n time.sleep(1)#Delays for 1 second\nprint(\"Begin!\")\nprint(\"*****************************************\")\nRecentStudent= [0,0,0]#This is a list with dummy values. The use of this is to save the last three score of the user.\ndef MathsQuiz():#I have used a function to make my code more efficient.\n score=0#No questions have been answered correctly yet so score is set to zero \n for questionNum in range(10):#I have used this to allow me to set my Parameters.\n Num1= random.randint (1, 10)#Generates a random number between 1 and 10 for Num1.\n Num2= random.randint (1, 10)#Generates a random number between 1 and 10 for Num2\n Symbol = [\"+\",\"-\",\"*\"]#These are my operators used for the arithmetic of Num1 and Num2.\n Operation = random.choice(Symbol)#This will randomly choose a operating symbol for a question\n RealAnswer= int(eval(str(Num1)+Operation+str(Num2)))#This is used to work out the answer for the question.The evaluate is used to interpret the code as a str and calculate an answer.\n#It will store the value of the Answer and call it when it is needed.\n print(\"Please give an answer for:\", Num1, Operation, Num2)#This is what makes the question and outputs it to the user by using the random functions. \n UserAnswer = int(input(\"Enter your answer here:\"))#This asks the user to enter their anser to the question.\n if UserAnswer == RealAnswer:#This checks if the answer from the user is the same as the real answer.\n score = score + 1#If the user gets the question right 1 should be added to the score.\n print(\"You are correct! :D\")#The program will congratulate the user.\n print(\"_______________________________________________\")\n else:#If the users answer is not the same as the real answer then it will print a wrong message.\n print(\"You are incorrect! :( \")#This tells the user that they got the question incorrect and tells the user the real answer.\n print(\"The answer was\", RealAnswer)\n print(\"________________________________________________\")#This will be used to split the quiz.\n print()#This is used to format the quiz.\n print(\"__________________________________________________\")\n print(\"Thank you for completing the quiz!\")\n print(\"Your Score is loading\")\n import time\n time.sleep(2)\n print(UserName,\"In this test you achieved\",score,\"/10\")#This tells the user the score they achieved in the maths test.\n print()#This is used to format the code\n del RecentStudent[0]\n RecentStudent.append(score)\n print(\"Your three most recent scores are:\",RecentStudent)\n print(\"********************************************************\")\ndef Resit1():#This function is used to easily call place of the program such as in this case when resitting.\n Resit1=input(\"Do you want to resit the test? Yes or No?:\")#Asks the user if they would like to resit\n\n #The variable will let user input whether they want to do the quiz again.\n if Resit1== \"Yes\" or Resit1==\"yes\":# Checks the input of the user to the resit question\n MathsQuiz()#This is used to call the quiz which will restart the quiz and allow them to retake the quiz.\n #It tells the user that they are finished \n\n\ndef Resit2():#This function is used to easily call place of the program such as in this case when resitting.\n Resit2=input(\"Do you want to resit the test? Yes or No?:\")#Asks the user if they would like to resit\n\n #The variable will let user input whether they want to do the quiz again.\n if Resit2== \"Yes\" or Resit2==\"yes\":# Checks the input of the user to the resit question\n MathsQuiz()#This is used to call the quiz which will restart the quiz and allow them to retake the quiz.\n print(\"Quiz Finished\")#It tells the user that they are finished \n\nMathsQuiz()#This will call the first function that has been set in the program.\nResit1()#This will call the Resit1 function when it is needed by the program.\nResit2()#This will call the Resit2 function when it is needed by the program.\n\nif ClassSelection==\"1\":#used to identify whether the ClassSelection is equal to 1.\n Class1 = []#class1 list is created and is empty.\n Class1.append(\"Student: \")#This text is added as the first item of the list.\n #The text helps with presentation and makes the data more clear.\n Class1.append(UserName)#The name variable is appended as the second item.\n Class1.append(\"Latest 3 Scores: \")#This text is added so user knows the next item is score.\n Class1.append(RecentStudent)#The score variable is appended as the last item.\n\n\n file = open(\"Class1Scores.txt\", 'a')#File opened called classAScores.\n #It is a text file because I added \".txt\"\n #I used the mode 'a' because this allows me to append things to the file.\n file.write(str(Class1))#Allows me to write the classA list onto the file.\n #Because the mode is append, it enables me to append a whole list to the file.\n #the str() makes sure the list is interpreted as code as code can be appended.\n #The list in its raw form will not append to the file.\n file.write(\"\\n\")#Ensures the next pupils data is recorded on the row below.\n file.close()#Closes the file so everything is saved.\n\nelif ClassSelection==\"2\":#used to identify whether the ClassSelection is equal to 1.\n Class2=[]#classA list is created and is empty.\n Class2.append(\"Student: \")#This text is added as the first item of the list.\n #The text helps with presentation and makes the data more clear.\n Class2.append(UserName)#The name variable is appended as the second item.\n Class2.append(\"Latest 3 Scores: \")#This text is added so user knows the next item is score.\n Class2.append(RecentStudent)#The score variable is appended as the last item.\n\n\n file = open(\"Class2Scores.txt\", 'a')#File opened called classAScores.\n #It is a text file because I added \".txt\"\n #I used the mode 'a' because this allows me to append things to the file.\n file.write(str(Class2))#Allows me to write the classA list onto the file.\n #Because the mode is append, it enables me to append a whole list to the file.\n #the str() makes sure the list is interpreted as code as code can be appended.\n #The list in its raw form will not append to the file.\n file.write(\"\\n\")#Ensures the next pupils data is recorded on the row below.\n file.close()#Closes the file so everything is saved.if ClassSelection==\"1\":#used to identify whether the ClassSelection is equal to 1.\n\n\nelif ClassSelection==3:\n Class3 = []#classA list is created and is empty.\n Class3.append(\"Student: \")#This text is added as the first item of the list.\n #The text helps with presentation and makes the data more clear.\n Class3.append(UserName)#The name variable is appended as the second item.\n Class3.append(\"Latest 3 Scores: \")#This text is added so user knows the next item is score.\n Class3.append(RecentStudent)#The score variable is appended as the last item.\n\n\n file = open(\"Class3Scores.txt\", 'a')#File opened called class3Scores.\n #It is a text file because I added \".txt\"\n #I used the mode 'a' because this allows me to append things to the file.\n file.write(str(Class3))#Allows me to write the class3 list onto the file.\n #Because the mode is append, it enables me to append a whole list to the file.\n #the str() makes sure the list is interpreted as code as code can be appended.\n #The list in its raw form will not append to the file.\n file.write(\"\\n\")#Ensures the next pupils data is recorded on the row below.\n file.close()#Closes the file so everything is saved.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is my code would I need to change the bottom of the code to save the files in a .csv file. I tried doing a different method, but never got anywhere . \u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2016-05-06 05:55:01.853 UTC","last_activity_date":"2016-05-06 06:33:44.767 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6298120","post_type_id":"1","score":"-2","tags":"python|list|csv|append","view_count":"81"} {"id":"34063328","title":"How to select multiple divs with Lasso Selection Tool","body":"\u003cp\u003eI have multiple div's on my HTML page, and want to create a selection tool to be able to select a subset of those divs (and afterwards simply add a class to those divs or whatever). It could select every div that falls within the selected area (or maybe only the ones which center fall within the selected area), like so:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/BiqiB.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/BiqiB.png\" alt=\"Selection\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eHow would I go about this? I looked into jQuery UI's \u003ccode\u003e.selectable()\u003c/code\u003e, but that's not quite what I'm looking for since it has a rectangle as selection box, not a freeform one.\u003c/p\u003e\n\n\u003cp\u003eI made a JSFiddle of what I want, but how do I create the lasso line?\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://jsfiddle.net/aesafjcy/4/\" rel=\"nofollow noreferrer\"\u003ehttp://jsfiddle.net/aesafjcy/4/\u003c/a\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etool_active = false;\nselect_active = false;\n\n$(\".btn-select\").click(function() {\n tool_active = !tool_active;\n $(this).toggleClass(\"btn-active\");\n $(\"html\").toggleClass(\"select-active\");\n});\n\n$(\"html\").mousedown(function(e) {\n if(tool_active \u0026amp;\u0026amp; e.target.id != \"selection_tool\") {\n select_active = true;\n }\n});\n\n$(\"html\").mouseup(function(e) {\n if(select_active) {\n select_active = !select_active;\n }\n});\n\n$(\"html\").mousemove(function(e) {\n if(select_active \u0026amp;\u0026amp; $(e.target).hasClass('box')) {\n $(e.target).addClass(\"box-selected\");\n }\n});\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"6","creation_date":"2015-12-03 10:20:55.327 UTC","last_activity_date":"2015-12-03 14:37:53.417 UTC","last_edit_date":"2015-12-03 14:37:53.417 UTC","last_editor_display_name":"","last_editor_user_id":"1264804","owner_display_name":"","owner_user_id":"1472812","post_type_id":"1","score":"-3","tags":"jquery|jquery-ui","view_count":"388"} {"id":"27714761","title":"NDB Model Querying of Key Ids using an array filter","body":"\u003cp\u003eI'm trying to query an NDB model using a list of provided key id strings. The model has string ids that are assigned at creation - for example:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eobjectKey = MyModel(\n id=\"123456ABC\",\n name=\"An Object\"\n ).put()\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow I can't figure out how to query the NDB key ids with a list filter. Normally you can do the MyModel.property.IN() to query properties:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003enames = ['An Object', 'Something else', 'etc']\n\n# This query works\nquery = MyModel.query(MyModel.name.IN(names))\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I try to filter by a list of keys, I can't get it to work:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# This simple get works\nobject = MyModel.get_by_id(\"123456ABC\")\n\nids = [\"123456ABC\", \"CBA654321\", \"etc\"]\n\n# These queries DON'T work\nquery = MyModel.query(MyModel.id.IN(ids))\nquery = MyModel.query(MyModel.key.id.IN(ids))\nquery = MyModel.query(MyModel.key.id().IN(ids))\nquery = MyModel.query(MyModel._properties['id'].IN(ids))\nquery = MyModel.query(getattr(MyModel, 'id').IN(ids))\n...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI always get \u003ccode\u003eAttributeError: type object 'MyModel' has no attribute 'id'\u003c/code\u003e errors. \u003c/p\u003e\n\n\u003cp\u003eI need to be able to filter by a list of IDs, rather than iterate through each ID in the list (which is sometimes long). How do I do it?\u003c/p\u003e","accepted_answer_id":"27714824","answer_count":"2","comment_count":"0","creation_date":"2014-12-31 00:49:21.857 UTC","last_activity_date":"2017-08-22 01:50:42.41 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1578715","post_type_id":"1","score":"2","tags":"python|google-app-engine|app-engine-ndb|google-cloud-datastore","view_count":"968"} {"id":"16380225","title":"Using libVLC as a video decoder","body":"\u003cp\u003eI'm attempting to use libVLC as a video decoder for a motion detection project. Previously I was using ffmpeg libraries, but some issues with Matroska files brought me here. Along with playing video back at the correct rate, I also want to be able to get one frame after another at the fastest rate my system can handle, as once the user sets up some parameters, I want the motion detection algorithm to run through the video as quickly as it can. My libVLC setup code looks like this (error handling and minor details omitted for brevity):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003econst char* vlc_argv[] =\n{\n \"--no-audio\", /* skip any audio track */\n};\nlibvlc_instance_t* inst = libvlc_new(sizeof(vlc_argv) / sizeof(*vlc_argv), vlc_argv);\nauto media = libvlc_media_new_path (inst, filename.c_str());\nplayer = libvlc_media_player_new_from_media(media);\nlibvlc_media_release(media);\n\n// Needed to initialize the player ?\nlibvlc_media_player_play(player);\nlibvlc_media_player_pause(player);\n\nfps = libvlc_media_player_get_fps(player);\nlength = libvlc_media_player_get_length(player);\nwidth = libvlc_video_get_width(player);\nheight = libvlc_video_get_height(player);\n\n// TODO: Add libvlc_video_set_callbacks to set up callbacks to render to memory buffer\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever, I am left with the following questions:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eIs there a more straightforward way to initialize the media player without starting playback besides calling \u003ccode\u003elibvlc_media_player_play\u003c/code\u003e then \u003ccode\u003elibvlc_media_player_pause\u003c/code\u003e?\u003c/li\u003e\n\u003cli\u003eAll of the \u003ccode\u003eget\u003c/code\u003e functions (\u003ccode\u003efps, length, width, height\u003c/code\u003e) all return zero. Do I need to do something like read the first frame to get these values, and if so, how am I supposed to know how large my decoded frame buffer must be?\u003c/li\u003e\n\u003c/ol\u003e","accepted_answer_id":"17429237","answer_count":"1","comment_count":"4","creation_date":"2013-05-05 00:28:11.203 UTC","last_activity_date":"2013-07-02 15:10:50.817 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"713961","post_type_id":"1","score":"3","tags":"c++|c|decode|libvlc","view_count":"3430"} {"id":"31642810","title":"Cant delete row from database","body":"\u003cp\u003eI have a form that brings in content from a database and I want the user to be able to select a student and delete it from the database.\nI get a error saying UNDEFINED INDEX.\nI am new to php. Thanks in advance for any help\nhere is my code\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;section\u0026gt; \n \u0026lt;form action=\"include/borrar2.php\" method=\"post\"\u0026gt;\n \u0026lt;center\u0026gt;\n \u0026lt;?php\n $sql=\"select * from registro\";\n $res=mysql_query($sql);\n echo \"\u0026lt;table border='1' class='tabla'\u0026gt;\";\n echo\"\u0026lt;thead\u0026gt;\";\n echo\"\u0026lt;tr\u0026gt;\"; \n\n echo\"\u0026lt;th class='op'\u0026gt;\".\"ID\".\"\u0026lt;/th\u0026gt;\";\n echo\"\u0026lt;th class='op'\u0026gt;\".\"Detalle\".\"\u0026lt;/th\u0026gt;\";\n echo\"\u0026lt;th class='op'\u0026gt;\".\"Costo\".\"\u0026lt;/th\u0026gt;\";\n echo\"\u0026lt;th class='op'\u0026gt;\".\"\u0026amp;nbsp;\".\"\u0026lt;/th\u0026gt;\";\n echo\"\u0026lt;th class='op'\u0026gt;\".\"\u0026amp;nbsp;\".\"\u0026lt;/th\u0026gt;\"; \n echo\"\u0026lt;/tr\u0026gt;\";\n echo\"\u0026lt;/thead\u0026gt;\";\n while ( $row = mysql_fetch_array($res)) {\n echo \"\u0026lt;tr\u0026gt;\"; \n echo \"\u0026lt;td name='id'\u0026gt;\".$row['id'].\"\u0026lt;/td\u0026gt;\";\n echo \"\u0026lt;td\u0026gt;\".$row['detalle'].\"\u0026lt;/td\u0026gt;\";\n echo \"\u0026lt;td\u0026gt;\".$row['costo'].\"\u0026lt;/td\u0026gt;\";\n echo \"\u0026lt;td class='opcionT op' \u0026gt;\".\"\u0026lt;a href=''\u0026gt;\".\"\u0026lt;input type='submit' value='Actualizar' class='btn2'\u0026gt;\".\"\u0026lt;/a\u0026gt;\".\"\u0026lt;/td\u0026gt;\";\n echo \"\u0026lt;td class='opcionT op' \u0026gt;\".\"\u0026lt;a href=''\u0026gt;\".\"\u0026lt;input type='submit' value='Eliminar' name=\"eliminar\" class='btn2'\u0026gt;\".\"\u0026lt;/a\u0026gt;\".\"\u0026lt;/td\u0026gt;\"; \n echo \"\u0026lt;/tr\u0026gt;\";\n }\n echo \"\u0026lt;/table\u0026gt;\";\n\n ?\u0026gt; \n \u0026lt;/center\u0026gt;\n \u0026lt;/form\u0026gt;\n \u0026lt;/section\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ephp\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif (isset($_POST['eliminar'])) {\n $idrow = $_POST['id'];\n$sql=\"DELETE FROM `agenda` WHERE `id` = $idrow\";\n$res=mysql_query($sql);\nif($res){\n echo '\u0026lt;script\u0026gt;alert(\"Datos Registrados..\")\u0026lt;/script\u0026gt;';\n echo \"\u0026lt;script\u0026gt;location.href='../index.php'\u0026lt;/script\u0026gt;\";\n}else{\n echo \"Error :(\" ;\n}\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"31642994","answer_count":"1","comment_count":"4","creation_date":"2015-07-26 22:59:56.293 UTC","favorite_count":"1","last_activity_date":"2015-07-26 23:27:15.29 UTC","last_edit_date":"2015-07-26 23:16:47.61 UTC","last_editor_display_name":"","last_editor_user_id":"2665110","owner_display_name":"","owner_user_id":"2665110","post_type_id":"1","score":"-2","tags":"php|html","view_count":"32"} {"id":"4721442","title":"Query to search for maximum value in a row, rather than within a column - SQL/MySQL","body":"\u003cp\u003eOk so I have a row in a table. This row has eight date type fields.\u003c/p\u003e\n\n\u003cp\u003eI am attempting to write a query that returns the highest date value from a row.\u003c/p\u003e\n\n\u003cp\u003eFor example:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e NULL,NULL,2009-10-09,2010-03-12,2010-04-15,2010-06-23,2010-08-27,NULL\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe query when run against the above table would return the following value for this row: 2010-08-27\u003c/p\u003e\n\n\u003cp\u003eI've tried a couple of combinations using CASE, but it seems inelegant and lengthy (and as such I haven't finished writing the query). \u003c/p\u003e\n\n\u003cp\u003eAre there any other options available to me? Or does someone have a solution that they have run successfully?\u003c/p\u003e\n\n\u003cp\u003eAppreciate any help that can be offered. :)\u003c/p\u003e","accepted_answer_id":"4721480","answer_count":"2","comment_count":"0","creation_date":"2011-01-18 07:21:56.117 UTC","last_activity_date":"2011-01-18 09:57:53.877 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"386103","post_type_id":"1","score":"0","tags":"sql|mysql|max","view_count":"339"} {"id":"30199263","title":"Difference in executing command with subprocess","body":"\u003cp\u003eI have this piece of code that executes well:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport subprocess\n\nexe_cmd = subprocess.Popen([\"ls\", \"-al\"], stdout=subprocess.PIPE)\noutput, err = exe_cmd.communicate()\nprint output\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd I have another piece where I assign the command to a variable and then pass it as argument. But in this case it fails. Why?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport subprocess\n\n#Here I assign the command to a variable.\n\ncmd = \"ls -al\" \nexe_cmd = subprocess.Popen(cmd, stdout=subprocess.PIPE)\noutput, err = exe_cmd.communicate()\nprint output\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"30199342","answer_count":"3","comment_count":"0","creation_date":"2015-05-12 18:55:34.89 UTC","last_activity_date":"2015-05-12 19:21:59.687 UTC","last_edit_date":"2015-05-12 19:02:04.44 UTC","last_editor_display_name":"","last_editor_user_id":"4099593","owner_display_name":"","owner_user_id":"4075907","post_type_id":"1","score":"1","tags":"python|subprocess","view_count":"71"} {"id":"30261909","title":"set a key without value for a dictionary in python","body":"\u003cp\u003eI am trying to set a dictionary for the staff's salary in Python. I want to create two functions, \u003ccode\u003egetname()\u003c/code\u003e and \u003ccode\u003egetsalary()\u003c/code\u003e so I tried: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eempDic={}\n\ndef setname(n):\n\nempDic={'n':''}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd then in python interactive 2.7 I typed:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026gt;\u0026gt;\u0026gt;setname('marson')\n\n\u0026gt;\u0026gt;\u0026gt;print empDic\n\n{}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe result is still an empty dictionary, How can I deal with that?\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2015-05-15 14:21:58.013 UTC","last_activity_date":"2015-05-15 14:28:17.11 UTC","last_edit_date":"2015-05-15 14:28:17.11 UTC","last_editor_display_name":"","last_editor_user_id":"4342498","owner_display_name":"","owner_user_id":"4904144","post_type_id":"1","score":"0","tags":"python","view_count":"1273"} {"id":"38080610","title":"Migration errors starting a Rails project on a new laptop","body":"\u003cp\u003eI'm trying to launch a Rails project on a new laptop and have some errors in few old migrations (attributes are no longer present for some models etc).\u003c/p\u003e\n\n\u003cp\u003eI commented those migrations and \u003ccode\u003erake db:migrate\u003c/code\u003e finished successfully. I've got a database dump and everything seems to be working fine.\u003c/p\u003e\n\n\u003cp\u003eIs it ok that some migrations were commented? Can it affect something in the future?\u003c/p\u003e","accepted_answer_id":"38080789","answer_count":"2","comment_count":"0","creation_date":"2016-06-28 15:39:10.407 UTC","last_activity_date":"2016-06-28 15:48:21.63 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5655881","post_type_id":"1","score":"0","tags":"ruby-on-rails|database-migration","view_count":"23"} {"id":"42750677","title":"How to acces specific data in .data","body":"\u003cp\u003eI'm pretty sure that it's possible, but I can't find how to acces some data in the .data section when they are declared like that (in nasm) :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003emsg: db 0xEA, 0xBA, 0x35, 0xB4, 0x88, 0x24, 0x14, 0x2C, 0xA1, 0x97, 0x5F, 0x1B, 0x56, 0xFA, 0xA3\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eFor example, if I want to move the 4th to a register, how can I do that ?\u003c/p\u003e","accepted_answer_id":"42750960","answer_count":"1","comment_count":"1","creation_date":"2017-03-12 17:24:50.797 UTC","last_activity_date":"2017-03-12 20:18:11.04 UTC","last_edit_date":"2017-03-12 19:52:17.97 UTC","last_editor_display_name":"","last_editor_user_id":"7162484","owner_display_name":"","owner_user_id":"7162484","post_type_id":"1","score":"1","tags":"assembly|nasm","view_count":"41"} {"id":"43557299","title":"About using YouTube API on TV","body":"\u003cp\u003eMy question is related to developing HTML5 based apps for TV, using YouTube API to play videos. I've tried to find Google forum to post my question, but they recommend it here. Currently IFrame API is the recommended way. However, I would like to know the extents and proper way to use it for TV. It seems to me that embedding videos on TV will greatly limit possibilities for user. So to concrete questions:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003e\u003cp\u003eHow to avoid \"Playback on other websites has been disabled...\" error? I'm not playing back from website after all. Meanwhile XBMC/Kodi can playback those videos just fine. Are they using some old deprecated API? I've tried to set \u003ccode\u003eorigin\u003c/code\u003e var in \u003ccode\u003eplayerVars\u003c/code\u003e to \u003ccode\u003ehttps://www.youtube.com/tv\u003c/code\u003e, but then the player object is failed to initialize.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eHow the advertisements are going to be presented/interacted? So far I haven't seen anything with \"Skip Ad\" button using IFrame API. Only small banner image on left bottom side. But on TV there is no way to click on it. YouTube original TV app is showing \"Skip Ad\" type ads. Is there some special way for TV apps to present ads in proper way for devices with limited input, like TV?\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eSimilarly the 'i' button appearing on top right side is not useful at all on TV. How to avoid it as well?\u003c/p\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eSo I would like to know the extents I can achieve in my HTML5 based app, presenting YouTube videos, comparing to native YouTube application. Both the legal way and the tricks to achieve best experience for TV users are in interest.\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2017-04-22 09:02:43.467 UTC","last_activity_date":"2017-04-22 09:02:43.467 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"315427","post_type_id":"1","score":"0","tags":"javascript|html5|youtube-api|youtube-iframe-api","view_count":"67"} {"id":"8370670","title":"Proper use libdl and dynamically linked libraries","body":"\u003cp\u003eI need to dynamically link a library that I have created. I'm not exactly sure what the issue is. It all compiles properly, but I always catch \u003ccode\u003ehandle\u003c/code\u003e as the \u003ccode\u003eNULL\u003c/code\u003e pointer:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evoid *handle;\nchar *error;\nhandle = dlopen (\"./hw11-lib-michaelSchilling.so\", RTLD_LAZY);\n//same error comes up with full path as well as './hw11...'\nif(!handle){\n error = dlerror();\n printf(\"%s\\n\", error);\n printf(\"Error loading library.\\n\");\n exit(1);\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI cant get passed this error and I'm not sure what could possibly be wrong. I'm pretty sure I've compiled everything correctly. Here are the compilation steps I used:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003egcc -rdynamic -c hw11-lib-michaelSchilling.c -o hw11-lib-michaelSchilling.so\ngcc hw11-michaelSchilling-4.c -ldl -o hw11-michaelSchilling-4\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm getting an error that reads \u003ccode\u003e./hw11-lib-michaelSchilling.so: only ET_DYN and ET_EXEC can be loaded.\u003c/code\u003e What does this mean?\u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","accepted_answer_id":"8371464","answer_count":"4","comment_count":"0","creation_date":"2011-12-03 20:17:14.293 UTC","last_activity_date":"2017-10-01 17:37:46.823 UTC","last_edit_date":"2011-12-03 22:12:16.893 UTC","last_editor_display_name":"","last_editor_user_id":"938505","owner_display_name":"","owner_user_id":"938505","post_type_id":"1","score":"8","tags":"c|dll|shared-libraries","view_count":"10028"} {"id":"5777114","title":"WMI Access Denied while Win32_Service query","body":"\u003cp\u003eI'm using WMI to retrieve REMOTE computer services. To check the results I try WMIC like:\u003c/p\u003e\n\n\u003cp\u003eWMIC /NODE:\"hostname\" /USER:\"login\" /PASSWORD:\"pwd\" OS\u003c/p\u003e\n\n\u003cp\u003eWMIC /NODE:\"hostname\" /USER:\"login\" /PASSWORD:\"pwd\" SERVICE etc.\u003c/p\u003e\n\n\u003cp\u003eEverything's fine on Win server 2k3 machines. But on a new Win server 2k8 it works everything but not SERVICE alias - I just get \"0x80041003 Access Denied\".\nI've got this error while remote query (there's no error if I query the SERVICE locally on the server itself).\u003c/p\u003e\n\n\u003cp\u003eMy user is a admin on this server. I've check Local Security Policies, give permission to the user from root/CIMV2 namespace for remoteEnable, DCOM permission for Remote Access, Remote Lunch, Remote Activation. I've try to enable logging but couldn't find any usefull info. I've read tens articles on this theme but couldn't find answer either.\u003c/p\u003e\n\n\u003cp\u003eHere \u003ca href=\"http://technet.microsoft.com/en-us/library/ee692772.aspx\" rel=\"nofollow\"\u003ehttp://technet.microsoft.com/en-us/library/ee692772.aspx\u003c/a\u003e I've read: \"0x80041003 (WBEM_E_ACCESS_DENIED) This typically results when the process trying to access the namespace does not have the required WMI privileges. The account attempting remote access should be an administrator on the target computer; in addition, the account might need to have a specific privilege enabled.\nTo troubleshoot this error, check the namespace security on the remote namespace to see the privileges enabled for the account.\"\u003c/p\u003e\n\n\u003cp\u003eSo, I've done all recommended action with no result.\u003c/p\u003e\n\n\u003cp\u003eWHY I can successfully query all aliases (means the user has all necessary rights) but not SERVICE? Now I already don't have any ideas and ask for help.\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2011-04-25 09:44:02.52 UTC","last_activity_date":"2011-04-25 09:44:02.52 UTC","last_editor_display_name":"","owner_display_name":"user723534","post_type_id":"1","score":"3","tags":"wmi|wmic","view_count":"3216"} {"id":"13339424","title":"BufferedReader.readLine() do not read and hang the system(wait)","body":"\u003cp\u003e\u003ccode\u003eBufferedReader.readLine()\u003c/code\u003e do not read and hang the \u003ccode\u003esystem(wait)\u003c/code\u003e. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eInputStream istrm = runtimeProcess.getInputStream();\nInputStreamReader istrmrdr = new InputStreamReader(istrm);\nBufferedReader buffrdr = new BufferedReader(istrmrdr);\nSystem.out.println(\"4\");\nString data;\nString st;\nSystem.out.println(\"4a\");\nwhile (!(st=buffrdr.readLine()).isEmpty()) {\n System.out.println(\"5 in loop\");\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"8","creation_date":"2012-11-12 06:51:28.943 UTC","last_activity_date":"2013-10-22 05:51:26.863 UTC","last_edit_date":"2013-10-22 05:51:26.863 UTC","last_editor_display_name":"","last_editor_user_id":"1554935","owner_display_name":"","owner_user_id":"1799232","post_type_id":"1","score":"0","tags":"java|java-ee|stream|filestream|bufferedreader","view_count":"5233"} {"id":"4366325","title":"Datagrid columns contains value","body":"\u003cp\u003eI'm working application in C#, .NET.\u003c/p\u003e\n\n\u003cp\u003eHow can I check in DataGridView component if some columns contains specific value?\nI have some contains methods, but I don't know how I would use them..\u003c/p\u003e","accepted_answer_id":"4366433","answer_count":"4","comment_count":"1","creation_date":"2010-12-06 12:20:45.593 UTC","last_activity_date":"2017-07-28 09:22:26.017 UTC","last_edit_date":"2010-12-06 12:31:02.73 UTC","last_editor_display_name":"","last_editor_user_id":"142234","owner_display_name":"","owner_user_id":"529112","post_type_id":"1","score":"1","tags":"c#|datagridview","view_count":"9551"} {"id":"5833937","title":"My Java code crashes when I try to call a method from an array of objects","body":"\u003cp\u003eI’m just learning Java and trying to have an array of a class. When a call a methed from the array it crashes. Works fine if it is not an array\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n cDate test=new cDate();\n test.setDay(0);\n mAppoitments = new cDate[24];\n // crashes why?????\n mAppoitments[0].setDay(0); \n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"5833952","answer_count":"5","comment_count":"0","creation_date":"2011-04-29 15:20:42.943 UTC","last_activity_date":"2011-04-30 18:58:54.13 UTC","last_edit_date":"2011-04-29 15:23:12.993 UTC","last_editor_display_name":"","last_editor_user_id":"505893","owner_display_name":"","owner_user_id":"564653","post_type_id":"1","score":"1","tags":"java|arrays","view_count":"106"} {"id":"11155322","title":"rbegin() of a boost::iterator_range","body":"\u003cp\u003eI refactored a class that used a single list of elements so it now uses a list of such lists.\nTo minimize the changes in derived classes, I implemented a custom \u003ccode\u003eiterator\u003c/code\u003e using \u003ccode\u003eboost::iterator_facade\u003c/code\u003eand also a method to get a \u003ccode\u003eboost::iterator_range\u0026lt;iterator\u0026gt;\u003c/code\u003e that can be used for iterating instead of the original list.\u003c/p\u003e\n\n\u003cp\u003eThis appears to work except in one place where \u003ccode\u003erbegin()\u003c/code\u003e is used. \u003ccode\u003eboost::iterator_range\u003c/code\u003e does not appear to support something like that.\u003c/p\u003e\n\n\u003cp\u003e\u003cem\u003eWhat would be a simple way of getting the range's last element?\u003c/em\u003e\u003c/p\u003e\n\n\u003cp\u003eI'm using VS2008 SP1, i.e. only some C++11 support in std::tr1, and boost is obviously available, too.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etypedef std::deque\u0026lt;MyData\u0026gt; DataList;\n\nclass MyClass : private boost::noncopyable\n{\npublic:\n void AppendData(DataList* newData \n\nprivate:\n typedef std::deque\u0026lt;DataList*\u0026gt; ListOfDatatLists;\n\n /**\n * Custom iterator.\n * The content is not meant to be modified so this iterator operates on const lists only.\n */\n class iterator\n : public boost::iterator_facade \u0026lt;\n iterator,\n MyData,\n boost::forward_traversal_tag // Only forward iteration necessary\n \u0026gt;\n {\n public:\n static boost::iterator_range\u0026lt;iterator\u0026gt; range(const ListOfDataLists * pListOfLists);\n\n private:\n friend class boost::iterator_core_access;\n\n iterator(const ListOfDataLists * pListOfLists = NULL) : m_pListOfLists(pListOfLists) {}\n\n /// \\name Implementations for boost base class\n //{@\n bool equal(iterator const \u0026amp; other) const;\n MyData \u0026amp; dereference() const;\n void increment();\n difference_type distance_to(const iterator \u0026amp; other) const;\n //@}\n\n const ListOfDataLists * m_pListOfLists;\n ListOfDataLists::const_iterator m_listIt; ///\u0026lt; The current list of data items\n DataList::const_iterator m_dataIt; ///\u0026lt; An iterator of the current list\n };\n\n\n ListOfResultLists m_dataLists;\n\n\nprotected:\n typedef std::tr1::shared_ptr\u0026lt;CLockedResults\u0026gt; SpLockedResults;\n\n /// For use by derived classes instead of the former single list\n boost::iterator_range\u0026lt;iterator\u0026gt; GetData() const;\n};\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"11155736","answer_count":"1","comment_count":"0","creation_date":"2012-06-22 11:28:48.073 UTC","last_activity_date":"2012-06-22 12:05:37.217 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"27596","post_type_id":"1","score":"0","tags":"c++|boost|iterator|reverse|traversal","view_count":"434"} {"id":"16424070","title":"Pointer assigned to multiple variables","body":"\u003cp\u003eI am wondering what is the meaning of the following expression:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eunsigned char *buff_p = txBuffer, hdrFlags, msgType;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"9","creation_date":"2013-05-07 16:29:00.557 UTC","last_activity_date":"2013-05-07 16:50:31.197 UTC","last_edit_date":"2013-05-07 16:50:31.197 UTC","last_editor_display_name":"","last_editor_user_id":"21461","owner_display_name":"","owner_user_id":"2359128","post_type_id":"1","score":"-2","tags":"c|pointers","view_count":"362"} {"id":"21131409","title":"How to select all from table and skip some row with a certain value","body":"\u003cp\u003eim trying to select all and skip some row.\u003c/p\u003e\n\n\u003cp\u003eThere's some syntax error on this line, i don't know what im doing wrong.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT * FROM ads WHERE bbookschool like '$data' \u0026amp;\u0026amp; WHERE bbookname != 'TEST' ORDER BY time desc\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eMORE CODE\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$data = preg_replace ('#[^a-zA-Z0.-_% ]#i', '', $_POST['data']);\n$Result = mysql_query(\"SELECT * FROM ads WHERE bbookschool like '$data' \u0026amp;\u0026amp; WHERE bbookname != 'TEST0160' ORDER BY time desc\")\n or die (mysql_error());\nwhile($row = mysql_fetch_array($Result)){\nrequire 'book_ad.php';\n$adCondition = (!empty($row['bbookname'])) ? $ad : ''; \necho $adCondition; \n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","accepted_answer_id":"21131460","answer_count":"4","comment_count":"1","creation_date":"2014-01-15 07:27:41.38 UTC","last_activity_date":"2014-01-15 08:50:48.373 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3109875","post_type_id":"1","score":"0","tags":"php|mysql","view_count":"88"} {"id":"4749539","title":"Forwarding http:// to http://www. using .htaccess","body":"\u003cp\u003eI would like to use .htaccess to point any calls to \u003ccode\u003ehttp://example.com/\u003c/code\u003e to \u003ccode\u003ehttp://www.example.com\u003c/code\u003e including whether a page is specified. That is, \u003ccode\u003ehttp://example.com/contact.html\u003c/code\u003e would redirect to to \u003ccode\u003ehttp://www.example.com/contact.html\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eCan someone help with the syntax as I've tried different examples and it won't work.\u003c/p\u003e","accepted_answer_id":"4749630","answer_count":"3","comment_count":"0","creation_date":"2011-01-20 16:11:28.653 UTC","favorite_count":"1","last_activity_date":"2011-10-27 13:04:52.51 UTC","last_edit_date":"2011-10-27 13:04:52.51 UTC","last_editor_display_name":"","last_editor_user_id":"209139","owner_display_name":"","owner_user_id":"202926","post_type_id":"1","score":"1","tags":".htaccess","view_count":"119"} {"id":"2235552","title":"Mock web service","body":"\u003cp\u003eWe have two components: enterprise application X, and Web service Y\u003c/p\u003e\n\n\u003cp\u003eWe want to make our (automated) testing tool that will test application X (that interact with Y) only,\nand we have not the web service Y available.\u003c/p\u003e\n\n\u003cp\u003eNotes:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003e\u003cp\u003eThe testing tool will be a desktop application.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eWe Don't want to use another external tools-e.g. SoapUI- for testing (as we want to automate the testing by running one application).\u003c/p\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eThe question is: How we can mock the web service Y in our testing -desktop- application?\nDoes it is easy to mock it by Socket programming, or any other method/library?\u003c/p\u003e\n\n\u003cp\u003eThanks in advance,\u003c/p\u003e","accepted_answer_id":"2236709","answer_count":"2","comment_count":"0","creation_date":"2010-02-10 09:08:25.303 UTC","last_activity_date":"2010-02-10 12:28:18.797 UTC","last_edit_date":"2010-02-10 09:22:23.403 UTC","last_editor_display_name":"","last_editor_user_id":"65210","owner_display_name":"","owner_user_id":"65210","post_type_id":"1","score":"6","tags":"java|web-services|testing|mocking|sockets","view_count":"2246"} {"id":"20130057","title":"Convert now() to specific format in MS Access VBA","body":"\u003cp\u003eHow do I convert now() to something like \"November 21st, 2013\"? I've looked into stuff like datepart and format but I can't find this translation.\u003c/p\u003e","accepted_answer_id":"20130276","answer_count":"2","comment_count":"0","creation_date":"2013-11-21 19:22:43.387 UTC","last_activity_date":"2013-11-21 19:51:01.483 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1435323","post_type_id":"1","score":"2","tags":"vba|ms-access","view_count":"273"} {"id":"37654335","title":"read a textfile using mmap, wchar_t","body":"\u003cp\u003eThe last few hours I am banging my head against the wall and actually do not really understand what's going wrong here.\u003c/p\u003e\n\n\u003cp\u003eI have a text file containing word phrases not longer than 128 characters. What I try to do is memory map this file and read of type \u003ccode\u003ewchar_t\u003c/code\u003e into a large buffer. Basically this file is a textual lookup, given a position and length of string would return a string out of this text index.\u003c/p\u003e\n\n\u003cp\u003eHere is - as for demonstration - what I did (or try to accomplish).\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eint main(int argc, char **argv)\n{\n int fd = 0;\n struct stat statbuf;\n wchar_t aux[128] = {0};\n const wchar_t *px = NULL;\n\n setlocale(LC_CTYPE, \"\");\n setlocale(LC_COLLATE, \"\");\n\n fd = open(\"./test2_termlist.txt\", O_RDONLY); \n\n fstat(fd, \u0026amp;statbuf); \n\n void *p = mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);\n\n /* Could have casted p to wchar_t already ... */\n px = (wchar_t *)p;\n\n /* Copy string with 45 characters from char position 92 */\n memcpy(aux, (const wchar_t *)px + 92, 45);\n aux[45] = L'\\0';\n\n printf(\"string = %ls\\n\", aux); \n\n return 1;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAbove is working demo code. I've tried various things such as using \u003ccode\u003ewmemcpy\u003c/code\u003e or \u003ccode\u003ewcsncpy\u003c/code\u003e to get the string. The result are always scrambled characters. \nIf I use \u003ccode\u003echar\u003c/code\u003e instead of \u003ccode\u003ewchar_t\u003c/code\u003e, things seem to work, but the indices that will be used are based on wide strings and thus not working if the text file is interpreted as \u003ccode\u003echar\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eI need a fast access to a large text file, that's why i try to use \u003ccode\u003emmap\u003c/code\u003e here.\u003c/p\u003e\n\n\u003cp\u003eWhat is my (maybe stupid) mistake here?\u003c/p\u003e\n\n\u003cp\u003eNOTE: valgrind does not show any error either.\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2016-06-06 09:51:12.92 UTC","last_activity_date":"2016-06-06 10:11:39.693 UTC","last_edit_date":"2016-06-06 10:11:39.693 UTC","last_editor_display_name":"","last_editor_user_id":"286917","owner_display_name":"","owner_user_id":"286917","post_type_id":"1","score":"1","tags":"c|linux|gcc|wchar-t|mmapi","view_count":"51"} {"id":"47318207","title":"Having trouble editting a series data range using VBA in Excel","body":"\u003cp\u003eSo my macro is meant to go fetch latest data from separate files and paste them into the next empty cell in the correct row. After that it`s supposed edit a chart so that it graphs the newest 6 data points. So far I have this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSub Update(startCell, data, sht, cht, sers)\n ActiveWorkbook.Sheets(sht).Activate\n Range(startCell).Select\n Do While (Not IsEmpty(ActiveCell))\n ActiveCell.Offset(0, 1).Select\n Loop\n Dim x As Range\n Dim y As Range\n Dim NewRng As String\n Dim ChrtNm As String\n Dim temp As Variant\n\n\n Set temp = Worksheets(sht).ChartObjects(cht).chart.SeriesCollection(sers)\n ChrtNm = temp.Name\n\n Set x = ActiveCell\n Set y = ActiveCell.Offset(0, -5)\n NewRng = x.Address \u0026amp; \":\" \u0026amp; y.Address\n NewRng = \"='\" \u0026amp; ChrtNm \u0026amp; \"'!\" \u0026amp; NewRng\n\n ActiveCell.Value() = data\n ActiveSheet.ChartObjects(cht).Activate\n ActiveChart.PlotArea.Select\n ActiveChart.SeriesCollection(sers).Values = NewRng\n\nEnd Sub\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eEverything works up until the very end instead of passing SeriesCollection(sers).Values the info it needs to pick up the information it is passing it the literal string created up top as the value. I'm using this sort of convoluted method because else seems to work and when i tried recording a marco just to learn how to edit series this is what I got:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSub ChangeRange()\n'\n' ChangeRange Macro\n'\n\n'\n ActiveSheet.ChartObjects(\"Graphique 3\").Activate\n ActiveChart.PlotArea.Select\n ActiveChart.SeriesCollection(1).Values = \"='Stewardship-Online'!$AP$29:$AU$29\"\nEnd Sub\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"2","creation_date":"2017-11-15 22:12:51.513 UTC","last_activity_date":"2017-11-15 22:12:51.513 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8761766","post_type_id":"1","score":"0","tags":"excel|vba|excel-vba|excel-2010","view_count":"19"} {"id":"44371163","title":"How do you do hide an empty ACF field using PHP?","body":"\u003cp\u003eI figured that I would simplify my question.\nThis could be a PHP problem so I apologize in advanced because this may not be an ACF issue but it could be an issue of me not knowing enough PHP, I'm not sure why this isn’t working.\u003c/p\u003e\n\n\u003cp\u003eSo I am using the ACF repeater field and I would like to hide the repeater Subfield when no data is entered in the field.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;?php\n\n // check if the repeater field has rows of data\n\n $feature_posts = the_sub_field('feature_image_post');\n\n if( have_rows('repeat_field') ):\n\n // loop through the rows of data\n while ( have_rows('repeat_field') ) : the_row();\n\n // display a sub field value\n echo '\u0026lt;div style=\"float:left\"\u0026gt;';\n the_sub_field('restaurant_name');\n echo '\u0026lt;/div\u0026gt;';\n echo '\u0026lt;div style=\"float:left\"\u0026gt;';\n the_sub_field('restaurant_state');\n echo '\u0026lt;/div\u0026gt;';\n\n echo '\u0026lt;div style=\"float:left\"\u0026gt;';\n the_sub_field('restaurant_image_post');\n echo '\u0026lt;/div\u0026gt;'; \n\n if (empty($feature_posts)) {\n echo '\u0026lt;div style=\"display:none\"\u0026gt;';\n the_sub_field('feature_image_post');\n echo '\u0026lt;/div\u0026gt;'; \n } \n\n else {\n\n the_sub_field('feature_image_post');\n }\n\n endwhile;\n\n else :\n\n // no rows found\n\n endif;\n\n ?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-06-05 14:23:12.43 UTC","last_activity_date":"2017-06-05 21:29:45.583 UTC","last_edit_date":"2017-06-05 21:29:45.583 UTC","last_editor_display_name":"","last_editor_user_id":"7082108","owner_display_name":"","owner_user_id":"7082108","post_type_id":"1","score":"1","tags":"javascript|php|advanced-custom-fields","view_count":"70"} {"id":"45111810","title":"set alarm using DatePicker (swift3","body":"\u003cp\u003eMy code below works that if you manually use to datePicker to match the date and time with the users date and time it will print cool. However the code does not work as a alarm. I can set the date picker ahead of the user time and when the user time matches the date pickers timer nothing prints. I just want to be able to select a date/time using date picker and when the users eventually matches the datePickers time just print cool.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport UIKit\n\n var dateFormatter : DateFormatter!\n\n let datePicker2 = UIDatePicker();\n let date = Date()\n\n class ViewController: UIViewController {\n\n@IBOutlet var dateLabel: UILabel!\noverride func viewDidLoad() {\n super.viewDidLoad()\n\n let datePicker : UIDatePicker = UIDatePicker(frame: CGRect(x: 0,y: 330,width: self.view.frame.size.width,height: 220))\n datePicker.datePickerMode = UIDatePickerMode.dateAndTime\n self.view.addSubview(datePicker)\n\n datePicker.addTarget(self, action: #selector(ViewController.change(_:)), for: UIControlEvents.valueChanged)\n\n dateFormatter = DateFormatter()\n dateFormatter.dateFormat = \"YYYY-MM-dd hh:mm\"\n}\n\n@IBAction func change(_ sender : UIDatePicker)\n{\n let pickerString = dateFormatter.string(from: sender.date)\nlet nowString = dateFormatter.string(from: Date())\n\ndateLabel.text = pickerString\nif pickerString == nowString {\n print(\"cool\")\n}\n}}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"1","creation_date":"2017-07-14 21:25:29.85 UTC","last_activity_date":"2017-07-15 02:24:26.983 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8105388","post_type_id":"1","score":"0","tags":"if-statement|time|swift3|datepicker|alarm","view_count":"77"} {"id":"15327152","title":"wordpress font css doesnt work in firefox","body":"\u003cp\u003eI have added a custom font to my wordpress based website.\nthe theme has the font files within it.\u003c/p\u003e\n\n\u003cp\u003eso far in testing the new font works in chrome, IE and safari but not in firefox.\u003c/p\u003e\n\n\u003cp\u003eIve tried playing about with my css files but no luck\u003c/p\u003e\n\n\u003cp\u003eany ideas why?\u003c/p\u003e","answer_count":"2","comment_count":"1","creation_date":"2013-03-10 20:24:02 UTC","last_activity_date":"2013-03-10 20:38:56.32 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2154659","post_type_id":"1","score":"0","tags":"css|wordpress|firefox|fonts","view_count":"75"} {"id":"43010386","title":"How to create a XAML + CodeBehind pair in Rider?","body":"\u003cp\u003e\u003cem\u003e(If that is even possible, of course; as of writing this, I am using the EAP 19 version, which is the latest release at the moment)\u003c/em\u003e\u003c/p\u003e\n\n\u003cp\u003eI have a WPF project where I am trying to pair a XAML and a XAML.CS file together since they're both parts of the definition of a partial class (as far as I understand it, at least).\u003c/p\u003e\n\n\u003cp\u003eHowever, no matter what I do, I cannot get Rider to understand they are linked.\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/ABEsU.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/ABEsU.png\" alt=\"Project explorer view\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eHere you can see Details.xaml.cs being neatly nested in Details.xaml, since Rider understands they're dependant, but no dice for CompendiumSearch.\u003c/p\u003e\n\n\u003cp\u003eDetails and CompendiumSearch have virtually identical code, save for the class names of course.\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003cp\u003ePS: App and Details were created with VS, this is an old project I imported in Rider to build upon it; that's why they're already neatly nested.\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2017-03-24 22:50:54.057 UTC","last_activity_date":"2017-03-24 22:50:54.057 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2743014","post_type_id":"1","score":"2","tags":"c#|wpf|xaml|partial-classes|rider","view_count":"466"} {"id":"7581192","title":"How did malloc and calloc end up with different signatures?","body":"\u003cblockquote\u003e\n \u003cp\u003e\u003cstrong\u003ePossible Duplicate:\u003c/strong\u003e\u003cbr\u003e\n \u003ca href=\"https://stackoverflow.com/questions/7536413/why-calloc-takes-two-arguments-while-malloc-only-one\"\u003eWhy calloc takes two arguments while malloc only one?\u003c/a\u003e \u003c/p\u003e\n\u003c/blockquote\u003e\n\n\n\n\u003cp\u003eThere are \u003cem\u003elots\u003c/em\u003e of resources describing the difference in functionality between \u003ccode\u003emalloc\u003c/code\u003e and \u003ccode\u003ecalloc\u003c/code\u003e, but I can't easily find one that describes the history behind the differing function signatures:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e void *calloc(size_t nmemb, size_t size);\n void *malloc(size_t size);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eOf course, the \u003ccode\u003esize\u003c/code\u003e in the former is the size for each member. Maybe the idea was that multiple-of-the-page-size member size callocs could be done lazily via the OS?\u003c/p\u003e\n\n\u003cp\u003e(I can make up reasons as well as the next guy -- no accepted answers without cited sources. :-)\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2011-09-28 09:38:47.92 UTC","favorite_count":"2","last_activity_date":"2011-09-28 11:22:45.907 UTC","last_edit_date":"2017-05-23 12:23:59.453 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"3594","post_type_id":"1","score":"20","tags":"c|history|libc|std","view_count":"1937"} {"id":"26007295","title":"Receive and send data from arduino to c# and vice versa","body":"\u003cp\u003efirst of all I started using c# yesterday morning so I apologize for potential numb questions.\u003c/p\u003e\n\n\u003cp\u003eSo far I wrote the following code. I'm able to send data from c# to arduino which seems to be working fine. Now i would like to receive data from arduino, through serial.print, at the same time and display it in a box (ListBox?). How could add this to the code? \u003c/p\u003e\n\n\u003cp\u003eI would be thankful for any input, tips and ideas.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003enamespace WindowsFormsApplication1\n{\n public partial class Form1 : Form\n {\n\n public Form1()\n {\n InitializeComponent();\n stop.Enabled = false;\n left.Enabled = false;\n right.Enabled = false;\n up.Enabled = false;\n down.Enabled = false;\n string[] ports = SerialPort.GetPortNames();\n comboBox1.Items.AddRange(ports);\n\n }\n private void Form1_Load(object sender, EventArgs e)\n {\n\n\n }\n private void start_Click(object sender, EventArgs e)\n {\n\n\n if (comboBox1.SelectedIndex \u0026gt; -1)\n {\n string port = (string)comboBox1.SelectedItem;\n serialPort2.PortName = port; // \"port\";\n serialPort2.BaudRate = 9600;\n serialPort2.Open();\n if (serialPort2.IsOpen)\n {\n start.Enabled = false;\n stop.Enabled = true;\n left.Enabled = true;\n right.Enabled = true;\n up.Enabled = true;\n down.Enabled = true;\n }\n }\n else\n {\n MessageBox.Show(\"Please connect the Arduino and select a Port\");\n }\n\n }\n private void stop_Click(object sender, EventArgs e)\n {\n if (serialPort2.IsOpen)\n {\n serialPort2.Close();\n start.Enabled = true;\n stop.Enabled = false;\n left.Enabled = false;\n right.Enabled = false;\n up.Enabled = false;\n down.Enabled = false;\n }\n }\n private void up_Click(object sender, EventArgs e)\n {\n\n if (serialPort2.IsOpen)\n {\n serialPort2.WriteLine(\"1\");\n }\n\n }\n\n private void left_Click(object sender, EventArgs e)\n {\n\n if (serialPort2.IsOpen)\n {\n serialPort2.WriteLine(\"4\");\n }\n\n }\n\n private void right_Click(object sender, EventArgs e)\n {\n if (serialPort2.IsOpen)\n {\n serialPort2.WriteLine(\"2\");\n }\n }\n\n private void down_Click(object sender, EventArgs e)\n {\n if (serialPort2.IsOpen)\n {\n serialPort2.WriteLine(\"3\");\n }\n }\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"28010808","answer_count":"2","comment_count":"3","creation_date":"2014-09-24 01:51:28.46 UTC","last_activity_date":"2017-06-06 18:31:36.3 UTC","last_edit_date":"2016-08-05 01:09:20.237 UTC","last_editor_display_name":"","last_editor_user_id":"5595825","owner_display_name":"","owner_user_id":"3010245","post_type_id":"1","score":"0","tags":"c#|arduino|serial-communication","view_count":"830"} {"id":"40911231","title":"How to get the td element without using row number in protractor","body":"\u003cp\u003eI have the existing method like below,\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003egetSpecificCell: function(tableObject, rowNumber, columnCss) {\n var ele = element(by.repeater(tableObject).row(rowNumber)).element(by.css('[' + columnCss + ']'));\n return ele;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs that possible to do the same using the row text instead of rowNumber?\u003c/p\u003e\n\n\u003cp\u003eForm the below html I need to get the column value without using the row number\u003c/p\u003e\n\n\u003cp\u003eHTML sample:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;table class=\"table\"\u0026gt;\n \u0026lt;thead\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;th class=\"checkbox-column\"\u0026gt;\u0026lt;/th\u0026gt;\n \u0026lt;th class=\"main-column main-column--checkbox\"\u0026gt;Name\u0026lt;/th\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/thead\u0026gt;\n \u0026lt;tbody ng-repeat=\"(a, b) in tests\" class=\"ng-scope\" style=\"\"\u0026gt;\n \u0026lt;tr class=\"panel__sub-header\"\u0026gt;\n \u0026lt;td\u0026gt;\n \u0026lt;input name=\"item-checkbox\" ng-click=\"toggleSelectAll(a)\" type=\"checkbox\"\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;td colspan=\"4\"\u0026gt;\n \u0026lt;h4 class=\"ng-binding\"\u0026gt;ROW2\u0026lt;/h4\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr ng-repeat=\"test in testData\" ng-class-odd=\"'odd'\" ng-class-even=\"'even'\" class=\"ng-scope odd\" style=\"\"\u0026gt;\n \u0026lt;td class=\"checkbox-column\"\u0026gt;\u0026lt;input name=\"item-checkbox\" ng-click=\"checkFunction()\" type=\"checkbox\"\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td class=\"main-column\"\u0026gt;\n \u0026lt;a ng-href=\"#\" class=\"ng-binding\" href=\"#\"\u0026gt;test.name\u0026lt;/a\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr ng-repeat=\"test in testData\" ng-class-odd=\"'odd'\" ng-class-even=\"'even'\" class=\"ng-scope odd\" style=\"\"\u0026gt;\n \u0026lt;td class=\"checkbox-column\"\u0026gt;\u0026lt;input name=\"item-checkbox\" ng-click=\"checkFunction()\" type=\"checkbox\"\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td class=\"main-column\"\u0026gt;\n \u0026lt;a ng-href=\"#\" class=\"ng-binding\" href=\"#\"\u0026gt;test.data\u0026lt;/a\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/tbody\u0026gt;\n \u0026lt;tbody ng-repeat=\"(a, b) in tests\" class=\"ng-scope\" style=\"\"\u0026gt;\n \u0026lt;tr class=\"panel__sub-header\"\u0026gt;\n \u0026lt;td\u0026gt;\n \u0026lt;input name=\"item-checkbox\" ng-click=\"toggleSelectAll(a)\" type=\"checkbox\"\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;td colspan=\"4\"\u0026gt;\n \u0026lt;h4 class=\"ng-binding\"\u0026gt;ROW1\u0026lt;/h4\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr ng-repeat=\"test in testData\" ng-class-odd=\"'odd'\" ng-class-even=\"'even'\" class=\"ng-scope odd\" style=\"\"\u0026gt;\n \u0026lt;td class=\"checkbox-column\"\u0026gt;\u0026lt;input name=\"item-checkbox\" ng-click=\"checkFunction()\" type=\"checkbox\"\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td class=\"main-column\"\u0026gt;\n \u0026lt;a ng-href=\"#\" class=\"ng-binding\" href=\"#\"\u0026gt;test.name\u0026lt;/a\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr ng-repeat=\"test in testData\" ng-class-odd=\"'odd'\" ng-class-even=\"'even'\" class=\"ng-scope odd\" style=\"\"\u0026gt;\n \u0026lt;td class=\"checkbox-column\"\u0026gt;\u0026lt;input name=\"item-checkbox\" ng-click=\"checkFunction()\" type=\"checkbox\"\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td class=\"main-column\"\u0026gt;\n \u0026lt;a ng-href=\"#\" class=\"ng-binding\" href=\"#\"\u0026gt;test.data\u0026lt;/a\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/tbody\u0026gt;\n\u0026lt;/table\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"3","creation_date":"2016-12-01 12:55:35.15 UTC","favorite_count":"1","last_activity_date":"2016-12-02 11:46:04.197 UTC","last_edit_date":"2016-12-01 13:25:38 UTC","last_editor_display_name":"","last_editor_user_id":"2833311","owner_display_name":"","owner_user_id":"2833311","post_type_id":"1","score":"0","tags":"selenium-webdriver|protractor|angularjs-e2e","view_count":"259"} {"id":"4943382","title":"Two ListView Side By Side","body":"\u003cp\u003eI have two ListView. And I need to place them side by side horizontally. But the problem is - Only one list is visible. (Note : The second list is in right side of the layout and can have at most 1 character. And the first list will expand to fill the rest of the screen.)\u003c/p\u003e\n\n\u003cp\u003eHelp me please.\u003c/p\u003e\n\n\u003cp\u003eThe layout is like this.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e------------\n| | |\n| | |\n| | |\n| | |\n| | |\n| | |\n| | |\n| | |\n| | |\n------------\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003chr\u003e\n\n\u003cp\u003e\n\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;LinearLayout\n android:layout_width=\"fill_parent\"\n android:layout_height=\"fill_parent\"\n android:layout_weight=\"1\"\n android:orientation=\"vertical\" \u0026gt;\n\n \u0026lt;ListView\n android:layout_width=\"fill_parent\"\n android:layout_height=\"fill_parent\" /\u0026gt;\n\u0026lt;/LinearLayout\u0026gt;\n\n\u0026lt;LinearLayout\n android:layout_width=\"wrap_content\"\n android:layout_height=\"fill_parent\"\n android:orientation=\"vertical\" \u0026gt;\n\n \u0026lt;ListView\n android:layout_width=\"fill_parent\"\n android:layout_height=\"fill_parent\"\n android:drawSelectorOnTop=\"true\" /\u0026gt;\n\u0026lt;/LinearLayout\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch2\u003e\u003c/h2\u003e\n\n\u003cp\u003eShaiful\u003c/p\u003e","answer_count":"8","comment_count":"4","creation_date":"2011-02-09 10:09:24.89 UTC","favorite_count":"2","last_activity_date":"2017-05-13 07:36:59.91 UTC","last_edit_date":"2014-03-06 01:45:25.33 UTC","last_editor_display_name":"","last_editor_user_id":"1224741","owner_display_name":"","owner_user_id":"595543","post_type_id":"1","score":"8","tags":"android|listview","view_count":"8627"} {"id":"46682527","title":"Node.js insert query not working","body":"\u003cp\u003ei'm trying to get a insert query to work because i've made a quiz in Javascript and i want the result to be uploaded on a database. this is my code (including the quiz):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;script\u0026gt; \n(function() { //the questions\nvar questions = [{\nquestion: \"What year was starcraft released?\",\nchoices: [1990, 1992, 1994, 1996, 1998],\ncorrectAnswer: 4\n}, {\nquestion: \"What was the first Starcraft expension called?\",\nchoices: [\"Brood War\", \"War of the Worlds\", \"Wings of Liberty\", \"Zerg rush\", \n\"Legacy of the Void\"],\ncorrectAnswer: 0\n}, {\nquestion: \"When was Warcraft: Orcs \u0026amp; Humans released?\",\nchoices: [1990, 1992, 1994, 1996, 1998],\ncorrectAnswer: 2\n}, {\nquestion: \"When was Blizzard founded?\",\nchoices: [1990, 1991, 1992, 1993, 1994],\ncorrectAnswer: 1\n}, {\nquestion: \"What is Blizzard´s latest new game?\",\nchoices: [\"Overwatch\", \"Heroes of the Storm\", \"Warcraft 3\", \"Starcraft 2: \nWings of Liberty\", \"Heartstone\"],\ncorrectAnswer: 0\n}, {\nquestion: \"What was Blizzards first game?\",\nchoices: [\"RPM Racing\", \"The lost Vikings\", \"Starcraft\", \"Warcraft: Orcs \u0026amp; \nHumans\", \"Heartstone\"],\ncorrectAnswer: 0\n }];\n\nvar questionCounter = 0; //Tracks question number\nvar selections = []; //Array containing user choices\nvar quiz = $('#quiz'); //Quiz div object\n\n// Display initial question\ndisplayNext();\n\n// Click handler for the 'next' button\n$('#next').on('click', function (e) {\ne.preventDefault();\n\n// Suspend click listener during fade animation\nif(quiz.is(':animated')) { \n return false;\n}\nchoose();\n\n// If no user selection, progress is stopped\nif (isNaN(selections[questionCounter])) {\n alert('please choose an answer');\n} else {\n questionCounter++;\n displayNext();\n}\n});\n\n// Click handler for the 'prev' button\n$('#prev').on('click', function (e) {\ne.preventDefault();\n\nif(quiz.is(':animated')) {\n return false;\n}\nchoose();\nquestionCounter--;\ndisplayNext();\n});\n\n// Click handler for the 'Start Over' button\n$('#start').on('click', function (e) {\ne.preventDefault();\n\nif(quiz.is(':animated')) {\n return false;\n}\nquestionCounter = 0;\nselections = [];\ndisplayNext();\n$('#start').hide();\n});\n\n// Animates buttons on hover\n$('.button').on('mouseenter', function () {\n$(this).addClass('active');\n});\n$('.button').on('mouseleave', function () {\n$(this).removeClass('active');\n});\n\n// Creates and returns the div that contains the questions and \n// the answer selections\nfunction createQuestionElement(index) {\nvar qElement = $('\u0026lt;div\u0026gt;', {\n id: 'question'\n});\n\nvar header = $('\u0026lt;h2\u0026gt;Question ' + (index + 1) + ':\u0026lt;/h2\u0026gt;');\nqElement.append(header);\n\nvar question = $('\u0026lt;p\u0026gt;').append(questions[index].question);\nqElement.append(question);\n\nvar radioButtons = createRadios(index);\nqElement.append(radioButtons);\n\nreturn qElement;\n}\n\n// Creates a list of the answer choices as radio inputs\nfunction createRadios(index) {\nvar radioList = $('\u0026lt;ul\u0026gt;');\nvar item;\nvar input = '';\nfor (var i = 0; i \u0026lt; questions[index].choices.length; i++) {\n item = $('\u0026lt;li\u0026gt;');\n input = '\u0026lt;input type=\"radio\" name=\"answer\" value=' + i + ' /\u0026gt;';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n}\nreturn radioList;\n}\n\n// Reads the user selection and pushes the value to an array\nfunction choose() {\nselections[questionCounter] = +$('input[name=\"answer\"]:checked').val();\n}\n\n// Displays next requested element\nfunction displayNext() {\nquiz.fadeOut(function() {\n $('#question').remove();\n\n if(questionCounter \u0026lt; questions.length){\n var nextQuestion = createQuestionElement(questionCounter);\n quiz.append(nextQuestion).fadeIn();\n if (!(isNaN(selections[questionCounter]))) {\n $('input[value='+selections[questionCounter]+']').prop('checked', \n true);\n }\n\n // Controls display of 'prev' button\n if(questionCounter === 1){\n $('#prev').show();\n } else if(questionCounter === 0){\n\n $('#prev').hide();\n $('#next').show();\n }\n }else {\n var scoreElem = displayScore();\n quiz.append(scoreElem).fadeIn();\n $('#next').hide();\n $('#prev').hide();\n $('#start').show();\n }\n });\n }\n\n // Computes score and returns a paragraph element to be displayed\n function displayScore() {\n var score = $('\u0026lt;p\u0026gt;',{id: 'question'});\n\n var numCorrect = 0;\n for (var i = 0; i \u0026lt; selections.length; i++) {\n if (selections[i] === questions[i].correctAnswer) {\n numCorrect++;\n }\n }\n\n score.append('You got ' + numCorrect + ' questions out of ' +\n questions.length + ' right! That is ' + \n numCorrect/questions.length * 100 + \"% !\");\n return score;\n }\n }\n\n )();\n\n var mysql = require('mysql');\n\n var con = mysql.createConnection({\n host: \"localhost\",\n user: \"******\",\n password: \"****,\n database: \"*******\"\n });\n\n con.connect(function(err) {\n if (err) throw err;\n console.log(\"Connected!\");\n var sql = \"INSERT INTO scores (score, quiz, gebruikersnaam) VALUES (100, \n 1, 'jeroen')\";\n con.query(sql, function (err, result) {\n if (err) throw err;\n console.log(\"1 record inserted\");\n });\n });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eif you can please help me get this working i would be really happy thx in advance \np.s. the quiz is working the results just wont get uploaded to the database\u003c/p\u003e","answer_count":"0","comment_count":"7","creation_date":"2017-10-11 07:41:24.81 UTC","last_activity_date":"2017-10-11 07:41:24.81 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8757233","post_type_id":"1","score":"0","tags":"javascript|node.js","view_count":"30"} {"id":"31762959","title":"Running Sonar Code Analysis from Eclipse Instance","body":"\u003cp\u003eWe use Jenkins for both building application and running sonar analysis through maven on the code.\u003c/p\u003e\n\n\u003cp\u003eI am able create a local server, and run sonarqube analysis using sonar runner.\u003c/p\u003e\n\n\u003cp\u003eI was able to connect my eclipse instance to the company sonarqube runner and get the issues from existing analysis on eclipse. But while running 'Analyse' from eclipse, it fails.\u003c/p\u003e\n\n\u003cp\u003eIt returns,\n\u003cem\u003eYou must define the following mandatory properties for 'Unknown': sonar.sources\u003c/em\u003e\u003c/p\u003e\n\n\u003cp\u003eWhile I looked into the process, I found that, a temporary sonar-runner is downloaded in the temp folder and a sonar-project.properties is created and the analysis is run using that. This property file does not have the sonar.sources defined inside it. Since this property file is not in my control, How to resolve this issue?\u003c/p\u003e","answer_count":"2","comment_count":"7","creation_date":"2015-08-01 14:33:03.477 UTC","last_activity_date":"2015-08-03 07:16:24.94 UTC","last_edit_date":"2015-08-01 14:43:52.31 UTC","last_editor_display_name":"","last_editor_user_id":"5180895","owner_display_name":"","owner_user_id":"5180895","post_type_id":"1","score":"0","tags":"java|eclipse|maven|jenkins|sonarqube","view_count":"679"} {"id":"17807509","title":"jQuery - Validate that two different \u003cli\u003e's has been selected","body":"\u003cp\u003eFor an online booking system I have the user put in a pickup and destination by postcode. The problem is that the user can search an address, e.g. 'LE115GU' and it will show multiple results. At the moment the user can go to the next page of the booking form without selecting an address so it doesn't write the address to the database. I basically need to put a validation in there so that if the user doesn't select an \u003ccode\u003eli-addr-res\u003c/code\u003e for either pickup or destination, they are prompted with an alert.\u003c/p\u003e\n\n\u003cp\u003eThis is what happens if a user searches a postcode:-\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/KCMr5.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eSo something like:-\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif(nextPgeNum == 2) { \n\n // CODE // if title=\"Dropoff\" and no li-addr-res is selected\n\n // or if title=\"Pickup\" and no li-addr-res is selected\n\n // alert(\"You must select a pickup or dropoff address\")\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm just not too sure how I can achieve this so any help would be much appreciated.\u003c/p\u003e\n\n\u003cp\u003eHere is the HTML code for the dropoff.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;div id=\"cp-row-wrapper-dp\" class=\"row-wrapper row-wrapper-addr-search\" title=\"Dropoff\"\u0026gt;\n\n \u0026lt;div class=\"div-search-label left\"\u0026gt;\n\n \u0026lt;p class=\"a-topheader-infotext\"\u0026gt;\n\n \u0026lt;strong\u0026gt;Destination\u0026lt;/strong\u0026gt;\n\n \u0026lt;/p\u0026gt;\n\n\u0026lt;/div\u0026gt;\n\n\u0026lt;div class=\"div-search-content div-content left div-subrow-style ui-corner-all\"\u0026gt;\n\n \u0026lt;input id=\"txt-dropoff-hn\" class=\"input-txt-xxxsml input-txt-highlight addr-ho-input left\" type=\"text\" value=\"\" maxlength=\"5\" size=\"4\" tabindex=\"3\" name=\"txt-dropoff-hn\"\u0026gt;\n\n \u0026lt;input id=\"txt-dropoff\" class=\"input-txt-xmed input-txt-highlight required validate-from-db addr-search-input txt-dropoff left default success\" type=\"text\" tabindex=\"4\" name=\"txt-dropoff\" autocomplete=\"off\"\u0026gt;\n\n \u0026lt;input class=\"hidden-lat-lng\" type=\"hidden\" value=\"\"\u0026gt;\n\n \u0026lt;input id=\"txt-hidden-dp\" class=\"hidden-post-code\" type=\"hidden\" name=\"txt-hidden-dp\" value=\"\"\u0026gt;\n\n \u0026lt;input class=\"hidden-route-leg\" type=\"hidden\" value=\"2\"\u0026gt;\n\n \u0026lt;button id=\"cp-search-dest\" class=\"btn-med ui-button ui-state-default ui-button-text-only ui-corner-all btn-hover-anim btn-row-wrapper left ui-state-hover\" name=\"btn-row-wrapper\"\u0026gt;Search\u0026lt;/button\u0026gt;\n\n \u0026lt;ul class=\"ul-addr-res ul-result-view\" style=\"visibility: visible; display: block;\"\u0026gt;\n\n \u0026lt;li class=\"li-addr-res\"\u0026gt;\n\n \u0026lt;p class=\"p-addr-res\" style=\"cursor: pointer;\" tabindex=\"0\"\u0026gt;PRINCE WILLIAM ROAD, LOUGHBOROUGH, LE115GU\u0026lt;/p\u0026gt;\n\n \u0026lt;/li\u0026gt;\n\n \u0026lt;li class=\"li-addr-res\"\u0026gt;\n\n\n \u0026lt;p class=\"p-addr-res\" style=\"cursor: pointer;\" tabindex=\"1\"\u0026gt;ARTHUR JONES MOTORS, 6A, PRINCE WILLIAM ROAD, LOUGHBOROUGH, LE115GU\u0026lt;/p\u0026gt;\n\n \u0026lt;/li\u0026gt;\n\n \u0026lt;li class=\"li-addr-res\"\u0026gt;\n\n \u0026lt;p class=\"p-addr-res\" style=\"cursor: pointer;\" tabindex=\"2\"\u0026gt;BROMAKIN LTD, 10, PRINCE WILLIAM ROAD, LOUGHBOROUGH, LE115GU\u0026lt;/p\u0026gt;\n\n \u0026lt;/li\u0026gt;\n\n \u0026lt;li class=\"li-addr-res\"\u0026gt;\n\n \u0026lt;p class=\"p-addr-res\" style=\"cursor: pointer;\" tabindex=\"3\"\u0026gt;C D M DUCTWORK, 17, PRINCE WILLIAM ROAD, LOUGHBOROUGH, LE115GU\u0026lt;/p\u0026gt;\n\n \u0026lt;/li\u0026gt;\n\n \u0026lt;li class=\"li-addr-res\"\u0026gt;\n\n \u0026lt;p class=\"p-addr-res\" style=\"cursor: pointer;\" tabindex=\"4\"\u0026gt;CHARNWOOD MOLECULAR, 13, PRINCE WILLIAM ROAD, LOUGHBOROUGH, LE115GU\u0026lt;/p\u0026gt;\n\n \u0026lt;/li\u0026gt;\n\n \u0026lt;/ul\u0026gt;\n\n \u0026lt;div class=\"div-result-info div-pagenation-style\" style=\"display: block;\"\u0026gt;\n\n \u0026lt;/div\u0026gt;\n\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"17808038","answer_count":"2","comment_count":"2","creation_date":"2013-07-23 10:24:26.263 UTC","last_activity_date":"2013-07-23 10:48:14.577 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1128694","post_type_id":"1","score":"1","tags":"jquery","view_count":"98"} {"id":"44030080","title":"Regex find character point number point number","body":"\u003cp\u003eHow can i find with regular expression where [Capital Letter][Point][Number][Point][Number]\u003c/p\u003e\n\n\u003cp\u003eExamples : B.1.1.1 , B.1.2 , B.1.2.3.\u003c/p\u003e\n\n\u003cp\u003eSometimes it can finish with point. \nLength or string is smaller than 9.\u003c/p\u003e","accepted_answer_id":"44030309","answer_count":"2","comment_count":"3","creation_date":"2017-05-17 16:16:53.883 UTC","last_activity_date":"2017-08-20 08:09:07.473 UTC","last_edit_date":"2017-08-20 08:09:07.473 UTC","last_editor_display_name":"","last_editor_user_id":"1033581","owner_display_name":"","owner_user_id":"3210023","post_type_id":"1","score":"0","tags":"c#|regex","view_count":"23"} {"id":"21639119","title":"I have javascript I use to set a hidden value in a form, how do I show an error message for the associated hidden attribute?","body":"\u003cp\u003eI have a view which has a div at the top that shows a list of images, then a form at the bottom:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e%div{ id: 'how-soon' }\n %ul\n - %w( now week month browsing ).each do |hs|\n %li{ class: 'inactive', id: hs }=image_tag \"how-soon/#{hs}.jpg\"\n\n= simple_form_for @employer_signup, :url =\u0026gt; url_for(:action =\u0026gt; 'create', :controller =\u0026gt; 'home'), method: :post do |f|\n = f.error_notification\n\n .form-inputs\n = f.hidden_field :how_soon\n\n .form-actions\n = f.button :submit, 'Join Now'\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen a user clicks one of the images in the \u003ccode\u003e#how-soon\u003c/code\u003e div this coffeescript sets a hidden value in the form:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$(\"#how-soon \u0026gt; ul \u0026gt; li\").click -\u0026gt;\n $(this).siblings('.active').toggleClass('inactive active')\n $(this).toggleClass('inactive active')\n $('#employer_signup_how_soon').val($(this).attr('id'))\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe attribute that is adjusted in the form, \u003ccode\u003e:how_soon\u003c/code\u003e is validated by its parent model for presence, \u003ccode\u003evalidates :how_soon, presence: true\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eIf the form is submitted without a value for \u003ccode\u003e:how_soon\u003c/code\u003e the form is re-displayed and I do not see the specific \u003ccode\u003evalue missing\u003c/code\u003e error because the field is hidden.\u003c/p\u003e\n\n\u003cp\u003eA typical solution to this seems to be to put the errors into the errors of another attribute and display them there, but I have no other attributes from this model being displayed that are visible, so I cannot display the errors that way. I would do this with something like:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eafter_validation :validate_how_soon\n\nprotected\n\ndef validate_how_soon\n if errors[:how_soon].present?\n errors[:how_soon].each { |message| errors.add :first_name, message }\n end\nend\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eBonus content (may not be needed to solve my problem):\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eWhile I simplified the code above, I'm actually rendering a form using a form object that is ultimately used to create two objects, a \u003ccode\u003eUser\u003c/code\u003e and a \u003ccode\u003eListing\u003c/code\u003e (think job listing). The attributes related to \u003ccode\u003eListing\u003c/code\u003e are all hidden values filled in by the user clicking the pictures they want and having the corresponding values set via jquery in the form. The \u003ccode\u003eUser\u003c/code\u003e attributes are all present. Here's the weird bit that \u003cem\u003emay\u003c/em\u003e be pertinent to my issue:\u003c/p\u003e\n\n\u003cp\u003eWhen I only have errors for visible attributes (which happen to all be \u003ccode\u003eUser\u003c/code\u003e attributes) the errors are displayed on their attributes appropriately. However, if I have errors on the visible attributes \u003cem\u003eand\u003c/em\u003e errors on the hidden attributes none of the errors for the visible attributes are shown at all, I just get the generic \u003ccode\u003ePlease review the problems below:\u003c/code\u003e notice at the top of the form.\u003c/p\u003e\n\n\u003cp\u003eLike I said, this \"bonus content\" may not actually help with the problem, but I thought I'd leave it here anyway.\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2014-02-07 22:42:37.223 UTC","last_activity_date":"2014-02-09 13:51:13.467 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1026898","post_type_id":"1","score":"0","tags":"ruby-on-rails|validation|simple-form|unobtrusive-javascript","view_count":"222"} {"id":"8349637","title":"how to execute query foreach cell in a database","body":"\u003cp\u003eI need to replace whitespace with NULL in every cell in my database. SQL server 2008 r2. I'm looking for something efficient, but looks like cursor is only way?\u003c/p\u003e","accepted_answer_id":"8364880","answer_count":"3","comment_count":"3","creation_date":"2011-12-01 23:06:15.823 UTC","last_activity_date":"2011-12-03 01:58:26.24 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"194076","post_type_id":"1","score":"0","tags":"sql|sql-server|sql-server-2008-r2","view_count":"129"} {"id":"7912272","title":"How to fix: videos reset themselves to 0m0s when users click the progress bar?","body":"\u003cp\u003eI noticed some flash players reset videos to 0 minutes 0 seconds when a user is viewing the video and clicks around on the video progress bar. I spoke with the owners of a few sites, and they just said that they were trying to fix it.\u003c/p\u003e\n\n\u003cp\u003eAre there common reasons why this happens? Is there a simple way to fix it? What are the side effects of the repair. I am especially interested side effects that would cause a web master to choose it over the functionality (for example, it's sometimes possible to fix intermittent video freezes in computers with low resources by increasing the buffer size, and this may translate to the web).\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://ovfile.com/nj4873av4csx\" rel=\"nofollow\"\u003eHere is a link to a a popular site where the problem occurs.\u003c/a\u003e\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2011-10-27 06:10:49.427 UTC","last_activity_date":"2011-10-27 07:20:21.363 UTC","last_edit_date":"2011-10-27 07:20:21.363 UTC","last_editor_display_name":"","last_editor_user_id":"861264","owner_display_name":"","owner_user_id":"861264","post_type_id":"1","score":"0","tags":"javascript|flash|video-encoding|embedded-flashplayer","view_count":"187"} {"id":"10238830","title":"Netty - buffering response on write","body":"\u003cp\u003eI have an app on Netty where I'm setting \u003ccode\u003etcpNoDelay\u003c/code\u003e to true (for both the server and \"child\" sockets). When I \"curl\" to my server with \u003ccode\u003e-vN\u003c/code\u003e (N disables the client buffer), and then slowly write data to the channel, nothing propagates to the client until some buffer limit is reached, and then it's pushed to the client. I should note that I'm writing back Chunked data (so the client stays connected until we close it).\u003c/p\u003e\n\n\u003cp\u003eI have used Wireshark to make sure that I get nothing sent to the client until the buffer limit is reached, and then I see a bunch of TCP packets flood to the client.\u003c/p\u003e\n\n\u003cp\u003eIdeally, this should be smooth. Strangely, this doesn't happen with the instance I run on my local machine (Mac OS X Lion, Java 1.6.0_31). Only presents itself on the server which is Ubuntu, Java 1.6.0_20. I can't imagine the slight version mismatch from _20 to _31 is the reason.\u003c/p\u003e\n\n\u003cp\u003eServer options being set:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003enioStreamBootstrap.setOption(\"child.tcpNoDelay\", true);\nnioStreamBootstrap.setOption(\"child.keepAlive\", true);\nnioStreamBootstrap.setOption(\"tcpNoDelay\", true);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eClient \"curl\":\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ecurl -vN http://my.remote.server/some/path\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy logs show the write being made to the client channel:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e--- Message received from downstream\n--- Writing message upstream\n--- Message received from upstream\n--- Writing message downstream\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e(note that the \"Writing message downstream\" call immediately precedes the \u003ccode\u003echannel.write(obj)\u003c/code\u003e call)\u003c/p\u003e\n\n\u003cp\u003eSo I'm not sure if it's OS-related, Java-related, or Netty-related. Suggestions?\u003c/p\u003e","accepted_answer_id":"10359008","answer_count":"1","comment_count":"0","creation_date":"2012-04-20 00:48:46.573 UTC","last_activity_date":"2012-04-27 23:06:12.423 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"604717","post_type_id":"1","score":"0","tags":"java|linux|netty","view_count":"562"} {"id":"19233538","title":"To use gapi.client.drive.files.insert or to use gapi.client.request for everything","body":"\u003cp\u003eI am trying to understand how best to access the Google Drive using client side Javascript. I wrote some test code to insert a new file having only the metadata. I found an example that used this code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar request = gapi.client.request({\n 'path': '/drive/v2/files',\n 'method': 'POST',\n 'body': {\n \"title\" : \"Meta File 1.json\",\n \"mimeType\" : \"application/json\",\n \"description\" : \"This is a test of creating a metafile\"\n }\n });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe above code worked fine, but it doesn't use gapi.client.drive.files.insert. So I searched stackoverflow and tried the code below:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar mydata = {};\nmydata.title = \"Meta File using Insert.json\";\nmydata.mimeType = \"application/json\";\nmydata.description = \"We are using insert to create a new file, but only the metadata.\";\n\nvar request = gapi.client.drive.files.insert( {'resource': mydata} );\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis code works fine also, so my question is which should I use? Is there any reason to use the various api calls like files.insert, or should I always use gapi.client.request for everything? \u003c/p\u003e","accepted_answer_id":"19238985","answer_count":"1","comment_count":"0","creation_date":"2013-10-07 19:57:42.067 UTC","favorite_count":"2","last_activity_date":"2015-02-02 16:50:41.277 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"899240","post_type_id":"1","score":"3","tags":"javascript|google-drive-sdk","view_count":"1535"} {"id":"23022622","title":"vector inside a map is clear safe?","body":"\u003cp\u003eJust a quick question, if you have say:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eusing namespace std;\n\nmap\u0026lt; int, vector\u0026lt; string \u0026gt; \u0026gt; map1;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eor maybe even:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003emap\u0026lt; int, map\u0026lt; int, vector\u0026lt; string \u0026gt; \u0026gt; \u0026gt; map2;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand just so you get the right idea:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003emap\u0026lt; int, map\u0026lt; int, map\u0026lt; int, vector\u0026lt; string \u0026gt; \u0026gt; \u0026gt; \u0026gt; map3;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eif I do just:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003emap1.clear();\nmap2.clear();\nmap3.clear();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs it safe in that it will empty everything in the map and its nested maps, vectors, lists, etc.?\u003c/p\u003e\n\n\u003cp\u003eNote:\nI know if you use pointers you need to manually go through and delete or if the map goes out of scope it should be fine too I'm only particularly interested in this case when in scope and on the stack.\u003c/p\u003e","accepted_answer_id":"23022636","answer_count":"2","comment_count":"1","creation_date":"2014-04-11 21:08:47.093 UTC","favorite_count":"1","last_activity_date":"2014-04-11 21:10:10.72 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3102241","post_type_id":"1","score":"4","tags":"c++|vector|map|stl|clear","view_count":"1592"} {"id":"16011747","title":"WPF-Accessing the textbox present in datagrid(xaml) in code using that particular datagrid events","body":"\u003cp\u003eI have a textbox in a datagrid that is designed using xaml. Can I access the textbox which has been designed in xaml previously in codefile using the events of the datagrid. Please help me.....................\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;Window x:Class=\"GridTextBox.Test\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" WindowState=\"Maximized\"\n Title=\"Test\" Height=\"300\" Width=\"300\" Loaded=\"Window_Loaded\"\u0026gt;\n\u0026lt;Grid\u0026gt;\n \u0026lt;Grid.RowDefinitions\u0026gt;\n \u0026lt;RowDefinition Height=\"30\"/\u0026gt;\n \u0026lt;RowDefinition Height=\"*\"/\u0026gt;\n \u0026lt;RowDefinition Height=\"30\"/\u0026gt;\n \u0026lt;/Grid.RowDefinitions\u0026gt;\n \u0026lt;Grid.ColumnDefinitions\u0026gt;\n \u0026lt;ColumnDefinition Width=\".25*\"/\u0026gt;\n\n \u0026lt;ColumnDefinition Width=\".25*\"/\u0026gt;\n \u0026lt;ColumnDefinition Width=\".25*\"/\u0026gt;\n \u0026lt;ColumnDefinition Width=\".25*\"/\u0026gt;\n \u0026lt;/Grid.ColumnDefinitions\u0026gt;\n \u0026lt;DataGrid Grid.Row=\"1\" Grid.Column=\"1\" Name=\"datagrid1\" SelectionChanged=\"datagrid1_SelectionChanged\" LoadingRowDetails=\"DataGrid_LoadingRowDetails\" Height=\"auto\" Width=\"auto\"\u0026gt;\n \u0026lt;DataGrid.Columns\u0026gt;\n \u0026lt;DataGridTemplateColumn\u0026gt;\n \u0026lt;DataGridTemplateColumn.CellTemplate\u0026gt;\n \u0026lt;DataTemplate\u0026gt;\n \u0026lt;TextBox Name=\"txtEmpid\" Text=\"hiiiiii\"\u0026gt;\u0026lt;/TextBox\u0026gt;\n \u0026lt;/DataTemplate\u0026gt;\n \u0026lt;/DataGridTemplateColumn.CellTemplate\u0026gt;\n \u0026lt;/DataGridTemplateColumn\u0026gt;\n \u0026lt;/DataGrid.Columns\u0026gt;\n \u0026lt;/DataGrid\u0026gt;\n\u0026lt;/Grid\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/p\u003e","answer_count":"2","comment_count":"1","creation_date":"2013-04-15 09:25:36.917 UTC","last_activity_date":"2014-02-13 00:07:08.123 UTC","last_edit_date":"2014-02-13 00:07:08.123 UTC","last_editor_display_name":"","last_editor_user_id":"1774011","owner_display_name":"","owner_user_id":"2281915","post_type_id":"1","score":"-2","tags":"wpf|xaml|textbox|wpfdatagrid","view_count":"1235"} {"id":"33741358","title":"centering element based on character position","body":"\u003cp\u003eI have dropdown select element like \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eUSA - New York\nIndia - Delhi\nCanada - Ottawa\nFinland - Helsinki\nLuxembourg - Luxembourg\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI want to center the elements based on the character '-' position. I have done this assigning id to each of those element and shifting the element which works fine but its not dynamic as I change or add the element I have to change the position. Is there way to center the elements based on the character '-' position ?\u003c/p\u003e\n\n\u003cp\u003eExpected result : \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e USA - New York\n India - Delhi\n Canada - Ottawa\n Finland - Helsinki\nLuxembourg - Luxembourg\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003ca href=\"http://plnkr.co/edit/Ys0urVnQlFASTudGOsdh?p=preview\" rel=\"nofollow\"\u003ehttp://plnkr.co/edit/Ys0urVnQlFASTudGOsdh?p=preview\u003c/a\u003e\u003c/p\u003e","answer_count":"2","comment_count":"2","creation_date":"2015-11-16 17:37:32.91 UTC","last_activity_date":"2015-11-16 19:00:34.787 UTC","last_edit_date":"2015-11-16 18:25:20.23 UTC","last_editor_display_name":"","last_editor_user_id":"5140425","owner_display_name":"","owner_user_id":"5140425","post_type_id":"1","score":"1","tags":"javascript|jquery|css","view_count":"41"} {"id":"16146502","title":"javascript: prevent browser using shiftKey when using window.open","body":"\u003cp\u003eLook at this example: \u003ca href=\"http://jsfiddle.net/casaschi/qKD9q/\" rel=\"nofollow\"\u003ehttp://jsfiddle.net/casaschi/qKD9q/\u003c/a\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div style=\"color:blue;\" onclick=\"window.open('http://www.google.com/search?q=' + Math.random(), '_blank');\"\u0026gt;\nclick me while pressing the shift key and then while NOT pressing it\n\u0026lt;/div\u0026gt;\n\u0026lt;br/\u0026gt;\ndoes one window appear as popup and the other one as a new tab?\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIf you click on the blue line on chrome or IE, a new tab will open.\nIf you shift-click on the blue line a popup window will open instead.\u003c/p\u003e\n\n\u003cp\u003eIs there a way to control from my javascript code how the new window is opened, for example always as a new window, regardless of the user pressing shiftKey or not?\u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2013-04-22 11:52:47.257 UTC","last_activity_date":"2013-04-22 12:19:19.293 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1228226","post_type_id":"1","score":"0","tags":"javascript","view_count":"150"} {"id":"3023884","title":"Books for transport layer protocol implementation in Computer Networks","body":"\u003cp\u003eI am trying to implement a transport layer protocol for my project. I am going to use Linux as my operating system. Could you please suggest me some books or links that explain the implementation of transport layer (like TCP)? Thank you..\u003c/p\u003e\n\n\u003cp\u003eThanks,\nBala\u003c/p\u003e","accepted_answer_id":"3035250","answer_count":"2","comment_count":"0","creation_date":"2010-06-11 15:04:14.383 UTC","last_activity_date":"2010-06-14 12:44:02.817 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"330036","post_type_id":"1","score":"1","tags":"network-programming|linux-kernel|network-protocols","view_count":"903"} {"id":"20643654","title":"Wordpress slow to load on initial load. Subsequent loads go quicker (caching disabled)","body":"\u003cp\u003eI'm having issues with a basic Wordpress install. I'm using Chrome, in incognito mode, so as to disable caching during testing.\u003c/p\u003e\n\n\u003cp\u003eWhat occurs is if I visit the site it will take roughly 10-30 seconds to load the initial time. Subsequent loads are usually around 2-5 seconds (remember I've disabled caching so this isn't an issue related to that).\u003c/p\u003e\n\n\u003cp\u003eThe vast majority of the load time is on the HTML page and NOT on the additional assets.\u003c/p\u003e\n\n\u003cp\u003eIf I wait about 15 minutes and load the page again, it will take 10-30 seconds. If I hit reload after that, it will again load in 2-5 seconds.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eHere's an image of the network panel in Chrome - \u003ca href=\"http://i.imgur.com/x2hxgyB.jpg\" rel=\"nofollow\"\u003ehttp://i.imgur.com/x2hxgyB.jpg\u003c/a\u003e\u003c/strong\u003e\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2013-12-17 20:07:03.577 UTC","last_activity_date":"2013-12-18 03:20:54.17 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3112705","post_type_id":"1","score":"0","tags":"wordpress|performance","view_count":"105"} {"id":"26827762","title":"Adding Datas via Javascript to existing JSON file on Server","body":"\u003cp\u003eI have following problem. I know that this is discussed quiet often, and i tried a lot of possibilities, but none is working up to now. \u003c/p\u003e\n\n\u003cp\u003eI have some datas in my javascript file, which i want to add to a already exsiting .json file on my server. I tried to do it the following way, but whenever i open the .json file after calling ajax_get_json(), no new datas are added. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction ajax_get_json(){\nvar hr = new XMLHttpRequest();\nhr.open('POST', 'myyjson.json', true);\nhr.setRequestHeader (\"Content-type\", \"application/x-www-form-urlencoded\");\nvar us = document.getElementById(\"firstname\").value;\nvar msg= document.getElementById(\"message\").value;\nhr.onreadystatechange= function(){\n if (hr.readyState == 4 \u0026amp;\u0026amp; hr.status == 200){\n var obj = JSON.parse(hr.responseText);\n obj['participant'].push({\"user\": us, \"message\": msg});\n var sendingObj =JSON.stringify(obj);\n }\n}\nhr.send (sendingObj);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e} \u003c/p\u003e\n\n\u003cp\u003eMy myjson.json File has following structure:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{ \"participant\":[\n{\"user\":\"Steven\", \"message\":\" Hey,i m in!\"}, \n{\"user\":\"Tim\", \"message\":\" i wrote sth.\"},\n{\"user\":\"lukas\", \"message\":\"example\"}\n]} \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eDoes anyone have an Idea what the problem yould be or is there a better way doing it?\u003c/p\u003e\n\n\u003cp\u003eThanks in advance!\u003c/p\u003e","accepted_answer_id":"26828502","answer_count":"1","comment_count":"3","creation_date":"2014-11-09 11:40:41.95 UTC","last_activity_date":"2014-11-09 13:05:47.583 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4185843","post_type_id":"1","score":"1","tags":"javascript|ajax|json","view_count":"400"} {"id":"1752570","title":"git-svn and a large project","body":"\u003cp\u003eI've scoured the web and found a lot about working with git-svn and branches, but nothing that fits my situation.\u003c/p\u003e\n\n\u003cp\u003eI'm working on a large project, and I work on several of many branches throughout the week. Standard ways of handling git branching wouldn't work for me here... just because of the size of the code involved. It takes about an hour to compile from the ground up, so I can't be switching back and forth between branches in that way. I want to use git-svn so I can use local branches. The svn branches might as well be considered separate projects, with common code in certain places.\u003c/p\u003e\n\n\u003cp\u003eAll I want to be able to do is merge changes from one svn repo to another using git-svn, but I haven't found a way to do it from google or the git-svn docs. I handle this in svn by maintaining a separate svn checkout it its own directory for each branch, and just use the merge command to pull changes. I expected to be able to do something similar using git-svn, but I haven't found the way to pull changes from another svn branch. Is there a way to do this?\u003c/p\u003e","accepted_answer_id":"1753731","answer_count":"2","comment_count":"1","creation_date":"2009-11-17 23:18:03.993 UTC","last_activity_date":"2009-11-18 09:26:36.017 UTC","last_editor_display_name":"","owner_display_name":"user213352","post_type_id":"1","score":"2","tags":"git|branch|git-svn","view_count":"227"} {"id":"7124703","title":"Does anybody know if there's a way to modify the action attribute of the wp-login.php?action=register form?","body":"\u003cp\u003eI'm trying to create a reference registration system in Wordpress. The idea is that the user will click a link which will contain wp-login.php?action=register\u0026amp;ref=12345\u003c/p\u003e\n\n\u003cp\u003eI'm hooking into the 'register_form' action hook and adding a reference number hidden input and on registration use that reference number to do whatever i need to do with it. \u003c/p\u003e\n\n\u003cp\u003eThe issue appears when the user gets something wrong in the registration form. The problem is that he will be taken to wherever the action attribute of the register form states which is \"wp-login.php?action=register\" without the ref parameter. I'm looking for a way to modify that action attribute. I've looked in the wp-login.php file and it seems that there's no filter there.\u003c/p\u003e\n\n\u003cp\u003eI know there's always javascript, but is there another wordpressy way to do this? \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2011-08-19 16:38:35.43 UTC","last_activity_date":"2011-09-01 03:44:41.523 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1182559","post_type_id":"1","score":"1","tags":"forms|wordpress|login|action","view_count":"177"} {"id":"41284298","title":"BizTalk orchestration to compare Input string with TableData","body":"\u003cp\u003eMy requirement is to read the incoming string and compare the words with Dynamically created Table. In Utility DB I have created a table which has 3 fields Keywords(KeyWords contain 3 rows with value Hi|I|Am There|is Where|if|go) Rating (8 2 4) Email (ABC DEF ABC).\nNow i have to read the incoming string and compare with Keyword Filed and append the rating according.\nEg: Incoming\nPayload Example 1\u003cbr\u003e\n WebForm\u003cbr\u003e\n 12/1/2016\u003cbr\u003e\n As a customer I would like to make a complaint and if I don’t get a response I will be sending a message \u003c/p\u003e\n\n\u003cp\u003eSo the output should be found I, If. Rating 12\u003c/p\u003e\n\n\u003cp\u003eFor retrieving MessageContent I have used Xpath in Expression shape. And i created Utility class where i am retrieving all the records as TableData and used this class in Expression shape to get the table contents.\u003c/p\u003e\n\n\u003cp\u003eAny suggestion how to proceed further.How to read each record\\row using orchestration(looping).Please let me know the steps to be followed. For, Foreach loop is not working in Expression shape. Do i need to create an array for looping. \u003c/p\u003e","answer_count":"0","comment_count":"1","creation_date":"2016-12-22 13:27:37.32 UTC","last_activity_date":"2016-12-22 13:27:37.32 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7326747","post_type_id":"1","score":"0","tags":"biztalk","view_count":"31"} {"id":"36379321","title":"How do I enter text into multidimentional array","body":"\u003cp\u003eI have a text file of\u003c/p\u003e\n\n\u003cp\u003ealex NAME\u003c/p\u003e\n\n\u003cp\u003eLondon CITY\u003c/p\u003e\n\n\u003cp\u003eEngland COUNTRY\u003c/p\u003e\n\n\u003cp\u003eI want to store it in a multidimentional array \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e string[,] tokened = new string[3, 2];\n int i = 0, j = 0;\n string[] input = File.ReadAllLines(@\"D:\\abc.txt\");\n foreach (string line in input)\n {\n foreach (var row in line.Split('\\n'))\n {\n foreach (var col in row.Trim().Split(' '))\n {\n tokened[i, j] = Convert.ToString((col.Trim()));\n j++;\n }\n i++;\n }\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ei have written this code but wouldn't work.\u003c/p\u003e","accepted_answer_id":"36379827","answer_count":"1","comment_count":"10","creation_date":"2016-04-02 22:12:58.473 UTC","last_activity_date":"2016-04-02 23:22:21.31 UTC","last_edit_date":"2016-04-02 23:00:16.053 UTC","last_editor_display_name":"","last_editor_user_id":"6150416","owner_display_name":"","owner_user_id":"6150416","post_type_id":"1","score":"-2","tags":"c#|multidimensional-array","view_count":"49"} {"id":"19318759","title":"Qt connect doesn't works","body":"\u003cp\u003eI've a C++ library. This library uses the publish-subscriber pattern.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003enamespace mylib {\ntypedef unsigned MyLibType;\nclass IEvent\n{\n virutal ~IEvent() {}\n\n virtual void event1() = 0;\n virtual void event2(MyLibType) = 0;\n};\n\nclass IMyClass\n{\npublic:\n virtual ~IMyClass() {}\n\n // operations\n};\n\n} // mylib\n\n// C interface\nint CreateMyClass( mylib::IMyClass** class, mylib::IEvent* listener );\n\n// implementation\nclass MyClass : public IMyClass { // ...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen MyClass is create uses a thread that generate some events.\u003c/p\u003e\n\n\u003cp\u003eNow on Qt:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass QtMyApplication : public QMainWindow, public mylib::IEvent\n{\n Q_OBJECT\n\npublic:\n explicit QtMyApplication(QWidget *parent = 0);\n ~QtMyApplication();\n\nsignals:\n void MyLibEvent1();\n void MyLibEvent2(mylib::MyLibType);\n\nprivate slots:\n void OnMyLibEvent1();\n void OnMyLibEvent2(mylib::MyLibType);\n\nprivate: // IEvent interface\n void event1()\n {\n emit MyLibEvent1();\n }\n\n void event2(mylib::MyLibType i)\n {\n emit OnMyLibEvent2( i );\n }\n\nprivate:\n Ui::QtMyApplication* ui;\n mylib::IMyLib mMyLib;\n};\n\n// implementation\nQtMyApplication::QtMyApplication( QWidget *parent ) :\n QMainWindow(parent),\n ui(new Ui::QtMyApplication)\n{\n ui-\u0026gt;setupUi( this );\n\n CreateMyLib( \u0026amp;mMyLib, this );\n\n connect( this, SIGNAL(MyLibEvent1()),\n this, SLOT(OnMyLibEvent1()) );\n connect( this, SIGNAL(MyLibEvent2(mylib::MyLibType)),\n this, SLOT(OnMyLibEvent2(mylib::MyLibType)) );\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I run the application event2() is called inside QtMyApplication but OnMyLibEvent2 is never called, instead event1() is called and OnMyLibEvent1 is called too.\nWhat am I wrong? Is the argument parameter the issue?\u003c/p\u003e\n\n\u003cp\u003e\u003cb\u003e edit 1 \u003c/b\u003e\u003c/p\u003e\n\n\u003cp\u003eI discovered that the connect has some restriction on params.... because if I change \u003ccode\u003eMyLibEvent2(mylib::MyLibType)\u003c/code\u003e in \u003ccode\u003eMyLibEvent2(int)\u003c/code\u003e all works properly...\u003c/p\u003e","accepted_answer_id":"19327435","answer_count":"1","comment_count":"5","creation_date":"2013-10-11 12:58:54.947 UTC","last_activity_date":"2013-10-11 21:19:42.79 UTC","last_edit_date":"2013-10-11 13:19:39.797 UTC","last_editor_display_name":"","last_editor_user_id":"1266688","owner_display_name":"","owner_user_id":"1266688","post_type_id":"1","score":"0","tags":"c++|qt4|qt5|publish-subscribe","view_count":"83"} {"id":"36372784","title":"Installing heroku with Ruby on Rails stucks... (Windows 10)","body":"\u003cp\u003eI am using Windows 10 and have installed Ruby on Rails and all the other components with rails installer while actually following the instructions here: \u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://installfest.railsbridge.org/installfest/create_a_heroku_account\" rel=\"nofollow\"\u003ehttp://installfest.railsbridge.org/installfest/create_a_heroku_account\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eWhile after installing toolbelt and trying to connect to heroku through the \"heroku login\" command the computer is basically... stuck...\u003c/p\u003e\n\n\u003cp\u003eThis is how it looks:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eC:\\Sites\u0026gt;heroku login\nheroku-cli: Installing Toolbelt v4... done\nFor more information on Toolbelt v4: https://github.com/heroku/heroku-cli\nheroku-cli: Adding dependencies... 12 MB/12 MB\nheroku-cli: Adding dependencies... 4.34 MB/4.34 MB\nheroku-cli: Installing core plugins...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat am I supposed to do now? (For the record I have tried uninstalling the toolbelt and after restarting the computer I have tried everything again).\u003c/p\u003e\n\n\u003cp\u003eWould it be better for me, under the circumstances to try and use APTANA and connect heroku through it?\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2016-04-02 11:43:36.103 UTC","favorite_count":"1","last_activity_date":"2016-04-06 07:30:55.49 UTC","last_edit_date":"2016-04-02 15:15:53.01 UTC","last_editor_display_name":"","last_editor_user_id":"5865420","owner_display_name":"","owner_user_id":"6148754","post_type_id":"1","score":"1","tags":"ruby-on-rails|heroku|heroku-toolbelt|railsinstaller","view_count":"98"} {"id":"19256951","title":"How do I make a construct to have beforeAuth only apply to certain views/functions in Laravel 4","body":"\u003cp\u003eI have a resource in Laravel I have called artists with an ArtistsController. I would like to add filters to some of the pages, but not all. I know I can add a filter to all of the functions/views in the resource controller like so:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic function __construct()\n {\n $this-\u0026gt;beforeFilter('auth', array('except' =\u0026gt; array()));\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow do I add the beforeAuth filter to only a certain view/function? I would like a user to be logged in in order to go the \"index\" view, but I would like a user to be able to go to the \"show\" pages without necessarily being logged in:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic function index()\n {\n $artists = Artist::all();\n\n return View::make('artists.index', compact('artists'))\n -\u0026gt;with('artists', Artist::all())\n -\u0026gt;with('artists_new', Artist::artists_new());\n }\n\npublic function show($id)\n {\n $artist = Artist::find($id);\n\n return View::make('artists.show', compact('artist'))\n -\u0026gt;with('fans', Fan::all());\n\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs there a way to do this? Thank you. \u003c/p\u003e","accepted_answer_id":"19257127","answer_count":"1","comment_count":"0","creation_date":"2013-10-08 19:48:07.463 UTC","last_activity_date":"2013-10-08 20:36:44.007 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1072337","post_type_id":"1","score":"0","tags":"authentication|laravel|laravel-4","view_count":"57"} {"id":"45658867","title":"How to change soap version in php iis?","body":"\u003cp\u003eHow to change soap version 1_2 from 1_1 on IIS Server php 5.6 ?\u003c/p\u003e\n\n\u003cp\u003eSOAP-ERROR: Parsing WSDL: Could not find any usable binding services in WSDL.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass GameService {\n\n public static $options = array(\n 'soap_version'=\u0026gt;SOAP_1_1,\n 'exceptions'=\u0026gt;true, \n 'trace'=\u0026gt;1,\n 'cache_wsdl'=\u0026gt; 0 \n );\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-08-13 09:19:01.237 UTC","last_activity_date":"2017-08-14 19:42:24.103 UTC","last_edit_date":"2017-08-13 09:27:12.65 UTC","last_editor_display_name":"","last_editor_user_id":"1211555","owner_display_name":"","owner_user_id":"8442249","post_type_id":"1","score":"1","tags":"php|iis|soap","view_count":"35"} {"id":"35471464","title":"Spark: Creating an index using groupByKey to produce sorted, distinct value list?","body":"\u003cp\u003eI am using Spark to create an \"inverted index\" that will map an English token back to the documentIds where the token is found. Given existing data of the form:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edocumentId1, token\ndocumentId2, token\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI would like to create an inverted index of the key, value form:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etoken, List(documentId1, documentId2, documentId3, ...)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ewhere the value is a list of documentIds that are \u003cstrong\u003esorted\u003c/strong\u003e and \u003cstrong\u003edistinct\u003c/strong\u003e (unique).\u003c/p\u003e\n\n\u003cp\u003eHere is what I have so far: :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e// List of (documentId, token) pairs\nvar data = Array((100, \"spark\"), (50, \"spark\"), (50, \"spark\"), (1, \"apache\"), (3, \"apache\"), (2, \"apache\"))\nvar myrdd = sc.parallelize(data)\nvar myrddGrouped = myrdd.map(pair =\u0026gt; (pair._2, pair._1)).groupByKey()\n// myrddGrouped: org.apache.spark.rdd.RDD[(String, Iterable[Int])] = ShuffledRDD[226] at groupByKey at \u0026lt;console\u0026gt;:31\n\nmyrddGrouped.foreach(println)\n// (apache,CompactBuffer(1, 3, 2))\n// (spark,CompactBuffer(100, 50, 50))\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAs you can see, I am using groupByKey(), but the result value is a CompactBuffer, not a List. How can I apply \"distinct\" and \"sort\" to it?\u003c/p\u003e","answer_count":"2","comment_count":"2","creation_date":"2016-02-18 02:05:57.037 UTC","favorite_count":"1","last_activity_date":"2017-03-24 18:42:07.117 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4561314","post_type_id":"1","score":"0","tags":"scala|apache-spark","view_count":"722"} {"id":"36398384","title":"alert id for jquery rates script","body":"\u003cp\u003eI'm using this script for rating:\n\u003ca href=\"http://antenna.io/demo/jquery-bar-rating/examples/\" rel=\"nofollow\"\u003ehttp://antenna.io/demo/jquery-bar-rating/examples/\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI chose the \"Font Awesome\" stars. I have several rates bar so I add ID to each one. When click on some star I would like to ALERT the right ID.\u003c/p\u003e\n\n\u003cp\u003eI tried this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e rateID = $(this).parent(\".br-wrapper\").find(\".rate-fontawesome\").attr('id');\n $('.rate-fontawesome').barrating({\n theme: 'fontawesome-stars',\n showSelectedRating: true,\n onSelect:function(value, text) {\n alert('Selected rating: ' + value + 'ID: ' + rateID);\n } \n });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut it's not working...\u003c/p\u003e","accepted_answer_id":"36398688","answer_count":"1","comment_count":"1","creation_date":"2016-04-04 09:00:57.8 UTC","last_activity_date":"2016-04-04 09:37:37.013 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5722817","post_type_id":"1","score":"0","tags":"jquery","view_count":"39"} {"id":"15978266","title":"\"Access is denied\" when changing a file's attributes","body":"\u003cp\u003eI have a PS script that is trying to change the attributes (archive flag) of a file but I am receiving an access to path is denied error.\u003c/p\u003e\n\n\u003cp\u003eThe user I am logged on as is a member of the local Administrators group, and can change the attributes without a problem by right-clicking the file.\u003c/p\u003e\n\n\u003cp\u003eThe script is allowed to write these files to this folder in the first place, just not change their attribute.\u003c/p\u003e\n\n\u003cp\u003eDoes anyone know what other security setting I may need to change? \u003c/p\u003e\n\n\u003cp\u003eThank you in advance.\u003c/p\u003e\n\n\u003cp\u003e-Ben\u003c/p\u003e\n\n\u003cp\u003eEdit - Code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$file=get-item E:\\Transfer\\In\\Data\\EAS\\BALSHEET.txt\nif(Test-Path $file){\n $file.attributes.GetType().Name\n $a = $file.attributes\n if($a -eq \"Archive\"){\n Copy-Item $file 'E:\\FDM_Apps\\Main\\Inbox\\_Data From Transfer'\n Copy-Item $file 'E:\\Transfer\\Archive\\In Archive\\Data\\EAS'\n $ArchiveFile = get-item 'E:\\Transfer\\Archive\\In Archive\\Data\\EAS\\BALSHEET.txt'\n $ArchiveName = 'BALSHEET'+$date+'.txt'\n Rename-Item $ArchiveFile $ArchiveName\n $file.Attributes=\"Normal\" #Error occurs on this line\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"6","creation_date":"2013-04-12 18:20:22.03 UTC","last_activity_date":"2013-04-12 18:25:58.7 UTC","last_edit_date":"2013-04-12 18:25:58.7 UTC","last_editor_display_name":"","last_editor_user_id":"708430","owner_display_name":"","owner_user_id":"708430","post_type_id":"1","score":"1","tags":"powershell","view_count":"918"} {"id":"46920460","title":"In a Django admin, add an inline of a generic relation","body":"\u003cp\u003eHere are my simplified models :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom django.contrib.contenttypes.fields import (\n GenericForeignKey, GenericRelation)\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\n\nclass Thing(models.Model):\n '''\n Our 'Thing' class\n with a link (generic relationship) to an abstract config\n '''\n\n name = models.CharField(\n max_length=128, blank=True,\n verbose_name=_(u'Name of my thing'))\n\n # Link to our configs\n config_content_type = models.ForeignKey(\n ContentType,\n null=True,\n blank=True)\n config_object_id = models.PositiveIntegerField(\n null=True,\n blank=True)\n config_object = GenericForeignKey(\n 'config_content_type',\n 'config_object_id')\n\n\nclass Config(models.Model):\n '''\n Base class for custom Configs\n '''\n class Meta:\n abstract = True\n\n name = models.CharField(\n max_length=128, blank=True,\n verbose_name=_(u'Config Name'))\n\n thing = GenericRelation(\n Thing,\n related_query_name='config')\n\n\nclass FirstConfig(Config):\n pass\n\n\nclass SecondConfig(Config):\n pass\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd Here's the admin:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom django.contrib import admin\nfrom .models import FirstConfig, SecondConfig, Thing\n\n\nclass FirstConfigInline(admin.StackedInline):\n model = FirstConfig\n\n\nclass SecondConfigInline(admin.StackedInline):\n model = SecondConfig\n\n\nclass ThingAdmin(admin.ModelAdmin):\n model = Thing\n\n def get_inline_instances(self, request, obj=None):\n '''\n Returns our Thing Config inline\n '''\n if obj is not None:\n m_name = obj.config_object._meta.model_name\n if m_name == \"firstconfig\":\n return [FirstConfigInline(self.model, self.admin_site), ]\n elif m_name == \"secondconfig\":\n return [SecondConfigInline(self.model, self.admin_site), ]\n return []\n\n\nadmin.site.register(Thing, ThingAdmin)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo far, I've a Thing object with a FirstConfig object linked together.\nThe code is simplified: in an unrelevant part I manage to create my abstract Config at a Thing creation and set the right content_type / object_id.\u003c/p\u003e\n\n\u003cp\u003eNow I'd like to see this FirstConfig instance as an inline (FirstConfigInline) in my ThingAdmin.\u003c/p\u003e\n\n\u003cp\u003eI tried with the django.contrib.contenttypes.admin.GenericStackedInline, though it does not work with my current models setup.\u003cbr\u003e\nI tried to play around with the \u003ccode\u003efk_name\u003c/code\u003e parameter of my FirstConfigInline.\u003cbr\u003e\nAlso as you can see, I tried to play arround with the 'thing' GenericRelation attribute on my Config Model, without success..\u003c/p\u003e\n\n\u003cp\u003eAny idea on how to proceed to correctly setup the admin?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-10-24 21:38:16.043 UTC","last_activity_date":"2017-11-10 12:07:15.133 UTC","last_edit_date":"2017-11-06 09:29:43.55 UTC","last_editor_display_name":"","last_editor_user_id":"1943863","owner_display_name":"","owner_user_id":"6622232","post_type_id":"1","score":"1","tags":"python|django","view_count":"127"} {"id":"5988908","title":"Mapping UITextField to class property","body":"\u003cp\u003emy problem is that i have a screen with a lot of UITextField and class where in all the data entered in UITextField is stored in my xyz class. Right now I am mapping my UITextField to the class properties using switch case which is lot horrible not to mention validation which adds more complexity to it. Is there any way to map the class property with the UITextField and get rid of the switch case, please help. \u003c/p\u003e","answer_count":"2","comment_count":"6","creation_date":"2011-05-13 07:55:15.217 UTC","favorite_count":"2","last_activity_date":"2011-05-13 17:28:25.167 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"152254","post_type_id":"1","score":"1","tags":"iphone|objective-c|uitextfield|nsobject","view_count":"301"} {"id":"33140157","title":"oracle prompt before declare gives error","body":"\u003cpre\u003e\u003ccode\u003eprompt ------------------------------------------------\nprompt Executing...DDL/SCRIPT NAME.sql \nprompt ------------------------------------------------\n\nSET SERVEROUTPUT ON;\nSET VERIFY OFF;\n WHENEVER SQLERROR EXIT ;\n WHENEVER OSERROR EXIT ;\n\nprompt DDL/JIRA-ID Checking columns UPDT_USERID, TIME_STAMP, LAST_ACTION for NULL values.\nDECLARE\n v_error boolean := FALSE;\n v_exit EXCEPTION;\nBegin\n--- Some Code\nEND;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhile running this code i am getting error at line\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprompt DDL/JIRA-ID Checking columns UPDT_USERID, TIME_STAMP, LAST_ACTION for NULL values.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eError is as below.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e DDL/FND-18918 Checking columns UPDT_USERID, TIME_STAMP, LAST_ACTION for NULL values.\n prompt DDL/FND-18918 Checking columns HIST_USERID, HIST_TIME_STAMP, HIST_ACTION for NULL values.\n *\n\nORA-06550: \nPLS-00103: Encountered the symbol \"DDL\" when expecting one of the following: \n:= . ( @ % ; \nThe symbol \":=\" was substituted for \"DDL\" to continue. \nORA-06550: \nPLS-00103: Encountered the symbol \"CHECKING\" when expecting one of the \nfollowing: \n* \u0026amp; = - + ; \u0026lt; / \u0026gt; at in is mod remainder not rem \n\u0026lt;an exponent (**)\u0026gt; \u0026lt;\u0026gt; or != or ~= \u0026gt;= \u0026lt;= \u0026lt;\u0026gt; and or like like2 \nlike4 likec between || member submultiset \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan i know exact root cause of this. because i have long DDL script in which i have put prompt statement before every DECLARE block.\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2015-10-15 04:55:50.753 UTC","last_activity_date":"2015-10-16 07:53:55.03 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1244566","post_type_id":"1","score":"1","tags":"plsql","view_count":"460"} {"id":"47281240","title":"Append mode requires a document without errors, even if recovery is possible","body":"\u003cp\u003eThe PDF which I signed with \u003cstrong\u003eappend\u003c/strong\u003e mode is exported from Office Word 2016.\u003c/p\u003e\n\n\u003cp\u003eHere is my file : \u003ca href=\"https://www.dropbox.com/s/i7eeamw9xouf76l/word.pdf?dl=0\" rel=\"nofollow noreferrer\"\u003eword.pdf\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eAnd I got this error message:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e\ncom.itextpdf.kernel.PdfException: Append mode requires a document without errors, even if recovery is possible.\n\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eI am using iText7 7.0.4 .\u003c/p\u003e","accepted_answer_id":"47282226","answer_count":"2","comment_count":"0","creation_date":"2017-11-14 08:47:54.4 UTC","favorite_count":"0","last_activity_date":"2017-11-16 12:09:49.9 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5941014","post_type_id":"1","score":"0","tags":"itext7","view_count":"64"} {"id":"46728748","title":"Duration from Each Hour in 24 hours work","body":"\u003cp\u003eI have a a MS access table (MasterLogs)with structure as Date, UserName, Position, loginTime, logoutTime.(Login and logout field type is date\u0026amp;time)\nI want to extract data from this table to another table (PositionHrs)where the columns are \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eDate\nUsername\nPosition\n0000-0059\n0100-0159\n0200-0259 \n...\nuntil 2300-2359 (which are basically like time duration).\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIn the Masterlogs table, the records are like 01-Aug-17, Username, position and there will be login logout times (eg:login 01-Aug-17 00:05 and logout time 01-Aug-17 02:45)\u003c/p\u003e\n\n\u003cp\u003eI am looking for a VBA code which can read the records in masterlogs and split the minutes of duration to corresponding column in the positionHrs table.\nSo that table should have a record for the username in 0000-0059 column with a value of 00:54 (54 minutes duration during 0000 to 0059 time and in the 0100-0159 column 01:00 and in the 0200-0259 column the remaining duration 00:45\nHope I have explained well.\u003c/p\u003e\n\n\u003cp\u003eCan anyone please help me to fix this ?\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2017-10-13 11:21:18.477 UTC","last_activity_date":"2017-10-14 05:12:26.863 UTC","last_edit_date":"2017-10-13 12:11:23.257 UTC","last_editor_display_name":"","last_editor_user_id":"5836929","owner_display_name":"","owner_user_id":"8770782","post_type_id":"1","score":"-1","tags":"vba","view_count":"74"} {"id":"24960466","title":"JS templating engine that preserves elements","body":"\u003cp\u003eI have the following problem:\u003c/p\u003e\n\n\u003cp\u003eA have a web application where I regularly need to update the user interface when data changes. The data consists of a list of items with different attributes. Because the UI representations of these items can be complex, I use JS templating to render them. When they change I just replace them in the DOM with the HTML representing their updated state.\u003c/p\u003e\n\n\u003cp\u003eThis approach is simple but has several problems:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eyou need to re-attach all event handlers because you practically replace elements\u003c/li\u003e\n\u003cli\u003ethere is a flickering effect when reloading resources (probably can be solved using document fragments)\u003c/li\u003e\n\u003cli\u003eit's impossible to work with developer tools (inspector) if the content changes frequently because, again, all the elements are replaced\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eSo I was wondering if there is any JS templating engine of \u003ca href=\"http://garann.github.io/template-chooser/\" rel=\"nofollow\"\u003ethat many\u003c/a\u003e that can deal with the situation. I'm thinking of a feature that intelligently matches elements of the new render and an old one and only changes the content when it has really changed.\u003c/p\u003e\n\n\u003cp\u003eI'm thinking of something like this:\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eOld HTML\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div\u0026gt;\n \u0026lt;h1\u0026gt;TV\u0026lt;/h1\u0026gt;\n \u0026lt;span\u0026gt;$250\u0026lt;/span\u0026gt;\n \u0026lt;a href=\"addtocart?id=123\"\u0026gt;Add to cart\u0026lt;/a\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eNew HTML\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div\u0026gt;\n \u0026lt;h1\u0026gt;TV\u0026lt;/h1\u0026gt;\n \u0026lt;span\u0026gt;$260\u0026lt;/span\u0026gt;\n \u0026lt;a href=\"addtocart?id=123\"\u0026gt;Add to cart\u0026lt;/a\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe templating engine find the \u003ccode\u003e\u0026lt;span\u0026gt;\u003c/code\u003e in the original DOM and replaces its changed value but leaves the rest of the elements intact.\u003c/p\u003e","accepted_answer_id":"25273436","answer_count":"2","comment_count":"0","creation_date":"2014-07-25 16:37:55.61 UTC","last_activity_date":"2015-07-12 10:48:15.107 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"397935","post_type_id":"1","score":"0","tags":"javascript|templates","view_count":"58"} {"id":"44834024","title":"Favicon is not visible on my hosting","body":"\u003cp\u003eI have added a favicon in a phpbb forum.\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/0NdCx.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/0NdCx.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI can clearly see it in the view source but the tab still shows the hostgator's favicon, I tried hard refresh as well. It didn't work.\u003c/p\u003e\n\n\u003cp\u003eThe same favicon is working fine another app.\u003c/p\u003e\n\n\u003cp\u003eWhat's the reason behind disappearance of favicon?\u003c/p\u003e\n\n\u003cp\u003eI click on the link directly from view source, I can see the icon.\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2017-06-29 20:03:59.633 UTC","last_activity_date":"2017-06-29 20:06:57.46 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1230257","post_type_id":"1","score":"0","tags":"phpbb3","view_count":"26"} {"id":"6034203","title":"MapReduce programming","body":"\u003cp\u003eI 've done this code on java which collects various information about photos and extracts the results to a text file.\nI would like to convert this program to function with the MapReduce model.\nI am a newbie on MapReduce programming. Any help would be very appreciated!!\nThank you\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport java.io.*;\nimport java.util.*;\nimport java.net.*;\n\nimport javax.xml.parsers.ParserConfigurationException;\n\nimport org.xml.sax.SAXException;\n\nimport com.aetrion.flickr.people.User;\nimport com.aetrion.flickr.photos.Photo;\nimport com.aetrion.flickr.photos.PhotoList;\nimport com.aetrion.flickr.photos.PhotosInterface;\nimport com.aetrion.flickr.photos.SearchParameters;\nimport com.aetrion.flickr.photosets.PhotosetsInterface;\nimport com.aetrion.flickr.test.TestInterface;\nimport com.aetrion.flickr.people.PeopleInterface;\nimport com.aetrion.flickr.groups.*;\nimport com.aetrion.flickr.groups.pools.*;\n\n\nimport com.aetrion.flickr.*;\n\npublic class example2{\n\npublic example2() {\n\n\n\n}\n\n/**\n* @param args\n* @throws FlickrException\n* @throws SAXException\n* @throws IOException\n* @throws ParserConfigurationException\n*/\n\n@SuppressWarnings(\"deprecation\")\npublic static void main(String[] args) throws IOException, SAXException, FlickrException, ParserConfigurationException { // TODO Auto-generated method stub\n\nFileWriter out = new FileWriter(\"photos.txt\");\n\n//Set api key\nString key=\"apikey\";\nString svr=\"www.flickr.com\";\nREST rest=new REST();\nrest.setHost(svr);\n\n//initialize Flickr object with key and rest\nFlickr flickr=new Flickr(key,rest);\nFlickr.debugStream=false;\n\n//initialize SearchParameter object, this object stores the search keyword\nSearchParameters searchParams=new SearchParameters();\nsearchParams.setSort(SearchParameters.INTERESTINGNESS_DESC);\nsearchParams.setGroupId(\"group_id\");\n\n//Initialize PhotosInterface object\nPhotosInterface photosInterface=flickr.getPhotosInterface();\n//Execute search with entered tags\nPhotoList photoList=photosInterface.search(searchParams,500,1);\n\nif(photoList!=null){\n//Get search result and check the size of photo result\nfor(int i=0;i\u0026lt;photoList.size();i++){\n//get photo object\nPhoto photo=(Photo)photoList.get(i);\n\nSystem.out.print(photo.getId()+\"\\t\");\nout.write(photo.getId()+\"\\t\");\n\nSystem.out.print(photo.getOwner().getId()+\"\\t\");\nout.write(photo.getOwner().getId()+\"\\t\");\n\nPhoto photo1=photosInterface.getPhoto(photo.getId());\n\n\nif(photo1.getGeoData() != null ){\nSystem.out.print(\"latitute=\"+photo1.getGeoData().getLatitude()+\"\\t\");\nout.write(photo1.getGeoData().getLatitude()+\"\\t\");\n\nSystem.out.print(\"longitude=\"+photo1.getGeoData().getLongitude()+\"\\t\");\nout.write(photo1.getGeoData().getLongitude()+\"\\t\");\n}\nelse {System.out.print(photo1.getGeoData()+\"\\t\");\nout.write(photo1.getGeoData()+\"\\t\\t\"+photo1.getGeoData());}\nSystem.out.println(\"\");\nout.write(\"\\n\");\n\n\n\n}\nout.close();\n}\n}}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"6034817","answer_count":"2","comment_count":"8","creation_date":"2011-05-17 16:42:34.677 UTC","last_activity_date":"2011-05-27 08:47:51.003 UTC","last_edit_date":"2011-05-27 08:47:51.003 UTC","last_editor_display_name":"","last_editor_user_id":"25324","owner_display_name":"","owner_user_id":"693209","post_type_id":"1","score":"2","tags":"java|mapreduce|photo","view_count":"1255"} {"id":"44970010","title":"Axes class - set explicitly size (width/height) of axes in given units","body":"\u003cp\u003eCurrently I will like to create a figure using matplotlib where I can explicitly specify the size of the axes, i.e. I can prescribe the width and height of the axes bbox.\u003c/p\u003e\n\n\u003cp\u003eI have looked around all over and I cannot find a solution for this. What I typically find is how to adjust the size of the complete Figure (including ticks and labels), for example using \u003ccode\u003efig, ax = plt.subplots(figsize=(w, h))\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eThis is very important for me as I want to have a 1:1 scale of the axes, i.e. 1 unit in paper is equal to 1 unit in reality. For example, if xrange is 0 to 10 with major tick = 1 and x axis is 10cm, then 1 major tick = 1cm. I will save this figure as pdf to import it to a latex document.\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://stackoverflow.com/questions/17990845/how-to-equalize-the-scales-of-x-axis-and-y-axis-in-python-matplotlib\"\u003eThis question\u003c/a\u003e brought up a similar topic but the answer does not solve my problem (using \u003ccode\u003eplt.gca().set_aspect('equal', adjustable='box')\u003c/code\u003e code)\u003c/p\u003e\n\n\u003cp\u003eFrom this other \u003ca href=\"https://stackoverflow.com/questions/19306510/determine-matplotlib-axis-size-in-pixels\"\u003equestion\u003c/a\u003e I see that it is possible to get the axes size, but not how to modify them explicitly.\u003c/p\u003e\n\n\u003cp\u003eAny ideas how I can set the axes box size and not just the figure size. The figure size should adapt to the axes size.\u003c/p\u003e\n\n\u003cp\u003eThanks!\u003c/p\u003e\n\n\u003cp\u003eP.D.\u003c/p\u003e\n\n\u003cp\u003eFor those familiar with \u003ca href=\"http://pgfplots.sourceforge.net/\" rel=\"nofollow noreferrer\"\u003epgfplots\u003c/a\u003e in latex, it will like to have something similar to the \u003ccode\u003escale only axis\u003c/code\u003e option (see \u003ca href=\"https://tex.stackexchange.com/questions/301594/scale-only-axis-only-for-one-axis\"\u003ehere\u003c/a\u003e for example).\u003c/p\u003e","accepted_answer_id":"44971177","answer_count":"1","comment_count":"0","creation_date":"2017-07-07 11:47:29.147 UTC","favorite_count":"1","last_activity_date":"2017-07-07 12:48:16.247 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6277690","post_type_id":"1","score":"0","tags":"python|matplotlib|plot|axis|axes","view_count":"73"} {"id":"43857075","title":"Use a variable in your router config Angular","body":"\u003cp\u003eMy app uses determines the default language you are using based on a variable loaded through an api.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ethis.api.getdefaultLang()\n .subscribe(lang =\u0026gt; {\n this.lang = lang.code\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand I want to pass it into my router when the user first visits the site.\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e{path: '', redirectTo:\u003c/code\u003e${lang}\u003ccode\u003e, pathMatch: 'full' }\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eIf the user navigates to it directly it will set the param in local storage and use it the next time they visit, I just need it to evaluate when the user first visits the application.\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-05-08 20:51:31.593 UTC","last_activity_date":"2017-05-08 20:51:31.593 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3984444","post_type_id":"1","score":"0","tags":"angularjs|angular-ui-router","view_count":"25"} {"id":"27574254","title":"PFQuery not getting Object ID","body":"\u003cp\u003eThe code below checks Parse to see if an email address has been verified. I am able to retrieve the object ID from Core Data (I saved it in a previous view controller) but when it comes to \u003ccode\u003equery.getObjectInBackgroundWithId(userID)\u003c/code\u003e, \u003ccode\u003euserID\u003c/code\u003e is for some reason \u003ccode\u003enil\u003c/code\u003e. I get the error:\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eError: no results matched the query (Code: 101, Version: 1.6.0)\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport UIKit\nimport CoreData\n\nclass HomePage: UIViewController{\n\n@IBOutlet var emailMessage: UILabel!\n\n//var userID: String!\n\noverride func viewDidLoad() {\n super.viewDidLoad()\n\n var appDel:AppDelegate = (UIApplication.sharedApplication().delegate as AppDelegate)\n\n var context:NSManagedObjectContext = appDel.managedObjectContext!\n\n var request = NSFetchRequest(entityName: \"Users\")\n\n request.returnsObjectsAsFaults = false\n\n var results: NSArray = context.executeFetchRequest(request, error: nil)!\n\n var res = results [0] as NSManagedObject\n\n var userID = res.valueForKey(\"userID\") as String\n\n println (userID) //Correct ID is retrieved here\n\n\n var query = PFQuery(className:\"User\")\n query.getObjectInBackgroundWithId(userID) { //ID becomes nil\n (email: PFObject!, error: NSError!) -\u0026gt; Void in\n if error == nil {\n\n let checkEmail = email[\"emailVerified\"] as Bool\n\n if (checkEmail != true)\n {\n self.emailMessage.hidden = false\n }\n\n else\n {\n self.emailMessage.hidden = true\n }\n\n }\n }\n}\n\n\noverride func didReceiveMemoryWarning() {\n super.didReceiveMemoryWarning()\n // Dispose of any resources that can be recreated.\n}\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"27574341","answer_count":"2","comment_count":"0","creation_date":"2014-12-19 21:40:34.71 UTC","last_activity_date":"2014-12-19 21:52:34.283 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4268022","post_type_id":"1","score":"0","tags":"xcode|core-data|swift|parse.com","view_count":"290"} {"id":"44450964","title":"SFSafariViewController init method forced to use iOS11 supported version","body":"\u003cp\u003eWith the recent update on Xcode 9 Beta and iOS11 preview, there are some changes to SFSafariViewController \u003ccode\u003einit\u003c/code\u003e methods.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@available(iOS 11.0, *)\npublic init(url URL: URL, configuration: SFSafariViewController.Configuration)\n\n@available(iOS, introduced: 9.0, deprecated: 11.0)\npublic convenience init(url URL: URL, entersReaderIfAvailable: Bool)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThere is one new \u003ccode\u003einit\u003c/code\u003e method that is supported from iOS11 onwards while the currently available init method will be deprecated by iOS11. The problem is that the current method is not exposed and could not be overwritten. This forces the use of the new \u003ccode\u003einit\u003c/code\u003e method if we want to use the beta to run the existing project. Has anyone found a way to use the existing \u003ccode\u003einit\u003c/code\u003e method in the new Xcode Beta?\u003c/p\u003e\n\n\u003cp\u003eEdit: For clarification, this is a snippet of the \u003ccode\u003einit\u003c/code\u003e method in my subclass\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass BPSafariViewController: SFSafariViewController {\n override init(url URL: URL, entersReaderIfAvailable: Bool) {\n super.init(url: URL, entersReaderIfAvailable: entersReaderIfAvailable)\n if #available(iOS 10.0, *) {\n preferredControlTintColor = UIColor.BPUIColor()\n } else {\n view.tintColor = UIColor.BPUIColor()\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"44519189","answer_count":"2","comment_count":"0","creation_date":"2017-06-09 06:40:21.14 UTC","last_activity_date":"2017-06-14 06:49:26.447 UTC","last_edit_date":"2017-06-14 06:49:26.447 UTC","last_editor_display_name":"","last_editor_user_id":"5030835","owner_display_name":"","owner_user_id":"5030835","post_type_id":"1","score":"0","tags":"ios|xcode|sfsafariviewcontroller|xcode9-beta","view_count":"426"} {"id":"11395888","title":"ISDATE() datetime string with offset","body":"\u003cp\u003eI need to check if a value is a date, however the \u003ccode\u003eISDATE()\u003c/code\u003e function return 0 when confronted with a value like \u003ccode\u003e2012-07-21 00:00:00+02:00\u003c/code\u003e because of the offset. My problem is that I cant simply cast the value, in fact \u003ccode\u003eISDATE()\u003c/code\u003e is intended to be used in the query to check if the value is a date before casting (see example below).\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT p.propertyid \nFROM property p \nWHERE CASE Isdate(p.[value]) \n WHEN 1 THEN \n CASE \n WHEN Cast(p.[value] AS DATETIME) \u0026gt;= Cast('7/1/2012' AS DATETIME) \n THEN 1 \n ELSE 0 \n END \n ELSE 0 \n END = 1 \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo I would like to know how to check if the \u003ccode\u003ep.[value]\u003c/code\u003e in the example is a date.\u003c/p\u003e","answer_count":"1","comment_count":"4","creation_date":"2012-07-09 13:18:54.467 UTC","last_activity_date":"2012-07-10 06:49:46.24 UTC","last_edit_date":"2012-07-10 06:49:46.24 UTC","last_editor_display_name":"","last_editor_user_id":"786192","owner_display_name":"","owner_user_id":"786192","post_type_id":"1","score":"2","tags":"sql|sql-server-2008","view_count":"649"} {"id":"7028275","title":"Can I bulk import tasks in tfs with having the parent as column?","body":"\u003cp\u003eI've got a list of Tasks in Excel. Now I want to import them in TFS but they all have a requirement as parent. So when I use the Tree I could import them one after another by using cut and paste under the requirement in Excel.\u003c/p\u003e\n\n\u003cp\u003eI would like to have the possibility to name the parent in a flat list and having a column for the parent name. Is there any possibility to do this?\u003c/p\u003e\n\n\u003cp\u003eKind Regards \u003c/p\u003e","accepted_answer_id":"7290566","answer_count":"1","comment_count":"0","creation_date":"2011-08-11 15:07:08.323 UTC","last_activity_date":"2011-09-03 01:19:46.027 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"181712","post_type_id":"1","score":"3","tags":"excel|tfs|tfs2010|import-from-excel","view_count":"1474"} {"id":"9838135","title":"How to check if the markers in a google map are not behind any custom controls in the Map","body":"\u003cp\u003eI'm using Google maps V3 API . I've added a custom control on the Map. Its having a width of 350px and height 300px.\u003c/p\u003e\n\n\u003cp\u003eIs there any way which i can figure out any of the marker is positioned behind the custom control on the Google maps.\u003c/p\u003e\n\n\u003cp\u003eAlso i need to find out if i could able to find any marker is behind the custom control , i want it to change the position of the marker out of the custom control.\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2012-03-23 11:05:18.903 UTC","last_activity_date":"2012-03-23 11:33:22.35 UTC","last_edit_date":"2012-03-23 11:33:22.35 UTC","last_editor_display_name":"","last_editor_user_id":"944096","owner_display_name":"","owner_user_id":"944096","post_type_id":"1","score":"1","tags":"google-maps|google-maps-api-3|google-maps-markers|infowindow","view_count":"117"} {"id":"19268370","title":"Polymorphism and overloaded functions with different signatures","body":"\u003cp\u003eWhat I want to do : a simple storage class, defined as a template to be as general as possible. And being able to derive from this class another, that would accept anything, convert it to \u003ccode\u003eint\u003c/code\u003e (the algorithm is not relevant here), and store it in the underlying class.\u003c/p\u003e\n\n\u003cp\u003eBut, this doesn't quite work as expected. Here is the minimal test case I wrote:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etemplate\u0026lt;typename T\u0026gt;\nclass A {\n public:\n void f(T\u0026amp; foo) { }\n};\n\nclass B : public A\u0026lt;int\u0026gt; {\n public:\n template\u0026lt;typename T\u0026gt;\n void f(T\u0026amp; foo) { }\n};\n\nint main() {\n A\u0026lt;int\u0026gt;* ptr = new B;\n ptr-\u0026gt;f(\"foo\");\n delete ptr;\n return 0;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eOf course, this doesn't work:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epierre@raringbeast:~/Workspace/Test/src$ icpc -o Test Test.cpp \nTest.cpp(16): error: a reference of type \"int \u0026amp;\" (not const-qualified) cannot\nbe initialized with a value of type \"const char [4]\"\n ptr-\u0026gt;f(\"foo\");\n ^\n\ncompilation aborted for Test.cpp (code 2)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs there any way to force the compiler to use the method definition from the B class, or is this a \u003cem\u003ereally\u003c/em\u003e bad idea?\u003c/p\u003e\n\n\u003cp\u003e--\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eEdit\u003c/strong\u003e: Made the inheritance public.\u003c/p\u003e","accepted_answer_id":"19268732","answer_count":"2","comment_count":"0","creation_date":"2013-10-09 09:40:18.423 UTC","last_activity_date":"2013-10-09 10:15:21.843 UTC","last_edit_date":"2013-10-09 09:55:39.18 UTC","last_editor_display_name":"","last_editor_user_id":"283181","owner_display_name":"","owner_user_id":"283181","post_type_id":"1","score":"1","tags":"c++|class|templates|polymorphism","view_count":"239"} {"id":"18690392","title":"How to add and initialize byte[] field with Mono.Cecil","body":"\u003cp\u003eI want to add a field of type \u003ccode\u003ebyte[]\u003c/code\u003e to the \u003ccode\u003e\u0026lt;Module\u0026gt;\u003c/code\u003e class and initialize it to an arbitrary array of bytes using Mono.Cecil. The following doesn't work.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTypeDefinition moduleClass = ModuleDefinition\n .GetAllTypes()\n .Single(typedef =\u0026gt; typedef.Name == \"\u0026lt;Module\u0026gt;\");\n\nFieldDefinition myBytes = new FieldDefinition(\"myBytes\"\n ,FieldAttributes.Private | FieldAttributes.Static | FieldAttributes.HasFieldRVA\n ,ModuleDefinition.Import(typeof(byte[])));\n\nmyBytes.InitialValue = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };\n\nmoduleClass.Fields.Add(myBytes);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is the result in ILSpy (using the \"IL\" view).\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e.class private auto ansi '\u0026lt;Module\u0026gt;'\n{\n // Fields\n .field private static uint8[] myBytes at I_00000000\n\n} // end of class \u0026lt;Module\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I try to execute the modified assembly, I get a TypeLoadException with the message \"Type '\u003ccode\u003e\u0026lt;Module\u0026gt;\u003c/code\u003e' from assembly 'TestApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' has a field of an illegal type.\"\u003c/p\u003e\n\n\u003cp\u003eIf I remove \u003ccode\u003eFieldAttributes.HasFieldRVA\u003c/code\u003e, I get no errors but the \u003ccode\u003eat I_00000000\u003c/code\u003e disappears, which I assume means the field won't be initialized.\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2013-09-09 01:29:44.643 UTC","last_activity_date":"2016-11-30 10:10:18.15 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1101204","post_type_id":"1","score":"1","tags":".net|mono.cecil","view_count":"762"} {"id":"19456480","title":"How to make a checkbox change value?","body":"\u003cp\u003eSo I am just wondering how would I change the value, whenever someone clicks on the checkbox. Basically the \u003cem\u003eTotal Land Transfer Tax (PLTT + TLTT)\u003c/em\u003e should become \u003ccode\u003e$0\u003c/code\u003e. I have tired to do if statements with the checkbox but then the program does not working properly. Please I just need some advice should I do?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;!doctype html\u0026gt;\n\u0026lt;html\u0026gt;\n \u0026lt;head\u0026gt;\n \u0026lt;script src=\"http://code.jquery.com/jquery-latest.min.js\" type=\"text/javascript\"\u0026gt;\u0026lt;/script\u0026gt;\n \u0026lt;/head\u0026gt;\n \u0026lt;body\u0026gt;\n \u0026lt;table bgcolor=\"#D4D4D4\" border=\"1\" width=\"450\" height=\"60\"\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td width=\"175\" align=\"center\"\u0026gt;Land Transfer Tax Calculator\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/table\u0026gt;\n\n \u0026lt;table border=\"0\" bgcolor=\"#E7E7E7\" width=\"450\" height=\"69\"\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td height=\"30\" align=\"center\"\u0026gt;Enter the Price:\u0026lt;input type=\"textbox\" name=\"x1\" id=\"price\" style=\"width:150px\"\u0026gt;\u0026lt;/td\u0026gt;\u0026lt;br\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td align=\"center\" \u0026gt;\u0026lt;font size=\"2\"\u0026gt;(no commas or decimals)\u0026lt;/font\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td align=\"center\"\u0026gt;\u0026lt;input type=\"checkbox\" id=\"check1\" value=\"\"\u0026gt;First time home buyers\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td align=\"center\"\u0026gt;\u0026lt;input type=\"button\" id=\"calculate\" style=\"\" value=\"Calculate\"\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/table\u0026gt;\n\n \u0026lt;table bgcolor=\"#E7E7E7\" width=\"450\" border=\"0\" \u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td align=\"center\"\u0026gt;Provincial Land Transfer Tax (PLTT)\u0026lt;/td\u0026gt;\n \u0026lt;td align=\"center\"\u0026gt;Toronto Land Transfer Tax (TLTT)\u0026lt;/td\u0026gt;\n \u0026lt;td align=\"center\"\u0026gt;Total Land Transfer Tax (PLTT + TLTT)\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td align=\"center\"\u0026gt;\u0026lt;input type=\"textbox\" id=\"provincal\" value=\"\" style=\"width:135px\" disabled/\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td align=\"center\"\u0026gt;\u0026lt;input type=\"textbox\" id=\"toronto\" value=\"\" style=\"width:135px\" disabled/\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td align=\"center\"\u0026gt;\u0026lt;input type=\"textbox\" id=\"final\" value=\"\" style=\"width:135px\" disabled\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/table\u0026gt;\n \u0026lt;/body\u0026gt;\n\n \u0026lt;script type=\"text/javascript\"\u0026gt;\n $(\"#calculate\").click(function () {\n var x1 = $(\"#price\").val();\n var y1,y2,y3,y4;\n\n if (x1 \u0026lt;= 50000) {\n y1=x1*0.005; //Provinical\n y2=x1*0.005; //Toronto\n y3=y1+y2;\n }\n else if (x1 \u0026lt;= 250000) {\n y1=(x1*0.01)-275; //Provinical\n y2=y1; //Toronto\n y3=y1+y2;\n }\n else if (x1\u0026lt;=400000) {\n y1=(x1*0.015)-1525; //Provinical\n y2=(x1*0.01)-275; //Toronto\n y3=y1+y2;\n }\n else if (x1\u0026gt;=400001) {\n y1=(x1*0.02)-3525;\n y2=y1-750;\n y3=y1+y2;\n }\n\n $(\"#rebate\").val(y4);\n $(\"#final\").val(y3);\n $(\"#toronto\").val(y2);\n $(\"#provincal\").val(y1);\n });\n \u0026lt;/script\u0026gt;\n\u0026lt;/html\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"19456707","answer_count":"3","comment_count":"2","creation_date":"2013-10-18 18:19:20.343 UTC","last_activity_date":"2017-07-23 07:09:34.473 UTC","last_edit_date":"2013-10-18 18:52:56.813 UTC","last_editor_display_name":"","last_editor_user_id":"1281907","owner_display_name":"","owner_user_id":"2868207","post_type_id":"1","score":"0","tags":"javascript|jquery","view_count":"140"} {"id":"47392795","title":"Applying Interaction EventTrigger for every Control of Type in a View","body":"\u003cp\u003eI have a view where I handle the whole navigation of the application. Now I want to add an \u003ccode\u003eEventTrigger\u003c/code\u003e to all the controls of type \u003ccode\u003e\u0026lt;vw:NavigationRadioButton/\u0026gt;\u003c/code\u003e \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;vw:NavigationRadioButton Text=\"Frisse Conche\" RegionName=\"MainRegion\" ViewName=\"PanoramaFrisse\"\u0026gt;\n \u0026lt;i:Interaction.Triggers\u0026gt;\n \u0026lt;i:EventTrigger EventName=\"PreviewMouseDown\"\u0026gt;\n \u0026lt;i:InvokeCommandAction Command=\"{Binding Path=CheckRecipeChangedCommand, Source={vw:AdapterBinding RecipeAdapter}}\" CommandParameter=\"MainRegion;PanoramaFrisse\"/\u0026gt;\n \u0026lt;/i:EventTrigger\u0026gt;\n \u0026lt;/i:Interaction.Triggers\u0026gt;\n\u0026lt;/vw:NavigationRadioButton\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAlso, if thats possible: I want to pass the value of the properties \u003ccode\u003eRegionName\u003c/code\u003e and \u003ccode\u003eViewName\u003c/code\u003e to my command (as I did manually in this example)\u003c/p\u003e\n\n\u003cp\u003eIf thats possible, how can I accomplish this?\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2017-11-20 13:07:31.607 UTC","last_activity_date":"2017-11-20 18:45:02.007 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2877820","post_type_id":"1","score":"0","tags":"c#|wpf|interaction","view_count":"31"} {"id":"16451909","title":"How to embed a TextField into a Movie Clip","body":"\u003cp\u003eI have a textfield I've positioned within another movieclip using the flash ide. In the library the textfield is clearly visible with a prevalue of 88 set there. When I run the swf the text field isn't there. \u003c/p\u003e\n\n\u003cp\u003eAs I'm exporting a Piece symbol from flash, my approach has been to look for the object (TextField) in the displayobject container. When I break inside loopStage(this) I have the reference to the textfield i positioned in the editor and can see the prevalue I set there \"88\". \u003c/p\u003e\n\n\u003cp\u003eCan anyone see why I can't see the text field but when debugging can see the reference?\u003c/p\u003e\n\n\u003cp\u003eFor more info - the textfield sits in its own layer and is on the stage for all frames in the movie clip.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e public class Piece extends MovieClip \n {\n\n public function Piece() \n {\n loopStage(this);\n }\n\n public function loopStage(dOC:DisplayObjectContainer)\n {\n var child:TextField = dOC.getChildAt(1) as TextField;\n _child = child;\n\n draw();\n }\n public var _child:TextField;\n\n public function draw():void\n {\n _child.text = \"1234\";\n }\n\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e\n\n\u003cp\u003eEdit: Thanks for all comments guys! Much appreciated...\u003c/p\u003e\n\n\u003cp\u003eFont embedding was done incorrectly on my part - what made the difference was after I filled the embed font dialog and gave it a name \"Abc\" - i forgot to select \"Abc\" from the font list and apply it to the TextField. Gah!\u003c/p\u003e\n\n\u003cp\u003eHappy to mark that answer as correct thanks again! :)\u003c/p\u003e","accepted_answer_id":"16458268","answer_count":"2","comment_count":"2","creation_date":"2013-05-08 23:30:23.003 UTC","last_activity_date":"2013-05-09 09:13:37.28 UTC","last_edit_date":"2013-05-09 02:36:36.537 UTC","last_editor_display_name":"","last_editor_user_id":"887050","owner_display_name":"","owner_user_id":"887050","post_type_id":"1","score":"0","tags":"actionscript-3|flash","view_count":"97"} {"id":"40556980","title":"Flexbox wrapping without specific height","body":"\u003cp\u003eI have an html structure that I would like to display in different ways for smaller and bigger screens, like so:\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003e\u003cem\u003eBigger screens\u003c/em\u003e\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e ----------- ------------------------------ -----------\n| | | Section A | | |\n| | ------------------------------ | |\n| Section B | | Section D | | Section C |\n| | ------------------------------ | |\n| | | Section E | | |\n ----------- ------------------------------ -----------\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003e\u003cem\u003eSmaller screens\u003c/em\u003e\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e ------------------------------ \n| Section A |\n ------------------------------ \n| Section B |\n ------------------------------ \n| Section C | \n ------------------------------ \n| Section D | \n ------------------------------ \n| Section E | \n ------------------------------ \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch1\u003eWhat I currently have\u003c/h1\u003e\n\n\u003cp\u003eI managed to get something very similar:\u003c/p\u003e\n\n\u003cp\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-css lang-css prettyprint-override\"\u003e\u003ccode\u003e#container {\r\n display: flex;\r\n flex-direction: column;\r\n}\r\n.section {\r\n background: gray;\r\n flex: 1; order: 1;\r\n}\r\n.pull {\r\n background: lightblue;\r\n}\r\n\r\n@media screen and (min-width: 1000px) {\r\n #container {\r\n flex-wrap: wrap;\r\n }\r\n \r\n .section {\r\n order: 2;\r\n width: 80%;\r\n flex: 1 0 25%;\r\n }\r\n \r\n .pull {\r\n width: 10%;\r\n flex: 0 0 100%;\r\n }\r\n .left {\r\n order:1;\r\n }\r\n .right {\r\n order:3;\r\n }\r\n}\r\n\r\n* {\r\n margin: 0;\r\n padding: 0;\r\n box-sizing: border-box;\r\n}\r\n\r\nhtml,\r\nbody,\r\n#container {\r\n height: 100%;\r\n width: 100%;\r\n}\u003c/code\u003e\u003c/pre\u003e\r\n\u003cpre class=\"snippet-code-html lang-html prettyprint-override\"\u003e\u003ccode\u003e\u0026lt;div id=\"container\"\u0026gt;\r\n \u0026lt;div class=\"section\"\u0026gt;Section A\u0026lt;/div\u0026gt;\r\n \u0026lt;div class=\"section pull left\"\u0026gt;Section B\u0026lt;/div\u0026gt;\r\n \u0026lt;div class=\"section pull right\"\u0026gt;Section C\u0026lt;/div\u0026gt;\r\n \u0026lt;div class=\"section\"\u0026gt;Section D\u0026lt;/div\u0026gt;\r\n \u0026lt;div class=\"section\"\u0026gt;Section E\u0026lt;/div\u0026gt;\r\n\u0026lt;/div\u0026gt;\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/p\u003e\n\n\u003ch1\u003eAnd the problem is..\u003c/h1\u003e\n\n\u003cp\u003eI need to get this layout working \u003cem\u003eregardless\u003c/em\u003e of height in \u003cem\u003eeither\u003c/em\u003e sections. See a demonstration of the issue:\u003c/p\u003e\n\n\u003cp\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"true\" data-console=\"true\" data-babel=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code snippet-currently-hidden\"\u003e\r\n\u003cpre class=\"snippet-code-css lang-css prettyprint-override\"\u003e\u003ccode\u003e.bigtext { height: 500px; background: red }\r\n#container {\r\n display: flex;\r\n flex-direction: column;\r\n}\r\n.section {\r\n background: gray;\r\n flex: 1; order: 1;\r\n}\r\n.pull {\r\n background: lightblue;\r\n}\r\n\r\n@media screen and (min-width: 1000px) {\r\n #container {\r\n flex-wrap: wrap;\r\n }\r\n \r\n .section {\r\n order: 2;\r\n width: 80%;\r\n flex: 1 0 25%;\r\n }\r\n \r\n .pull {\r\n width: 10%;\r\n flex: 0 0 100%;\r\n }\r\n .left {\r\n order:1;\r\n }\r\n .right {\r\n order:3;\r\n }\r\n}\r\n\r\n* {\r\n margin: 0;\r\n padding: 0;\r\n box-sizing: border-box;\r\n}\r\n\r\nhtml,\r\nbody,\r\n#container {\r\n height: 100%;\r\n width: 100%;\r\n}\u003c/code\u003e\u003c/pre\u003e\r\n\u003cpre class=\"snippet-code-html lang-html prettyprint-override\"\u003e\u003ccode\u003e\u0026lt;div id=\"container\"\u0026gt;\r\n \u0026lt;div class=\"section\"\u0026gt;Section A\u0026lt;/div\u0026gt;\r\n \u0026lt;div class=\"section pull left\"\u0026gt;Section B\u0026lt;/div\u0026gt;\r\n \u0026lt;div class=\"section pull right\"\u0026gt;Section C\u0026lt;/div\u0026gt;\r\n \u0026lt;div class=\"section\"\u0026gt;\u0026lt;div class=\"bigtext\"\u0026gt;hi\u0026lt;/div\u0026gt;\u0026lt;/div\u0026gt;\r\n \u0026lt;div class=\"section\"\u0026gt;Section E\u0026lt;/div\u0026gt;\r\n\u0026lt;/div\u0026gt;\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/p\u003e\n\n\u003cp\u003eOn smaller screens, sections should always be stacked on top of each other.\u003c/p\u003e\n\n\u003cp\u003eOn bigger screens, each section should take the height of its descendants, without harming the structure. That is true for the side columns (sections B and C) that should always stick to the sides, as well as the middle sections (A, D, E) that should alway appear in that order on top of each other.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eI should note that scrolling on the page should be possible, if the height of sections (in total) is bigger than viewport, as one would expect in a regular web page.\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eI did not manage to do that. I hope anyone here can help me out.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-11-11 22:06:50.82 UTC","last_activity_date":"2016-11-12 03:14:15.033 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7148006","post_type_id":"1","score":"1","tags":"css|flexbox","view_count":"47"} {"id":"42907930","title":"Sync-DlmDatabaseSchema just hangs mid execution","body":"\u003cp\u003eI am trying to use RedGate's DLM Automation scripts to update a database in development after we restore from the previous nights backup. The command is executing fine, the schema validation on the temporary database passes. Then it tries to apply the schema from Source Control to the restored database, and when it gets to a particular View the execution just stops. There are no error messages, and all activity is halted. \u003c/p\u003e\n\n\u003cp\u003eWhat's worse is that it leaves the database bricked - so i have to restore again from the backup\u003c/p\u003e\n\n\u003cp\u003eThis is a snippet of our powershell script:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etry\n{\n if($validatedSchema -ne $null)\n {\n Sync-DlmDatabaseSchema -Source $validatedSchema -Target $trunkdb -AbortOnWarningLevel None -SQLCompareOptions \"NoTransactions\" -Verbose -ErrorAction Stop\n }\n else\n {\n throw \"The schema validation object is null, so we cannot attempt a synchronisation at this point.\" ;\n }\n}\ncatch\n{\n Write-Host \"An error occured synching the database\";\n throw $_.Exception;\n};\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWe know that the command has to run without transactions, but we have the stop on error switched on, and i'm pretty sure any exception should get caught, and then re-thrown\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-03-20 15:42:39.987 UTC","last_activity_date":"2017-03-20 15:42:39.987 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"175085","post_type_id":"1","score":"0","tags":"sql|powershell|redgate","view_count":"14"} {"id":"27833154","title":"Git Project Sharing in Android Studio","body":"\u003cp\u003eHow to share git project in android studio? In Eclipse, we can share Team -\u003e Share Prjects . But I don't know how to share in android sudio on mac platforms. I want to share via local network with ssh.When I checkout other branch,all code are not change ,showing previous branch code. \u003c/p\u003e","accepted_answer_id":"27833963","answer_count":"1","comment_count":"1","creation_date":"2015-01-08 04:49:35.127 UTC","favorite_count":"1","last_activity_date":"2015-01-12 08:55:16.283 UTC","last_edit_date":"2015-01-12 08:55:16.283 UTC","last_editor_display_name":"","last_editor_user_id":"134130","owner_display_name":"","owner_user_id":"134130","post_type_id":"1","score":"1","tags":"android|git|android-studio","view_count":"168"} {"id":"1240060","title":"Google maps not being interactive","body":"\u003cp\u003eHey, I just started using Google maps, and am having a problem. Adding overlays is working fine. If I add controls (zoom, left/right etc.), they are also working fine. But Googlemaps isn't allowing me to drag, even if I set map.enableDragging(). It also won't respond to any of my GEvent.addListeners. I've looked on other sites, and there's supposed to be a hand icon on mouseover to drag and click and such, and all I have is my pointer. Am I doing something wrong? Parts of my code:\u003c/p\u003e\n\n\u003cp\u003eThe declaration of the map. EnableDragging is supposed to be default, and it's not even working when I call the function to set it to true.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Boozemap.map = new GMap2( $('#map_mapholder').get(0));\n Boozemap.map.enableDragging();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe function to add a marker, which makes the marker show up, but not be interactive:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eBoozemap.addBCMarker = function(lat, lng)\n{\n var point = new GLatLng(lat, lng);\n var icon = new GIcon();\n\n icon.image = absoluteFilepath(\"images/fstar.png\");\n icon.iconSize = new GSize(25, 25);\n icon.iconAnchor = new GPoint(140, 25);\n\n var bcmarker = new GMarker(point, icon);\n\n GEvent.addListener(bcmarker, 'click', function(){alert('clicked!')});\n\n Boozemap.map.addOverlay(bcmarker);\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAny and all help would be lovely, thanks!\u003c/p\u003e","accepted_answer_id":"1240226","answer_count":"1","comment_count":"3","creation_date":"2009-08-06 16:31:28.183 UTC","last_activity_date":"2009-08-06 17:09:44.363 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"115593","post_type_id":"1","score":"1","tags":"javascript|google-maps","view_count":"756"} {"id":"21253949","title":"Save Same Value As Of Its Identity Column","body":"\u003cp\u003eI have two forms - Credit.aspx \u0026amp; Debit.aspx. Both use the same table. The former saves only credit records and the latter-debit.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eTABLE:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eCOLUMN DATATYPE\n------------------\n ID int\n RefID int\n Credit Decimal\n Debit Decimal\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eID is an AutoIdentity column. \nUsing C# to save data. \u003c/p\u003e\n\n\u003cp\u003eOnly, When saving a \u003cstrong\u003ecredit record\u003c/strong\u003e, I would like to save the ID as also its RefID. The Credit form can save single or many records at a time. If the data type was GUID, we would have known beforehand and is easy, but now is not the case.\u003c/p\u003e\n\n\u003cp\u003eThe expected output would be\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eID RefID Credit Debit\n-------------------------\n9 9 2.0 0.0\n10 10 3.0 0.0\n11 9 0.0 1.0\n12 9 0.0 4.0\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo, is it possible. \nGetting the max(ID) doesnt seem like a good idea to me. \u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2014-01-21 09:25:31.343 UTC","last_activity_date":"2014-01-21 10:28:55.723 UTC","last_edit_date":"2014-01-21 10:28:55.723 UTC","last_editor_display_name":"","last_editor_user_id":"2474175","owner_display_name":"","owner_user_id":"2183586","post_type_id":"1","score":"0","tags":"c#|asp.net|sql","view_count":"56"} {"id":"9844741","title":"How to set up permissions after hg clone on remote server?","body":"\u003cp\u003eI am new to DVCS, but I have finally managed to figure out how it works, I would first like to check if the above steps in my workflow are the logical ones:\u003c/p\u003e\n\n\u003cp\u003eSteps: locally do: \u003ccode\u003ehg init\u003c/code\u003e, add and modify files, \u003ccode\u003ehg add .\u003c/code\u003e, \u003ccode\u003ehg commit\u003c/code\u003e \u003ccode\u003ehg push path_to_my_ repo\u003c/code\u003e; then go on remote server and do \u003ccode\u003ehg init\u003c/code\u003e, \u003ccode\u003ehg clone path_to_my_ repo\u003c/code\u003e and \u003ccode\u003ehg update\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003e(clone directly in dev.domain.com as the repo content extracts in a directory, is this OK?!)\u003c/p\u003e\n\n\u003cp\u003eProblem: I do get my files on the remote server, they are all there, but \u003cstrong\u003eI can't edit any of them through my FTP\u003c/strong\u003e/SFTP client? I can't edit anything in these added folders so it must be a permissions issue.\u003c/p\u003e\n\n\u003cp\u003eI have tried ls -al proj1/:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edrwxr-xr-x 3 root root 4096 Mar 23 15:26 ./\ndrwxr-x--- 18 moove nobody 4096 Mar 23 15:26 ../\ndrwxr-xr-x 3 root root 4096 Mar 23 15:26 .hg/\n-rw-r--r-- 1 root root 40272 Mar 23 15:26 wp-app.php\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd chown root:root proj1 but this didn't resolve the problem.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eAny advices please?\u003c/strong\u003e\u003c/p\u003e","accepted_answer_id":"9846038","answer_count":"1","comment_count":"4","creation_date":"2012-03-23 18:38:38.127 UTC","last_activity_date":"2012-03-24 09:58:57.077 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1016900","post_type_id":"1","score":"0","tags":"unix|mercurial|centos|file-permissions","view_count":"630"} {"id":"24841165","title":"I have a serious issue about Python scripting in Blender","body":"\u003cp\u003eRecently I have started to build up a 3D game engine using mainly C++ and OpenGL, but I would like to write a script in Python to export some objects from the actual scene to a file. Everything has been succeeded, except I have some issue about how does the Python API works with objects and different types of objects?\u003c/p\u003e\n\n\u003cp\u003eCode:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efor Lampa in Lamp.Get(): # In this case we are working with lamps\n Lampatipus=Lampa.getType()\n if Lampa.getParent()==Targy\\ # Objects have parents in blender, but it shows error that lamps doesn't have functions like getParent()\n and Lampatipus==\"Lamp\":\n\n self.file.write(Lampa.getName())\n self.file.write(\"\\00\")\n\n # Lampa beallitasai\n\n Lampa_alap_tomb=array('f', [\\\n Lampa.LocX, # Shows error message that lamps doesnt have position x...\n Lampa.LocY,\n Lampa.LocZ,\n Lampa.R,\n Lampa.G,\n Lampa.B,\n Lampa.getEnergy()/10.0,\n Lampa.color[0],\n Lampa.color[1],\n Lampa.color[2],\n Lampa.color[3]\\\n ])\nLampa_alap_tomb.tofile(self.file)\n\n# Another case:\n\nfor Lampa in Jelenet.objects: # In this case we are working with objects\n Lampatipus=Lampa.getType()\n if Lampa.getParent()==Targy\\ # no problem here\n\n self.file.write(Lampa.getName())\n self.file.write(\"\\00\")\n\n # Lampa beallitasai\n\n Lampa_alap_tomb=array('f', [\\\n Lampa.LocX,\n Lampa.LocY,\n Lampa.LocZ,\n Lampa.R, # Shows error message that objects doesnt have R (red component of color of a light)\n Lampa.G,\n Lampa.B,\n Lampa.getEnergy()/10.0,\n Lampa.color[0],\n Lampa.color[1],\n Lampa.color[2],\n Lampa.color[3]\\\n ])\n Lampa_alap_tomb.tofile(self.file)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eEND OF CODE!!\u003c/p\u003e\n\n\u003cp\u003eFor example, if I would like to go through all lamps and write some of their properties into a file, (name, color, parent object, etc.) some of a lamp's properties aren't recognized by Python as variables used by different objects. The same thing happens if I go through every objects and first get the type of the object (which is actually a lamp), but the console shows up an error message showing that for example spot radius or anything else is not an attribute of a \"Blender Object\". In the previous case I have explained that the Python doesn't realize that a \"Blender Lamp\" is actually a \"Blender Object\", but \"Blender Lamp\"s should also keep their original properties inherited from \"Blender Object\"s as I think. Because in Blender, whatever type an object has, it has a position rotation, scale and etc. So far, as you know every lamp has position (like objects have) and also light properties (light color etc.) But if I would like to get the position of a Blender Lamp, it doesn't work, because it shows that kind of a lamp is not an object but in Blender a lamp also have location and everything like normal objects. I also didn't find references to positions of lights in Blender 2.49 python api documentation.\u003c/p\u003e\n\n\u003cp\u003ePlease Help!\nThanks in advance...\u003c/p\u003e\n\n\u003cp\u003eP. S. sorry for english i am from hungary and have no profession. and some of the variables i wrote in hungarian, but i hope you understand the issue. thx\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-07-19 13:59:09.35 UTC","last_activity_date":"2014-07-20 10:13:10.217 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3855974","post_type_id":"1","score":"1","tags":"python|class|scripting|blender","view_count":"466"} {"id":"46033903","title":"Implent smart app banner similar Amazon","body":"\u003cp\u003eI would like to implement a smartbanner similar Amazon in Android.\u003c/p\u003e\n\n\u003cp\u003eI know how to implement the native smartbanner, but I would like to create one in javascript that:\n- if the app is installed open the app\n- else open play store\u003c/p\u003e\n\n\u003cp\u003eBy browser i cant't know if the app is installed but amazon can do it...\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-09-04 09:16:02.563 UTC","last_activity_date":"2017-09-04 10:01:00.177 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3455676","post_type_id":"1","score":"-1","tags":"javascript|smartbanner","view_count":"34"} {"id":"36172037","title":"User Interface Problems - CSS","body":"\u003cp\u003eI'm currently working on a flash project using external interface and I'm able to get this \u003ca href=\"http://codepen.io/rginnow/pen/mwFpC\" rel=\"nofollow\"\u003einterface to display\u003c/a\u003e. However when I try to type something in the input field, it doesn't allow me to click on the field or on the buttons. So I did some digging around and found out that maybe this is what's causing it.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e .panel {\n background: #000;\n padding: 10px;\n width: 45%;\n height: 200px;\n position: absolute;\n top: 10px;\n z-index: -1;\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI tried changing \u003ccode\u003ez-index\u003c/code\u003e to \u003ccode\u003e1\u003c/code\u003e and it allowed me to type but at the same time, it seems to mess up the interface. Does anyone have a fix for this?\u003c/p\u003e\n\n\u003cp\u003eOne more thing, whenever I click on a option like \u003ccode\u003echange password\u003c/code\u003e the panel opens up, but when I click on it again, it doesn't close but instead slides right back up.\u003c/p\u003e\n\n\u003cp\u003eI'm no expert when it comes to CSS so I'm hoping someone can help me out with this.\u003c/p\u003e","accepted_answer_id":"36172166","answer_count":"4","comment_count":"0","creation_date":"2016-03-23 07:24:52.067 UTC","last_activity_date":"2016-03-23 07:43:25.533 UTC","last_edit_date":"2016-03-23 07:32:30.063 UTC","last_editor_display_name":"","last_editor_user_id":"1517735","owner_display_name":"","owner_user_id":"6102813","post_type_id":"1","score":"0","tags":"jquery|html|css","view_count":"39"} {"id":"5972679","title":"Is there any .NET string.format compatible function for Delphi win32?","body":"\u003cp\u003eIs there any .NET string.format compatible function for Delphi Win32 ?\u003c/p\u003e\n\n\u003cp\u003eI want to use it's argument order syntax.\u003c/p\u003e\n\n\u003cp\u003eI found \u003ca href=\"http://www.delphi3000.com/articles/article_3909.asp\" rel=\"nofollow\"\u003eone\u003c/a\u003e at delphi3000.com, but it's pretty simple and without supporting number precition, etc.\u003c/p\u003e\n\n\u003cp\u003eDon't you know any better open-source implementation ?\u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","accepted_answer_id":"6001444","answer_count":"1","comment_count":"8","creation_date":"2011-05-12 02:23:05.997 UTC","last_activity_date":"2011-05-14 11:16:16.3 UTC","last_edit_date":"2011-05-14 11:16:16.3 UTC","last_editor_display_name":"","last_editor_user_id":"26736","owner_display_name":"","owner_user_id":"26736","post_type_id":"1","score":"4","tags":"delphi|formatting","view_count":"403"} {"id":"21473995","title":"How to handle failed XPATH lookup in MSXML from AutoIT?","body":"\u003cp\u003eI am parsing a piece of XML returned from a Web API. I am looking for a particular node. If that node does not exist, according to the \u003ca href=\"http://msdn.microsoft.com/en-us/library/ms757846%28v=vs.85%29.aspx\" rel=\"nofollow\"\u003eMSXML documentation\u003c/a\u003e, it returns null.\u003c/p\u003e\n\n\u003cp\u003eThe problem is, I don't know how to check for null in AutoIT. I have read the \u003ca href=\"http://www.autoitscript.com/autoit3/docs/keywords/Null.htm\" rel=\"nofollow\"\u003eonline API doc for Null\u003c/a\u003e, but when I run the script using AutoIt3Wrapper v.2.1.2.9, it does not recognize null.\u003c/p\u003e\n\n\u003cp\u003eHere is a sample script to show what I mean:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$oXMLDOM = ObjCreate(\"Msxml2.DOMDocument.3.0\")\n$xml = '\u0026lt;response\u0026gt;\u0026lt;error code=\"1\"\u0026gt;\u0026lt;![CDATA[ Incorrect password or username ]]\u0026gt;\u0026lt;/error\u0026gt;\u0026lt;/response\u0026gt;'\n$oXMLDOM.loadXML($xml)\n$node = $oXMLDOM.selectSingleNode(\"/response/error\")\nMsgBox(0, \"\", $node.text) ;; No problems\n$node = $oXMLDOM.selectSingleNode(\"/response/token\")\n;; $node should be 'null' now; how do I check that in AutoIT?\nMsgBox(0, \"\", $node.text) ;; Fails horribly\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"21512998","answer_count":"2","comment_count":"0","creation_date":"2014-01-31 06:41:50.217 UTC","last_activity_date":"2014-02-02 16:33:58.39 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"274354","post_type_id":"1","score":"0","tags":"autoit|msxml","view_count":"534"} {"id":"11279736","title":"Logo Animation - Don't know where to begin","body":"\u003cp\u003eI'm trying to have a cool little animation for my logo when it first appears on my Android App screen.\u003c/p\u003e\n\n\u003cp\u003eI have completely no idea how I would implement this idea though, OpenGL, Make a video and import it into an activity, other options?\u003c/p\u003e\n\n\u003cp\u003eHere is what I would like to accomplish:\n\u003cimg src=\"https://i.stack.imgur.com/UF37J.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eStep 1: Start the bottom line of the triangle\nStep 2: Start going up and back down and connect\nStep 3: Have my custom logo fade into the triangle\u003c/p\u003e\n\n\u003cp\u003eAm I going out of my way trying to learn how to do this, or am I better off just having my logo show up as an image?\u003c/p\u003e","accepted_answer_id":"11897603","answer_count":"2","comment_count":"2","creation_date":"2012-07-01 05:07:28.437 UTC","last_activity_date":"2013-02-12 12:19:48.26 UTC","last_edit_date":"2013-02-12 12:19:48.26 UTC","last_editor_display_name":"","last_editor_user_id":"1720391","owner_display_name":"","owner_user_id":"1193321","post_type_id":"1","score":"1","tags":"android|opengl-es|android-animation","view_count":"858"} {"id":"33005260","title":"How to introduce a new variable in Coq?","body":"\u003cp\u003eI was wondering if there is a way to introduce an entirely new variable during the proof of a theorem in Coq?\u003c/p\u003e\n\n\u003cp\u003eFor a complete example, consider the following property \u003ca href=\"http://www.cis.upenn.edu/~bcpierce/sf/current/Prop.html\" rel=\"nofollow\"\u003efrom here\u003c/a\u003e about the evenness of the length of a list.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eInductive ev_list {X:Type}: list X -\u0026gt; Prop :=\n | el_nil : ev_list []\n | el_cc : forall x y l, ev_list l -\u0026gt; ev_list (x :: y :: l).\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow I want to prove that for any list \u003ccode\u003el\u003c/code\u003e if its \u003ccode\u003elength\u003c/code\u003e is even, then \u003ccode\u003eev_list l\u003c/code\u003e holds:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eLemma ev_length__ev_list': forall X (l : list X), ev (length l) -\u0026gt; ev_list l.\nProof.\n intros X l H.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ewhich gives:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e1 subgoals\nX : Type\nl : list X\nH : ev (length l)\n______________________________________(1/1)\nev_list l\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow, I'd like to \"define\" a new free variable \u003ccode\u003en\u003c/code\u003e and a hypothesis \u003ccode\u003en = length l\u003c/code\u003e. In hand-written math, I think we can do this, and then do induction about \u003ccode\u003en\u003c/code\u003e. But is there a way to do the same in Coq?\u003c/p\u003e\n\n\u003cp\u003eNote. the reasons I ask are that:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003e\u003cp\u003eI don't want to introduce this \u003ccode\u003en\u003c/code\u003e artificially into the statement of the theorem itself, as is done in the page linked earlier, which IMHO is unnatural. \u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eI tried to \u003ccode\u003einduction H.\u003c/code\u003e, but it seems not working. Coq wasn't able to do case analysis on \u003ccode\u003elength l\u003c/code\u003e's \u003ccode\u003eev\u003c/code\u003e-ness, and no induction hypothesis (IH) was generated.\u003c/p\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","accepted_answer_id":"33005343","answer_count":"3","comment_count":"0","creation_date":"2015-10-08 01:44:46.92 UTC","favorite_count":"2","last_activity_date":"2015-10-08 16:10:57.683 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"683218","post_type_id":"1","score":"2","tags":"coq|coq-tactic","view_count":"933"} {"id":"38318410","title":"Facebook PHP SDK login and localhost","body":"\u003cp\u003eI am trying to set FB SDK to work in my localhost. I made a test App and set it site URL and App Domain to \u003ca href=\"http://localhost\" rel=\"nofollow\"\u003ehttp://localhost\u003c/a\u003e, but it doesn't work. I see this error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eURL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs.\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eIs there a way FB SDK work on localhost ? I see another questions here, but same solutions does not work\u003c/p\u003e","answer_count":"2","comment_count":"3","creation_date":"2016-07-12 00:58:03.357 UTC","last_activity_date":"2016-08-04 19:27:27.847 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5849229","post_type_id":"1","score":"0","tags":"php|facebook|sdk|facebook-javascript-sdk|facebook-php-sdk","view_count":"513"}