texts
sequence
tags
sequence
[ "Magento - Show product attributes on Order confirmation email", "I need help with the following:\n\nIn Magento I have created a configurable product and assigned some simple products to it. They have an individual attribute set with individual attributes that I have created.\n\nOn the order review page, the product name as well as the options are displayed - this is fine.\n\nOn the order confirmation email, only the product's name and the SKU of the associated/ordered product is displayed. I need to display the atttributes that belong to my product as well (the attributes, that I have created to describe that specific product, like length, width, etc.).\n\nAny help is appreciated!\nThanks!" ]
[ "php", "html", "magento" ]
[ "NPM not caring about duplicate dependencies. Did this change?", "Unlike other package managers, npm installs a tree of dependencies. Each package has its node_modules folder, and can contain the same dependency in the same or different version. At least this was the case in 2016, described here and here.\nNow when i open node_modules, i see many more sub-folders than before and that's strange especially when i installed only one package in my project (umi-test). I guess those are all dependencies of that package, installed horizontally. So it seems NPM installs only one version of each package and no duplicates anymore.\nWhat's the truth?" ]
[ "npm", "dependencies", "node-modules", "install.packages" ]
[ "Limit RewriteRule in htaccess file", "i got a site php based with some rules in the .htaccess file to get rid of file extentions in the url adress bar. Basically it takes http://netbureau.com.br/en/about.php/ and turns it into http://netbureau.com.br/en/about.\nHere are the lines in the htaccess file:\nRewriteEngine on\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteCond %{REQUEST_FILENAME}\\.php -f\nRewriteRule ^(.*)$ $1.php\n\nThe problem comes when i try to access the rss feed of the blog at http://netbureau.com.br/blog/?feed=rss2 and when i try to set custom permalinks for the blog at http://netbureau.com.br/blog. It gets messed up by the htaccess file.\nSo is there any way to disallow the RewriteRule for the /blog folder so that i can get back my rss link and set custom permalinks in the blog?\nI know it's at the same time Wordpress related but it feels more connected to the htaccess file than Wp.\nThanks in advance.\nEDIT #1:\nI've set up the wordpress permalinks to the default structure which goes like this: http://netbureau.com.br/blog/?p=123 This made my rss link back for good.\nThe remaining problem is that Wordpress gives me its own rewriterule which is:\nRewriteEngine On\nRewriteBase /blog/\nRewriteRule ^index\\.php$ - [L]\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . /blog/index.php [L] \n\nIs there a way to to still use the first rule to apply to the whole site except the /blo/ folder and apply the WP rule only to the /blog/ folder?\nI've tried different combinations but without luck so far. I could only have the site without the custom links for the blog or the custom blog links and a 404 on the pages of the site." ]
[ ".htaccess", "url-rewriting", "rewrite" ]
[ "Full width/height div css specifics", "Considering I aim modern desktop and mobile browsers, is there any practical difference in which one of the following css rules to use? Are there any hidden caveats?\n\n.modal-1{\n position:fixed;\n top:0; \n right:0; \n bottom:0; \n left:0;\n}\n\n.modal-2{\n position:fixed;\n width:100%;\n height:100%;\n}\n\n.modal-3{\n position:fixed;\n min-width:100%;\n min-height:100%;\n}\n\n\nAnd a sub-question: what if everything is the same, except position:absolute;, when I want to make a modal div inside another (relative or absolute positioned) div and not body, is there any difference in css rules then?" ]
[ "html", "css" ]
[ "How will I be able to senda ctrl + c in tcl", "Is there a way that I could send a Ctrl+C signal a tcl program?\n\nI am having a tcl code in which when I execute it, internally it should undergo through Ctrl+C signal and print something like:\n\nputs \"sent ctrl+c\" within the same file.\n\nproc abc { \n\n # Want to sent ctrl + c\"\n Here I want the command for ctrl+c\n puts \" sent ctrl+c\"\n}" ]
[ "tcl" ]
[ "Setting TIME_WAIT TCP", "We're trying to tune an application that accepts messages via TCP and also uses TCP for some of its internal messaging. While load testing, we noticed that response time degrades significantly (and then stops altogether) as more simultaneous requests are made to the system. During this time, we see a lot of TCP connections in TIME_WAIT status and someone suggested lowering the TIME_WAIT environment variable from it's default 60 seconds to 30.\n\nFrom what I understand, the TIME_WAIT setting essentially sets the time a TCP resource is made available to the system again after the connection is closed.\n\nI'm not a \"network guy\" and know very little about these things. I need a lot of what's in that linked post, but \"dumbed down\" a little.\n\n\nI think I understand why the TIME_WAIT value can't be set to 0, but can it safely be set to 5? What about 10? What determines a \"safe\" setting for this value?\nWhy is the default for this value 60? I'm guessing that people a lot smarter than me had good reason for selecting this as a reasonable default.\nWhat else should I know about the potential risks and benefits of overriding this value?" ]
[ "tcp", "network-protocols" ]
[ "Struggling to translate jQuery JSONP query to a Node.JS query using http.request", "Long-time(well, 3 months) reader, first-time poster. I have a client-side jquery AJAX request of some JSONP data which I am trying to switch into a http.request, so I can use it server-side on a Node.js server.\n\nThe jQuery works easily enough: JSfiddle here http://jsfiddle.net/gk0uttdu/ , code here:\n\n $.ajax({\n type: 'GET',\n url: 'http://www.mysupermarket.co.uk/Api.aspx?Command={\"Output\":\"JSONP\",\"Commands\":[{\"Name\":\"Basket\",\"Params\":{\"BrandStores\":[\"780\"],\"ProductPrices\":{\"920\":[\"ASDA\",\"Ocado\",\"Sainsburys\",\"Tesco\",\"Waitrose\"],\"016555\":[\"ASDA\",\"Sainsburys\",\"Tesco\",\"Waitrose\"]},\"TrolleyItems\":[\"920\",\"52200\",\"1017\"],\"TrolleyLinks\":[\"780\"]}}]}&banner=34',\n dataType: 'jsonp',\n success: function(json) {\n alert(JSON.stringify(json)); \n }\n});\n\n\nHowever, when I try to rewrite this request using Node's http module as below, it fails with a 403. I suspect it is because I am not setting dataType:JSONP anywhere. \n\nvar ajaxUrl = 'http://www.mysupermarket.co.uk/Api.aspx?Command={\"Output\":\"JSONP\",\"Commands\":[{\"Name\":\"Basket\",\"Params\":{\"BrandStores\":[\"780\"],\"ProductPrices\":{\"920\":[\"ASDA\",\"Ocado\",\"Sainsburys\",\"Tesco\",\"Waitrose\"],\"016555\":[\"ASDA\",\"Sainsburys\",\"Tesco\",\"Waitrose\"]},\"TrolleyItems\":[\"920\",\"52200\",\"1017\"],\"TrolleyLinks\":[\"780\"]}}]}&banner=34';\n\nvar req = http.request(ajaxUrl, function(res) {\n console.log('STATUS: ' + res.statusCode);\n console.log('HEADERS: ' + JSON.stringify(res.headers));\n res.setEncoding('JSONP');\n res.on('data', function (chunk) {\n console.log('BODY: ' + chunk);\n });\n});\n\nreq.on('error', function(e) {\n console.log('problem with request: ' + e.message);\n});\n\n// write data to request body\nconsole.log('data\\n');\nconsole.log('data\\n');\nreq.end();\n\n\nLooked through the http documentation and cannot find how to set it. Also tried the request module for Node with Matt's suggested answer, failed to get that to work either. Node HTTP request for Restful api's that return JSONP\n\nWhat is the proper way to do this? Feel like I have been banging head against the wall for a few days, any help greatly appreciated." ]
[ "jquery", "ajax", "node.js", "jsonp" ]
[ "Collapse/Expand item which is not below header (jQuery Collapse)", "Im using the Plugin \"JQuery Collapse\" from Daniel Stocks -> http://webcloud.se/code/jQuery-Collapse/ which is doing a great job.\n\nBut by default, it is only possible to Expand/Collapse the element BELOW the header:\n\n<div>\n <h1>header</h1>\n <p class=\"collapse\">collapsible content</p>\n</div>\n\n\nNow I want to collapse the element after the first p. I tried to modify the jQuery-Code but had no success. How do I manage this?\n\n<div>\n <h1>header</h1>\n <p>some text</p>\n <p class=\"collapse\">collapsible content</p>\n</div>\n\n\nThank you,\n\nDavid" ]
[ "jquery", "expand", "collapse" ]
[ "Does the construction of an object through a class variable always need the parent class to have a constructor?", "A bit of a convoluted question, I know, and I'm sure someone is at hand to simplify it to its basics.\n\nConsider the following code:\n\nTTestClass = class\npublic\nend;\n\nTTestClassDescendant = class(TTestClass)\npublic\n constructor Create;\nend;\n\n\nimplementation\n\nprocedure TForm1.Button1Click(Sender: TObject);\nvar tc: TTestClass;\nbegin\n tc := TTestClassDescendant.Create;\n tc.Free;\nend;\n\n{ TTestClassDescendant }\n\nconstructor TTestClassDescendant.Create;\nbegin\n ShowMessage('Create executed') // this gets executed\nend;\n\n\nThe Create procedure gets executed properly.\n\nNow consider following code:\n\nTTestClass = class\npublic\nend;\n\nTTestClassDescendant = class(TTestClass)\npublic\n constructor Create;\nend;\n\nTTestClassClass = class of TTestClass;\n\nimplementation\n\nprocedure TForm1.Button1Click(Sender: TObject);\nvar tc: TTestClass;\n tcc: TTestClassClass;\nbegin\n tcc := TTestClassDescendant;\n tc := tcc.Create;\n tc.Free\nend;\n\n{ TTestClassDescendant }\n\nconstructor TTestClassDescendant.Create;\nbegin\n ShowMessage('Create executed') // this does NOT get executed\nend;\n\n\nThe Create procedure of the descendant class does not get executed anymore.\n\nHowever, if I introduce a constructor in the parent class and override it in the descendant class, it does get executed:\n\nTTestClass = class\npublic\n constructor Create; virtual;\nend;\n\nTTestClassDescendant = class(TTestClass)\npublic\n constructor Create; override;\nend;\n\n\nPardon me if I'm overlooking the obvious, but shouldn't the constructor code in that second block of code be executed when the construction occurs through a class variable, just as it is when it is called through the class identifier itself?" ]
[ "class", "delphi", "constructor", "delphi-xe2" ]
[ "Smooth jquery/javascript animations", "I am using jquery for sliding content up and down but it's not delivering the smoothness i need.\nThe animations work fine on webkit browsers like chrome and safari but give awful performance on mozilla based browsers.\n\nHow can i make my jquery animations to be as smooth as these - http://www.audentio.com/preview/mybb/darkseries\n\nWhat is the secret for that smooth animation?" ]
[ "jquery", "animation", "smooth" ]
[ "Need to check a windows service, if that service not available execute the msi file via cmd", "The script need to verify one windows service if that particular service is not available it needs to execute the MSI file (silent installation)" ]
[ "command-line", "command", "command-line-interface", "command-prompt" ]
[ "Download manager crashes on On DOWNLOAD COMPLETE", "This is my broadcast receiver:\n\n BroadcastReceiver broadcast = new BroadcastReceiver() {\n @Override\n public void onReceive(Context context, Intent intent) {\n String action = intent.getAction();\n if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {\n dwnId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0);\n Cursor c = DownloadManagerWrapper.getInstance(getActivity()).getDownloadManager().query(new DownloadManager.Query().setFilterById(dwnId));\n c.getInt(c.getColumnIndex(DownloadManager.COLUMN_STATUS));\n } else {\n Toast.makeText(getActivity(), \"ERROR!\", Toast.LENGTH_SHORT).show();\n }\n\n }\n};\n\n\nOn my onCreateView i register it:\n\n(getActivity()).registerReceiver(broadcast, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));\n\n\nThis is how my DownloadManagerWrapper looks like:\n\npublic class DownloadManagerWrapper {\nprivate static final String DOWNLOAD_SERVICE = \"download\";\n\nprivate DownloadManager mgr;\n\nprivate static DownloadManagerWrapper i;\n\nprivate DownloadManagerWrapper(Context c) {\n mgr = (DownloadManager) c.getSystemService(DOWNLOAD_SERVICE);\n}\n\npublic static DownloadManagerWrapper getInstance(Context c) {\n if (i == null) {\n i = new DownloadManagerWrapper(c);\n }\n return i;\n}\n\npublic DownloadManager getDownloadManager() {\n return mgr;\n}\n\n}\n\n\nThis is what i do that makes it FC:\n\n if(Util.hasNetworkConnection(ctx)){\n Uri destination = Uri.parse(\"file://\" + Environment.getExternalStorageDirectory().getAbsolutePath() + \"/media/video.mp4\");\n DownloadManagerWrapper.getInstance(ctx).getDownloadManager().enqueue(new DownloadManager.Request(uri).setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE).setAllowedOverRoaming(false).setDestinationUri(destination));\n }else{\n Toast.makeText(ctx, \"No Internet Available!!\", Toast.LENGTH_SHORT).show();\n }\n\n\nI get this error:\n\n02-14 15:57:03.488: E/AndroidRuntime(4987): FATAL EXCEPTION: main\n02-14 15:57:03.488: E/AndroidRuntime(4987): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.DOWNLOAD_COMPLETE flg=0x10 pkg=com.Red.medicalpaint (has extras) } in com.Red.Fragments.AppLibraryFragment$1@41a1f998\n02-14 15:57:03.488: E/AndroidRuntime(4987): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:765)\n02-14 15:57:03.488: E/AndroidRuntime(4987): at android.os.Handler.handleCallback(Handler.java:615)\n02-14 15:57:03.488: E/AndroidRuntime(4987): at android.os.Handler.dispatchMessage(Handler.java:92)\n02-14 15:57:03.488: E/AndroidRuntime(4987): at android.os.Looper.loop(Looper.java:137)\n02-14 15:57:03.488: E/AndroidRuntime(4987): at android.app.ActivityThread.main(ActivityThread.java:4978)\n02-14 15:57:03.488: E/AndroidRuntime(4987): at java.lang.reflect.Method.invokeNative(Native Method)" ]
[ "android", "file", "download", "uri", "download-manager" ]
[ "Created App in Production produces FeatureNotAvailable", "We just moved our app from Sandbox to production. We have no issue with sending SMS to any number in Sandbox but it's not working when we switched to production.\n\nHere's the error:\nException: The requested feature is not available SDK HTTP Error at https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/sms Response text: { \"errorCode\" : \"FeatureNotAvailable\", \"message\" : \"The requested feature is not available\", \"errors\" : [ { \"errorCode\" : \"MSG-242\", \"message\" : \"The requested feature is not available\" } ] }\nWhat am I doing wrong? Thanks." ]
[ "api", "sms", "ringcentral" ]
[ "Play frame work 2.2 No of parallel threads configuration", "Hi we are using play frame work 2.2. We are doing concurrent execution by using Promise.promise. But as of now its spawning a batch of 8 threads.Once this 8 thread over it will move to next 8 threads. But we need to run more than this concurrently. How can we configure this parallelism in our configuration. \nThanks in advance" ]
[ "playframework-2.2" ]
[ "rails select_tag selected no working", "I'm not sure what I am doing wrong but my select_tag :selected is not working. Check the code below:\n\n<%= select_tag :supplier, options_from_collection_for_select(SupplierItem.select(\"DISTINCT(SUPPLIER)\").group(\"SUPPLIER\"), \"SUPPLIER\", \"SUPPLIER\"), { :selected => params[:supplier], prompt: \"Select a Category\"} %>" ]
[ "ruby-on-rails", "ruby" ]
[ "When calling a function (in a loop) which uses a callback, how pass variables in and have them not change?", "I'm calling sendMessage in a loop for a bunch of appIds that are in an array. When my callback is called, I need to check for an error and then \"blacklist\" the appId that has the error. The problem is that every way I've tried this causes the appId in the callback to be changed by the time it's called! So the wrong appId gets blacklisted.\n\nI have three versions I tried (see below). One never blacklists, and the other two do the wrong one:\n\n** THIS ONE BLACK LISTS THE WRONG ONE **\n\nfor ( var appName in apps )\n{\n var app = apps[ appName ];\n\n var appId = app[ \"appId\" ];\n\n //Send message to that app\n chrome.runtime.sendMessage(\n app[ \"appId\" ],\n app,\n function (response)\n {\n var lastError = chrome.runtime.lastError;\n\n //Want to blacklist apps here\n if ( lastError && lastError.message.indexOf( \"not exist\" ) !== -1 )\n {\n //This blacklists the wrong one!\n myGlobalObject.addToTimeout( appId );\n }\n }\n );\n}\n\n\n** THIS ONE ALSO BLACK LISTS THE WRONG ONE **\n\nfor ( var appName in apps )\n{\n var app = apps[ appName ];\n\n var appId = app[ \"appId\" ];\n\n //Send message to that app\n chrome.runtime.sendMessage(\n app[ \"appId\" ],\n app,\n function (response)\n {\n var lastError = chrome.runtime.lastError;\n\n //Want to blacklist apps here\n if ( lastError && lastError.message.indexOf( \"not exist\" ) !== -1 )\n {\n //This blacklists the wrong one!\n myGlobalObject.addToTimeout( this[ \"appId\" ] );\n }\n }.bind( app )\n );\n}\n\n\n** THIS ONE NEVER BLACK LISTS IT **\n\nfor ( var appName in apps )\n{\n var app = apps[ appName ];\n\n //Send message to that app\n chrome.runtime.sendMessage(\n app[ \"appId\" ],\n app,\n function (response)\n {\n var lastError = chrome.runtime.lastError;\n\n //Want to blacklist apps here\n if ( lastError && lastError.message.indexOf( \"not exist\" ) !== -1 )\n {\n //Somehow this NEVER blacklists it!\n myGlobalObject.addToTimeout( app[ \"appId\" ] );\n }\n }\n );\n}" ]
[ "javascript", "google-chrome", "google-chrome-extension", "google-chrome-devtools", "google-chrome-app" ]
[ "Mux(8-bits input and 4-bits output) in HDL", "If sel = false, then out should contain the lower 4-bits of in (i.e. in[0], in[1], in[2], in[3])\n If sel = true, then out should contain the upper 4-bits of in (i.e. in[4], in[5], in[6], in[7])\n\nHere is my code and how to modify it....?\n\nCHIP NewMux\n{\n IN in[8], sel;\n OUT out[4];\nPARTS:\n Mux4(sel=sel, a=in[0], b=false, out=out[0]);\n Mux4(sel=sel, a=in[1], b=false, out=out[1]);\n Mux4(sel=sel, a=in[2], b=false, out=out[2]);\n Mux4(sel=sel, a=in[3], b=false, out=out[3]);\n Mux4(sel=sel, a=in[4], b=true, out=out[0]);\n Mux4(sel=sel, a=in[5], b=true, out=out[1]);\n Mux4(sel=sel, a=in[6], b=true, out=out[2]);\n Mux4(sel=sel, a=in[7], b=true, out=out[3]);\n}" ]
[ "hdl", "mux", "nand2tetris" ]
[ "Building HTTP POST request for registering printer with Google Cloud Print service", "I am trying to register a printer with the Google Cloud Print service using the register API at:\n\nhttps://developers.google.com/cloud-print/docs/proxyinterfaces#register\n\nI am trying to send a HTTP POST request using Google API Client Library for c++.\n\nHere's my source code:\n\nvoid IllustratePostWithData(const char* url, HttpTransport* transport){\n\n scoped_ptr<HttpRequest> request(transport->NewHttpRequest(HttpRequest::POST));\n request->AddHeader(\"X-CloudPrint-Proxy\", \"my proxy\");\n request->set_content_type(\"multipart/form-data; boundary=-----------RubyMultipartPost\");\n request->set_url(url);\n util::Status status = request->Execute();\n if (!status.ok())\n cerr << status.error_message();\n\n HttpResponse *response = request->response();\n if (response->ok()) {\n cout << \"Success\" << endl;\n } else {\n cout << \"Failed with status=\" << response->status().error_message() << endl;\n }\n string body;\n util::Status stat = response->GetBodyString(&body);\n cout << \"Received HTTP status code =\" << response->http_code() << endl;\n if (stat.ok()) {\n cout << \"HTTP body\" << body << endl;\n }\n}\n\nint main() {\n char* Cloud_print_url = \"https://www.google.com/cloudprint/register\";\n scoped_ptr<HttpTransport> transport;\n\n HttpTransportFactory* factory = new CurlHttpTransportFactory();\n HttpTransport* globalTransport = factory->New();\n\n IllustratePostWithData(Cloud_print_url, globalTransport);\n return 0;\n}\n\n\nI get the following response:\n\nSuccess\nReceived HTTP status code =200\nHTTP body{\n \"success\": false,\n \"message\": \"Proxy ID is required.\",\n \"request\": {\n \"time\": \"0\",\n \"params\": {\n }\n },\n \"errorCode\": 115\n}\n\n\nGoing through the API, I could not find a function to set proxy. Am I missing out on something in the HTTP POST request?\n\nThanks" ]
[ "c++", "http", "c++11", "google-api", "google-cloud-print" ]
[ "Strange issue with DDXMLElement", "I'm using XMPPFramework and just updated to the version 3.7 and now when I try to compile this line:\n\nbody.setStringValue(message)\n\n\nit gives me this error:\n\nValue of type 'DDXMLElement' has no member 'setStringValue'\n\n\nHow can I fix that?" ]
[ "swift", "xmppframework" ]
[ "Dagger 2 activity injection not working", "I'm trying the new dagger 2, it's my first time implementing it but I can't make it work. I think I got the concept and I understand the example here\n\nI try to copy the same structure just a bit modified for my example. \n\nHere is the AppComponent that extends the Graph where I defined the classes I want.\n\n@ApplicationScope\n@Component(modules = {AppModule.class, DataModule.class})\npublic interface EFAppComponent extends EFGraph {\n\n /**\n * An initializer that creates the graph from an application.\n */\n public final static class Initializer {\n\n private Initializer() {\n } // No instances.\n\n public static EFAppComponent init(EFApp app) {\n return Dagger_EFAppComponent.builder()\n .appModule(new AppModule(app))\n .build();\n }\n }\n}\n\n\npublic interface EFGraph {\n\n public void inject(EFApp app);\n\n public ImageLoader imageLoader();\n\n public EventBus eventBus();\n\n}\n\n\nThen inside each module I'm providing the corresponding classes. From here everything works good and Dagger seams to build the Dagger_EFAppComponent correctly.\n\nThen in the Application class I init using the constructor \n\ncomponent = EFAppComponent.Initializer.init(this);\ncomponent.inject(this);\n\n\nThen my goal is to Inject ImageLoader and EventBus in my activity. To do that I create a ActivityComponent.\n\n@ActivityScope\n@Component(\n dependencies = EFAppComponent.class,\n modules = ActivityModule.class\n)\npublic interface ActivityComponent {\n\n public void inject(BaseActivity activity);\n\n}\n\n\nThen from my activity I call inject. \n\nactivityComponent = Dagger_ActivityComponent.builder()\n .eFAppComponent(component)\n .activityModule(new ActivityModule(this))\n .build();\nactivityComponent.inject(this);\n\n\nSo because I declared @Inject EventBus eventBus in my activity after the inject method call should be injected. Well it's not.\n\nSo after debugging and tracking step by step my app and the example I realized that the Dagger_ActivityComponent is not build correctly. \n\nprivate final ActivityModule activityModule;\n private final EFAppComponent eFAppComponent;\n\n private Dagger_ActivityComponent(Builder builder) { \n assert builder != null;\n this.activityModule = builder.activityModule;\n this.eFAppComponent = builder.eFAppComponent;\n initialize();\n }\n\n\nWere the initialize method is empty and no Provider are declared as variable.\n\nAm I missing something? I've been the full day trying to make it work but I'm not success. \n\nAppreciate the help." ]
[ "java", "android", "dependency-injection", "dagger-2" ]
[ "How to make Debian's minimal bash look the same as Desktop version", "I have used virtualbox to install a minimal Debian version because I only want to use the bash terminal to use GIT. But the terminal looks completely different to the desktop version. I want to make it look the same as the Desktop version because it's easier to read. How do I configure this? \n\nupdate: I have edited the ~/.bashrc file to force_color_prompt=yes and set the environment variable TERM=\"xterm-256color\". I do get color but the text in the desktop version are all bold, where as my minimal isn't. And the background should be grey. \n\nScreenshot: \nMinimal Terminal and Desktop Bash" ]
[ "bash", "colors", "debian" ]
[ "\"GoogleApiClient is not connected yet\" on logout when using Firebase auth with google sign in", "I'm using Firebase auth with Google Sign In but I want to signout from another activity but when I logout using this method which works perfectly from the same activity but not with another activity. Here is the method.\n\npublic void logOut() {\n mAuth.signOut();\n // Google sign out\n Auth.GoogleSignInApi.signOut(googleApiClient).setResultCallback(\n new ResultCallback<Status>() {\n @Override\n public void onResult(@NonNull Status status) {\n authorizeUser(null);\n }\n });\n }\n\n\nBut when making this method static and the googleApiClient static it still doesn't work and when i perform only \n\nFirebaseAuth.getInstance().signOut();\n\n\nthe error i m getting is this (logcat)\n\nE/AndroidRuntime: FATAL EXCEPTION: main\n Process: com.igov, PID: 21316\njava.lang.IllegalStateException: GoogleApiClient is not connected yet.\n at com.google.android.gms.internal.zzoe.zzd(Unknown Source)\n at com.google.android.gms.internal.zzoh.zzd(Unknown Source)\n at com.google.android.gms.internal.zzof.zzd(Unknown Source)\n at com.google.android.gms.auth.api.signin.internal.zzc.signOut(Unknown Source)\n at com.igov.design.LoginActivity.logOut(LoginActivity.java:159)\n at com.igov.design.LoginActivity$2.onClick(LoginActivity.java:62)\n at android.view.View.performClick(View.java:5198)\n at com.igov.design.MainActivity.onNavigationItemSelected(MainActivity.java:101)\n at android.support.design.widget.NavigationView$1.onMenuItemSelected(NavigationView.java:152)\n at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:810)\n at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)\n at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:957)\n at android.support.design.internal.NavigationMenuPresenter$1.onClick(NavigationMenuPresenter.java:318)\n at android.view.View.performClick(View.java:5198)\n at android.view.View$PerformClick.run(View.java:21147)\n at android.os.Handler.handleCallback(Handler.java:739)\n at android.os.Handler.dispatchMessage(Handler.java:95)\n at android.os.Looper.loop(Looper.java:148)\n at android.app.ActivityThread.main(ActivityThread.java:5417)\n at java.lang.reflect.Method.invoke(Native Method)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)" ]
[ "android", "firebase", "firebase-authentication", "google-signin" ]
[ "How to add a hidden field value to QSqlRelationalTableModel during row creation?", "I'm starting out with PyQt5. I've created a simple password management app that has a login page and a password listing page against various URLs. I'm unable to find a way to add the user_id value to the record with QSqlRelationalTableModel before it gets inserted into the DB. This is what I've done so far. Code examples would help me. Thanks.\n self.model.beforeInsert.connect(self.beforeInsert)\n\ndef addRecord(self):\n """\n Add a new record to the last row of the table.\n """\n last_row = self.model.rowCount()\n self.model.insertRow(last_row)\n\ndef beforeInsert(self, record):\n print("[INFO] beforeInsert called", record)\n record.setValue("user_id", 1)\n done = self.model.insertRecord(-1, record)\n # done is False at this point, however record.value("user_id") is 1" ]
[ "python", "pyqt", "pyqt5" ]
[ "How can I add wrap capability to a QLegend", "After adding more than 3 items (like all of the examples) to a QChat's QLegend, the legend becomes overcrowded and the text for each series item gets truncated becoming unreadable. I need to be able to resize the attached legend or at lease allow the items to wrap to additional rows.\n\nIs there any way to get a QLegend to wrap series items?" ]
[ "c++", "qt", "qchart" ]
[ "Componentjs vs requirejs?", "What benefits to use componentjs (https://github.com/component/component) instead of requirejs?\n\nBoth project has the same idea, hard to make choice between them." ]
[ "javascript", "requirejs", "components" ]
[ "The Mystery of an Image", "So I'm developing a Model View Controller (MVC) project. Due to the size and complexity, I'm trying to ensure organization. I've managed to stumble on a unique quandary, one that has left me quite stumped. My issue is drawn from a Jquery Rotator that I'm integrating into my site.\n\nMy Solution Explorer:\n\n\nContent : This particular folder contains three direct sub-folders Images, Scripts, and Stylesheets.\n\n\nThose three sub-folders contain more specific and honed in details, an example would be the Scripts contains another folder called Rotator for this jQuery implementation.\n\nSo the dilemma occurs inside the View.\n\nAn example within this View:\n\n<div class = \"banner-style\">\n <div id = \"Infinite-Banner\">\n <div class = \"banner-container\">\n <div class = \"slides\">\n <img src = \"~/Content/Images/Banner/Slides/One.jpg\">\n <img src = \"~/Content/Images/Banner/Slides/Two.jpg\">\n </div>\n </div>\n </div>\n</div>\n\n\nSo within this structure it doesn't appear to load the Images. Though it is properly mapped to the directory. But if you use the same structure above but change the img portion to:\n\n<div class = \"slide-one\" />\n<div class = \"slide-two\" />\n\n\nThen in a the correlating Stylesheet, simply define a background: url(~/Content/Images/Banner/Slides/One.jpg); for the slide-one Element it magically appears. \n\nSo this makes me believe that it is due to nesting. But doesn't quite make sense, as this will force me to build an inner element between the div slides so that I can generate the proper affects.\n\nThe other idea would be to create a model that maps all the relational image data; but that seems like an awful lot of work.\n\nIs this a limitation or an issue specific to my machine? What would be the best work around to such an issue? Is this indeed due to the structure I've taken to my folders?" ]
[ "c#", "asp.net", "asp.net-mvc", "asp.net-mvc-4" ]
[ "Primary and secondary constraints in core data", "Is there such a thing as primary and secondary constraints in core data?\nI have a one to many relationship. In the \"many\" entity, I would like to have a constraint for one attribute. The problem is that the constraint is for all entities that I create and not for the specific one that is related to the \"one\" entity in the relationship." ]
[ "ios", "swift", "core-data" ]
[ "Performant calculation of datetime diffs in days", "I have a Django model that contains a unique record with a date . I'm currently counting records into ranges of days, e.g. X Number have already passed todays date, X will happen within the next 10 days, X will happen within the next 30 days.\nThe code below is what I am currently using, it pulls all values back from an records.objects.all() query against the model and then loops through each object to calculate the datetime delta and increment the relevant counter.\n\nfor x in records:\n if x.date is None:\n missingValue += 1\n else:\n delta = x.date - date.today()\n if delta.days < 0:\n passed += 1\n if delta.days < 10:\n tenDays += 1\n if delta.days < 30:\n thirtyDays += 1\n\n\nFor around 50,000 records this takes about 5-6 seconds which is longer than I would like, I'm trying to reduce this as the number of records is likely to increase.\nThe question is really around the performant calculation of datetime diffs and grouping the resultant number of days as if there is a better method through a Django Query or other method I've not been able to find I'm open to trying it.\n\nI've explored the use of DateAdd in a raw SQL but it would appear to need me to query the database for each date range and would still lead to me needing to loop through the results." ]
[ "python", "sql-server", "django", "python-2.7", "django-1.11" ]
[ "How to write SQL to select the not covered InvoiceDueDate", "I Have these tables. I need to select the InvoiceDueDate in overDue, the logic is:\n\nPendingCredit = Amount alread paid\nSelect which InvoiceDueDate doesn't cover the amount already paid.\n\n\nSomething like:\n\nvar table1 = select * \n from Table1 \n order by InvoiceDueDate \n where Balance > 0 \n and ReceivableId = 72\nvar pending = 940.13\n\nforeach(var record in table1)\n{\n pending = pending - balance\n if(pending <= 0)\n return InvoiceDueDate\n}\n\n\nTable 1\n\n╔══════════════╦═══════════════╦═════════╦════════════════╗\n║ ReceivableId ║ PendingCredit ║ Balance ║ InvoiceDueDate ║\n╠══════════════╬═══════════════╬═════════╬════════════════╣\n║ 72 ║ 940.13 ║ 183.79 ║ 21/10/2014 ║\n║ 72 ║ 940.13 ║ 90.87 ║ 27/10/2014 ║\n║ 72 ║ 940.13 ║ 160.55 ║ 28/10/2014 ║\n║ 72 ║ 940.13 ║ 92.03 ║ 3/11/2014 ║\n║ 72 ║ 940.13 ║ 200.9 ║ 4/11/2014 ║\n║ 72 ║ 940.13 ║ 15.02 ║ 6/11/2014 ║\n║ 72 ║ 940.13 ║ 34.96 ║ 6/11/2014 ║\n║ 72 ║ 940.13 ║ 108.15 ║ 10/11/2014 ║\n║ 72 ║ 940.13 ║ 27.48 ║ 17/11/2014 ║\n║ 72 ║ 940.13 ║ 26.38 ║ 1/12/2014 ║\n╚══════════════╩═══════════════╩═════════╩════════════════╝" ]
[ "c#", "sql", "tsql", "sql-server-2012" ]
[ "Extend class in third party definition file", "I provide a typescript definition file for a non-ts library I've written. My library extends EventEmitter2 as a \"native\" event system so I'm trying to determine how to define that:\n\n/// <reference types=\"eventemitter2\" />\n\ndeclare module \"my-module\" {\n class MyClass extends EventEmitter2 {\n // ...\n }\n}\n\n\n... which doesn't work. EventEmitter2 provides a d.ts file so it should be available, but the error I get is:\n\nCannot find name 'EventEmitter2'\n\nI don't work with ts enough to know where I'm going wrong. I've tried reading docs/looking for examples but nothing seems to address this type of issue." ]
[ "typescript" ]
[ "Re-initialize variable in TensorFlow to custom value", "I want to initialize a w_gate tensor with a custom np.array as in the code below:\n\n w_init = np.ones(shape=(dim, self.config.nmodels)) / self.config.nmodels\n\n w_gate = tf.Variable(\n name=\"W\",\n initial_value=w_init,\n dtype=tf.float32)\n\n\nEvery a certain number of train iterations, I want w_gate to be re-initialized again to the w_init array. For this, and based on Re-initialize variables in Tensorflow, I tried\n\nsess.run(tf.variables_initializer([w_gate]))\n\n\ninside my training loop. This line is executed every certain number of iterations. Although, w_gate doesn't seem to be re-initialized. What am I missing here?" ]
[ "python", "tensorflow" ]
[ "What is wrong with this ICalendar", "I've tried this in a couple of validators. It passes. Can someone please advise what is wrong with this. I doesn't load in any of our smart phones nor in Lotus Notes\n\nBEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Company Name//NONSGML Intranet Outage Cal//EN\nCALSCALE:GREGORIAN\nMETHOD:REQUEST\nBEGIN:VEVENT\nDTSTART:20130421T000000\nDTEND:20130421T003000\nDTSTAMP:20130410T163211\nORGANIZER:MAILTO:[email protected]\nUID:[email protected]\nLOCATION:EAF #1\nTRANSP:OPAQUE\nSEQUENCE:0\nSUMMARY:Outage Calendar : added\\, EAF #1 outage\nPRIORITY:5\nX-MICROSOFT-CDO-IMPORTANCE:1\nCLASS:PUBLIC\nX-FRS-EXT-BUILDNO;X-FRS-SEND=SEND:8.03.80716\nX-FRS-EXT-OPLINK;X-FRS-SEND=SEND:205A5936304D412A315F4B3026512E\nX-FRS-EXT-RECTYPE;X-FRS-SEND=SEND:A\nBEGIN:VALARM\nTRIGGER:-PT20H\nACTION:DISPLAY\nDESCRIPTION:Reminder:EAF #1 outage\nEND:VALARM\nEND:VEVENT\nEND:VCALENDAR" ]
[ "icalendar" ]
[ "Finger drag on your bottoms", "assume that a five buttons side by side, i need to know how to make them accept (Called) the drag from outside to inside the border of each button \n\ni.e. Like the piano if u drag your finger every button called and make sound\n\nThanks" ]
[ "iphone", "objective-c", "cocoa-touch" ]
[ "what is the difference of these two implementations of a recursion algorihtm?", "I am doing a leetcode problem. \n\nA robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).\n\nThe robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).\n\nHow many possible unique paths are there?\n\n\nSo I tried this implementation first and got a \"exceeds runtime\" (I forgot the exact term but it means the implementation is slow). So I changed it version 2, which use a array to save the results. I honestly don't know how the recursion works internally and why these two implementations have different efficiency. \n\nversion 1(slow):\n\nclass Solution {\n // int res[101][101]={{0}};\npublic:\n int uniquePaths(int m, int n) {\n if (m==1 || n==1) return 1;\n else{ \n return uniquePaths(m-1,n) + uniquePaths(m,n-1);\n }\n }\n};\n\n\nversion2 (faster):\n\nclass Solution {\n int res[101][101]={{0}};\npublic:\n int uniquePaths(int m, int n) {\n if (m==1 || n==1) return 1;\n else{ \n if (res[m-1][n]==0) res[m-1][n] = uniquePaths(m-1,n);\n if (res[m][n-1]==0) res[m][n-1] = uniquePaths(m,n-1);\n return res[m-1][n] + res[m][n-1];\n }\n }\n};" ]
[ "recursion" ]
[ "How to set matplotlib ax range positive and mirrored around a certian value", "I am trying to plot a data and function with matplotlib 2.0 under python 2.7. \n\nThe x values of the function are evolving with time and the x is first decreasing to a certain value, than increasing again. \n\nIf the function is plotted against time, it shows function like this plot of data against time\n\n\n\nI need the same x axis evolution for plotting against real x values. Unfortunately as the x values are the same for both parts before and after, both values are mixed together. This gives me the wrong data plot:\n\n\n\nIn this example it means I need the x-axis to start on value 2.4 and decrease to 1.0 than again increase to 2.4. I swear I found before that this is possible, but unfortunately I can't find a trace about that again." ]
[ "python-2.7", "matplotlib" ]
[ "Django queryset and generator", "Just out of the blue I wonder if the following way of iterating through a result set using generator will cause any positive or negative impact against normal iteration?\n\neg.\n\ndef all_items_generator():\n for item in Item.objects.all():\n yield item\n\nfor item in all_items_generator():\n do_stuff_with_item(item)\n\n\nagainst:\n\nfor item in Item.objects.all():\n do_stuff_with_item(item)" ]
[ "python", "django", "iteration", "generator" ]
[ "Why are array initializers only allowed for arrays?", "Possible Duplicate:\n Collection initialization syntax in Visual Basic 2008? \n\n\n\n\nThis does not compile.\n\nDim Tom As New List(Of String) = {\"Tom\", \"Tom2\"}\n\n\nThis does\n\nDim Tom As String() = {\"Tom\", \"Tom2\"}\n\n\nIMO this features should be allowed for all collection types and not only arrays." ]
[ "vb.net", "arrays", "collections" ]
[ "How to remove the last new line in javascript?", "I tried to split the text by new lines then stored into array that the array return the length was 5. But my input file has four lines. How to remove the last new line. \n\n$.get('patrn', function (file) {\nvar filedata = file;\nvar seq = new Array;\nseq = filedata.split(\"\\n\");\nvar seqpass = new seqleng(seq);\n}, 'text');\n\nfunction seqleng (b){\n//Pdat = b.replace(/[\\n]/gm,\"\"); //But this is not working\nvar Pdat = b;\nalert(Pdat.length);\n}\n\n\nMy input file Like this\n\nPQEMTGKPLFIVE\nAAAG\nMTG\nKPLFIVE" ]
[ "javascript", "jquery" ]
[ "How to clean views and models in Backbonejs", "movieDb.Router = Backbone.Router.extend({\n routes:{\n '': 'landPage',\n 'home': 'landPage',\n 'login': 'login',\n 'signup': 'signup'\n },\n\n landPage: function(p){\n $('div#homepage').empty();\n },\n\n login: function(p){\n new loginViews(); // Calls its own model \n },\n\n signup: function(p){\n new signupViews(); // Calls its own model\n }\n });\n\n\nThe problem is when coming from signup and calling login, it also calls the previous model requests(signup) resulting to login and signup request at the same time(my models are ajax requests), how can I remove the previously called models everytime I create a new request in my views.\n\nThanks." ]
[ "backbone.js", "backbone-events", "backbone-views" ]
[ "Return canvas that is drawed by some methods (plot, contour, imshow...)", "I wrote a matlab function that I try to return the graphics inside the figure.\n\nfunction h = multifigures(I, f)\n imshow(I);\n hold on;\n h=contours(f, [0,0]);\n hold off;\nend\n\n\nI call this function inside another function, and try to save it to disk\n\nfunction savefigures(I, f)\n h = multifigure(I,f);\n imwrite(h, 'sample.png');%or this-error saveas(h,'sample.png');\nend\n\n\nHowever, I just got a blank image (actualy, two rows of pixels)." ]
[ "matlab", "matlab-figure" ]
[ "Unable to open service via kubectl proxy", "➜ kubectl get svc \nNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\nairflow-flower-service ClusterIP 172.20.119.107 <none> 5555/TCP 54d\nairflow-service ClusterIP 172.20.76.63 <none> 80/TCP 54d\nbackend-service ClusterIP 172.20.39.154 <none> 80/TCP 54d\n\n➜ kubectl proxy\n\nxdg-open http://127.0.0.1:8001/api/v1/namespaces/edna/services/http:airflow-service:/proxy/#q=ip-192-168-114-35\n\nand it fails with\nError trying to reach service: 'dial tcp 10.0.102.174:80: i/o timeout'\n\nHowever if I expose the service via kubectl port-forward I can open the service in the browser\nkubectl port-forward service/backend-service 8080:80 -n edna\nxdg-open HTTP://localhost:8080\n\nSo how to open the service via that long URL (similar how we open the kubernetes dashboard?\nhttp://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/overview?namespace=default\n\nIf I query the API with CURL I see the output\n➜ curl http://127.0.0.1:8001/api/v1/namespaces/edna/services/backend-service/\n{\n "kind": "Service",\n "apiVersion": "v1",\n "metadata": {\n "name": "backend-service",\n "namespace": "edna",\n "selfLink": "/api/v1/namespaces/edna/services/backend-service",\n "uid": "7163dd4e-e76d-4517-b0fe-d2d516b5dc16",\n "resourceVersion": "6433582",\n "creationTimestamp": "2020-08-14T05:58:45Z",\n "labels": {\n "app.kubernetes.io/instance": "backend-etl"\n },\n "annotations": {\n "argocd.argoproj.io/sync-wave": "10",\n "kubectl.kubernetes.io/last-applied-configuration": "{\\"apiVersion\\":\\"v1\\",\\"kind\\":\\"Service\\",\\"metadata\\":{\\"annotations\\":{\\"argocd.argoproj.io/sync-wave\\":\\"10\\"},\\"labels\\":{\\"app.kubernetes.io/instance\\":\\"backend-etl\\"},\\"name\\":\\"backend-service\\",\\"namespace\\":\\"edna\\"},\\"spec\\":{\\"ports\\":[{\\"port\\":80,\\"protocol\\":\\"TCP\\",\\"targetPort\\":80}],\\"selector\\":{\\"app\\":\\"edna-backend\\"},\\"type\\":\\"ClusterIP\\"}}\\n"\n }\n },\n "spec": {\n "ports": [\n {\n "protocol": "TCP",\n "port": 80,\n "targetPort": 80\n }\n ],\n "selector": {\n "app": "edna-backend"\n },\n "clusterIP": "172.20.39.154",\n "type": "ClusterIP",\n "sessionAffinity": "None"\n },\n "status": {\n "loadBalancer": {\n \n }\n }\n}" ]
[ "kubernetes", "kubectl", "kube-proxy" ]
[ "React Native StackNavigator default props for screens", "I am using 2 seperate StackNavigators in my application and render one them in an if condition structure. \nFor Example : \n\nif(this.props.authToken)//authToken is a state object setting in one of my reducers\nreturn <AppNavigator />\nelse\nreturn <AuthNavigator />\n\n\nSee i will use that authToken object almost in every screen of AppNavigator.\n\nOne way i am using currently is that getting that on my \"mapStateToProps\" function in every screens export statement.\n\nclass SomeScreen extends React.Component {\n\n render() {\n return (\n <View><Text>Some UI {this.props.authToken.userName} </Text></View>\n );\n }\n}\n\nconst mapStateToProps = state => {\n return {\n\n//This line that i have to write in every screen\n authToken: state.app.authToken\n };\n};\n\nconst mapDispatchToProps = dispatch => {\n return {...}\n};\n\n\nexport default connect(mapStateToProps, mapDispatchToProps)(SomeScreen);\n\n\nBut it i didn't like that. So if there is an object that i might use in most of my navigator screens I desire that passing it from my root component to rendering navigator component like : \n\n if(this.props.authToken)//authToken is a state object setting in one of my reducers\n return <AppNavigator authToken={this.props.authToken} someOtherCommonProp={{....}}/>\n else\n return <AuthNavigator />\n\n\nSo my question is that what would be the best practise for that issue." ]
[ "react-native", "redux", "reducers", "stack-navigator" ]
[ "Reading and Saving .txt files into an array in Java", "I am currently trying to figure out how to read and save .txt files to a dynamic array in Java, I do not know how to save the read .txt file into the array. The file I am trying to read is named songCollection.txt.\n\nThe specific data parts need to be:\n\ntitle,artist,genre,album,songID\n\n\nBelow is my current code, any help will be much appreciated. Thanks\n\nCode:\n\nimport java.io.BufferedReader;\nimport java.io.DataInputStream;\nimport java.io.FileInputStream;\nimport java.io.InputStreamReader;\nimport java.util.*;\nimport java.io.*;\n\n\npublic class song {\n private int SongID; // The unique song identifier\n private String title; // The song title\n private String artist; // The song artist\n private String genre; // The genre of the song\n private String album; // The album name\n private String songData;\n\n public song() {\n // TODO Auto-generated constructor stub \n }\n\n public static void main(String[] args) {\n // TODO Auto-generated method stub\n try {\n FileInputStream fstream = new FileInputStream(\"songCollection.txt\");\n // use DataInputStream to read binary NOT text\n // DataInputStream in = new DataInputStream(fstream);\n BufferedReader br = new BufferedReader(new InputStreamReader(fstream));\n String strLine;\n\n while ((strLine = br.readLine()) != null) {\n String[] splitOut = strLine.split(\", \");\n for (String token : splitOut)\n System.out.println(token);\n }\n in.close();\n } catch (Exception e) {\n System.err.println(\"Error: \" + e.getMessage());\n }\n Readable fileSong;\n String[] songData = new Scanner(fileSong);\n\n while (songData.hasNextLine()) {\n String songCollection = songData.nextLine();\n songData = songCollection.split(\",\");\n }\n\n }\n}" ]
[ "java", "arrays" ]
[ "ASP .NET MVC Form fields Validation (without model)", "I am looking for a way to validate two fields on ASP View page. I am aware that usual way of validating form fields is to have some @model ViewModel object included on a page, where the properties of this model object would be annotated with proper annotations needed for validation. For example, annotations can be like this:\n\n[Required(ErrorMessage = \"Please add the message\")]\n[Display(Name = \"Message\")]\n\n\nBut, in my case, there is no model included on a page, and controller action that is being called from the form receives plane strings as method arguments.\nThis is form code:\n\n@using (Html.BeginForm(\"InsertRssFeed\", \"Rss\", FormMethod.Post, new { @id = \"insertForm\", @name = \"insertForm\" }))\n{\n<!-- inside this div goes entire form for adding rssFeed, or for editing it -->\n ...\n <div class=\"form-group\">\n <label class=\"col-sm-2 control-label\"> Name:</label>\n <div class=\"col-sm-10\">\n <div class=\"controls\">\n @Html.Editor(\"Name\", new { htmlAttributes = new { @class = \"form-control\", @id = \"add_rssFeed_name\" } })\n </div>\n </div>\n </div>\n\n <div class=\"form-group\">\n <label class=\"col-sm-2 control-label\"> URL:</label>\n <div class=\"col-sm-10\">\n <div class=\"controls\">\n @Html.Editor(\"Url\", new { htmlAttributes = new { @class = \"form-control\", @id = \"add_rssFeed_Url\" } })\n </div>\n </div>\n </div>\n\n </div>\n </div>\n <!-- ok and cancel buttons. they use two css classes. button-styleCancel is grey button and button-styleOK is normal orange button -->\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"button-styleCancel\" data-dismiss=\"modal\">Close</button>\n <button type=\"submit\" class=\"button-styleOK\" id=\"submitRssFeed\">Save RSS Feed</button>\n </div>\n}\n\n\nYou can see that form is sending two text fields (Name and Url) to the RssController action method, that accepts these two string parameters:\n\n[HttpPost]\npublic ActionResult InsertRssFeed(string Name, string Url)\n{\n\n if (!String.IsNullOrEmpty(Name.Trim()) & !String.IsNullOrEmpty(Url.Trim()))\n {\n var rssFeed = new RssFeed();\n rssFeed.Name = Name;\n rssFeed.Url = Url;\n\n using (AuthenticationManager authenticationManager = new AuthenticationManager(User))\n {\n string userSid = authenticationManager.GetUserClaim(SystemClaims.ClaimTypes.PrimarySid);\n string userUPN = authenticationManager.GetUserClaim(SystemClaims.ClaimTypes.Upn);\n\n rssFeedService.CreateRssFeed(rssFeed);\n }\n }\n\n return RedirectToAction(\"ReadAllRssFeeds\", \"Rss\");\n}\n\n\nIf the page would have model, validation would be done with @Html.ValidationSummary method, but as I said I am not using modelview object on a page. \nIs there a way to achieve this kind of validation without using ModelView object, and how to do that? Thanks." ]
[ "c#", "asp.net", "asp.net-mvc", "asp.net-mvc-4", "validation" ]
[ "(re)implement dynamic_cast", "I am working in an ARM7 embedded environment. The compiler I am using does not support the full C++ functionality. One feature it does NOT support is dynamic type casting.\n\nIs there a way to implement dynamic_cast<>()?\n\nI looked for code using Google, but no luck so far. Any ideas? Any links?\n\nUPDATE:\n\nDue to the comments... I'm using the ARM(R) IAR C/C++ Compiler." ]
[ "c++", "embedded", "arm" ]
[ "Is it Possible to expose a private variable in c# ?", "i just wanted to know Is it Possible to expose a private variable in c# ? I know if data of a class is private means is not accessible from outside class. if, yes, then how ?" ]
[ "c#", "properties", "access-specifier" ]
[ "kernel-cfs : Why is LOAD_AVG_MAX 47742?", "In PELT of CFS, below parameters are used for calculating PELT. \n\n\"#define LOAD_AVG_MAX 47742 /* maximum possible load avg */\"\n\n\"#define LOAD_AVG_MAX_N 345 /* number of full periods to produce LOAD_AVG_MAX */\"\n\nWhy is the LOAD_AVG_MAX 47742 ?\n\nWhy is the LOAD_AVG_MAX_N 345 ?\n\nI cannot find the exact explanation about these parameters. \nCould you explain it in detail ?" ]
[ "kernel", "cfs" ]
[ "Python Requests, bind to different source ip for each request not working as expected", "My server have two NICs ens1 and ens2. These NICs are on two different VPC networks, are connected to same server(I am using Google Cloud). I think ens1 is default and ens2 is secondary.\nIn following code when I pass the SOURCE_IP as IP address of ens1 it works fine. But when I pass IP of ens2 as SOURCE_IP then program stop and goes into waiting state. It does not show any error nor it works, just hangs there.\nI am passing internal IP of NIC.\n import requests\n from requests_toolbelt.adapters import source\n \n s = requests.Session()\n new_source = source.SourceAddressAdapter('<SOURCE_IP>')\n s.mount('http://', new_source)\n s.mount('https://', new_source)\n rep = s.get("https://httpbin.org/ip")\n print(rep.text)" ]
[ "python", "sockets", "python-requests" ]
[ "Doxygen : how to use EXPAND_AS_DEFINED", "I have defined the following macros, and try to have it expanded when generating documentation.\n\n#define GETSET(param) \\\nbool CYNOVE_Enable##param(postproc_ctx_t ctx, bool enable) \\\n{ \\\n struct postproc_ctx * c; \\\n c = (struct postproc_ctx *)ctx; \\\n c->do_##param = enable?1:0; \\\n return TRUE; \\\n} \\\n\n\nIn doxygen, if I use :\n\nMACRO_EXPANSION = YES\n\n\nThen the macro is expanded when I use it.\nHowever if set :\n\nMACRO_EXPANSION = YES\nEXPAND_ONLY_PREDEF = YES\nEXPAND_AS_DEFINED = GETSET\n\n\nthe macro is not expanded\n\nSince I think, one of the answer is wrong, but the comment just suck for any lengthy explanation, let me add how I think this should work.\n\nAccording to the doxygen documentation and this link, PREDEFINED and EXPAND_AS_DEFINED serve different purpose. I understood that EXPAND_AS_DEFINED is used to selectively expand a given macro \"as it was defined in the source code\", hence the name, while PREDEFINED is here to give Doxygen the meaning of a macro." ]
[ "c", "doxygen" ]
[ "\"this selection is not valid\" error when using insert to reorder a column VBA", "I have the following unsorted tree:\n\n\nI have code that attempts to order it using a priority lookup in another sheet:\n\nSorted:\n\n\nThe code:\n\nSub SortWeights()\n\nDim formatRow As Integer ' Current row in ordered list of parents\nDim weightRow As Integer ' Current row while sorting weights\nDim startRow As Integer ' First row in weights group\nDim endRow As Integer ' Last row in weights group\nDim weightsSheet As Worksheet ' Worksheet containing weights\nDim formatSheet As Worksheet ' Worksheet containing ordered parent weights\nDim looking As Boolean ' True while gathering child rows\nDim doShift As Boolean ' True if weights group needs to be moved\nDim candidate As Range ' Candidate weight\nDim sortingWeight As Range ' Reformatted sorting weight name\nDim lastWeightRow As Integer\n\nConst firstFormatRow As Integer = 1 'First row in ordered list of parents\nConst lastFormatRow As Integer = 6 'Last row in ordered list of parents\nConst firstWeightRow As Integer = 8 'First row in list of weights to be sorted\n'Const lastWeightRow As Integer = 100 'Last row in list of weights to be sorted\nConst weightNameColumn As Integer = 3 'Column with parent names to be sorted\nConst formatNameColumn As Integer = 3 'Column with parent names in ascending order\n\nSet weightsSheet = ActiveWorkbook.Sheets(\"Weights\")\nSet formatSheet = ActiveWorkbook.Sheets(\"Formatting\")\nformatRow = lastFormatRow\nlastWeightRow = Range(\"C\" & Rows.Count).End(xlUp).row\n' Loop through the list of ordered parent weights\nDo Until formatRow < firstFormatRow\n\n ' Reset everything\n looking = False\n doShift = False\n startRow = 0\n endRow = 0\n Set sortingWeight = formatSheet.Cells(formatRow, formatNameColumn)\n\n ' Loop through the list of all weights\n For weightRow = firstWeightRow To lastWeightRow\n\n Set candidate = weightsSheet.Cells(weightRow, weightNameColumn)\n\n ' If match found, start counting\n If candidate.Value = sortingWeight.Value Then\n ' If the match is in the first row, it is already in place, skip it.\n If weightRow = 1 Then\n Exit For\n Else\n startRow = weightRow\n looking = True\n doShift = True\n End If\n End If\n\n ' If gathering children...\n If looking Then\n ' If this is the last row, it is the end of the group.\n If weightRow = lastWeightRow Then\n endRow = weightRow\n ' Otherwise, if this is a new group, the previous row was the end.\n ElseIf candidate.IndentLevel = 2 And candidate <> sortingWeight Then\n endRow = weightRow - 1\n Exit For\n End If\n End If\n\n Next weightRow\n\n ' Only do the cut and insert if necessary\n If doShift Then\n weightsSheet.Range(CStr(startRow) & \":\" & CStr(endRow)).Cut\n weightsSheet.Range(CStr(firstWeightRow) & \":\" & CStr(firstWeightRow)).Insert\n End If\n\n ' Do the next parent.\n formatRow = formatRow - 1\n\nLoop\n\nEnd Sub\n\n\nThis code works fine on some trees, however occasionally, I will get a \"this selection is not valid\" error when running this on a slightly different tree. I can't seem to find what the issue is, any help would be appreciated." ]
[ "excel", "vba" ]
[ "Python: Is it possible to compare unicode strings by the visible outcome", "if i have Strings with arabic and latin letters mixed, the outcome can be strange.\n\ne.g. a String can look like this:\n(2)‏بسك‏ويت \nor like this: \n‏(2)‏بسك‏ويت \n\nand the only difference is a right-to-left mark (which is a invisible unicode character U+200F) in the second one. \nHowever it wouldn't make any difference if there is only one right-to-left-mark or if there are multiple. \nThere could also be the normal right-to-left or a embedded right to left (U+200F or U+202B)\n\nwhen i compare two string, i only know if they are equal.\nIs there also a possibility to know if the visible outcome would be the same even if the strings are not the same?" ]
[ "python-2.7", "unicode" ]
[ "Three.js - multiple material plane", "I'm trying to have multiple materials on a single plane to make a simple terrain editor. So I create a couple of materials, and try to assign a material index to each vertex in my plane:\nvar materials = [];\nmaterials.push(new THREE.MeshFaceMaterial( { color: 0xff0000 }));\nmaterials.push(new THREE.MeshFaceMaterial( { color: 0x00ff00 }));\nmaterials.push(new THREE.MeshFaceMaterial( { color: 0x0000ff }));\n// Plane\nvar planegeo = new THREE.PlaneGeometry( 500, 500, 10, 10 );\nplanegeo.materials = materials;\nfor(var i = 0; i < planegeo.faces.length; i++)\n{\n planegeo.faces[i].materialIndex = (i%3);\n}\n\nplanegeo.dynamic = true;\nthis.plane = THREE.SceneUtils.createMultiMaterialObject(planegeo, materials);\n\nBut I always get either a whole bunch of errors in the shader, or only a single all-red plane if I use MeshBasicMaterial instead of FaceMaterial. What am I doing wrong?" ]
[ "three.js", "textures", "terrain" ]
[ "String that is being read in by stream reader is producing unrecognizable characters", "I am using a StreamReader To read in some chars into a buffer, then converting it to a string and splitting it on a NUL combination. This is just the way the file format is. However I get funky \"?\" characters in the string when I read in something from a different language (Acústicos for example has a '?' for the accent character). I have tried some of the encoding solutions, but I'm not sure how to implement it into a StreamReader based solution, here's what I'm doing now:\n\n using (StreamReader _sr = new StreamReader(FilePath)){\n char[] _buffer = new char[1024];\n _sr.Read(_buffer, 0, 32);\n\n _sr.Read(_buffer,0,200);\n string _stuff = new string(_buffer);\n\n string[] _test = _stuff.Split(new[] { \"\\0\\0\\0\" }, StringSplitOptions.RemoveEmptyEntries);\n\n //Title\n string _name = ParseFile(_test, _k);\n }\n\nprivate string ParseFile(string[] test, int k) {\n bool _flag = false;\n string _name = string.Empty;\n int _i;\n //Assign i to the k counter so that we don't always start at the beginning and get the same string\n for (_i = k; _i < test.Length; _i++) {\n for (int _j = 0; _j < test[_i].Length; _j++) {\n if (char.IsControl(test[_i][_j])) {\n }\n else {//This contains a real string. Get out and return\n _flag = true;\n break;\n }\n }\n if (_flag) {\n break;\n }\n }\n if (_flag) {\n _k = _i;\n _name = test[_i].Substring(1);\n }\n return _name;\n }\n\n\nThe question is: How can I use all these strings to get the correct character from the file?" ]
[ "c#", "string", "encoding" ]
[ "How can I create a re-usable piece of markup in Jade", "What I'm trying to accomplish.\n\nWhat I'm trying to do is actually really simple and the Jade template engine should be able to help me out quite a bit with it, but I'm running into some snags.\n\nI'm building a site that uses a lot of semi-transparent elements like the one in this jsFiddle: http://jsfiddle.net/Chevex/UfKnM/\nIn order to make the container background be semi-transparent but keep the text opaque this involves 3 elements:\n\n\nA container DIV with position: relative\nA child DIV with position: absolute, a background color, height/width set to 100%, and its opacity set to the desired level.\nAnother child DIV for the content with no special positioning.\n\n\nIt's pretty simple and I use it fairly effectively on CodeTunnel.com.\n\nHow I want to simplify it.\n\nI'm re-writing CodeTunnel.com in node.js and the Jade template engine seems like it could greatly simplify this piece of markup that I re-use over and over again. Jade mixins look promising so here's what I did:\n\n\nI defined a mixin so I could just use it wherever I need it.\n\nmixin container\n .container(id=attributes.id) // attributes is an implicit argument that contains any attributes passed in.\n .translucentFrame\n .contentFrame\n block // block is an implicit argument that contains all content from the block passed into the mixin.\n\nUse the mixin, passing in a block of content:\n\n+container#myContainer\n h1 Some test content\n\n\nGenerates:\n\n<div id=\"myContainer\" class=\"container\">\n <div class=\"translucentFrame\"></div>\n <div class=\"contentFrame\">\n <h1>Some test content</h1>\n </div>\n</div>\n\n\n\nSo far everything works great! There is just one problem. I want to use this mixin in a layout.jade template and I want the child template to be able to use block inheritance. My layout.jade file looks like this:\n\ndoctype 5\nmixin container\n .container(id=attributes.id)\n .translucentFrame\n .contentFrame\n block\nhtml\n head\n title Container mixin text\n body\n +container#bodyContent\n block bodyContent\n\n\nThen in another jade file (index.jade) I extend layout.jade:\n\nextends layout\n\nblock bodyContent\n h1 Some test Content\n\n\nEverything looks to be in order but the jade parser fails:\n\n\n\nI assume it has something to do with the block keyword conflicting. Inside a mixin block is an implicit argument containing the block passed into the mixin, but when extending a jade template block is a keyword that identifies a block of markup that is to be substituted in the equivalent block in the parent template.\n\nIf I replace the block bodyContent that I'm passing into the mixin with any other markup then everything works fine. It's only when I try to pass in a block definition that it gets upset.\n\nAny ideas?" ]
[ "javascript", "node.js", "view", "express", "pug" ]
[ "How to add timeline markers to HTML audio tag controls", "Given an HTML audio element, how can markers be added to the controls playbar?\nFor example, say the track is 1 minute long, I want to be able to add a marker so the user can see that at seconds 4, 32, and 47 there is important information.\nI'm open to external libraries if necessary, but pure HTML / CSS + javascript would be better." ]
[ "html", "css", "html5-audio" ]
[ "HoloLens BLE communication ( windows 10 )", "I want to have two sensors, one in each hand to give out position values to the HoloLens Unity3D app.\nthese two sensors are temporarily going to be android native application on android phones sending out some random values in BLE. \n\nI just thought since HoloLens supports BLE, It should be possible for the holoLens to connect and receive the values advertised by the sensors.\nBut I could not find any plugin in Unity3D asset store for windows BLE. I need to know if anyone has impletemented any samples plugins for windows BLE in Unity.\n\nThanks." ]
[ "unity3d", "windows-10", "bluetooth-lowenergy", "hololens" ]
[ "How to export (bacpac) azure database", "I have one database in azure and accessing in my SQL Server Management studio and try to export the database but gives me the errors.\n\nHere are the steps I have done:\n\n1) Export data-tier Application\n\n\n\n2) No of errors I got \n\n\n\n3) Got this error in all the processes:\n\n\n\nI am using SSMS (2014 and 2016)" ]
[ "export", "azure-sql-database", "ssms", "bacpac" ]
[ "Match URL to a specific file in Apache", "I have a domain which is currently redirecting to another page. This is my virtual hosts file:\n\n<VirtualHost *:80>\n ServerName example.com\n ServerAlias www.example.com\n\n Redirect permanent / http://www.anotherdomain.com\n</VirtualHost>\n\n\nNow I need an SSL certificate for that page, and to verify I must provide a file under a certain URL.\n\nIs it possible to provide the apache configuration that matches e.g. example.com/verify_file_123.txt to a file on my filesystem, e.g. /var/www/my_site/verify_file_123.txt while still having redirects for all other routes?\n\nI tried it with\n\n<VirtualHost *:80>\n ServerName example.com\n ServerAlias www.example.com\n\n Alias \"/verify_file_123.txt\" \"/var/www/my_site/verify_file_123.txt\"\n\n Redirect permanent / http://www.anotherdomain.com\n</VirtualHost>\n\n\nbut that doesn't work." ]
[ "apache" ]
[ "List files with MATLAB which are not .m files", "I can list all .m files in the current directory with this code: dir(fullfile('.', '*.m')).\n\nBut how to change the regular expression that only files will be listed which have not the ending .m (files without \"ending\" should be included as well)?\n\nAny help will be appreciated! Thanks in advance!" ]
[ "regex", "matlab", "regex-negation", "dir" ]
[ "Pandas group-by / pivot data while entries of one column become new lables", "I would like to sum-up the capacities of power plants by technology with python + pandas (previous question).\n\nFor this task the data must be grouped / pivoted while the column entries in column \"Technology\" should become column labels\n\nThis is my input:\n\nPlant Name,Nameplate Capacity,Technology,...\nBarry,153.1,Natural Gas Steam Turbine,..\nBarry,153.1,Natural Gas Steam Turbine,..\nBarry,403.7,Conventional Steam Coal,..\nBarry,788.8,Conventional Steam Coal,..\nBarry,195.2,Natural Gas Fired Combined Cycle,..\nBarry,195.2,Natural Gas Fired Combined Cycle,..\n\n\nAnd the desired output:\n\nPlant Name,Natural Gas Steam Turbine,Conventional Steam Coal,Natural Gas Fired Combined Cycle,..\nBarry,306.2,1192.5,390.4,..\n\n\nI've tried a few commands, but nothing worked out:\n\ndf.groupby(['Plant Name', 'Technology']).sum().pivot('Plant Name', 'Technology').fillna(0)\n\n\nor\n\n#with numpy as np\nres = df.pivot_table(index=[\"Plant Name\"], columns=[\"Plant Name\"], values=[\"Technology\"], aggfunc=np.sum)\n\n\nAn additional question\n\nHow can I find out the largest entry (e.g. \"Conventional Steam Coal\" in my example) for each row as a new column?" ]
[ "python", "pandas", "csv" ]
[ "Align section of form next to table horizontally", "I am looking to display a table in line with a section of a form.\n\nHere is what I am looking for:\n\n#Form\n\nLabel: |TextBox|\nLabel: |TextBox|\nLabel: |TextBox|\nLabel: |TextBox|\n--------------------------------------------------------------------\nLabel: |TextBox| |----------- Table -----------|\nLabel: |TextBox| |-------------------------------|\nLabel: |TextBox| |-------------------------------|\nLabel: |TextBox| |-------------------------------|\nLabel: |TextBox| |-------------------------------|\n--------------------------------------------------------------------\nLabel: |TextBox|\nLabel: |TextBox|\nLabel: |TextBox|\nLabel: |TextBox|\n\n#End of Form\n\n\nI have created a Bootply to assist in what my source is looking like and so you can manipulate it as much as you want.\n\nAny help is appreciated." ]
[ "html", "css", "twitter-bootstrap" ]
[ "Can not use an arrow function with return void type hinting", "Using arrow functions in php 7.4 with return type hinting void results in a php fatal error. I think, that I am missing something. Can you help me.\nExample 1:\n<?php\n\nfunction returnvoid(): void {\n echo 'I am here, but do not return anything aka void';\n}\n\n$arrow_function = fn(): void => returnvoid();\n\n$arrow_function();\n\nresults in\nPHP Fatal error: A void function must not return a value in [my_filesystem]/.config/JetBrains/PhpStorm2020.1/scratches/scratch_3.php on line 7\n\nalso Example 2:\n<?php\n\n$f = fn(): void => 1;\n\nthrows the same Exception. I understand, that example 2 throws an exception because it is an implicit return. How is that for explicit calling a method/function with void return type hinting?\nWhy? I'd like to be specific in return types. Makes live easier with ide and debugging.\nIs it not possible to return void in arrow functions? Am I missing something? Is this not documented?" ]
[ "php", "arrow-functions", "type-hinting", "php-7.4" ]
[ "Build c program for release and build", "The original makefile comes for Release build.\nOriginal\nAPP:= deepstream-app\n\nTARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)\n\nNVDS_VERSION:=5.0\n\nLIB_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/\nAPP_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/bin/\n\nifeq ($(TARGET_DEVICE),aarch64)\n CFLAGS:= -DPLATFORM_TEGRA\nendif\n\nSRCS:= $(wildcard *.c)\nSRCS+= $(wildcard ../../apps-common/src/*.c)\n\nINCS:= $(wildcard *.h)\n\nPKGS:= gstreamer-1.0 gstreamer-video-1.0 x11\n\nOBJS:= $(SRCS:.c=.o)\n\nCFLAGS+= -I../../apps-common/includes -I../../../includes -DDS_VERSION_MINOR=0 -DDS_VERSION_MAJOR=5\n\nLIBS+= -L$(LIB_INSTALL_DIR) -lnvdsgst_meta -lnvds_meta -lnvdsgst_helper -lnvdsgst_smartrecord -lnvds_utils -lm \\\n -lgstrtspserver-1.0 -ldl -Wl,-rpath,$(LIB_INSTALL_DIR)\n\nCFLAGS+= `pkg-config --cflags $(PKGS)`\n\nLIBS+= `pkg-config --libs $(PKGS)`\n\nall: $(APP)\n\n%.o: %.c $(INCS) Makefile\n $(CC) -c -o $@ $(CFLAGS) $<\n\n$(APP): $(OBJS) Makefile\n $(CC) -o $(APP) $(OBJS) $(LIBS)\n\ninstall: $(APP)\n cp -rv $(APP) $(APP_INSTALL_DIR)\n\nclean:\n rm -rf $(OBJS) $(APP) \n\nModified for both Release and Debug\nAPP:= deepstream-app\nDEBUGAPP:= deepstream-app-debug\n\nTARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)\n\nNVDS_VERSION:=5.0\n\nLIB_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/\nAPP_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/bin/\n\nifeq ($(TARGET_DEVICE),aarch64)\n CFLAGS:= -DPLATFORM_TEGRA\nendif\n\nSRCS:= $(wildcard *.c)\nSRCS+= $(wildcard ../../apps-common/src/*.c)\n\nINCS:= $(wildcard *.h)\n\nPKGS:= gstreamer-1.0 gstreamer-video-1.0 x11\n\nOBJS:= $(SRCS:.c=.o)\n\nCFLAGS+= -I../../apps-common/includes -I../../../includes -DDS_VERSION_MINOR=0 -DDS_VERSION_MAJOR=5\n\nLIBS+= -L$(LIB_INSTALL_DIR) -lnvdsgst_meta -lnvds_meta -lnvdsgst_helper -lnvdsgst_smartrecord -lnvds_utils -lm \\\n -lgstrtspserver-1.0 -ldl -Wl,-rpath,$(LIB_INSTALL_DIR)\n\nCFLAGS+= `pkg-config --cflags $(PKGS)`\n\nLIBS+= `pkg-config --libs $(PKGS)`\n\nall: $(APP)\n\n%.o: %.c $(INCS) Makefile\n $(CC) -c -o $@ $(CFLAGS) $<\n%.o: %.c $(INCS) Makefile\n $(CC) -g3 -c -o $@ $(CFLAGS) $<\n\n$(APP): $(OBJS) Makefile\n $(CC) -o $(APP) $(OBJS) $(LIBS)\n$(DEBUGAPP): $(OBJS) Makefile\n $(CC) -g3 -o $(DEBUGAPP) $(OBJS) $(LIBS)\n\ninstall: $(APP)\n cp -rv $(APP) $(DEBUGAPP) $(APP_INSTALL_DIR)\n\nclean:\n rm -rf $(OBJS) $(APP) $(DEBUGAPP)\n\nBut it doesn't produce deepstream-app-debug. What should I change for both release and debug?" ]
[ "c", "makefile" ]
[ "Convert bytes to bits in python", "I am working with Python3.2. I need to take a hex stream as an input and parse it at bit-level. So I used \n\nbytes.fromhex(input_str)\n\nto convert the string to actual bytes. Now how do I convert these bytes to bits?" ]
[ "python", "hex", "byte", "bits" ]
[ "Inheritance in CSS properties?", "Sorry, but no matter how often I read it, I just don't grok it.\n\nI have declared \n\n.submit_button \n{ \n font: 12px Arial; \n margin:0px; \n padding:2px; \n}\n\n\nand now I want to declare centered_submit_button which inherits from submit_button and adds margin-left:auto; margin-right:auto;\n\nPlease take pity on me ..." ]
[ "css" ]
[ "Error reading file share paths as arguments", "I am receiving the following error when I execute the below script.\n\n\n Test-Path : A positional parameter cannot be found that accepts\n argument 'input.dat'.\n\n\n.\\FL.ps1 \\\\flamingdev\\analytics\\source\\INBOUND \\\\flamingdev\\analytics\\source\\OUTBOUND\n\n[CmdletBinding()]\nparam (\n [string] $SrcFolder,\n [string] $FileListPath\n)\n\n$SrcFolder\n$FileListPath\n\nIF (Test-Path \"$FileListPath\"\\input.dat) {\nRemove-Item \"$FileListPath\"\\input.dat\n}\n\nGet-ChildItem -File -Path \"$SrcFolder\"\\Extract* | Select-Object - ExpandProperty Name | Add-Content -Path \"$FileListPath\"\\input.dat" ]
[ "powershell" ]
[ "django update record in database", "I tried following code to update records in table but this creates new record instead of updating. What I need is update resevedplaces in table instead of creating new record\n\nHere is my code , thank you:\n\nview :\n\nclass ReservationCancelView(mixins.RetrieveModelMixin, mixins.ListModelMixin, mixins.DestroyModelMixin, mixins.CreateModelMixin,mixins.UpdateModelMixin, viewsets.GenericViewSet):\n#Model = Reservation\nserializer_class = ReservationCSerializer\npermission_classes = (permissions.IsAuthenticated,) \n\ndef get_queryset(self):\n resid = self.request.POST.get('id') \n Res= Reservation.objects.get(id=resid)\n #Res.reservedplaces =F('reservedplaces ') - 1\n #Res.save()\n return Res\n\ndef post(self, request, token=None, format=None):\n resid = self.request.POST.get('id') \n travel_id = self.request.POST.get('travel_id') \n\n Res= Reservation.objects.get(id=resid) \n Res.reservedplaces =F('reservedplaces ') - 1\n Res.travel_id = travel_id\n Res.save()\n\n\nserializer\n\nclass ReservationCSerializer(serializers.ModelSerializer):\n user = Serializers.PrimaryKeyRelatedField(read_only=True,default=serializers.CurrentUserDefault())\n\n class Meta:\n model = Reservation\n fields = ('__all__')\n\n\nurls.py\n\nrouter.register(r'cancelreservation', ReservationCancelView,'reservationcancel')\n\n\nAnd here is post request :\n\n let data = {\n 'travel_id': rideID ,\n 'id' : resID,\n 'address' : address,\n 'reservedplaces': nbplaces \n };\n\n $.ajax({\n method: 'POST',\n url: '/api/cancelreservation/',\n datatype: 'json',\n headers: {\n 'Authorization': 'Token ' + localStorage.token\n },\n data: data,\n success: function (response) {\n }\n })" ]
[ "django", "class" ]
[ "Open a mutex shared with a service", "I have a service that creates a thread with a loop that should run until the mutex is signalled by another process. I have the following in my service code\n\n private readonly Mutex _applicationRunning = new Mutex(false, @\"Global\\HsteMaintenanceRunning\");\n\n protected override void OnStart(string[] args)\n {\n new Thread(x => StartRunningThread()).Start();\n }\n\n internal void StartRunningThread()\n {\n while (_applicationRunning.WaitOne(1000))\n {\n FileTidyUp.DeleteExpiredFile(); \n _applicationRunning.ReleaseMutex();\n Thread.Sleep(1000);\n }\n\n }\n\n\nNow I have a console application that should claim the mutex and force the while loop to be exited\n\n var applicationRunning = Mutex.OpenExisting(@\"Global\\HsteMaintenanceRunning\");\n if (applicationRunning.WaitOne(15000))\n {\n Console.Write(\"Stopping\");\n applicationRunning.ReleaseMutex();\n Thread.Sleep(10000);\n }\n\n\nWhen the console application tries to open the mutex I get the error \"The wait completed due to an abandoned mutex.\" Whats wrong here?" ]
[ "c#", "multithreading", "service", "mutex" ]
[ "how to call system() with 2 arguments in vim", "function! ReName()\n let old_name = expand(\"<cword>\")\n let new_name = input(\"new name: \",old_name)\n let cmd = \"ref.sh \".expand(old_name).expand(\" \").expand(new_name)\n :call system(cmd)\nendfunction\n\n\nref.sh is a bash file, context is\n\n#! /bin/bash\nfind . -name '*.[ch]' | xargs sed -i s/$1/$2/g\n\n\nbut now, when i use ReName function in vim, it does not work." ]
[ "system", "vim" ]
[ "Allow access to page with an Admin email address Rails", "Im using Devise gem and Rails to create a web app, and have it set up running correctly, How can I set it up so there is a certain email address which is allowed to access a page.\nFor example if I login with [email protected], only then can I access a certain page." ]
[ "ruby-on-rails", "ruby", "devise" ]
[ "c struct relationships", "//CHILD\ntypedef struct Child{\n int id;\n}Child;\nChild* newChild(){\n Child *aChild = malloc(sizeof(Child));\n aChild->id = 0;\n return aChild;\n}\n\n//PARENT\ntypedef struct Parent{\n int id;\n Child **children;\n}Parent;\n\nParent* newParent(){\n Parent *aParent = malloc(sizeof(Parent));\n aParent->id = 0;\n aParent->children = malloc(sizeof(Child*) * 5);//ARRAY OF 5 CHILDREN?\n for(i=0; i<5; i++){\n aParent->children[i] = newChild();\n }\n return aParent;\n}\n\n\nIs the newParent() function a correct way to create a struct with an array children? My main concern is the line:\n\naParent->children = malloc(sizeof(Child*) * 5);" ]
[ "c", "struct", "relationship" ]
[ "how to write a function and its parameters in c which can a read file", "I have a c code which works successfully and shows contents of an input file on console window, but once I try to convert code to implement it through a function, I don't see output at all. The code is below with original working code lines commented out, and new code lines which implement a function included in code.\nCode is below:\n\ntypedef struct List\n{\n char *data;\n struct List *next;\n}list;\n\nvoid extract(FILE *input_file, list *tokens)\n{\n tokens = NULL;\n list *current = NULL;\n\n char line[50];\n while (fgets(line, sizeof(line), input_file)!=NULL) \n {\n list *node = malloc(sizeof(list));\n node->data = strdup(line);\n node->next = NULL;\n if (tokens == NULL)\n {\n current = tokens = node;\n }\n else\n {\n current = current->next = node;\n }\n }\n}\n\n\nint main()\n{\n FILE *input_file;\n list *tokens = NULL;\n list *current = NULL;\n\n input_file = fopen(\"test.evl\", \"r\");\n if (input_file == NULL)\n {\n printf(\"I cant read:%d\\n\", errno);\n printf(\"I cant read:%s\\n\",strerror ( errno));\n perror(\"I cant read\");\n fprintf(stderr, \"I cant read\");\n }\n //char line[50];\n //while (fgets(line, sizeof(line), input_file)!=NULL) \n //{\n // list *node = malloc(sizeof(list));\n // node->data = strdup(line);\n // node->next = NULL;\n // if (tokens == NULL)\n // {\n // current = tokens = node;\n // }\n // else\n // {\n // current = current->next = node;\n // }\n //}\n extract(input_file,tokens);\n\n current = tokens;\n while (current != NULL)\n {\n fputs(current->data,stdout);\n current = current->next;\n }\n\n if (input_file)\n {\n fclose(input_file);\n }\n getch();\n return 0;\n}\n\n\nWhat can be a successful way to implement a c code through a function, and what is solution to my code so that output shows up on console window?\nThere are no compile errors and there are no exceptions, its just no output at all." ]
[ "c", "function" ]
[ "the Terminal of Android Studio can't work", "I tried to use the terminal of Android Studio and error below popped up.\n\nERROR: JAVA_HOME is set to an invalid directory: jdk1.8.0_131\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\n\nI made sure that jdk1.8.0_131 is in C:\\Program Files\\Java,\nalso no ; or /bin at the end of command line as its seen....\ncould you help to solve this problem?" ]
[ "java", "android", "gradle" ]
[ "Image based on base64 in titanium appcelerator view", "I want to put an image from SQLite but the code below does't work:\n\nvar imageView = Ti.UI.createImageView({\n image:services.fieldByName('image')\n});" ]
[ "titanium", "base64", "titanium-alloy" ]
[ "Differentiate behavior between no, close option in message dialog", "I am using an open dialog from MessageDialog class\n\nboolean confirm = MessageDialog.open(MessageDialog.QUESTION_WITH_CANCEL,new Shell(),\n \"Save Project\" has been modified.Save changes?\", SWT.NONE)\n\n\nit returns true on yes and false otherwise. it is doing one thing at my end, when i cancel and click on cross behavior it also return false and got close as No option(I have written some steps on false) does. in cacel and cross button it should dispose dialog only, so what i am doing wrong here." ]
[ "java", "eclipse", "dialog", "jface" ]
[ "Enter each line user inputs with file. functions", "n = int(input('How many tracks are in the album?: ')) \nfor i in range(n): \n line = raw_input('Next Track: ') \n lines.append(line) \n\n\nWhere it says line = raw_input('Next Track: ') is where the text would be saved to the file. But, if there are, say, 20, how would you make it so each track is recorded and saved?\n\nHere is the code where the text gets written:\n\nf.write(\"Track Name/Rating: \" + line +\"\\n\")" ]
[ "python", "function", "user-input" ]
[ "How to implement Excel formulas in vba", "I am programming a tool now by VBA and I have got a problem with writing a IF formula. I have two worksheets \"site\" and \"overview\", I would like to write an IF formula for the \"site\" worksheet range column L. \n\nIn the Excel formula bar it is the following formula \n\n=IF(ISBLANK('Overview'!$Q$2:$Q$17), 'Site'L2:L17, 'Overview',Q2:Q17)\n\n\nHow should I write and implement this formula with a correct syntax in VBA. Thanks in advance." ]
[ "vba", "excel" ]
[ "how can I apply for loop through more than one pages and add each page to csv file", "how can I get more data form more than one page into my csv file\n\nfrom bs4 import BeautifulSoup\nimport requests\nimport csv\nsource = requests.get('https://software-overzicht.nl/amersfoort?page=1','https://software-overzicht.nl/amersfoort?page=2' ).text\nsoup = BeautifulSoup(source, 'lxml')\ncsv_file = open('cms_scrape.csv','w')\ncsv_writter = csv.writer(csv_file)\ncsv_writter.writerow(['naambedrijf', 'adress'])\nfor search in soup.find_all('div', class_='company-info-top'):\n title = search.a.text\n adress = search.p.text\n for page in range(1, 22):\n url = 'https://software-overzicht.nl/amersfoort?page={}'.format(page)\n print(title)\n csv_writter.writerow([title,adress])\ncsv_file.close()`" ]
[ "python", "web-scraping" ]
[ "Libtorch: How to load an ONNX-model?", "I need to load and run an ONNX-model in a C++ environment using Libtorch on Windows 10 (Visual Studio 2015, v140). Searching the web, there seem to be almost exclusivly instructions for how to do it in Python. Is there a well documented way/does anyone know how to this in C++?" ]
[ "c++", "pytorch", "onnx", "libtorch" ]
[ "JQuery Ajax Post Data for odata web api", "I created a odata web api using below link \nMicrosoft Doc OData V4 Link\n\nSo my solution contains two project\n\n\nODATAWebApi \nWebApp\n\n\nPlease find the code WebApp Code \nI am able to consume & post the data to odata web api by below code\n\n\n index.html\n\n\n<input type=\"text\" id=\"txtName\" value=\"\" />\n<br />\n<input type=\"text\" id=\"txtPrice\" value=\"\" />\n<br />\n<input type=\"text\" id=\"txtCategory\" value=\"\" />\n<br />\n\n<input type=\"button\" id=\"btnPostData\" value=\"Post Data Via Query \" />\n\n<input type=\"button\" id=\"btnPostData2\" value=\"Post Data Via Json Object\" />\n\n\n\n Ajax Code\n\n\n$(\"#btnPostData\").bind(\"click\", function () {\n var Name = $(\"#txtName\").val();\n var Price = $(\"#txtPrice\").val();\n var Category = $(\"#txtCategory\").val();\n\n //I am creating a query string to post the data to odata web api\n var PostData = \"Name=\" + Name + \"&Price=\" + Price + \"&Category=\" + Category;\n\n $.ajax({\n url: 'https://localhost:44340/api/Products',\n type: 'POST',\n crossDomain: true,\n dataType: 'json',\n data:PostData,\n success: function (data) {\n alert('Data: ' + data);\n },\n error: function (request, error) {\n console.log(\"Request: \" + JSON.stringify(request));\n alert(\"Request: \" + JSON.stringify(request));\n }\n });\n });\n\n\nUsing the above methodology we were able to post the data to odata web api but i want to post the data via json object as shown below but it is not working\n\n\n Product Model\n\n\npublic class Product\n{\n public int Id { get; set; }\n public string Name { get; set; }\n public decimal Price { get; set; }\n public string Category { get; set; }\n}\n\n\n\n Json Product Model\n\n\n$(\"#btnPostData2\").bind(\"click\", function () { \n var Product = {\n Id : null,\n Name: $(\"#txtName\").val(),\n Price: $(\"#txtPrice\").val(),\n Category: $(\"#txtCategory\").val()\n }\n\n $.ajax({\n url: 'https://localhost:44340/api/Products',\n type: 'POST',\n crossDomain: true,\n dataType: 'json',\n data: JSON.stringify(Product),\n success: function (data) {\n alert('Data: ' + data);\n },\n error: function (request, error) {\n console.log(\"Request: \" + JSON.stringify(request));\n alert(\"Request: \" + JSON.stringify(request));\n }\n });\n });\n\n\nUsing above methodology I am not able to post the data to odata web api.\nplease help or please let me known any other way to post the data to odata web api." ]
[ "jquery", "json", "ajax", "asp.net-web-api2", "odata" ]
[ "Removing dictionaries from list with for loop", "I have this sample list of dictionaries below. I want to know why the below code will only loop over two values in the list? Why does it not loop over every value in the list? \n\nupdated_list_of_site_dicts = [{'site': 'living', 'status': 'ready' }, {'site': 'keg', 'status': 'ready' }, {'site': 'box', 'status': 'ready' }, {'site': 'wine', 'status': 'ready' }]\n\nfor site_dict in updated_list_of_site_dicts:\n if site_dict['status'] == 'ready':\n print site_dict['site'] + \" is ready\"\n updated_list_of_site_dicts.remove(site_dict)\n print updated_list_of_site_dicts" ]
[ "python", "list", "dictionary" ]
[ "Read file contents into an ArrayList", "On a previous project I was required to read file contents into an array. Now I have to do the same thing only I have to read the contents into an ArrayList. A few problems I am encountering is\n\n\nHow do I step through the ArrayList adding each item separately?\nIf the file contains more than 10 inputs, it has to exit. I have tried the following, which does not work properly.\n\n\nCode:\n\n public static String readFile(String fileName) throws IOException {\n String result = \"\";\n String line = \"\";\n\n FileInputStream inputStream = new FileInputStream(fileName);\n Scanner scanner = new Scanner(inputStream);\n DataInputStream in = new DataInputStream(inputStream);\n BufferedReader bf = new BufferedReader(new InputStreamReader(in));\n\n int lineCount = 0;\n String[] numbers;\n while ((line = bf.readLine()) != null) {\n numbers = line.split(\" \");\n\n for (int i = 0; i < 10; i++) {\n if(i > 10) {\n System.out.println(\"The file you are accessing contains more than 10 input values. Please edit the file you wish to use so that it contains\"\n + \"> 10 input values. The program will now exit.\");\n System.exit(0);\n }\n\n matrix[i] = Integer.parseInt(numbers[i]);\n }\n lineCount++;\n\n result += matrix;\n }" ]
[ "java", "arraylist", "readfile" ]
[ "How can I use an UUID as an @Id for my @Entity properly?", "I want to store a User entity from Spring Boot into a MySQL database and I want to use an UUID as an Id. But when I follow the online solutions I only get The userId doesn't have a default value. And I just can't figure out whats wrong. Here is the code:\nUser entity:\n@NoArgsConstructor\n@AllArgsConstructor\n@Entity\n@Table(name = "user")\n@Data\npublic class User {\n\n @JsonProperty("userId")\n @Column(name = "userId", columnDefinition = "BINARY(16)")\n @GeneratedValue(generator = "uuid2")\n @GenericGenerator(name = "uuid2", strategy = "uuid2")\n @Id\n private UUID userId;\n \n @JsonProperty("email")\n @Column(name = "email", nullable = false)\n private String email;\n \n @JsonProperty("name")\n @Column(name = "name", nullable = false)\n String name;\n\n @JsonProperty("surname")\n @Column(name = "surname", nullable = false)\n String surname;\n\n @JsonProperty("password")\n @Column(name = "password", nullable = false)\n private String password;\n}\n\nMySQL table:\ncreate table if not exists user (\n userId binary(16) not null primary key,\n name varchar(80) not null,\n surname varchar(80) not null,\n email varchar(120) not null,\n password varchar(120) not null\n);\n\nThe error message:\nSQL Error: 1364, SQLState: HY000\n\n2020-07-23 15:31:29.234 ERROR 16336 --- [nio-8080-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper : Field 'userId' doesn't have a default value\n2020-07-23 15:31:29.251 ERROR 16336 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement] with root cause" ]
[ "java", "mysql", "spring-boot", "hibernate", "jpa" ]
[ "Python: Generating a big uniform permutation cheaply", "I'm not sure whether this is possible even theoretically; but if it is, I'd like to know how to do it in Python.\n\nI want to generate a big, random permutation cheaply. For example, say that I want a permutation on range(10**9). I want the permutation to be uniform (i.e. I want the numbers to be all over the place without any seeming structure.) I want to have a function available to get the nth item in the permutation for each n, and I want to have another function available to get the index of every number in the permutation. \n\nAnd the big, final condition is this: I want to do all of that without having to store all the items of the permutation. (Which can be a huge amount of space.) I want each item to be accessible, but I don't want to store all the items, like range in Python 3.\n\nIs this possible?" ]
[ "python", "permutation", "combinatorics" ]
[ "Compute a running ratio of two totals", "I have a PostgreSQL 9.4.1 database (Retrosheet data) with a table events containing one row per baseball play. I want to a compute a running batting average for a given player: the formula is (total number of hits so far)/(total number of valid at-bats so far).\n\nI can use window functions to get a running total of hits for David Ortiz, whose player code is ortid001, using the following query:\n\nSELECT count(*) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) \nFROM events WHERE bat_id='ortid001' AND (event_cd='20' OR event_cd='21' \nOR event_cd='22' OR event_cd='23');\n\n\n(The clause involving event_cd just identifies which rows are considered hits.)\n\nUsing the same technique, I can get a running total of at-bats (the event_cd clause rejects every row that doesn't count as an at-bat. note that the hits selected above are a subset of at-bats):\n\nSELECT count(*) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) \nFROM events WHERE bat_id='ortid001' AND (event_cd != '11' AND \nevent_cd!='14' AND event_cd!='15' AND event_cd!='16' AND \nevent_cd!='17');\n\n\nHow can I combine these? Ideally, for each row describing a play with bat_id='some_player_id', I would compute two functions: the count of all preceding rows describing an at-bat, and the count of all preceding rows describing hits. Dividing these gives the running batting average at that row." ]
[ "sql", "postgresql", "window-functions", "aggregate-filter" ]
[ "only displays a message in the conversation", "i have make its here before. mySQL - how to show all records from the messages table, not just one\n\nHello \n\nThis is how I'm going to build a messaging system which make the user 1 and user 2 has a conversation somewhere. \n\nThat itself, I go to the site so come all the conversations appear on the page. \n\nthe problem is such that it does only one message from the database. Therefore, I would like it to display all messages from the database.\n\nDatabase\n\nCREATE TABLE IF NOT EXISTS `fms_opslagpm` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `fra_id` int(11) NOT NULL,\n `til_id` int(11) NOT NULL,\n `title` varchar(30) NOT NULL,\n `besked` longtext NOT NULL,\n `datotid` datetime NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;\n\nINSERT INTO `fms_opslagpm` (`id`, `fra_id`, `til_id`, `title`, `besked`, `datotid`) VALUES\n(1, 2, 1, 'hrerherhe', 'hello world ', '2014-04-01 22:25:29'),\n(2, 2, 1, 'hrerherhe', 'hej', '2014-04-01 23:51:49');\n\n\nmysqli/php here.\n\n$sql = \"\n SELECT fms_bruger.fornavn, fms_bruger.efternavn, fms_opslagpm.id, fms_opslagpm.fra_id, fms_opslagpm.til_id, fms_opslagpm.title, fms_opslagpm.besked \n FROM fms_bruger INNER JOIN fms_opslagpm ON fms_bruger.id=fms_opslagpm.fra_id \n WHERE fms_opslagpm.id = ? and fms_opslagpm.fra_id = ? OR fms_opslagpm.til_id = ? \n GROUP BY fms_opslagpm.title ORDER BY fms_opslagpm.datotid DESC\n \";\n if ($stmt = $this->mysqli->prepare($sql)) { \n $stmt->bind_param('iii', $id, $fra_id, $til_id);\n $id = $_GET[\"id\"];\n $fra_id = $_SESSION[\"id\"];\n $til_id = $_SESSION[\"id\"];\n $stmt->execute();\n $stmt->store_result();\n $stmt->bind_result($fornavn, $efternavn, $id, $fra_id, $til_id, $title, $besked);\n while ($stmt->fetch()) {\n ?>\n <tr class=\"postbox\">\n <td class=\"beskedinfoBOX\">\n <p>\n <?php\n echo $fornavn . \" \" . $efternavn;\n ?>\n </p>\n </td>\n <td>\n <?php\n //beskeden.\n echo $besked;\n ?>\n </td>\n </tr>\n <?php\n }\n $stmt->close();\n }\n else\n {\n echo 'Der opstod en fejl i erklæringen: ' . $this->mysqli->error;\n }\n\n\n\n\nThis is how when I write fra_id = 2 and til_id = 1, then shows it is still only the content of the page. So samtidigvæk a message on the page.\n\nfms_opslagpm = fra_id - is he / she who sends the message\n\nfms_opslagpm = til_id - is he / she who receives the message" ]
[ "php", "mysqli" ]
[ "without selecting how to pass the spinner value", "Hi in the below code I have a edit button .If I am click on edit button setting the spinner values to the spinner .\n\nclick on edit button spinner value is setting the adapter.\n\n String speclizations = getArguments().getString(\"speclization_name\");\n ArrayAdapter<String> dataAdapter1 = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, Specializationnames);\n dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n spinnerSpecialization.setAdapter(dataAdapter1);\n if(spinnerSpecialization.getSelectedItem().equals(0)){\n\n speclizations = getArguments().getString(\"speclizations\");\n Log.d(\"salutation_names\",salutation_names);\n\n }else {\n speclizations=spinnerSpecialization.getSelectedItem().toString();\n }\n\n\nSame value I am passing after click on save button I am passing the spinner value without selecting want to pass the same value.but it is throwing an error.\n\nspinner.getslecteditem().toString();//null\n\nCan any one help me how to resolve the issue." ]
[ "java", "android", "spinner" ]
[ "python3 easy way to ignore a blank value", "I am working on a project where I need to parse a YAML file and write it's contents in another file. Now, the key value can be blank, and in that case, the value is supposed to be ignored, i.e., should not be written in the file. I can write an \"if statement\" checking whether the value is blank and writing in the file only if it is isn't, but is there any easier way to do it?" ]
[ "python-3.x" ]
[ "Make a CSV file Downloadable", "I use the below code. But the file created in tmp is not downloading .\n\n $error = fopen(/tmp/error.csv);\n $write[] = \"hello\";\n $dest_file_path=\"/tmp/error.csv\";\n $dest_file_name=\"error.csv\";\n if(!empty($write))\n {\n $flag = FALSE;\n fputcsv($error,$write,\";\");\n fclose($error);\n header(\"Content-Transfer-Encoding: Binary\");\n header(\"Content-length: \".filesize($dest_file_path));\n header('Content-Type: text/csv');\n header('Content-Disposition: attachment; filename=\"'.$dest_file_name.'\"');\n readfile($dest_file_path);\n }" ]
[ "php", "codeigniter", "csv" ]
[ "How to implement Graph Edition View in EmberJS", "I'm a rails developer and new to EmberJS and I ask for a little help implementing the UI, because it's heavy in javascript code and I want to try Ember\n\nHere's what I want to accomplish\n\n\n\nWhen I click the GraphEditor it adds a new Actor and shows the new actor popover form\n\nThe thing is that the UI elements are made with SVG tags in order to be zoomable, pannable and things like that\n\nMy problems are\n\n\nWhich controllers keep track of Actors and Relations? How to invoke them from the SocialNetwork show view?\nHow to render the Actors and Relations views? {{render}} doesn't work multiple times, and I need to bound the view properties with the model properties (kind of render partial: 'actor', actor: actor)\nHow I can create the Actor/Relation Details Popover view?\nHow do you structure the view hierarchy in order to accomplish this? My proposition is to have this nested views hierarchy.\n\n\n\n\nSorry about the general question but I'm implementing this in Ember because It's a complex view bound to data and I don't know how to implement this. Any initial insight would be useful" ]
[ "user-interface", "ember.js", "implementation" ]
[ "powershell tts command narrator change using python", "Does anyone know how to change the voice in this tts powershell command?\n\n-Powershell Command Add-Type -AssemblyName System.Speech\n$Speaker = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer\n$Speaker.Speak('oh my god, I can now talk; it''s amazing!')\n\n\nAnd it needs to be as small as possible as I'm implementing this using pythons os.system() command" ]
[ "python", "windows", "powershell", "text-to-speech" ]
[ "Error converting data type varchar to int (stored procedure C# ASP.NET)", "I am new in C# and i am working on a project where you call stored procedures from sql database in asp.net C#.\nIn my table, the 'ID' uses varchar datatype.\nwhen ever i type the ID in a textbox and click in the search button, it generate an error\n\n\n \n System.Data.SqlClient.SqlException: Error converting data type varchar to int.*\n \n\n\nI have gone through the code over and over again but i can't see the error.\nKindly assist. \nThank you.\n\nMYCODE\n\nstring connString2 = \"Data Source=EFTSRV4;Initial Catalog=PaySwitch;Integrated Security=True\";\n SqlConnection con = new SqlConnection(connString2);\n con.Open();\n SqlCommand cmd = new SqlCommand(\"GetMemberDetailsByID\", con);\n cmd.CommandType = CommandType.StoredProcedure;\n cmd.CommandText = \"GetMemberDetailsByID\";\n SqlDataAdapter da = new SqlDataAdapter();\n da.SelectCommand = cmd;\n DataSet ds = new DataSet();\n cmd.Parameters.Add(\"@MBID\", SqlDbType.VarChar).Value = (txtSearch.Text.Trim());\n cmd.ExecuteNonQuery();\n cmd.Connection = con;\n\n //da.Fill(ds, \"Members\");\n //(SqlDbType.Int).Parse(da.RowUpdated[0][\"@MBID\"]);\n // Mobileno = Convert.ToInt32(txmobileno.Text);\n //cmd.Parameters.Add(\"@MBID\", SqlDbType.Int).Value = (txtSearch.Text.Trim());\n try\n {\n dg_Data.EmptyDataText = \"No Records Found\";\n dg_Data.DataSource = cmd.ExecuteReader();\n dg_Data.DataBind();\n }\n catch (Exception ex)\n {\n throw ex;\n }\n finally\n {\n con.Close();\n con.Dispose();\n }\n\n\nMYSTOREDPROCEDURE\n\nUSE [PaySwitch]\nGO\n/****** Object: StoredProcedure [dbo].[GetMemberDetailsByID] Script Date: 03/02/2014 15:19:12 ******/\nSET ANSI_NULLS ON\nGO\nSET QUOTED_IDENTIFIER ON\nGO\nALTER PROCEDURE [dbo].[GetMemberDetailsByID] (\n@MBID VARCHAR (20)\n)\nAS\nBEGIN\nSELECT MBCompanyName, MBContactAddress1, MBContactCity,MBContactCountry, MBContactPostCode, MBContactPhone,MBContactEmailAdmin,MInstitutions FROM [dbo].[Members]\nWHERE MBID=@MBID\nEND\n\n\nMYERROR\n\nException Details: System.Data.SqlClient.SqlException: Error converting data type varchar to int.\n\nSource Error: \n\n\nLine 38: DataSet ds = new DataSet();\nLine 39: cmd.Parameters.Add(\"@MBID\", SqlDbType.VarChar).Value = (txtSearch.Text.Trim());\nLine 40: cmd.ExecuteNonQuery();\nLine 41: cmd.Connection = con;\nLine 42:" ]
[ "c#", "asp.net", "tsql", ".net-4.5" ]
[ "Excel file (azure blob) does not download in chrome", "Excel files are stored in azure blob containers. They are downloaded without incident in IE but in Chrome the page displays this message (and in Canary it crashes):\n\nThis file appears corrupt\n\n\nand provides a link to download it and all is well from that point. I've tried setting the content-type to different excel formats but the result is the same.\n\nHere's the blob code:\n\n MemoryStream memoryStream = new MemoryStream();\n CreateFile(memoryStream, grid);\n memoryStream.Position = 0;\n var blockBlob = container.GetBlockBlobReference(randomFileName);\n blockBlob.Properties.ContentType = \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\";\n blockBlob.DeleteIfExists();\n\n var options = new BlobRequestOptions()\n {\n ServerTimeout = TimeSpan.FromMinutes(10)\n };\n\n try\n {\n blockBlob.UploadFromStream(memoryStream, null, options);\n }\n catch (Exception e)\n {\n _logger.Error(\"Uploading excel file: Error: {0}\", e.Message);\n }\n\n\n return new Uri(\"https://myblobs.blob.core.windows.net/\" + \"containername/\" + randomFileName);" ]
[ "excel", "azure", "azure-storage-blobs" ]
[ "Writing sql search engine query", "I'm trying to write a script which is searching in database using every single word of query provided by user.\n\nFor example query could be:\n\"Nike Black Hat\"\n\nIn my script that string is split by space by PHP and then passed to SQL query in that form:\n\n foreach($query as $word)\n {\n $searchQuery[] = \" title ILIKE '%\".$word.\"%' ESCAPE '|' \";\n }\n\n\nThe problem is that those query is able to find words like semi*Black* or *Hat*ed. I don't want that so what I did was adding spaces:\n\nWHERE title ILIKE '% \".$word.\" %' ESCAPE '|' \n\n\nNow the problem is that if user query is \"Nike red shorts\", script will find nothing because \"Nike\" don't have a space before in database. I don't know how to resolve it - find only by whole words including words which don't begin or end with space." ]
[ "php", "sql", "postgresql", "search-engine" ]
[ "Segmentation Fault: 11 on OSX python", "I'm getting an intermittant segfault in python, which really shouldn't happen. It's a heisenbug, so I haven't figured out exactly what's causing it.\n\nI've done the search and found that there was a known problem with an older version of python, but I'm using 2.7.10 (in a virtualenv, in case that matters)\n\nI'm using pandas (0.18.0) , scipy(0.17.0) and numpy (1.11.0), in case the problem might be in there..." ]
[ "python", "macos", "numpy", "pandas", "scipy" ]
[ "Optimisation of view hierarchy in iOS", "Consider this view hierarchy: \n\n +----------------------------+ \n |A |\n |+--------+ +------------+ |\n ||B | |C | |\n || | |+----------+| |\n |+--------+ ||D || |\n | |+----------+| |\n | +------------+ |\n +----------------------------+\n\n\nIf there is an event on the view \"D\", the systems hit test returns the view 'A'. Then, it calls pointInside:withEvent: on B which returns NO. It recursively goes down in the hierarchy of 'C' (because the pointInside:withEvent: returned YES) to come to a conclusion that the hit event actually happened in 'B'. \n\nNow, it looks like the pointinside:withEvent call on the view 'B' is a waste of CPU. What if the view is very complex and if the system futilely calls this on views, doesn't it adversely affect the system performance? \n\nIn this light, how can we, as developers, construct our views to increase the response time to events?" ]
[ "ios", "optimization" ]
[ "how to get selected option jquery autocomplete", "I know there's a \"select\" event but is not working.\n\nThis is my code:\n\n$(\"#Asignacion_Movimiento_OrdenCompra\").autocomplete(\n \"/Asignaciones/ObtenerOrdenesCompra\",\n {\n extraParams: { Serial: function () { return $(\"#Asignacion_Movimiento_Material\").val(); } },\n delay: 200,\n select: function (event, ui) {\n alert(this.value + \" - \" + ui.item.value);\n ObtenerDatosAdicionales();\n return true;\n }\n }\n );\n\n\nI also tried adding:\n\nresult: function (event, data, formatted) {\n alert(data);\n ObtenerDatosAdicionales();\n return true;\n }\n\n\nBut nothing happens...\n\nHow can I get the value of the selected item by the user?\n\nThx." ]
[ "jquery", "autocomplete" ]
[ "How to get Android Voice Assistant to read hyphen as \"to\"?", "I'm having a task that require Voice Assistant on Android to read \"monday to friday\" for the text \"Monday - Friday\" displayed on HTML page.\n\nThis is my code:\n\n<html>\n<p tabindex=\"0\">We have received your request.</p>\n<p tabindex=\"0\"><strong>Have a question?</strong></p>\n<p tabindex=\"0\">You can call us on <a href=\"tel:132265\">13 22 \n65</a> for all general and credit card enquiries<br></br>\n<span aria-labelledby=\"to\">Monday - Friday</span> 8am - 7pm (AEST/AEDT)<br>\n</br>\nWeekends 9am - 6pm (AEST/AEDT)</p>\n<p tabindex=\"0\">Or, you can call us on <a href=\"tel:131012\">13 10 \n12</a> for all business banking, agribusiness banking and nabhealth \nenquiries<br></br>\n<span aria-labelledby=\"to\">Monday - Friday</span> 8am - 9pm (AEST/AEDT)<br>\n</br>\nWeekends 9am - 6pm (AEST/AEDT)</p>\n<p tabindex=\"0\"> </p>\n\n<span id=\"to\">monday to friday</span>\n</html>\n\n\nI have try <span aria-label=\"monday to friday\">Monday - Friday</span> but this doesn't work either.\n\nAny suggestion is much appreciated" ]
[ "accessibility", "nvda" ]
[ "Is sizeof(T) == sizeof(int)?", "I've been poring over the draft standard and can't seem to find what I'm looking for.\n\nIf I have a standard-layout type\n\nstruct T {\n unsigned handle;\n};\n\n\nThen I know that reinterpret_cast<unsigned*>(&t) == &t.handle for some T t; \n\nThe goal is to create some vector<T> v and pass &v[0] to a C function that expects a pointer to an array of unsigned integers.\n\nSo, does the standard define sizeof(T) == sizeof(unsigned) and does that imply that an array of T would have the same layout as an array of unsigned?\n\nWhile this question addresses a very similar topic, I'm asking about the specific case where both the data member and the class are standard layout, and the data member is a fundamental type.\n\nI've read some paragraphs that seem to hint that maybe it might be true, but nothing that hits the nail on the head. For example:\n\n§ 9.2.17\n\n\n Two standard-layout struct (Clause 9) types are layout-compatible if\n they have the same number of non-static data members and corresponding\n non-static data members (in declaration order) have layout-compatible\n types\n\n\nThis isn't quite what I'm looking for, I don't think." ]
[ "c++", "arrays", "sizeof" ]
[ "How to design \"ordering\" of objects with Core Data", "I have a Bullet object and a List object. A List has many bullets and a Bullet can belong to many Lists. \n\nBut I need to guarantee ordering of Bullet objects. For example, a List object should always have #1 Bullet A #2 Bullet B and #3 Bullet C in that order. Another List (List B) might have those same bullets, but in a different order, #1 Bullet B, #2 Bullet C and #3 Bullet A. \n\nNSSet doesn't store ordering, and Core Data doesn't allow arrays. \n\nWhat should I do? Can I do something with properties here? \n\nEdits: After listening to the comments below, I realized that it's a \"Many to Many\" relationship between lists and bullets ... For example, a Bullet (name: \"Egg\") can appear in the List (name: \"Dairy\") and the List (name: \"Food\")." ]
[ "ios", "objective-c", "oop", "core-data", "nsset" ]