texts
sequence | tags
sequence |
---|---|
[
"Getting Data from PAC file",
"Is it possible to execute the Javascript in a PAC file from a .Net windows application to return the proxy server?"
] | [
"c#",
".net",
"web"
] |
[
"Sinatra app - Where to place Zurb Foundation?",
"I am following this sinatra recipe (Foundation framework + Compass) and have always been unsure, when implementing foundation, of where I should place these files.\n\nMy Sinatra app has the structure:\n\nsinatra_app/\n|\n|----app/\n|----config/\n|----models/\n|----views/\n|----etc...\n\n\nBy running foundation new project_name from sinatra_app, I have folder project_name within my app.\n\nI'm just a bit confused if I should just name this folder 'foundation' and have it build out the assets accordingly.\n\nOr should it actually live outside of my sinatra app and have compass build the assets into the sinatra app folder structure?\n\nFrom the tutorial, it seems as though all of the foundation files just live in the actual root of the sinatra app which doesn't seem like it would be good at all? (with all those extra files generated by foundation - humans.txt, index.html, README.md etc etc)"
] | [
"ruby",
"sinatra",
"zurb-foundation",
"sinatra-assetpack"
] |
[
"Restart or reverse code in jQuery",
"I have this code here:\n\nBefore reading, most of the code isn't relevant to the question but it might make it easier to understand what I'm trying to do, if it's possible or not. \n\n $(document).ready(function(){\n\n AnimateRotate(360, \"#box\", 0)\n $(\"#box\").animate({ \n\n top: ((sheight/2)-282)+\"px\",\n left: ((swidth/2)-307)+\"px\",\n width: \"350px\",\n height: \"200px\"\n\n\n\n }, 2000, function(){\n\n $('<div>', { id: 'details' }).appendTo('#box').fadeIn(1500)\n\n $('<input />',{ \"class\" : \"name\" }).appendTo(\"#box\").fadeIn(1500)\n $('.name').val($('.name').val() + 'Enter Name here');\n\n $('<input />',{ \"class\" : \"numb\" }).appendTo(\"#box\").fadeIn(1500)\n $('.numb').val($('.numb').val() + 'Enter Age here');\n\n $('<input type=\"button\" value=\"Submit\">').fadeIn(1500).appendTo(this) \n .click(function(){ \n\n $(this).remove();\n\n num = $(\"#box\").find(\".numb\").val();\n nam = $(\"#box\").find(\".name\").val();\n\n $(\"#box\").find(\".numb\").remove();\n $(\"#box\").find(\".name\").remove();\n $(\"#details\").remove();\n\n AnimateRotate(-360, \"#box\", 0)\n\n $(\"#box\").animate({ \n\n top: \"150px\",\n left: \"100px\",\n width:\"0px\",\n height: \"0px\",\n padding:\"0px\"\n\n\n }, 2000, function(){\n\n\n //AnimateRotate(360, \"#box\", 2000)\n\n if (num>0 && num<110 && /^\\D+$/.test(nam)) {\n\n\n\n $(\"#box\").delay(2000).animate({ \n\n top: \"0px\",\n left: \"0px\",\n width: (swidth-100)+\"px\",\n height: (sheight-100)+\"px\",\n padding: \"20px\",\n margin: \"20px\"\n\n\n\n }, 2000, function(){\n\n\n $(\"#box\").append('<span class=\"title\">BizAppliance</span>')\n $('<div>', { id: 'info' }).appendTo('#box')\n $(\"#info\").append('<span class=\"num\">' + nam + '</span>')\n $(\"#info\").append('<span class=\"num\"> is </span>')\n $(\"#info\").append('<span class=\"num\">' + num + '</span>')\n $(\"#info\").append('<span class=\"num\"> years old</span>')\n\n\n\n });\n\n }else{\n\n //GO BACK TO WHERE IT SAYS DOCUMENT.READY()\n\n }\n\n\n });\n\n\n });\n });\n\n\n });\n\n\nAt the bottom of my code you will see an else statement where I would like the code to restart if the input is incorrect. Is there any way of telling javascript to go back to where it says 'document.ready()'?\n\nThanks for any anhswers."
] | [
"javascript",
"jquery",
"restart"
] |
[
"Curry and closures in Scala",
"I am preparing a presentation on Scala and functional programming and I am not sure about two notions.\n\nI use a function introduced earlier during the presentation:\n\ndef safe_division(x: Int, y: Int) : Option[Double] = {\n if(y != 0)\n Some(x / y.toDouble)\n else\n None\n}\n\n\nI created a curried version (please correct me if I am wrong!):\n\nval curried_safe_division: (Int) => (Int) => Option[Double] = {\n (x) => \n (y) => \n if(y != 0)\n Some(x / y.toDouble)\n else\n None\n}\n\n\nSo the first part where I am unsure is \"is curried_safe_division called the curry?\"\n\nThen I introduce some code to show how currying functions allows a programmer to reuse functionalities efficiently:\n\nval divideSix = curried_safe_division(6)\ndivideSix(3)\n// prints: Some(2.0)\ndivideSix(6)\n// prints: Some(1.0)\n\n\nAm I right saying here that divideSix is a closure?\nIs curried_safe_division not a closure as well?\nI am using this definition:\n\n\n https://softwareengineering.stackexchange.com/a/40708\n a function that can be stored as a variable (referred to as a \"first-class function\"), that has a special ability to access other variables local to the scope it was created in.\n\n\nI read multiple resources online, the wikipedia pages and this stackoverflow question: What is a 'Closure'? but it is still not super clear"
] | [
"scala",
"closures",
"currying"
] |
[
"Get character offsets of beginning and end of selected text",
"For a given string I am able to get the selected text with\n\nvar text = window.getSelection().toString();\n\n\nand I am trying to get the character offset of the selected text. I have tried\n\nwindow.getSelection().getRangeAt(0).startOffset\n\n\nfor the character offset of the beginning of the selection and\n\nwindow.getSelection().getRangeAt(0).endOffset\n\n\nfor the character offset of the end of the selection however this gives the incorrect result.\n\nFor example, for the example string\n\nlskdjfldjf sdlkjfsdl jflsdk fjlksdjf lksdjfl sdjfl sdjflsdkjfskl\n\n\nWhen I select the first word (i.e. everything up to the first space), the beginning offset is 41 and the end offset is 51 according to the above method. The correct offsets should be 0 and 10. I feel like I am somewhat on the right track since the difference between the offsets is correct but its just the values that are wrong. Is there some way to programatically get the value that I should subtract from the offsets to get the correct offsets (41 in this case)? Or is there a better method to get the offsets of the selected text?\n\nUPDATE:\n\nHere is the larger html block where this is happening\n\n <div class=\"panel panel-default\">\n <div class=\"panel-heading\"><strong>Example {{i + 1}} of {{examples.length}}</strong></div>\n <div class=\"panel-body\">\n <div (mouseup)=\"showSelectedText(i)\">\n {{example.labelled}}\n </div>\n </div>\n </div>\n\n\nthis is an angular2 app. Where the function showSelectedText() contains the selection logic"
] | [
"javascript",
"angular"
] |
[
"HotChocolate GraphQL add type extension or schema at runtime",
"I want to add a new type or query extension dynamically when a back end service registers at our API anytime at runtime. So on startup in ConfigureServices we basically just have a query with one test method:\nservices.AddGraphQLServer()\n .AddQueryType(t => t.Name("Query"))\n .AddType<Query>();\n\nAfter startup I need to call AddType or AddTypeExtensionsFromString to add the new methods/types to the API. Is there an way to do this with HotChocolate?"
] | [
"asp.net-core",
"graphql",
"hotchocolate"
] |
[
"VueJS 2 $emit and $on",
"I use VueJS 2 and I really don't figure out how communicate from child component to parent.\n\nI have 2 components : Dashboad and DashboardPanel.\n\nIn DashboardPanel, I have one method :\n\nexecute () {\n // emit to parent\n this.$emit('executeSQL', this.value)\n ...\n}\n\n\nAnd in Dashboard :\n\nmounted () {\n // get event from DashboardPanel\n this.$on('executeSQL', function(value) {\n alert(value)\n })\n}\n\n\nNothing happens, I don't find in doc where to use $on and I don't know if I can use other way to achieve it ?"
] | [
"vue.js",
"vuejs2"
] |
[
"Check if string is repetition of an unknown substring",
"I'm trying to write a regex or Ruby method which will find the longest repeated pattern in a string. For example:\n\n\"abcabc\" => \"abc\" \n\"cccc\" => \"c\"\n\"abcd\" => \"abcd\"\n\n\nWhat is the best way to implement this? I naïvely tried /^(.*)*$/ but that won't work as it just matches the full string."
] | [
"ruby",
"regex"
] |
[
"Integrate ElasticSearch with MongoDB database",
"I am trying to implement search functionality in which my search will return documents which match the text typed in search bar\n\nMy MongoDB database is hosted on MongoLabs and I want ElasticSearch to search from a Collection that is available in this database.\n\nI am using express and angular and I work on Windows,so please answer accordingly.Thanks in advance"
] | [
"mongodb",
"express",
"elasticsearch",
"elasticsearch-plugin"
] |
[
"Python PyQt Setting Scroll Area",
"I am trying to make my QGroupBox scrollable once it grow higher than 400px. The contents in the QGroupBox are generated using a for loop. This is an example of how it was done.\n\nmygroupbox = QtGui.QGroupBox('this is my groupbox')\nmyform = QtGui.QFormLayout()\nlabellist = []\ncombolist = []\nfor i in range(val):\n labellist.append(QtGui.QLabel('mylabel'))\n combolist.append(QtGui.QComboBox())\n myform.addRow(labellist[i],combolist[i])\nmygroupbox.setLayout(myform)\n\n\nSince the value of val depends on some other factors, the myform layout size could not be determined. In order to solve this, i added a QScrollableArea like this.\n\nscroll = QtGui.QScrollableArea()\nscroll.setWidget(mygroupbox)\nscroll.setWidgetResizable(True)\nscroll.setFixedHeight(400)\n\n\nUnfortunately, that doesn't seems to make any effect on the groupbox. No sign of scrollbar. Am i missing somthing?"
] | [
"python",
"layout",
"pyqt",
"pyqt4",
"qscrollarea"
] |
[
"Can I create a Bluetooth RFCOMM connection in Windows 7",
"I know that in Win8.1 an explicit RFCOMM Api exist. Nevertheless I wonder whether I can create a direct RFCOMM connection also from Win7 and which API I must use. Currently I simply use SPP, which is basically 95% RFCOMM, but it directly integrates as COM port in the system when pairing."
] | [
"windows-7",
"bluetooth",
"rfcomm"
] |
[
"How to style a WPF ToggleButton like star button",
"appbar_star static resource is the designed star from modern-icons\n\nStarToggleButtonStyle\n\n<Style x:Key=\"StarToggleButtonStyle\" TargetType=\"ToggleButton\">\n <Setter Property=\"Foreground\" Value=\"White\"/>\n <Setter Property=\"BorderBrush\" Value=\"Black\"/>\n <Setter Property=\"BorderThickness\" Value=\"1\"/>\n <Setter Property=\"Template\">\n <Setter.Value>\n <ControlTemplate TargetType=\"ToggleButton\">\n <Border BorderBrush=\"{TemplateBinding BorderBrush}\" BorderThickness=\"{TemplateBinding BorderThickness}\">\n <ContentPresenter SnapsToDevicePixels=\"{TemplateBinding SnapsToDevicePixels}\"\n RecognizesAccessKey=\"True\"\n ContentTemplate=\"{TemplateBinding ContentTemplate}\"\n HorizontalAlignment=\"{TemplateBinding HorizontalContentAlignment}\"\n Margin=\"{TemplateBinding Padding}\"\n VerticalAlignment=\"{TemplateBinding VerticalContentAlignment}\" />\n </Border>\n <ControlTemplate.Triggers>\n\n </ControlTemplate.Triggers>\n </ControlTemplate>\n </Setter.Value>\n </Setter>\n</Style>\n\n\nUsage\n\n<ToggleButton cal:Message.Attach=\"Favorite($dataContext)\" Width=\"15\" Height=\"15\" Style=\"{StaticResource StarToggleButtonStyle}\" Margin=\"10,0,0,0\">\n <Rectangle Width=\"10\" Height=\"10\" Fill=\"{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ToggleButton}}}\">\n <Rectangle.OpacityMask>\n <VisualBrush Stretch=\"Fill\" Visual=\"{StaticResource appbar_star}\" />\n </Rectangle.OpacityMask>\n </Rectangle>\n </ToggleButton>\n\n\nHowever, here is what I got from the above markup:\n\n\n\nI'd like that the border follow along the content icon, and not be a square border. How to accomplish that?"
] | [
"wpf",
"expression-blend",
"wpf-style"
] |
[
"How to access an options menu item from outside the menu",
"How can an options menu item be accessed from an object outside of the menu itself? I'm trying to set an alpha value for one of the options menu items, but it's not working for some reason. The commented lines are what I tried.\n\nI've seen the following code used before, but it's not clear on where and how it should be used: \n\n Drawable drawable = item.getIcon();\n if (drawable != null) {\n drawable.mutate();\n drawable.setAlpha(1);\n }\n\n\nActivity class\n\npublic class WebviewActivity extends AppCompatActivity {\n private static final String TAG = WebviewActivity.class.getSimpleName();\n\n WebView myWebView;\n ProgressBar myProgressBar;\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.fragment_webview);\n }\n\n @Override\n protected void onStart() {\n super.onStart();\n setContentView(R.layout.fragment_webview);\n\n String url = getIntent().getStringExtra(\"url\");\n myWebView = findViewById(R.id.web_view);\n myWebView.setWebViewClient(new WebViewClient());\n WebSettings webSettings = myWebView.getSettings();\n webSettings.setJavaScriptEnabled(true);\n myWebView.loadUrl(url);\n\n myWebView.setWebChromeClient(new WebChromeClient() {\n @Override\n public void onProgressChanged(WebView view, int newProgress) {\n super.onProgressChanged(view, newProgress);\n myProgressBar.setProgress(newProgress);\n }\n });\n }\n\n private class WebViewClient extends android.webkit.WebViewClient {\n @Override\n public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request){\n String url=request.getUrl().toString();\n view.loadUrl(url);\n return true;\n }\n\n @Override\n public void onPageFinished(WebView view, String url) {\n super.onPageFinished(view, url);\n }\n }\n\n public void onBtnBackPressed() {\n if (myWebView.canGoBack()){\n myWebView.goBack();\n } else {\n onBackPressed();\n }\n }\n\n public void onBtnForwardPressed() {\n if (myWebView.canGoForward()){\n myWebView.goForward();\n } else {\n// menu.getItem(R.id.action_webbrowser_forward).setEnabled(false);\n// menu.getItem(R.id.action_webbrowser_forward).mutate();\n// menu.getItem(R.id.action_webbrowser_forward).setAlpha(1);\n }\n }\n\n @Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.web_browser, menu);\n return true;\n }\n\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n else if (item.getItemId() == R.id.action_webbrowser_back) {\n onBtnBackPressed();\n } else if (item.getItemId() == R.id.action_webbrowser_forward) {\n onBtnForwardPressed();\n }\n return super.onOptionsItemSelected(item);\n }\n}"
] | [
"java",
"android",
"android-webview",
"android-optionsmenu"
] |
[
"yii find models through related models by using having",
"For example I have two related models with MANY_MANY relation.\nNeed to find all models which name contains 'test' or in which relation model2.name contains 'test'.\n\nOn sql I wrote this query and it's what I want to get from ActiveRecord in result by using standard relations mechanism and CDbCriteria.\n\n\nSELECT \n m1.* \nFROM\n model1 m1 \n LEFT JOIN model_model mm \n ON mm.from_id = m1.id \n LEFT JOIN model2 m2 \n ON mm.to_id = m2.id \nGROUP BY m1.id \nHAVING (\n m1.name LIKE '%test%' \n OR GROUP_CONCAT(m2.name) LIKE '%test%'\n);\n\n\nSimple use Activerecord.findBySql is not good solution because I have many models such as above. So for faster combination any models a relations is prefered.\n\nWhen I use CDbCriteria.with Yii generate 2 query.\nWhen I use CDbCriteria.with with CDbCriteria.together Yii tried to select all columns from related tables, it's redundantly and may be slowly in future because number of relations can become much more than in this example.\n\nHave any idea?\n\nThanks."
] | [
"activerecord",
"yii"
] |
[
"Replace text with php using str_replace",
"Possible Duplicate:\n parse youtube video id using preg_match\n Grab the video ID only from youtube's URLs \n\n\n\n\nI use something like this now but i get a lot of errors...\n\n$video_id = $_GET['url'];\n\n$video_id = str_replace('http://www.youtube.com/watch?v=','',$video_id);\n$video_id = str_replace('&feature=related','',$video_id);\n$video_id = str_replace('&feature=fvwrel','',$video_id);\n$video_id = str_replace('&hd=1','',$video_id);\n$video_id = str_replace('&feature=relmfu','',$video_id);\n$video_id = str_replace('&feature=channel_video_title','',$video_id);\n$video_id = str_replace('&feature=list_related','',$video_id);\n$video_id = str_replace('&playnext=1','',$video_id);\n$video_id = str_replace('_player','',$video_id);\n\n\nThe problem is that youtube has multiple url variables for '&feature=' and maybe others\n\nThe only thing i want to extract from the youtube url is the unique video id\n\nex: //www.youtube.com/watch?v=lgT1AidzRWM&feature=related \n\nand nothing after the id or before\n\ncan someone help me to get it?"
] | [
"php",
"str-replace"
] |
[
"UIImageView in PopOver not changing?",
"I'm making an app and it has multiple button that when you press them it open a pop over view (using Storyboard.) The image is blank in IB (I set it that way) and my buttons are ment to populate the image view. This is the code I'm using:\n[popoverImageView setImage:[UIImage imageNamed:@\"telegraph.jpeg\"]];\nSteps (in order run)\n\n\nPopover opens\nAbove code is run\n\n\nSome notes:\nThe image is case matched.\nThe image is built-into the bundle\n\nAnyone able to shed some light?"
] | [
"objective-c",
"imageview"
] |
[
"Kafka authorization and authentication ports",
"I have read the documentation on Kafka security here: https://kafka.apache.org/documentation/#security_authz_cli\n\nand I was wondering something about the ports they use. For the authentication portion, under 7.2 Encryption and authentication using SSL, they have the statement:\n\nkafka-console-producer.sh --broker-list localhost:9093 --topic test --producer.config client-ssl.properties\nkafka-console-consumer.sh --bootstrap-server localhost:9093 --topic test --consumer.config client-ssl.properties\n\n\nfor the use cases of the console consumer and producer.\n\nFor the authorization portion, under 7.4 Authorizations and ACL, when showing on how to add to ACLs different permissions for different users, they have the phase:\n\nbin/kafka-acls.sh --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:Bob --allow-principal User:Alice --allow-host 198.51.100.0 --allow-host 198.51.100.1 --operation Read --operation Write --topic Test-topic\n\n\nSo my question is, for the \"broker-list\" and \"bootstrap-server\" variable in the authentication portion and the \"zookeeper.connect\" variable in authorization, does the port and localhost have the be the same? It isn't in the examples given and I'm trying to combine the authentication and authorization parts using SSL. Is they need to be the same or do not need to be the same, why? Any documentation / tutorial on how to do this using purely console only is appreciated. I don't want to use Kerebos."
] | [
"authentication",
"apache-kafka",
"authorization",
"kafka-consumer-api",
"kafka-producer-api"
] |
[
"Android: LeakCanary for fragments",
"I have an app with one activity and 4 fragments.\n\nI want to make sure that LeakCanary is installed correctly so I can check a suspicious memory leak in my app. I don't get anything for it so I wanted to simulate one but failed. I read on how to leak an activity but I have only one.\n\nIn MainActivity, I did the following:\n\nprivate static RefWatcher refWatcher;\npublic static RefWatcher getRefWatcher() {\n return MainActivity.refWatcher;\n}\n\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n if (LeakCanary.isInAnalyzerProcess(this)) {\n // This process is dedicated to LeakCanary for heap analysis.\n // You should not init your app in this process.\n return;\n }\n refWatcher = LeakCanary.install(getApplication());\n...\n}\n\n\nIn fragment X, I did the following:\n\n@Override\npublic void onDestroy() {\n super.onDestroy();\n RefWatcher refWatcher = MainActivity.getRefWatcher();\n refWatcher.watch(this);\n}\n\nvoid registerListener() {\n SensorManager sensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);\n Sensor sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ALL);\n sensorManager.registerListener(new SensorEventListener() {\n @Override\n public void onSensorChanged(SensorEvent sensorEvent) {\n\n }\n\n @Override\n public void onAccuracyChanged(Sensor sensor, int i) {\n\n }\n }, sensor, SensorManager.SENSOR_DELAY_FASTEST);\n}\n\n\nIn onCreate of the fragment, I did this\n\nfinal ImageView ivSort = (ImageView) v.findViewById(R.id.ivSort);\nivSort.setOnClickListener(new View.OnClickListener() {\n@Override\npublic void onClick(View v) {\n registerListener();\n Utils.selectMenuItem(((MainActivity) getActivity()).navigation.getMenu().getItem(0),(MainActivity) getActivity(),-1);\n}\n\n\nWhen my app starts, it will open fragment X. When clicking ivSort, it will register a listener and immediately move to fragment Y, assuming the lack of unregistering the listener, will cause a leak but nothing happens.\n\nPlease advice, I'm lost\nThanks\n\nEdited, went on a different approach:\n\nMainActivity's onCreate:\n\nif (LeakCanary.isInAnalyzerProcess(this)) {\n // This process is dedicated to LeakCanary for heap analysis.\n // You should not init your app in this process.\n return;\n}\nLeakCanary.install(getApplication());\nUtils.leak = this;\n\n\nadd a class Utils.java\n\npublic static Activity leak;\n\n\nAnd I changed from portrait to landscape and back. LeakCanary is sleeping.\nWhat am I missing?"
] | [
"android",
"android-fragments",
"memory-leaks",
"leakcanary"
] |
[
"SQL - Everything before a certain character; and if there character is not there",
"I have a data set and I'm trying to get everything before the comma, or the data if there is no comma. Basically I am trying to get critera1. Here's what it looks like:\n\nUser1 criteria1,criteria2,criteria3 \nUser2 criteria1\nUser3 criteria1,criteria2\n\n\nI've tried these 2 that I found I this site: \n\n,LEFT([TURFS], CHARINDEX(',', [TURFS]) - 1) AS [TURF]\n,REPLACE(LEFT(TURFS, CHARINDEX(',',TURFS)-1),',',' ')\n\n\nbut they come back with an error, and I'm guessing because some of my data rows do not have commas in them.\n\nthis is the error I get:\nMsg 537, Level 16, State 2, Line 1\nInvalid length parameter passed to the LEFT or SUBSTRING function."
] | [
"sql",
"sql-server"
] |
[
"How to save contact's images in local database while fetching contacts from phone in phonegap",
"I am fetching contacts from phone along with their images in phonegap.I have to save those images to my local database in Base64 or byte-array, So that later i can send those data to server also.\n\nI am able to convert image into Base64 but this process is synchronous.\nLet suppose i have 10 Contacts in my phone in which 5 contacts have image and rest has not.\nso when i am applying loop for saving those images,so that time contacts who have images takes time to change images to Base64 mean while contacts who doesn't have images store in database because for these 5 contacts no need to change image to Base64.\n\nSo only 5 contacts get inserted in database and i get the Base64 of those 5 contacts after completing the loop.\n\nI want that in loop untill i get the Base64 of any image, loop index should not increase by 1. As i get the Base64 of image after that i should move to next index.\n\nThis is the method which i am using for Converting any image to Base64.\n\nfunction convertImgToBase64(url, callback, outputFormat){\n alert(url);\n var canvas = document.createElement('CANVAS');\n var ctx = canvas.getContext('2d');\n var img = new Image;\n img.crossOrigin = 'Anonymous';\n img.onload = function(){\n canvas.height = img.height;\n canvas.width = img.width;\n ctx.drawImage(img,0,0);\n var dataURL = canvas.toDataURL(outputFormat || 'image/png');\n //alert(\"URL \"+url);\n //alert(\"dataURL \" + dataURL);\n alert(dataURL);\n\n callback.call(this, dataURL);\n // Clean up\n canvas = null; \n };\n img.src = url;\n }\n\n\nCan anyone please help me."
] | [
"image",
"cordova",
"base64",
"phonegap-plugins"
] |
[
"How to debug Android's Unable to resume activity error?",
"I'm getting an error in main thread:\n\njava.lang.RuntimeException: Unable to resume activity {...}:\njava.lang.NullPointerException`\n\n\nHowever, there is no user code in the stack trace:\n\nandroid.app.ActivityThread.performResumeActivity(ActivityThread.java:2812)\nandroid.app.ActivityThread.handleResumeActivity(ActivityThread.java:2841)\nandroid.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2276)\nandroid.app.ActivityThread.access$800(ActivityThread.java:144)\nandroid.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)\nandroid.os.Handler.dispatchMessage(Handler.java:102)\nandroid.os.Looper.loop(Looper.java:136)\nandroid.app.ActivityThread.main(ActivityThread.java:5146)\njava.lang.reflect.Method.invokeNative(Native Method)\njava.lang.reflect.Method.invoke(Method.java:515)\ncom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)\ncom.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)\ndalvik.system.NativeStart.main(Native Method)\n\n\nI'm not sure where this is originating from as I'm just hitting the Thread.setDefaultUncaughtExceptionHandler method. All I know is that it's a null pointer exception. I've changed many things since the last build, so I have no idea where this is thrown. How can I debug this error when there's no user code? I've got nothing that can throw in onResume either:\n\n@Override\nprotected void onResume() {\n instance = this;\n super.onResume();\n}\n\n\nThe onResume method is being hit, and is executed to the end without an exception. How do I debug the error?"
] | [
"android",
"android-activity",
"nullpointerexception"
] |
[
"How to handle keyboard behaviour for chat screen in android",
"Below is the requirement for chat screen :\n1.) Show last message by default when the screen comes.\n2.) If I am on the last msg, and click inside message box, message box should be scrolled up and the last message should be shown above this box. Header shouldn't be gone. \n3.) If I m in between the chat messages, and click inside message box, then only message box should be above side of keyboard, not the message list. Please keep in mind that header should be visible in all cases. Header is a RelativeLayout.\n\nBelow are some of the screens required to analyze the requirement :\n\n\n\n\n\nHere is some portion of code I am doing to handle softkeypad behaviour:\n\nHere is the code related to :\nThis is the code for sendbox OnClick :\n\ncase R.id.editEmojicon : {\n\n if (messagesItems != null && messagesItems.size() > 0) {\n currentMessageID = adapter.getCurrentMessageID();\n lastMessageID = messagesItems.get(messagesItems.size() - 1).getMessageId();\n\n if (lastMessageID.equalsIgnoreCase(currentMessageID))// i.e. We are on last message so scroll screen to last and last should be upside of message box\n {\n getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);\n } else // We are not on last message so don't scroll the screen\n {\n getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);\n }\n break;\n }"
] | [
"android",
"android-softkeyboard"
] |
[
"Accessing Conda in non-graphical mode Ubuntu",
"I want to use anaconda environments in non-graphical mode (Ctrl-Alt-F2) on Ubuntu 18.04. Everything works perfect in regular Ubuntu. However, in non-graphical mode command 'conda' is not found. For that matter I don't have either base or any of my environments available. I used to access conda in non-graphical by loading conda (module load anconda3) in the University, but now I want to use it on my personal desktop. Any ideas?"
] | [
"python",
"ubuntu",
"anaconda",
"conda"
] |
[
"Form is instantiating multiple times in custom event handler",
"I'm having an issue that I'm sure there's a simple fix to but I'm new to WinForms. I'm building an application that needs to be able to instantiate a fully functional input form from the main form and a list view form when a list view item is double clicked. Instantiating from the main form works perfectly but, when I try to instantiate from the list view form, I get multiple instances of the form. It's as if the previous instance is being added to a list somewhere and, however many times I've double clicked in the list view, that's how many new input windows open.\n\nI suspect it may have something to do with the fact that I'm daisy-chaining a custom event handler from the list view form to the main form and then from the main form to the input form.\n\nHere's the custom event handler that passes the list view form to the main form:\n\nprivate void listView1_DoubleClick(object sender, EventArgs e)\n{\n MainMenuForm mainMenuForm = Application.OpenForms[0] as MainMenuForm;\n\n selectedCharacter = listView1.SelectedItems[0].Tag as Character;\n\n CharDoubleClick += mainMenuForm.HandleCharDoubleClick;\n\n if(CharDoubleClick != null)\n {\n CharDoubleClick(this, new EventArgs());\n }\n}\n\n\nHere, the selected character from the list view form is extracted and passed to the input form to populate its fields:\n\npublic void HandleCharDoubleClick(object sender, EventArgs e)\n{\n CharListForm extractForm = new CharListForm();\n extractForm = sender as CharListForm;\n\n selectedCharacter = extractForm.SelectedCharacter;\n\n CharCreatorForm characterCreator = new CharCreatorForm();\n\n CharDoubleClick += characterCreator.HandleCharDoubleClick;\n characterCreator.CharCreatorFormClosed += HandleCharCreatorFormClosed;\n\n if (CharDoubleClick != null)\n {\n CharDoubleClick(this, new EventArgs());\n }\n\n characterCreator.Show();\n}\n\n\nAnd here, the selected character is extracted into the input form and the fields are populated:\n\npublic void HandleCharDoubleClick(object sender, EventArgs e)\n{\n MainMenuForm extractForm = sender as MainMenuForm;\n Character selectedCharacter = extractForm.SelectedCharacter;\n\n PopulateFields(selectedCharacter);\n}\n\n\nEverything is working as desired except for the fact that the second time the list view is double clicked, two input forms are instantiated, three appear on the third try, four on the forth, etc."
] | [
"c#",
"winforms"
] |
[
"Displaying LiveData in ViewModel from Room with co-routines",
"This question is in regard to the best practices in Android programming using MVVM, LiveData, Room (and hence also RetroFit) and co-routines. One of the best practises states that\n\n\n Long running executions such as Network - or Database calls should be performed asynchronous from the UI thread. \n\n\nCurrent documentation and blogs explain how to do this in detail using co-routines and some examples are demonstrating this nicely, e.g. the Sunflower App. \n\nThe part I am missing is when a ViewModel is initialized and it needs to show content from the database/repository/network, how the loading using co-routines is done. In the Sunflower App the repository is returning LiveData, but there is no use of co-routines. \n\nExample:\n\nIn PlantDao we see:\n\n@Query(\"SELECT * FROM plants WHERE id = :plantId\")\nfun getPlant(plantId: String): LiveData<Plant>\n\n\nThere is no suspend keyword hence, this is not part of a co-routine. \n\nIn plantRepository there is:\n\nfun getPlant(plantId: String) = plantDao.getPlant(plantId)\n\n\nAgain no suspend keyword so no co-routine.\n\nIn the PlantDetailViewModel the initialization shows us \n\nval plant = plantRepository.getPlant(plantId)\n\n\nSo no scope, Job or any co-routine related stuff. \n\nMy questions:\n\n\nIs room performing the DB query asynchronous? And if so, is it using co-routines?\nIs this a good practice? Because the repo is only returning LiveData and can only be used to return LiveData\nWhat are other strategies to do this? Any examples?\nWould this strategy differ for network requests?"
] | [
"android",
"mvvm",
"android-room",
"android-livedata",
"kotlin-coroutines"
] |
[
"Combining JQuery Validation followed by ajax post",
"I'm sure this is simple but I'm new to JQuery. I am using the JQuery plugin to validate an email address, this works and the code is:\n\n$(document).ready(function () {\n $(\"#email\").click(function () {\n $(this).attr({value: ''});\n });\n $(\"#subscribe-form\").validate();\n});\n\n\nWhat I then want to do is to post the email address using an ajax post, again this code works fine without the validator:\n\n$(document).ready(function () {\n $('#submit').click(function () {\n var email = $('#email').val();\n var data = \"email=\" + email;\n $.ajax({\n type: \"POST\",\n url: \"subscript.php\",\n data: data,\n });\n });\n});\n\n\nWhat I don't seem to be able to do is combine them both, so that if the email is valid it will then post. I'd really appreciate help on how to do this.\n\nThanks very much"
] | [
"jquery",
"ajax",
"validation",
"post"
] |
[
"Why is there so much fuzz about d3 and alike?",
"Sorry if this question is considered trivial but I am a bit lost:\n\nWhy is there so much discussion and efforts in working with d3 for data visualization?\n\nIn python we have matplotlib (MPL). It can to so many things. Especially for publication ready graphics (PS, PDF)?\n\nOr is the target these new initiatives are trying to achieve the web-visualization and interactivity, only?\n\nAnd how is the question of report generation (e.g. preparation of a printable report) tackled?\n\nE.g. I have a website with a dashboard for graphics.\nI zoom in, retrieve data etc. How to I store the figure together with the data table behind to a report?\nIMHO, easy to achieve with the \"old\" MPL based way.\n\nThanks in advance for your clarifications and hints on this hot topic."
] | [
"matplotlib",
"d3.js",
"report",
"pandas",
"data-visualization"
] |
[
"R session abort during data.matrix transformation",
"I have this big binary data.table:\n\n> str(mat)\nClasses 'data.table' and 'data.frame': 262561 obs. of 10615 variables:\n $ 1001682: num 0 0 0 0 0 0 0 0 0 0 ...\n $ 1001990: num 0 0 0 0 0 0 0 0 0 0 ...\n $ 1002541: num 0 0 0 0 0 0 0 0 0 0 ...\n $ 1002790: num 0 0 0 0 0 0 0 0 0 0 ...\n $ 1003312: num 0 0 0 0 0 0 0 0 0 0 ...\n $ 1004403: num 0 0 0 0 0 0 0 0 0 0 ...\n\n\nThere are somewhere 1 (it's not full of zeros). And I'm trying to convert it to data.matrix by just writing mat <- data.matrix(mat) but R session always abort. Is it a problem with my computer? Should I try some high performance computer? Or is there some other way to do this? I need it in data.matrix.\n\nI'm using macbook pro early 2015 with 2.7 GHz Intel Core i5 and 8Gm DDR3."
] | [
"r",
"matrix"
] |
[
"How to Move the Marker in top of the Map Window in google map",
"If i put map.setCenter(marker.getPosition()); in OnClick Marker then the Marker Moves to Center Position of the Map Window.Which mean the Function get Marker Position and set it as center of the Map so the Marker Became Center Position of the Window.\n\nNow i want this.\nmap.SetCenter(top, center); So that the marker will be in Top Center of the Map Window. Why i need this because When i click Marker the InfoBox opens downside of the maker and Half of the Info Box hide.\n\nPlease Give a Solution to solve this issue.\n\nI am using this Info Box http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/examples.html"
] | [
"google-maps-api-3",
"google-maps-markers",
"infobox"
] |
[
"Textview at the bottom of listview does not appear as listview adds more items?",
"In my first screen shot you can see expended listview at top and textview placed at below next to expended listview.\nBut if you look at my second screen shot, as the listview adds more items textview place at the bottom does not appear.\n\n\n\n\nMy layout code is :\n\n<LinearLayout \nandroid:orientation=\"vertical\"\nandroid:layout_width=\"fill_parent\"\nandroid:layout_height=\"fill_parent\" \nandroid:id=\"@+id/form_view\" \n>\n\n <LinearLayout\n android:id=\"@+id/relativeLayout1\"\n android:orientation=\"horizontal\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\" >\n <Spinner \n android:layout_height=\"wrap_content\" \n android:layout_width=\"0dip\" \n android:layout_weight=\"2\" \n android:id=\"@+id/spinnerSemester\" /> \n\n <Button\n android:id=\"@+id/graph_button\"\n android:layout_width=\"0dip\"\n android:layout_weight=\"0.7\"\n android:layout_height=\"wrap_content\" \n android:text=\"Chart\" />\n </LinearLayout>\n\n <ExpandableListView\n android:id=\"@+id/lv_attendance\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_alignParentTop=\"true\"\n android:layout_alignParentLeft=\"true\"\n android:layout_weight=\"1\"\n android:cacheColorHint=\"#00000000\"\n >\n</ExpandableListView>\n\n <TextView\n android:id=\"@+id/TV_note\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_below=\"@+id/lv_attendance\"\n android:paddingLeft=\"10dp\"\n android:text=\"[NOTE : The data displayed here is for advance information only. Please check with the college office/department concerned for the final and certified data. In case of discrepancies, the data maintained in the college records will be deemed to be the final one.]\"\n android:layout_marginTop=\"10px\"\n android:textSize=\"13sp\" />\n</LinearLayout>\n\n\nThanks,\nNandakishore P"
] | [
"android"
] |
[
"Imagemagick crop while keeping size",
"I want to crop the top 10 pixels of an image, but to keep the width\n\nAll exmaples I found look like \n\n convert rose: -crop 90x60-10-10 crop_all.gif\n\n\nI need to supply the 90x60 so for the result size\n\nHow can I crop with something like +0+10 and not supply a final size"
] | [
"imagemagick",
"imagemagick-convert"
] |
[
"PHP: Testing if Base64 encoded POST data is empty",
"Is there any reason why the PHP empty function would return true for valid base64 encoded data? Perhaps I should be using another function besides empty. The front-end app, build in flex, tests to make sure the Bitmap that's converted to base64 isn't empty prior to the POST.\n\n//codeigniter\n$ImageData = $this->input->post('ImageData'); //ImageData encoded in base64 format\n\nif (empty($ImageData))\n {\n //echo json error \n return;\n }"
] | [
"php"
] |
[
"Transmuting row entries to columns in R",
"I'm new here. I have just started learning R.\n\nI have this question:\n\nSuppose I have a dataframe:\n\nname = c(\"John\", \"John\",\"John\",\"John\",\"Mark\",\"Mark\",\"Mark\",\"Mark\",\"Dave\", \"Dave\",\"Dave\",\"Dave\")\ncolor = c(\"red\", \"blue\", \"green\", \"yellow\",\"red\", \"blue\", \"green\", \"yellow\",\"red\", \"blue\", \"green\", \"yellow\") \nvalue = c( 1,2,1,3,5,5,3,2,4,6,7,8)\ndf = data.frame(name, color, value)\n#View(df)\ndf\n# name color value\n# 1 John red 1\n# 2 John blue 2\n# 3 John green 1\n# 4 John yellow 3\n# 5 Mark red 5\n# 6 Mark blue 5\n# 7 Mark green 3\n# 8 Mark yellow 2\n# 9 Dave red 4\n# 10 Dave blue 6\n# 11 Dave green 7\n# 12 Dave yellow 8\n\n\nand I want it to look like this:\n\n# names red blue green yellow\n#1 John 1 2 1 3\n#2 Mark 5 5 3 2\n#3 Dave 4 6 7 8\n\n\nThat is, the entries in the first column (name) will become unique and the levels in the second column (color) will be new columns and the entries that will be in these new columns will come from the corresponding rows in the third column (value) in the original data frame.\n\nI can accomplish this using the following:\n\nlibrary(dplyr)\n df = df %>%\n group_by(name) %>%\n mutate(red = ifelse(color == \"red\", value, 0.0),\n blue = ifelse(color == \"blue\", value, 0.0),\n green = ifelse(color == \"green\", value, 0.0),\n yellow = ifelse(color == \"yellow\", value, 0.0)) %>%\n group_by(name) %>%\n summarise_each(funs(sum), red, blue, green, yellow)\ndf\n name red blue green yellow\n1 Dave 4 6 7 8\n2 John 1 2 1 3\n3 Mark 5 5 3 2\n\n\nBut this would not be ideal if there are lots of levels in the color column. How would I go on doing that?\n\nThank you!"
] | [
"r",
"dplyr"
] |
[
"What does function (i, val) mean in javascript?",
"Hi guys I was just wondering what (i, val) means in this function and what it is passing?\n\nfunction boldToggler(itemid) {\n $(itemid).css(\"font-weight\", function(i, val) {\n return val == \"bold\" ? \"normal\" : \"bold\";\n });\n}\n\n\nAny help would be greatly appreciated!"
] | [
"javascript",
"jquery"
] |
[
"java \"error cannot open file\" jar",
"I can't run the class or jar file it gives me the \"Error cannot open file\".\n\nI'm using the following commands:\n\njavac src/*.java\n\njar cfe MyJar.jar src.Main src/*.class\n\njava -jar MyJar.jar\n\n\nOutput:\n\njavac src/*.java\njar cfe MyJar.jar src.Main src/*.class\njava -jar MyJar.jar\nError cannot open file\nC^% \n\n\nI'm using linux/ubuntu and java:\n\njava version \"1.6.0_24\"\nOpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~12.04.1)\nOpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)\n\n\nContent of MANIFEST.MF:\n\nManifest-Version: 1.0\nCreated-By: 1.6.0_24 (Sun Microsystems Inc.)\nMain-Class: src.Main"
] | [
"java",
"compiler-construction"
] |
[
"How to remove directory in web.config?",
"I tried hard but maybe not enough, still, I just want to achieve this :\n\nmysite.com/en\n=> mysite.com\n\nand so on : \n\nmysite.com/en/page1\n=> mysite.com/page1\n\n<rule name=\"Redirect to en version\" stopProcessing=\"true\">\n <match url=\"(.*)\\/en(.*)\" />\n <action type=\"Rewrite\" url=\"en/{R:1}\" />\n </rule>\n\n\nObviously it doesn't work and i'm getting crazy with regex.\n\nThanks a lot for your help !"
] | [
"asp.net",
".htaccess",
"iis",
"web-config"
] |
[
"maven shows up some modules marked as \"unnamed\"",
"I'm working with maven in a multi module project and it works fine. But when it starts it refers to some projects as unnamed. Why does this happen, and how can I solve it?"
] | [
"maven-2"
] |
[
"innodb and myisam in mysql database",
"Possible Duplicate:\n MyISAM versus InnoDB \n\n\n\n\nwhat is the difference between innodb and myisam ? i see both of them as a type of engine in my mysql database."
] | [
"mysql"
] |
[
"Timer firing on the wrong interval",
"I am trying to abstract system.threading.timer based off this article:\nhttp://www.derickbailey.com/CommentView,guid,783f22ad-287b-4017-904c-fdae46719a53.aspx \n\nHowever, it seems the timer is firing according to the wrong parameter\n\nIn the class below we have this line\n\ntimer = new System.Threading.Timer(o => TimerExecute(), null, 1000, 30000);\n\n\nThis should mean wait for 1 second before starting, then fire every 30 seconds\n\nHowever, the code is firing every one second\n\nwhat have I done wrong\n\n public interface ITimer\n {\n void Start(Action action);\n void Stop();\n }\n\n public class Timer : ITimer, IDisposable\n {\n private TimeSpan timerInterval;\n private System.Threading.Timer timer;\n private Action timerAction;\n\n private bool IsRunning { get; set; }\n\n public Timer(TimeSpan timerInterval)\n {\n this.timerInterval = timerInterval;\n }\n\n public void Dispose()\n {\n StopTimer();\n }\n\n public void Start(Action action)\n {\n timerAction = action;\n IsRunning = true;\n StartTimer();\n }\n\n public void Stop()\n {\n IsRunning = false;\n StopTimer();\n }\n\n private void StartTimer()\n {\n timer = new System.Threading.Timer(o => TimerExecute(), null, 1000, Convert.ToInt32(timerInterval.TotalMilliseconds));\n }\n\n private void StopTimer()\n {\n if (timer != null)\n {\n timer.Change(Timeout.Infinite, Timeout.Infinite);\n timer.Dispose();\n timer = null;\n }\n }\n\n private void TimerExecute()\n {\n try\n {\n StopTimer();\n timerAction();\n }\n finally\n {\n if (IsRunning)\n StartTimer();\n }\n }\n }"
] | [
"c#",
"timer"
] |
[
"XercesDOMParser* and DOMDocument* going out of scope before a DOMElement*",
"Short Version: Is it safe for a XercesDOMParser* and DOMDocument* to go out of scope before a DOMElement* that they were used to create does? \n\nLong version:\n\nIn the code snippet below I create a local XercesDOMParser* and DOMDocument* in order to get the root element of the document and store it in a member DOMElement* variable. The XercesDOMParser* and DOMDocument* both go out of scope at the end of the constructor, but the DOMElement* lives on as a member variable. Is this ok? So far it seems to work but I am nervous that I may have problems later.\n\nJNIRequest::JNIRequest(JNIEnv *env, jobject obj, jstring input)\n{\n char *szInputXML = (char*) env->GetStringUTFChars(input, NULL);\n XMLPlatformUtils::Initialize();\n XercesDOMParser* pParser = new XercesDOMParser();\n XMLByte* xmlByteInput = (XMLByte*) szInputXML;\n xercesc::MemBufInputSource source(xmlByteInput, strlen(szInputXML), \"BufferID\");\n pParser->parse(source);\n DOMDocument* pDocument = pParser->getDocument();\n /* This next variable is a DOMElement* */\n this->_pRootElement = pDocument->getDocumentElement(); \n}"
] | [
"xerces-c"
] |
[
"Using `calc()` vs `transform` when placing elements",
"Is there a reason one would want to use calc() over the transform property when placing an element, or vise versa, when the size of the element is known?\n\nFor example...\n\n.element {\n bottom: 100%;\n transform: translateY(-9px);\n}\n\n\nProduces the same results as:\n\n.element {\n bottom: calc(100% + 9px);\n}\n\n\nIf the size of the element is not known, I see the advantage of using transform. However, if the size is known (as above) I can just as easily use calc() to adjust.\n\n\"calc() uses just one line, while transform requires two lines\"\n\nFair enough. But (in my case) I'm already using transform to adjust along the other axis (because I don't know the initial size), so I could easily combine the translateY() and translateX() to actually reduce the number of lines.\n\n\"Because browser support\"\n\nAssume we have full browser support across both solutions.\n\nIs there a standard, or performance situation, that would suggest one solution is better than the other?"
] | [
"css",
"css-transforms"
] |
[
"Trying to loop back to the beginning of the console app",
"I am working on an assessment piece where we have to output whether or not a painting is in portrait or landscape orientation. I can't work out where to put or even if a loop would work in my code to resart if the user enters an invalid string. My code look slike this. \n\nclass Program\n{\n static void Main(string[] args)\n {\n Console.WriteLine(\"What is the Height of the Painting?\");\n\n string input = Console.ReadLine();\n int height;\n\n if (!int.TryParse(input, out height))\n {\n Console.WriteLine(\"Invalid number. Please make it an integer... e.g 1-9\");\n }\n else\n {\n Console.WriteLine(\"What is the Width of the Painting?\");\n\n string input2 = Console.ReadLine();\n int width;\n\n if (!int.TryParse(input2, out width))\n {\n Console.WriteLine(\"Invalid number. Please make it an integer... e.g 1-9\");\n }\n else\n {\n var orientation = (height > width ? Orientation.Landscape : Orientation.Portrait);\n\n Console.WriteLine(\"Your Painting is currently in the: \" + orientation + \" orientation\");\n }\n }\n }\n\n public enum Orientation\n {\n Landscape,\n Portrait\n }\n}\n\n\nAny help would be greatly appreciated."
] | [
"c#",
"console"
] |
[
"Color some areas delimited programmatically",
"I want to write an algorithm that allows me to fill color in delimited area in a draw. I show you an example:\n\nBEFORE\n\n\nAFTER\n\n\n\nwhat's the way to begin this algorithm? Where I can act to realize this function?\nOr is there something done?\n\nthanks"
] | [
"colors",
"bitmap",
"drawing"
] |
[
"Effcient way to store and display in a PHP web application",
"I am developing a PHP web application. Looking for the efficient way of storing user uploaded images and display it on the web application. Please let me know your suggestions. \n\nExpected number of images is 1 million."
] | [
"php",
"web-applications",
"web",
"content-management-system"
] |
[
"Is there an equivalent to the perl debugger 'x' in pdl2 (or Devel::REPL)?",
"I am using pdl2 (the PDL shell) also as a my default Perl interactive shell (it loads all the nice plugins for Devel::REPL). But I am missing the x dumper-printing alias. p is nice for piddles but it does not work for a normal array ref or hash ref. I have loaded Data::Dumper but it lacks an easy way of controlling depth and I like the way you can quickly set depth limits with x, e.g. x 2 $deep_datastruct for complex data structures. But with Data::Dumper the process is more cumbersome:\n\npdl> say $c\nHASH(0x53b0b60)\n\npdl> p $c\nHASH(0x12b14018)\n\npdl> use Data::Dumper\n\npdl> p Dumper $c\n$VAR1 = {\n 'c' => {\n 'c' => 3,\n 'a' => 1,\n 'b' => {\n 'c' => '3',\n 'a' => '1',\n 'b' => '2'\n }\n },\n 'a' => 1,\n 'b' => 4\n };\npdl> $Data::Dumper::Maxdepth = 1;\npdl> p Dumper $c\n$VAR1 = {\n 'c' => 'HASH(0x97fba70)',\n 'a' => 1,\n 'b' => 4\n };\n\n\nIn the Perl debugger you can achieve the same thing with x 1 $c directly. Does pdl2 have something similar and so concise?\n\n[update]\nAnd related with this question: does pdl2 or Devel::REPL have convenience functions like the Perl debugger commands m or y? Or should one create a module with PadWalker and export them? I would like to use a real REPL instead of the Perl debugger as an interactive shell, but still the Perl debugger has some important things that I don't know how to do with Devel::REPL or pdl2.\n\nFor example to see all variables (pdl2 only show piddles):\n\npdl> help vars\nPDL variables in package main::\n\nName Type Dimension Flow State Mem\n----------------------------------------------------------------\nno PDL objects in package main::\n\n\nBy the way, does someone know a Devel::REPL plugin for listing all the variables in use (like y in the debugger, but only the names, not the values) and then have a x-like to dump the wanted one?"
] | [
"perl",
"read-eval-print-loop",
"pdl"
] |
[
"how to hide top button in mat calendar",
"I have a month year calendar but when i click on top button it displays me year, month and day how could i hide that button or tell calendar not to display days\n\nlook image\n\nI was thinking on a css class that hides that element, whats the best way to do it?\n\nthis is the html\n\n<button cdkarialive=\"polite\" class=\"mat-calendar-period-button mat-button _mat-animation-noopable\" mat-button=\"\" type=\"button\" ng-reflect-politeness=\"polite\" aria-label=\"Choose month and year\"><span class=\"mat-button-wrapper\">JUL. 2019<div class=\"mat-calendar-arrow\"></div></span>\n <div class=\"mat-button-ripple mat-ripple\" matripple=\"\" ng-reflect-centered=\"false\" ng-reflect-disabled=\"false\" ng-reflect-trigger=\"[object HTMLButtonElement]\"></div>\n <div class=\"mat-button-focus-overlay\"></div>\n</button>\n\n\nhere you can check this problem\n\nhttps://stackblitz.com/edit/angular-wtbblu"
] | [
"css",
"angular",
"angular-material"
] |
[
"Change the Bootstrap Modal effect",
"I found this Demo ,\n\nThe demo have a pretty effect, I wonder if any one have way to apply this demos to be easy to use with bootstrap Modal \nspecially the first one (Fade In & Scale)"
] | [
"twitter-bootstrap",
"css"
] |
[
"How to disable ShoutBox in yetanotherforum?",
"I am using version 2.2.3 of yetanotherforum.\n\nI need to disable the Shoutbox feature since it keeps making ajax requests every few milliseconds. I tried going through board settings under Admin, but could not find any setting for shoutbox.\n\nHow would I disable it?"
] | [
"yetanotherforum"
] |
[
"How should I define Custom Controls to enable UI Automation and TestStack White?",
"I am beginning to use TestStack White (UI Automation) to automate tests in an WPF existing application. When using standard controls everything works fine. However, I run into problems when trying to interact custom controls.\n\nFor example, I have a LabeledComboBox which is actually a TextBlock plus a ComboBox. This is defined as a class derived from Control plus a ControlTemplate in XAML:\n\n\r\n\r\npublic class LabeledComboBox : Control\r\n{\r\n static LabeledComboBox()\r\n {\r\n DefaultStyleKeyProperty.OverrideMetadata(typeof(LabeledComboBox), new FrameworkPropertyMetadata(typeof(LabeledComboBox)));\r\n }\r\n}\r\n\r\n\r\n\n\n\r\n\r\n<local:LabeledComboBox>\r\n <local:LabeledComboBox.Template>\r\n <ControlTemplate TargetType=\"{x:Type local:LabeledComboBox}\">\r\n <StackPanel>\r\n <TextBlock Text=\"Text\"/>\r\n <ComboBox/>\r\n </StackPanel>\r\n </ControlTemplate>\r\n </local:LabeledComboBox.Template>\r\n</local:LabeledComboBox>\r\n\r\n\r\n\n\nThis control works, but if you run UI Automation Verify the only part visible to UI Automation is the ComboBox, and the TextBlock cannot be accessed.\n\nHowever, if you create this as a UserControl using XAML and Code Behind, both the TextBox and the ComboBox are properly visible to UI Automation. \n\nI have tried to create an AutomationPeer (FrameworkElementAutomationPeer) for my control, but I have not been able to make the TextBlock visible to UI Automation so far. One interesting result is that FrameworkElementAutomationPeer::GetChildrenCore() properly returns a list of 2 automation peers, one for the TextBlock and one for the ComboBox.\n\nHow should I change my custom control so it is properly testable using UI Automation and White?"
] | [
"c#",
"wpf",
"custom-controls",
"microsoft-ui-automation",
"white-framework"
] |
[
"Inno Setup Error \"Text is not inside a section.\" after upgrade",
"I recently upgraded my Inno Setup from version 5.4.3(u) to version 5.5.5(a), and now I'm getting an error for a script which used to compile fine with the previous version.\n\nThis is Inno Setup's output:\n\n[ISPP] Preprocessing.\n[ISPP] Preprocessed.\n\nError on line 1 in c:\\Workspace\\MyProject\\MyInstaller.iss: Text is not inside a section.\n\n\nThe line in question is:\n\n#if MYLANG == MYLANG_ENGLISH\n\n\nSo the processor is running, but somehow this line is not preprocessed. Why does this happen and how do I fix this?"
] | [
"inno-setup"
] |
[
"Android Animation Help",
"Hello I am trying to create an animation like creating heart like bubbles but not 100% like this. This could on some static Activity.\n\nBut I am at no where. Documentation lacks examples and examples in API are just unacceptable. It shouldn't be so hard to make such animation.\n\nI am pasting my code please help me.\n\nClass File\n\nimport android.app.Activity;\nimport android.graphics.drawable.AnimationDrawable;\nimport android.os.Bundle;\nimport android.view.View;\nimport android.widget.Button;\nimport android.widget.ImageView;\nimport android.widget.RelativeLayout;\n\npublic class AnimationTest extends Activity {\nAnimationDrawable animation;\n\n@Override\npublic void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n\n Button btnStart = (Button) findViewById(R.id.btnStart);\n final ImageView imgView = (ImageView) findViewById(R.id.img);\n\n btnStart.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n startAnimation();\n }\n });\n imgView.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n\n }\n });\n}\n\nclass Starter implements Runnable {\n public void run() {\n animation.start();\n }\n}\n\nprivate void startAnimation() {\n animation = new AnimationDrawable();\n animation.addFrame(getResources().getDrawable(R.drawable.one), 100);\n animation.addFrame(getResources().getDrawable(R.drawable.two), 100);\n animation.addFrame(getResources().getDrawable(R.drawable.three), 100);\n animation.addFrame(getResources().getDrawable(R.drawable.four), 100);\n animation.addFrame(getResources().getDrawable(R.drawable.five), 100);\n animation.addFrame(getResources().getDrawable(R.drawable.six), 100);\n animation.addFrame(getResources().getDrawable(R.drawable.seven), 100);\n animation.addFrame(getResources().getDrawable(R.drawable.eight), 100);\n animation.setOneShot(false);\n\n\n ImageView imageView = (ImageView) findViewById(R.id.img);\n RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(80, 90);\n params.alignWithParent = true;\n params.addRule(RelativeLayout.CENTER_IN_PARENT);\n imageView.setLayoutParams(params);\n imageView.setImageDrawable(animation);\n imageView.post(new Starter());\n}\n\n\n}\n\nXML File\n \n \n\n <TextView android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\" android:text=\"Frame by Frame Animation Example\"\n android:gravity=\"center\" />\n\n <RelativeLayout android:layout_width=\"fill_parent\"\n android:layout_height=\"fill_parent\" android:layout_gravity=\"center_horizontal\">\n\n <ImageView android:id=\"@+id/img\" android:layout_width=\"80px\"\n android:layout_height=\"90px\" android:layout_centerInParent=\"true\" />\n\n <Button android:id=\"@+id/btnStart\" android:text=\"Start Animation\"\n android:layout_width=\"wrap_content\" android:layout_height=\"wrap_content\"\n android:layout_alignParentRight=\"true\" />\n\n </RelativeLayout>\n\n</LinearLayout>\n\n\nImages, you can past some other images too\n124\n\nEDIT\nWhat I want to accomplish\nstep1: a fish comes from left side \nsetp2: a fish comes from right side\n\nstep3: a heart appears and grows bigger in very center of both fish\nstep4: then small hearts fly away and disappear"
] | [
"android",
"animation"
] |
[
"Extract tweets using Twitter API",
"I want to extract tweets from the following twitter API.\nhttps://api.twitter.com/1.1/search/tweets.json\nNow, a maximum of 100 tweets can be extracted using parameter 'count = 100' but I know we can extract 3200 tweets. I want to know what other parameter needs to be set correctly.\nI tried setting 'page = 2', but it gives an error."
] | [
"api",
"twitter",
"tweets"
] |
[
"Debian aptitude install: 'find' not found in PATH or not executable",
"When I try to install any package such as php5, it gives me this error.\nI did update and upgrade all libraries.\n\nroot@host:~# apt-get install apache2-mpm-prefork libapache2-mod-php5\nReading package lists... Done\nBuilding dependency tree \nReading state information... Done\napache2-mpm-prefork is already the newest version.\nThe following extra packages will be installed:\n libonig2 libqdbm14 php5-cli php5-common\nSuggested packages:\n php-pear\nThe following NEW packages will be installed:\n libapache2-mod-php5 libonig2 libqdbm14 php5-cli php5-common\n0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 0 B/6,106 kB of archives.\nAfter this operation, 18.7 MB of additional disk space will be used.\nDo you want to continue [Y/n]? y\ndebconf: delaying package configuration, since apt-utils is not installed\ndpkg: warning: 'find' not found in PATH or not executable\ndpkg: error: 1 expected program not found in PATH or not executable\nNote: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin\nE: Sub-process /usr/bin/dpkg returned an error code (2)\n\n\nCan someone help me?"
] | [
"find",
"debian",
"warnings",
"php4",
"dpkg"
] |
[
"Sails JS - Nested .query method doesn't run sequence",
"I beginner in Sails JS. I try to make multiple .query(\"SELECT ... \"). I have a problem when looks like it not run sequence. I will explain my problem, look to My snippet code :\n\nvar isSuccess = true;\nfor(var loc = 0 ; loc < decode.length ; loc++){\n Location.query('SELECT * FROM abc', function (err, res){\n if (err) {\n isSuccess = false;\n return res.json(200, {\n data: {\n\n },\n status: {\n id: 0,\n message: err.message\n }\n });\n } else {\n var validate = res.rows;\n sails.log(validate);\n\n secondQuery.query('SELECT * FROM def', function (err, seconResult) {\n if (err) {\n isSuccess = false;\n sails.log(\"Update is Success : \"+isSuccess);\n return res.json(200, {\n data: {\n\n },\n status: {\n id: 0,\n message: err.message\n }\n });\n } else {\n\n\n }\n });\n }\n });\n\n if(isSuccess){\n return res.json(200, {\n data: {\n\n },\n status: {\n id: 1,\n message: \"Successful\",\n isSuccess: isSuccess\n }\n });\n }\n }\n\n\nWhen i request the API via POST method and the result is :\n\nOn Console Node JS Server :\n\nUpdate is Success : false\nSo it means the request is failed and must be return status = 0 in postman\n\nBut in the Postman, it show :\n\n data: {\n\n },\n status: {\n id: 1,\n message: \"Successful\",\n isSuccess: true\n }\n\n\nMy Question :\n\nCan anyone help me to explain why and how to make it a sequence process, not like \"multi thread\" ? (In my case, i need to use RAW query cause i will face with really complex query)\n\nThank you."
] | [
"javascript",
"node.js",
"postgresql",
"sails.js",
"sails-postgresql"
] |
[
"Swift use 'is' for function type, compiler behavior is different with runtime",
"I am testing about function is first class citizen in Swift. and I got in trouble. Check the code below:\n\nlet f: Int -> Int = { $0 }\nif f is (Int -> Int?) { // compiler warning: 'is' test is always true\n print(\"hello\")\n} else {\n print(\"ops\") // runtime: this line is executed\n}\n\n\nI got a compiler warning in the if line says: \"'is' test is always true\". But when I run the code, console print \"ops\" which means is test is false. This confuses me. Why compiler says true when runtime says false?"
] | [
"swift",
"function",
"runtime",
"compiler-warnings"
] |
[
"Download canvas to PNG black background",
"I am building some charts on a canvas using Charts.js and Bootstrap. Users want to be able to download a PNG file of the chart to copy it into a Powerpoint slide. I have the following function working and it downloads the file but it has a completely black background. On the page the image has a white background. I see a bunch of posts about this with JPEG and the solution says to use PNG but I am using PNG. Not sure if there is something I can change in the canvas itself. I have tried to explicitly set the background color of the canvas to white but that doesn't help.\n\nthe downloadToPNG function:\n\nfunction downloadToPNG() {\n var canvas = document.getElementById('parentCanvas');\n var dt = canvas.toDataURL('image/png');\n var hiddenElement = document.createElement('a');\n hiddenElement.href = dt;\n hiddenElement.target = '_blank';\n hiddenElement.download = fileName;\n hiddenElement.click();\n hiddenElement.remove();\n}"
] | [
"javascript",
"html",
"canvas"
] |
[
"Get and Set properties doesn't change permanently c#, VS",
"I'm working on my c# pac-man game in visual studio.\n\nI have a main sprite class and a subclass called User. The user should Set the x position and y position as it calculated it.\n\nWhat my timer does:\n\n pictureBox1.Focus();\n paper.Clear(Color.Transparent);\n user.moveUser(keyValue);//Code1 shown below\n sprite.DrawSprites(paper);//Code shown below\n pictureBox1.Image = bmp;\n\n\nCode behind those Methods:\n\nCode1:\n\npublic void moveUser(int mKeyValue)\n {\n\n switch (previousImage)\n {\n case false:\n\n switch (mKeyValue)\n {\n case 39:\n sprite.Image = imageArray[0];//left\n sprite.XPos += stepsAmount;\n\n break;\n case 37:\n sprite.Image = imageArray[1];//right\n sprite.XPos -= stepsAmount;\n\n break;\n case 38:\n sprite.Image = imageArray[2];//up\n sprite.YPos -= stepsAmount;\n\n break;\n case 40:\n sprite.Image = imageArray[3];//down\n sprite.YPos += stepsAmount;\n\n break;\n }\n previousImage = true;\n break;\n case true:\n switch (mKeyValue)\n {\n case 39:\n sprite.Image = imageArray[4];\n break;\n case 37:\n sprite.Image = imageArray[5];\n break;\n case 38:\n sprite.Image = imageArray[6];\n break;\n case 40:\n sprite.Image = imageArray[7];\n break;\n }\n previousImage = false;\n break;\n\n }\n }\n\n\ncode2:\n\n protected int xPos = 0, yPos = 0, size = 28;\n\n public Image Image\n {\n get { return image; }\n set { image = value; }\n }\n\n\n public int YPos\n {\n get { return yPos; }\n set { yPos = value; }\n }\n\n public int XPos\n {\n get { return xPos; }\n set { xPos = value; }\n }\n\n\n public void DrawSprites(Graphics drawArea)\n {\n drawArea.DrawImage(Image, xPos, yPos, size, size);\n }\n\n\nWhen I debug, and the console runs the moveUser method, the set propertie Xpos, YPos and Image get changed. But when the drawSprites method runs, those variables are back 0 or the original assigned value. I need to make them permantly changed so I can move my little yellow friend.\n\nnote: not all code has been pasted, only the one which is needed, if you need more code just ask.\n\nnote 2: User is a subclass from Sprite\n\nThanks for your time"
] | [
"c#",
"inheritance",
"properties",
"get",
"set"
] |
[
"Regex matching original datetime format in python",
"I've crafted a regex to find unique datetime formats. I want to substitute out invalid datetimes (where the month is not 1 through 12). \n\ni.e.\n\n10-2019 (NO MATCH)\n2-2020 (NO MATCH)\n19-2019 (MATCH because 2-digit is not 1-12)\n\n\nI do not care about the 4-digit number. Thus, I've derived this regex:\n\\b(0|00|1[3-9]|[2-9][0-9])\\b-\\d{4}\n\nHowever, I'm not receiving any matches:\n\n>>> x = '00-1421 a 15-1432'\n>>> re.sub('\\b(0|00|1[3-9]|[2-9][0-9])\\b-\\d{4}','',x)\n'00-1421 a 15-1432'"
] | [
"python-3.x",
"regex"
] |
[
"Run query when in while loop nodejs not occuring",
"Hi i am running the while loop however the while loop is not running the block in the second line afterconsole.log(\"In while loop\")\n\nthis is the whole section \n\nrouter.post(\"/\", function(req,res,next){\n router.use(bodyParser.json());\n let tag_id = generate_tag();\n let tag_id_correct = false;\n while(tag_id_correct != true){\n console.log(\"in while loop\");\n res.locals.connection.query(\"SELECT Tag_ID from trakk_items WHERE Tag_ID = '\" + tag_id +\"'\", function (error, results, fields){\n console.log(\"WE ARE IN\");\n if (error) {\n res.send(JSON.stringify({\n \"status\": 500,\n \"error\": error,\n \"response\": null\n }));\n }\n else{\n tag_id_correct = true;\n console.log(tag_id_correct);\n }\n console.log(results);\n res.send(JSON.stringify({\n \"response\" : results\n }));\n });\n }\n console.log(\"unique tagid created\");\n\n});\n\nmodule.exports = router;\n\n\nany suggestions\n\nThanks"
] | [
"node.js"
] |
[
"Why does eclipse CDT extract function feature want to reformat unrelated code in my .cc file?",
"I have some C++ code that contains 5 or so lines of code that I want to refactor into a function. When I right-click->refactor->extract function, the refactor generates the function correctly, but it insists also on reformatting a large chunk of code that has nothing to do with the code I'm refactoring. Furthermore, neither the reformatted code nor the generated function fits my current style (K&R modified by me) as near as I can tell.\n\nWhy does it do this?\n\nIs there a way to get it to follow my code style?\n\nIs there a way to turn it off?"
] | [
"eclipse",
"eclipse-cdt"
] |
[
"Change background on selected item in listView",
"I have problem when Im trying to change background on selected item in listview. When I select item A, it's background is changed. If I select item B, it changed too, but item A doesn't back to default background.\n\nThis drawable for background selected_item.xml: \n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <item android:state_selected=\"true\"\n android:drawable=\"@color/colorMegna\"/>\n <item android:drawable=\"@color/colorWhite\"/>\n</selector>\n\n\nThis is the XML item_kategori.xml :\n\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:id=\"@+id/lay_nama_kategori\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_margin=\"5dp\"\n android:orientation=\"vertical\"\n android:background=\"@drawable/selected_item\">\n\n <TextView\n android:id=\"@+id/txtView_kategori\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:textSize=\"18sp\"\n android:textAllCaps=\"false\"\n android:textColor=\"@color/colorMegna\"\n android:layout_marginStart=\"10dp\"\n android:layout_marginTop=\"5dp\"\n android:layout_marginBottom=\"5dp\"/>\n\n</LinearLayout>\n\n\nThis is the setOnClickListener() in Adapter:\n\ninner class CategoryViewHolder(itemView: View): RecyclerView.ViewHolder(itemView){\n fun bind(kategori: Category){\n itemView.txtView_kategori.text = kategori.category\n itemView.setOnClickListener {\n\n if(kategoriList[adapterPosition] == kategori){\n itemView.isSelected = true\n itemView.txtView_kategori.setTextColor(Color.WHITE)\n }\n }\n }\n }"
] | [
"java",
"android",
"xml",
"kotlin"
] |
[
"Can Spring batch used for data processing or it is only an ETL tool?",
"I'm trying to utilize Spring Batch in one of the projects that I have, as there is another project that is based on Spring Batch.\n\nHowever the more I read the more I realize that Spring batch is nothing like ApacheBeam or MapReduce, it is only used for transferring the SAME data from one place to another with some type mapping like varchar -> string.\n\nHowever, the task in hand requires some processing, not only types mapping and converting but also aggregations and data structure. \nCan Spring batch used for data processing or it is only an ETL tool ?"
] | [
"spring",
"spring-batch"
] |
[
"Is there other way to handle configuration data in Win Forms beside Custom Configuration Sections",
"I am in early beginning of learning and deploying Win App using C#,\n\nNow I wanna try to build sample application with sample store configure settings inside,\nI want to application remember the users selection of three or four folders with other specific information, as sharing name, and other two or three values for describing selected folders\n\nI am trying to do that in scholar way using app.config and Custom Configuration Sections but\nIt is all much confusing to me, Making class for each element and more I read more I do not know how I cloud do it.\n\nNow I wondering is there other ways to WinApp store config data and to that still be in one nice and accepted ways, I looked at INI files but it seems to me like an old app and I considering, Can I just open app.config as XmlDocument and than use Xpath to read and write my values. Or to I just put XML in working folder, But I now using app.conifg to store connection strings."
] | [
"c#",
"winforms",
"configuration"
] |
[
"Access Denied in MySQL, just not for everything",
"MAMP Pro is running my Apache and Mysql instances. When I\nmysql -u root -p -P 8889 I get access denied. When I try to access the database through Sequel Pro I get access denied. However, my Wordpress installation is talking to the database fine, and PHPMyAdmin through MAMP is also talking to the database just fine. So what gives? I must be missing a setting or maybe I need to give Sequel Pro or the mysql command a socket?"
] | [
"mysql",
"mamp-pro"
] |
[
"C++ std::async() terminate on exception before calling future.get()",
"I am trying to create a wrapper that calls std::terminate() when it catch an exception.\nI would like this wrapper to take the same arguments as std::async() (it could be a call to a function as well as a call to a method).\nSomeone know how to make this code to compile ?\n\nThank you\n\nhttp://ideone.com/tL7mTv\n\n#include <iostream>\n#include <functional>\n#include <future>\n\ntemplate<class Fn, class... Args>\ninline auto runTerminateOnException(Fn&& fn, Args&&... args) {\n try {\n return std::bind(std::forward<Fn>(fn), std::forward<Args>(args)...)();\n } catch (...) {\n std::terminate();\n }\n}\n\ntemplate<class Fn, class... Args>\ninline auto runAsyncTerminateOnException(Fn&& fn, Args&&... args) {\n return std::async(std::launch::async, runTerminateOnException<Fn, Args&&...>, std::forward<Fn>(fn), std::forward<Args>(args)...);\n}\n\nstruct Foo {\n void print() {\n printf(\"Foo::print()\\n\");\n }\n};\n\nint main() {\n Foo foo;\n std::future<void> future = runAsyncTerminateOnException(&Foo::print, &foo);\n // your code goes here\n return 0;\n}"
] | [
"c++",
"c++11"
] |
[
"How Cordapps are getting deployed with corda.jar while running corda nodes?",
"We are defining the nodes configuration in build.gradle.\n\nAfter running the gradle deployNodes task, based on the configuration in build directory/nodes- Folders are getting created in their names.\n\nEach node is having the following files:\n\n\nCorda.jar\nnetwork-parameters\npersistence.mv.db\nnode.conf\ncertificates\ndrivers\nlogs\ncordapps\n\n\nThese the following questions I have,\n\n\nWhat is the runnodes.jar does - means how corda.jar is started and how cordapps are deployed on top of that?\nIf I change the node.conf, then runnodes will it affect the node.conf or Do I need to build the corda.jar again ?\nWhere the p2paddress of other nodes are shared with each node.\n\n\nSuppose If I want to deploy the nodes in different EC2 instances, Do I need to mention the p2paddress with correct ec2 ipaddress of each nodes on build.gradle or I can do it dynamically?"
] | [
"corda"
] |
[
"When should you use a mutex over a channel?",
"For the past few weeks I've been wrestling with one (not-so) simple question:\n\nWhen is it best to use a sync.Mutex and, conversely, when is it best use a chan?\n\nIt seems that for a lot of problems either strategy is interchangeable with the other - and that's just the problem!\n\nTake this video found in the Golang documentation. Below, I've taken the liberty to dictate the code in the playground and also translate it to a sync.Mutex equivalent.\n\nIs there a certain problem - encountered in the real world - that warrants the use of one other?\n\nNotes:\n\n\nI am a huge fan of this use of chan and struggle to think of a more elegant implementation using sync.Mutex.\nIt's worth noting that the chan implementation does more work in the same time (reaches 12)*\n\n\nPlaygrounds:\n\n\nChan implementation \nMutex implementation\n\n\nPing/pong with chan:\n\npackage main\n\nimport (\n \"fmt\"\n \"time\"\n)\n\ntype Ball struct { hits int }\n\nfunc main() {\n table := make(chan *Ball)\n go player(\"ping\", table)\n go player(\"pong\", table)\n\n table <- new(Ball)\n time.Sleep(1 * time.Second)\n <-table\n}\n\nfunc player(name string, table chan *Ball) {\n for {\n ball := <-table\n ball.hits++\n fmt.Println(name, ball.hits)\n time.Sleep(100 * time.Millisecond)\n table <- ball\n }\n}\n\n\nPing/pong with sync.Mutex:\n\npackage main\n\nimport (\n \"fmt\"\n \"time\"\n \"sync\"\n)\n\ntype Ball struct { hits int }\n\nvar m = sync.Mutex{}\n\nfunc main() {\n ball := new(Ball)\n go player(\"ping\", ball)\n go player(\"pong\", ball)\n\n time.Sleep(1 * time.Second)\n}\n\nfunc player(name string, ball *Ball) {\n for {\n m.Lock()\n ball.hits++\n fmt.Println(name, ball.hits)\n time.Sleep(100 * time.Millisecond)\n m.Unlock()\n\n }\n}"
] | [
"go",
"concurrency"
] |
[
"How do you pass in variables into the shell or the root view model",
"I'm new to durandal. I just wondered if there was a way to pass in variables to the root view model aka the shell, either via querystring or any other way?\n\nso main.js looks something like the below\n\ndefine(['durandal/app'], function (app) {\n app.configurePlugins({\n router: true\n });\n\n app.start().then(function () {\n app.setRoot('shell');\n });\n});\n\n\nCan you do something similar to what's written below in the shell.js file.\nI tried it but it doesn't work\n\nfunction activate(variableIwantToPass) {\n doSomething(variableIwantToPass);\n configureRoutes(variableIwantToPass);\n return router.activate();\n}\n\nfunction configureRoutes(variableIwantToPass) {\n var specialRoute = 'bar';\n if(variableIwantToPass == 'foo') {\n specialRoute = foo;\n }\n var routes = [\n {\n route: '',\n moduleId: 'home'\n },\n {\n route: 'doThings/:specialRoute/',\n moduleId: 'orchestrator'\n }\n ];\n\n router.makeRelative({ moduleId: 'viewModels'}).map(routes); \n}\n\n\nI can't make a call to a service to get the data in the shell as the information/variable I want is passed into the page that leads to the spa as a querystring parameter.\n\nSo, is it possible to pass something into the shell, or is there any other alternative to achieve what I want. Like creating a cookie to store this variable and reading it via javascript in shell.js?"
] | [
"durandal",
"durandal-navigation"
] |
[
"How to keep connection in app in background mode?",
"I have XMPP messenger in my app and when user presses home button and minimize the app, my XMPP stopping to receive new message signals and does not show any alert.\n\nIn iOS 9 I solved that problem with turning on Voice over IP checkbox. But in iOS 10 I started to receive this warning:\n\nLegacy VoIP background mode is deprecated and no longer supported\n\n\nSo with this solution my app worked iniOS 9, but stopped to receive messages and show message alerts in background mode in iOS 10.\n\nHow can I solve that issue?"
] | [
"ios",
"swift",
"background",
"voip"
] |
[
"jQuery Datatable sort by column header",
"Basically, jQuery Datatable allow us to sort data by column index.\n\n\"order\": [1, 'desc']\n\n\nI wonder if we can sort by column header name? For example:\n\n\"order\": ['my_column_name', 'desc']\n\n\nThankyou\nAlex"
] | [
"jquery",
"datatables"
] |
[
"XAMPP MySQL error messgae, blocked port",
"Problem detected!\nPort 3306 in use by \"\"C:\\Program Files\\MySQL\\MySQL Server 5.1\\bin\\mysqld\" --defaults-file=\"C:\\Program Files\\MySQL\\MySQL Server 5.1\\my.ini\" MySQL\"!\nMySQL WILL NOT start without the configured ports free!\nYou need to uninstall/disable/reconfigure the blocking application\nor reconfigure MySQL and the Control Panel to listen on a different port\n\n\nAlthough i change the port in the my.ini file, it still doesn't work. Anyone who would know how to fix this? I get this error when i start MYSQL in XAMPP"
] | [
"mysql",
"apache",
"xampp",
"ports"
] |
[
"3D image gradient in OpenCV",
"I have a 3D image data obtained from a 3D OCT scan. The data can be represented as I(x,y,z) which means there is an intensity value at each voxel.\n\nI am writing an algorithm which involves finding the image's gradient in x,y and z directions in C++. I've already written a code in C++ using OpenCV for 2D and want to extend it to 3D with minimal changes in my existing code for 2D.\n\nI am familiar with 2D gradients using Sobel or Scharr operators. My search brought me to this post, answers to which recommend ITK and Point Cloud Library. However, these libraries have a lot more functionalities which might not be required. Since I am not very experienced with C++, these libraries require a bit of reading, which time doesn't permit me. Moreover, these libraries don't use cv::Mat object. If I use anything other than cv::Mat, my whole code might have to be changed.\n\nCan anyone help me with this please?\n\nUpdate 1: Possible solution using kernel separability\n\nBased on @Photon's answer, I'm updating the question.\n\nFrom what @Photon says, I get an idea of how to construct a Sobel kernel in 3D. However, even if I construct a 3x3x3 cube, how to implement it in OpenCV? The convolution operations in OpenCV using filter2d are only for 2D. \n\nThere can be one way. Since the Sobel kernel is separable, it means that we can break the 3D convolution into convolution in lower dimensions. Comments 20 and 21 of this link also tell the same thing. Now, we can separate the 3D kernel but even then filter2D cannot be used since the image is still in 3D. Is there a way to break down the image as well? There is an interesting post which hints at something like this. Any further ideas on this?"
] | [
"c++",
"opencv",
"image-processing",
"3d"
] |
[
"ProcessCmdKey not working with dual displays",
"I have 2 programs that run on the same PC with a dual display setup. The 2 programs communicate via TCP/IP. The main display overrides ProcessCmdKey for function and cursor key handling and works as expected. The issue I have is that when the user selects the second display the keys stop working as expected. I then added ProcessCmdKey to the second program at the top-level form and send the cmds to the other program via the TCP/IP link and this works until the user selects one of the other forms on the second display.\nWhat I mean is that I have a top-level form with the other forms added to the panel on the top-level form that are shown or hidden as require based on a set of buttons down the left side. This all works reliably but the top level forms ProcessCmdKey function doesn't always receive the key presses for all of the other forms. Only some of them work.\nWhy would some forms work and others fail?"
] | [
"forms"
] |
[
"Sublime Text 3 keybinding priority",
"When I've installed a new sublime package the new package occasionally overwrites a keybinding I've added.\nIn my User sublime-keymap settings is there any way to give priority to my custom key-binding? For example any custom key-mapping I add has priority over default package ones?"
] | [
"sublimetext3",
"key-bindings",
"keymapping"
] |
[
"ReactNative app crashes only if running in Release mode",
"I'm building this app in RN and after upgrading to 0.49, it started crashing only when in \"release\" mode. It crashes right after it starts. It took me awhile to even trace down the crash point because my crash reporter (bugsnag) isn't even triggering.\n\nI set the scheme in xcode to \"release\" and I was finally able to reproduce the crash with a tethered device.\n\nThe output is:\n\n43 JavaScriptCore 0x00000001880011ac _ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueERN3WTF8NakedPtrINS_9ExceptionEEE + 316\n44 JavaScriptCore 0x000000018836a558 JSEvaluateScript +2017-10-15 02:54:24.331 [error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 's.View.propTypes.style')\nB56\nINFO : BSG_KSCrashReport.c (2157): void bsg_kscrashreport_writeStandardReport(BSG_KSCrash_Context *const, const char *const): Writing crash report to /var/mobile/Containers/Data/Application/00FD4F8E-DFF5-4166-982B-0D4AB56048DE/Library/Caches/KSCrashReports/GP/GP-CrashReport-0659B2B2-1DB4-48B9-BDDB-5EC72DE8B201.json\n2017-10-15 02:54:24.354 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 's.View.propTypes.style')\n2017-10-15 02:54:24.357 [error][tid:com.facebook.react.JavaScript] Module AppRegistry is not a registered callable module (calling runApplication)\nINFO : BSG_KSCrashReport.c (2157): void bsg_kscrashreport_writeStandardReport(BSG_KSCrash_Context *const, const char *const): Writing crash report to /var/mobile/Containers/Data/Application/00FD4F8E-DFF5-4166-982B-0D4AB56048DE/Library/Caches/KSCrashReports/GP/GP-CrashReport-9288B937-E697-4571-AE3D-5377FB7EABAE.json\nlibc++abi.dylib: terminating with uncaught exception of type NSException\n\n\nI suspect it's being caused by the bundler.. Could be Babel or something else. I've tracked down any references to \"*.propTypes.style\" and commented them out, thinking it'd be those, but that didn't change the result. It still crashes.\n\nAny suggestions would be much appreciated. Thanks!"
] | [
"react-native"
] |
[
"ActiveRecord: SQL injection resistant wheres",
"I'm trying to build a miniature engine that will allow a search query to be built up on the fly by user input. I get the column name and the search string in the params, let's assume:\n\nparams = {:filter_column => \"column_name\", :filter_string => \"search term\"}\n\n\nI know that if I were just calling a standard sort of where on my model it would be along the lines of:\n\nModelName.where(\"column_name LIKE ?\", params[:filter_string])\n\n\nThe problem I have is I'm trying to compile a list of my filters and then apply them one at a time to the search. Can I build up the where string before I call the where method?\n\nI've tried:\n\nModelName.where(\"? LIKE ? \", column_name, search_term)\n\n\nwithout much luck. Any hints, tips or pointers?\n\nthanks!"
] | [
"ruby-on-rails",
"activerecord",
"sql-injection"
] |
[
"SQLite join in embedded database tables",
"I am currently writing a Windows Store Application for Windows 8 and I am using SQLite for the persistence on the embedded database in a class library for windows apps. I am trying to join data from two different tables in my embedded database but SQLite keeps throwing a not supported exception from their GenerateCommand method.\n\nI do currently have data in both tables and they both have a questionId in each table to join on. I've tried two different methods which both throw the same error.\n\nThe first method:\n\n var q = (from gameTable in db.Table<Model.GameSaved>()\n join qTable in db.Table<Questions>() on gameTable.QuestionId equals qTable.QuestionId\n select qTable\n ).First();\n\n\nThe second method:\n\n var q =\n (from question in db.Table<Model.GameSaved>()\n select question\n ).Join(db.Table<Questions>(), \n game => game.QuestionId, \n questionObject => questionObject.QuestionId,\n (game,questionObject) => questionObject)\n .First();\n\n\nI'm not exactly sure what I'm missing here but it has to be something simple and obvious."
] | [
"c#",
"sqlite",
"join",
"windows-store-apps",
"sqlite-net"
] |
[
"Mcrypt PHP extension required in Mac OS X El Capitan",
"Getting error Mcrypt PHP extension required. with Laravel in Mac OS X El Capitan.\n\nAlready installed the mcrypt using brew.\n\nbrew install mcrypt\nbrew install homebrew/php/php55-mcrypt\nsudo apachectl restart\n\n\nwhich php\n\n/usr/local/bin/php\n\n\nphp --version\n\nPHP 5.5.30 (cli) (built: Oct 3 2015 23:48:03) \nCopyright (c) 1997-2015 The PHP Group\nZend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies\n\n\nphp --ini\n\nConfiguration File (php.ini) Path: /usr/local/etc/php/5.5\nLoaded Configuration File: /usr/local/etc/php/5.5/php.ini\nScan for additional .ini files in: /usr/local/etc/php/5.5/conf.d\nAdditional .ini files parsed: /usr/local/etc/php/5.5/conf.d/ext-mcrypt.ini"
] | [
"php",
"macos",
"laravel",
"mcrypt"
] |
[
"HTML first file in file selector doesn't exist",
"All I'm trying to do is let the user upload image files and display them one by one, but for some reason the first file in the list of images I upload never works. The image data is undefined. No errors show up.\n\nTest here: http://jsfiddle.net/59q8f3bh/\n\nTry to upload only one image, and then multiple images.\n\nMy HTML:\n\n<body>\n <input type=\"file\" name=\"image\" id=\"image\" multiple accept=\"image/*\">\n <button type=\"submit\" onclick=\"upload()\">Upload</button>\n <img src=\"\">\n\n <script src=\"js/upload.js\"></script>\n</body>\n\n\nMy JS:\n\nfunction upload() {\n var selected = document.getElementById('image');\n\n for (var i = 0; i < selected.files.length; i++) {\n var img = selected.files[i];\n var imgData;\n\n var reader = new FileReader();\n\n reader.addEventListener(\"load\", function () {\n imgData = reader.result;\n }, false);\n\n reader.readAsDataURL(img);\n document.getElementsByTagName('img')[0].src = imgData;\n alert(i);\n }\n}"
] | [
"javascript",
"html",
"image",
"file-upload",
"filereader"
] |
[
"Basic JPEG manipulation with Carrierwave Mac",
"What's the least painful way to get basic JPEG scaling available to CarrierWave on a Mac (Leopard) Server? I'm trying to avoid installing the full ImageMagick suite and all its myriad dependencies as this server is stable right now and, well, ImageMagick scares me as it litters /usr/local/bin with PDF, Font, fax, bmp, png, etc utilities which we won't need. \n\nAll we need out of CarrierWave is for it to create jpeg thumbs from uploaded JPEGs. Any suggestions?"
] | [
"ruby-on-rails",
"imagemagick",
"carrierwave",
"osx-server",
"mogrify"
] |
[
"JsTree layout brokes when used inside Materialize's SideNav",
"I'm trying to use a jstree inside a sidenav from Materialize. The jstree works pretty fine outside the sidenav but misalign inside it.\n\nHere is a comparison:\n\nAligned \n\nMisaligned\n\nHere is the main HTML code:\n\n<div id=\"slide-out\" class=\"side-nav\">\n <div id=\"jstree\"></div>\n</div>\n\n\nAlso here is a fiddle: https://jsfiddle.net/0bdrhokg/19/"
] | [
"html",
"css",
"materialize",
"jstree"
] |
[
"How to fix \"NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0.\"",
"I am creating a new iOS application using swift, and need help with getting my tableView to delete data. I am using Core Data to save the data in a one-to-many relationship, and I have it so the entity selected deletes but it crashes when it updates the tableView. \n\nI have created applications before but this is my first with using the one-to-many data storage method. I have also Googled solution but none have worked. Here is my code for my tableView editingStyle.\n\nif editingStyle == .delete {\n context.delete(items[indexPath.row])\n\n do {\n try context.save()\n\n self.tableView.beginUpdates()\n items.remove(at: indexPath.row)\n self.tableView.deleteRows(at: [indexPath], with: .fade)\n self.tableView.endUpdates()\n } catch let error as NSError {\n print(\"Could not save. \\(error.localizedDescription)\")\n }\n}\n\n\nI want the row to delete along with the entity in Core Data but it is actually just deleting the entity and then crashing when it tries to update the tableView. Specifically I think it is crashing when it calls \"deleteRows\" because it then gives the error:\n\n\n Project Aurora[14179:303873] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (2) must be equal to the number of rows contained in that section before the update (2), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'\n\n\nMore Code:\n\noverride func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n let count = fetchedRC.fetchedObjects?.count ?? 0\n return count\n}\n\n\noverride func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n let cell = tableView.dequeueReusableCell(withIdentifier: \"itemsTable\", for: indexPath) as! ItemsTableViewCell\n\n items.append(fetchedRC.object(at: indexPath))\n\n if items[indexPath.row].isComplete == true {\n let attributeString = NSMutableAttributedString(string: items[indexPath.row].name!)\n\n attributeString.addAttribute(NSAttributedString.Key.strikethroughStyle, value: NSUnderlineStyle.single.rawValue, range: NSMakeRange(0, attributeString.length))\n cell.nameL.attributedText = attributeString\n\n } else {\n cell.nameL.text = items[indexPath.row].name\n }\n\n return cell\n}"
] | [
"ios",
"swift",
"uitableview",
"core-data",
"crash"
] |
[
"Do apache ant supports cordova to build native mobile apps?",
"I need to package an app which is created with the support of ionic framework. Apache Cordova allows for building native mobile applications using HTML, CSS and JavaScript. But i have used jenkins(CI tool) with ant, so how do integrate cordova with apache ant?\n\nHelps Appreciated...!!!"
] | [
"cordova",
"jenkins",
"ant",
"ionic-framework"
] |
[
"How to print from class with no print lines in class",
"I am trying to print by making it a string in the class. I am trying not to have any print lines in the class at all. I can't figure out how to not have the print lines in my printBoard method.\nclass MakeString() {\n\nfun printThis(): String {\n var line = arrayOf("hello","printMe") \n var addThis = "there"\n\n for (element in array) {\n println()\n }\n \n return line.toString()\n }\n \n override fun toString(): String {\n return """\n ${printThis()}\n """.trimIndent()\n }\n}"
] | [
"class"
] |
[
"OwnerDrawn ListBox blank when it loses focus",
"I subscribe to the ListBox.DrawItem event and it draws fine when it has focus but when I navigate away it draws nothing.\n\nprivate void lbHeader_DrawItem(object sender, DrawItemEventArgs e)\n{\n e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds);\n e.Graphics.FillRectangle(SystemBrushes.GradientActiveCaption, e.Bounds);\n\n int left = e.Bounds.Left + ImageList.ImageSize.Width;\n for (int i = 0; i < Columns.Count; i++)\n {\n Rectangle textRect = Rectangle.FromLTRB(\n left, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom);\n TextRenderer.DrawText(e.Graphics, \"Some Text\", e.Font, textRect,\n FontColor, TextFormatFlags.Left | TextFormatFlags.VerticalCenter);\n left += Columns[i].Width;\n }\n}"
] | [
"c#",
".net",
"winforms",
"listbox",
"ownerdrawn"
] |
[
"Reset a sum in a query when a date field changes month",
"I am currently executing the following query:\n\nSelect *, Balance = SUM(DailyReAdmits) \nOVER (ORDER BY Date_Total ROWS UNBOUNDED PRECEDING) \nFrom #AllReadmits\n\n\nWhich returns these results:\n\nDate_Total DailyReAdmits Balance\n2015-08-25 4 4\n2015-08-26 8 12\n2015-08-27 9 21\n2015-08-28 3 24\n2015-08-29 1 25\n2015-08-30 4 29\n2015-08-31 3 32\n2015-09-01 5 37\n\n\nHowever, when a new month starts, I would like the balance to start over again and look like this:\n\nDate_Total DailyReAdmits Balance\n2015-08-25 4 4\n2015-08-26 8 12\n2015-08-27 9 21\n2015-08-28 3 24\n2015-08-29 1 25\n2015-08-30 4 29\n2015-08-31 3 32\n2015-09-01 5 5\n\n\nHow can I achieve this?"
] | [
"sql-server"
] |
[
"OpenResty POST issue",
"When having a page that accepts a POST request and running it via jQuery, I get an OpenResty error:\n\n\n 25031#0: *237 client sent invalid method while reading client\n pipelined request line, client: <snip>, server: <snip>, request:\n \"name=&gamemode=&plugname=&port=\"\n\n\nI'm not sure why. If you need any more information, just ask."
] | [
"http",
"post",
"lua",
"openresty"
] |
[
"Horizontal StackView issue for multiline label and fixed size icon image",
"I want to show a an icon image which is fixed size of 20px X 20px ,It is showing good when a label is only one line but not showing accurately when label became in two lines.Screenshot is attached."
] | [
"ios",
"swift",
"uistackview",
"nsstackview"
] |
[
"Failed to store stdin state and compare it in C++",
"using namespace std;\n\nint main(void)\n{\n int input;\n\n while (true)\n {\n cin >> input;\n ios_base::iostate state = cin.rdstate();\n\n if (state == ios_base::eofbit)\n // if (state == (ios_base::eofbit | ios_base::failbit)) doesn't work also\n break;\n }\n\n return EXIT_SUCCESS;\n\n}\n\n\nWhy it never stops when ^D (EOF, ^Z in Windows) is pressed?"
] | [
"c++",
"eof"
] |
[
"declared font weight but can't call font weight",
"I added a font & declared font weight:\n@font-face {\nfont-family: 'Gotham-Medium';\nfont-weight: 700; \nsrc: url("fonts/Gotham-Medium-Regular.woff");\n}\n\nBut font-weight doesn't work - so the below code doesn't call the Medium font (it calls the bold font). What am I doing wrong? Btw I didn't have to add regular & bold gotham font files, somehow I already had access to it.\n.active, .accordion:hover {\nfont-weight: 700;\n}\n\nBelow code correctly calls medium font, but I'm hoping to use 'font-weight' to call the medium font.\n.active, .accordion:hover {\n font-family: 'Gotham-Medium'; \n }"
] | [
"html",
"css",
"font-face"
] |
[
"How to solve this minimum steps needed to reach end of matrix problem?",
"Given a matrix containing initial state of each elements, find minimum number of steps to reach from top left to bottom right?\n\nConditions:\n\nInitial state of any element will be randomly one of North, East, South or West.\nAt every step, we can either not move anywhere or move in the direction of current state of that element (ofcourse we never go out of the matrix)\nAny step will simulatanously change the state of all elements of the matrix. States change in a clockwise cyclic manner i.e from N -> E -> S -> W. Even if we don't move in a step, the states do change"
] | [
"algorithm",
"matrix",
"depth-first-search",
"breadth-first-search"
] |
[
"What changed with AngularJS 1.2.0-rc.3 that stops ng-click from having the right model value?",
"We have some code in an ng-click that broke with version 1.2.0-rc.3 because the value in the scope hasn't been updated from the click. Here's a dumbed down version:\n\nHTML:\n\n<div ng-app=\"\" ng-controller=\"MyCtrl\">\n <input type=\"checkbox\" ng-model=\"checkAll\" ng-click=\"allChecked()\"/>\n <input type=\"checkbox\" ng-model=\"check1\"/>\n <input type=\"checkbox\" ng-model=\"check2\"/>\n <input type=\"checkbox\" ng-model=\"check3\"/>\n <input type=\"checkbox\" ng-model=\"check4\"/>\n <input type=\"checkbox\" ng-model=\"check5\"/>\n <p/>\n All: {{checkAll}}<br/>\n 1: {{check1}}<br/>\n 2: {{check2}}<br/>\n 3: {{check3}}<br/>\n 4: {{check4}}<br/>\n 5: {{check5}}<br/>\n</div>\n\n\nJavaScript:\n\nfunction MyCtrl($scope)\n{\n $scope.allChecked = function() {\n console.log($scope.checkAll);\n if ($scope.checkAll)\n {\n\n $scope.check1 = true;\n $scope.check2 = true;\n $scope.check3 = true;\n $scope.check4 = true;\n $scope.check5 = true;\n }\n else\n {\n $scope.check1 = false;\n $scope.check2 = false;\n $scope.check3 = false;\n $scope.check4 = false;\n $scope.check5 = false;\n }\n }\n}\n\n\nFiddle with 1.2.0-rc.2: http://jsfiddle.net/73E26/\n\nNow with the same exact setup for 1.2.0-rc.3 (http://jsfiddle.net/LZR6j/), it now longer works as expected. $scope.checkAll is false, even though it is checked. So, the model isn't getting updated before the click listener is called like it was with 1.2.0-rc.2. What changed that is causing this? I've found that I can make this work by using ng-change instead of ng-click (http://jsfiddle.net/8VV7N/), but I want to understand what is going on so I base future decisions on it. Can anyone shed some light this?"
] | [
"javascript",
"angularjs",
"angularjs-ng-click"
] |
[
"Converting Java classes to applets",
"I have four classes of Java in Netbeans IDE and one of them contains the main method. I want to use them as applets. How do I do that?"
] | [
"java",
"applet"
] |
[
"gorm/grails sort hasMany children items",
"class A {\n hasMany = [b: B]\n} \nclass B {\n int type\n String title\n belongsTo = [a: A]\n}\n\n\nIs there any way to get or list type A, which would have collections of type B sorted in one case by type, in another by title?"
] | [
"hibernate",
"grails",
"hql",
"gorm"
] |
[
"Can't get VLCJ CaptureTest to work",
"I need to be able to record from my webcam in the Java application I'm programming. I've tried JMF but couldn't get the Capture Device (it only saw the audio devices). Right now I'm trying with VLCJ and it just doesn't work. If I open the VLC Player I can access the camera with no problem at all, so I know my webcam works because and that I should be able to make it work through VLCJ. I just don't know how.\n\nThe code is the same in the CaptureTest.java file available here:\n\nhttp://code.google.com/p/vlcj/wiki/SimpleExamples\n\nall I did was try it with a String \"dshow://\" as mrl.\n\nIm on Windows 7, JDK 1.6, VLC 2.1 and Netbeans 7.1\n\nAny ideas?\nThank you very much to anyone who can help me out here."
] | [
"java",
"webcam",
"vlcj"
] |
[
"xml.child is not a function?",
"For some reason AS3 does not recognize the child function of the XML class as a function.\n\nIn the docs:\n\nchild(propertyName:Object):XMLList\n\n\nLists the children of an XML Object.\n\nvar xml:XML = new XML (\n <body>\n <bar value = \"1\"/>\n <foo value = \"2\"/>\n </body> );\n\nvar f:Function = xml.child as Function;\ntrace(XMLList(f(\"foo\")).toXMLString());\n\n\nThis code gives the error: Error #1006: value is not a function.\n\nUpon further inspection, f is found to be null.\nSo my question is, how do I assign the child() function of the XML Class to a variable of the type Function?\n\nOn a side note, the reason that this is necessary is because of its use in a utility function, forEach(arr:Array, f:Function):Array, which executes the function f on each item in the array and returns the result."
] | [
"xml",
"actionscript-3",
"function"
] |
[
"What is the T-SQL syntax to fill the columns of a table in my database with the same set of data with continuous dates?",
"I am using SQL Server 2016 and I need to create a table (RoomInventory) in my database that will contain the following set of data which will be repeated for the period 01 January 2016 to 31 December 2016.\n\nHere is how I want the final table to appear:\n\nDate RoomType Property Inventory \n2016-01-01 SUP JS 20\n2016-01-01 DLX JS 15\n2016-01-01 FAS FB 6\n\n2016-01-02 SUP JS 20\n2016-01-02 DLX JS 15\n2016-01-02 FAS FB 6\n-------------------------------------------\n-------------------------------------------\n2016-12-31 SUP JS 20\n2016-12-31 DLX JS 15\n2016-12-31 FAS FB 6\n\n\nI know how to create the Table and how to insert data using the INSERT INTO syntax but I have no clue as to how to write the proper syntax that will fill the DATE column with the dates required."
] | [
"sql-server",
"date",
"sql-insert"
] |
[
"SelectOneMenu default value in edit mode",
"I have a editable datatable, containing column \"Datatype\". When editing this column, a selectOneMenu is used to select a value \"String\", \"Number\" or \"Date\". When I enter the edit mode, the \"Datatype\" column is set to \"String\" (the first item of data type list), but I would like it to be the current value of this column (like in Primefaces showcase: Click - for example if I click on a first row and third column of the second table, 'Fiat' should be selected and not the first item from selectOneMenu - 'BMW' -like in my case). \n\nWhat could be the problem with my code? \n\nxhtml:\n\n<p:column headerText=\"Type\" >\n <p:cellEditor>\n <f:facet name=\"output\">\n <h:outputText value=\"#{item.dataType.code}\" />\n </f:facet>\n <f:facet name=\"input\">\n <p:selectOneMenu value=\"#{item.dataType}\" converter=\"myConverter\" >\n <f:selectItems value=\"#{backingBean.dataTypeList}\" var=\"dt\" itemLabel=\"#{dt.code}\" itemValue=\"#{dt}\" />\n </p:selectOneMenu>\n </f:facet>\n </p:cellEditor>\n</p:column>\n\n\nDataType class:\n\npublic class DataType implements Serializable {\n\n private BigDecimal id;\n private String code;\n private String descr;\n\n // Getters+Setters.\n}\n\n\nUsing Primefaces 5.1.\n\nI'm available for any additional information needed."
] | [
"jsf",
"jsf-2",
"primefaces"
] |
[
"Why will this hailstone number producer not work?",
"I am trying to make a JButton on a JPanel that, when clicked, produces the hailstone number (if the number is even divide by two; if the number is odd, multiply by 3 and then add one). However, when I click my JButton, the program freezes and no number is outputted. Why is this happening?\n\nHere is my code:\n\n\r\n\r\nimport javax.swing.*;\r\nimport java.awt.*;\r\nimport java.awt.event.*;\r\npublic class Panel03 extends JPanel {\r\nprivate JLabel label;\r\nprivate JButton button;\r\nprivate JTextField box;\r\n\r\npublic Panel03()\r\n{\r\n box = new JTextField(\"0\", 10);\r\n box.setForeground(Color.black);\r\n box.setHorizontalAlignment(SwingConstants.RIGHT);\r\n add(box);\r\n \r\n label = new JLabel();\r\n label.setFont(new Font(\"Serif\", Font.BOLD, 20));\r\n label.setForeground(Color.blue);\r\n add(label);\r\n\r\n button = new JButton(\"Next\");\r\n button.addActionListener(new Listener());\r\n add(button);\r\n}\r\n\r\nprivate class Listener implements ActionListener\r\n{\r\n public void actionPerformed(ActionEvent e)\r\n {\r\n String s = box.getText();\r\n int a = Integer.parseInt(s);\r\n int b = a;\r\n do {\r\n if(a%2 == 0){b/=2.0;}\r\n else{a=((3*b)+1);}\r\n label.setText(Integer.toString(b));\r\n }\r\n while(b!= 4||b!= 2||b!= 1);\r\n }\r\n}\r\n}"
] | [
"java",
"jpanel",
"actionlistener"
] |
[
"The DELETE statement conflicted with the REFERENCE constraint the error shows when i delete it in the procedures",
"I have a table tb1 which is a parent table and child table tb2. My parent table has a column pid and it is referred to tb2 cpid as a foreign key FK_name for cpid.\n\nWhen I delete from the child table first and then the parent table manually, it's working fine. But when I do it inside a procedure, I get an error \n\n\n The DELETE statement conflicted with the REFERENCE constraint \"FK_name\".\n The conflict occurred in database \"database Name\", table \"childTablename\"\"\n\n\nCan anyone help me resolve this error?"
] | [
"sql-server"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.