texts
sequence
tags
sequence
[ "rapid volume changes cause artefacts in AVAudioPlayer", "I have some pure tones (sine waves) that I need to fade in and out and also adjust their volume arbitrarily through a thumbwheel. I generate the PCM data along with a WAV header and then encapsulate it in an AVAudioPlayer which plays back fine at constant volume.\n\nNow, as trivial as this sounds, I'm finding that changing volume rapidly on iOS 7 causes some pretty nasty artefacts. Imagine a tone playing with a slider controlling it's volume. Moving the slider around rapidly will cause the noise I'm describing. It's particularly obvious because the source signal is just a tone. If it were music, things would likely just get lost in the relative noise. Oddly, if I directly instrument the device volume via MPMusicPlayerController instead of trying to control things either through AVAudioPlayer's volume or even at the byte level, I get much smoother results and no artefacts. I suspect the device is doing something when it's volume is adjusted that I am not.I know this kind of quantization noise is an issue in audio processing and I'm wondering if anyone may have some advice.\n\nI've also reproduced the issue using sample level playback via Novocaine. No matter what I do, I can't seem to get smooth, noise-free fade in/out characteristics. Any help would be much appreciated." ]
[ "ios", "audio", "signal-processing" ]
[ "How to consume variables from CI pipeline into CD pipeline directly", "How can I consume variables set in CI pipeline directly in CD pipeline?\n\nExample:\nIf there are multiply variables declared in one group. How to access particular variable in CI/CD pipeline?\n\n\n\nAlso how to use variable groups for multiple keyvault's?\n\nThank you" ]
[ "azure-devops", "continuous-integration", "azure-pipelines", "continuous-deployment" ]
[ "Using a variable as part of a control name (to constantly check a condition)", "I am using toggle buttons that change color, caption and add / subtract to a counter. Since I will have to have a few of those buttons I'd rather habe a general function instead of having to change the script for each button.\n\nThis is what I currently have:\n\nPrivate Sub ToggleButton1_Click()\nIf ToggleButton1.Value = True Then\n ToggleButton2.BackColor = RGB(0, 255, 0)\n ToggleButton2.Caption = \"PASS\"\n Range(\"A1\").Value = Range(\"A1\").Value + 1\n\n If Range(\"A2\").Value > \"0\" Then\n Range(\"A2\").Value = Range(\"A2\").Value - 1\n End If\n\n\n\nElse\n ToggleButton1.BackColor = RGB(255, 0, 0)\n ToggleButton1.Caption = \"FAIL\"\n Range(\"A2\").Value = Range(\"A2\").Value + 1\n\n If Range(\"A1\").Value > \"0\" Then\n Range(\"A1\").Value = Range(\"A1\").Value - 1\n End If\n\nEnd If\n\nEnd Sub\n\n\nWhat I expect is something like:\n\nFor i = 1 to 100\n If ToggleButton & i.Value = True Then\n ....\n\n\nOr maybe even something like\nFor each togglebutton do blah\n\nSo how do I use a variable in the control name? TIA" ]
[ "excel", "vba", "variables", "controls" ]
[ "Autocomplete-like interface with separate ID field?", "I'd like to use jQuery Autocomplete to offer a sort of interactive dropdown in my form. However, I'd like to display 2 fields - the ID and the description. While it is easy to output both, I can't find a way to keep the ID and the text you want displayed separate, as you can with a simple html select dropdown element. I want to display ID + Description, and be able to \"search\" for either, but once it's selected I only want to have access to the ID. How can I accomplish this without specifically parsing out the ID? (I'm open to using something other than autocomplete)" ]
[ "jquery", "autocomplete", "html-select" ]
[ "(C++ Array problem) I want to printout the foods I ordered via numbercode I inputed during DoWhile process", "I will input: (The numbers is food code, Y/N is yes/no for do-while)\n\n1\nY\n2\nY\n3\nN\n\n\nThen my expected output would be\n\nChicken\nFries\nHotdog\n\n\nPlease see my code, it does not print out anything.\nMy idea would be everytime I inputed a number , it will trigger the switch function, then a variable with the prepared value (ex:order2 = fries) will be stored within the array. So when looping it, I will input multiple orders and I want to print them out (see my expected output above)\n\n#include <iostream>\nusing namespace std;\n\nint main() {\nint ordercode;\nint i;\nint limit;\nchar yesno;\nchar allorder[10][100];\nstring order1=\"Chicken\";\nstring order2=\"Fries\";\nstring order3=\"Hotdog\";\ndo \n{\nlimit++;\ni++;\ncout<<\" Enter order \";\ncin>>ordercode;\nswitch(ordercode){\n case 1:\n order1 == allorder[i];\n break;\n case 2:\n order2 == allorder[i];\n break;\n case 3:\n order3 == allorder[i];\n break;\n}\ncout<<\"Will you order again?\";\ncin>>yesno; \n}\n\nwhile(yesno == 'Y');\n\nfor(i = 0; i<limit; i++)\n{\n\n cout <<allorder[i];\n cout<<\"\\n\";\n}\n}" ]
[ "c++", "arrays", "do-while" ]
[ "how to hide UIButton in UIViewController in IOS?", "As shown in screen shot i have login page, which contains login and registration buttons, after registration over i need hide the registration button.\n click here to view screenshots" ]
[ "uibutton" ]
[ "Sailsjs behind Apache2 proxy logging socket errors", "I get the following log lines with each connection:\n\ninfo: handshake authorized bQumvCf9KtcMVUoXcXG5 \nwarn: websocket connection invalid\ninfo: transport end (undefined)\n\n\nAnd the Apache2 error log shows this at the same time:\n\n[Sun Apr 06 15:09:16 2014] [error] [client 24.84.162.51] (20014)Internal error: proxy: error reading status line from remote server localhost:7000\n[Sun Apr 06 15:09:16 2014] [error] [client 24.84.162.51] proxy: Error reading from remote server returned by /socket.io/1/websocket/bQumvCf9KtcMVUoXcXG5\n\n\nIs there something I can do in Sails to adjust the socket.io behaviour? I mean, pages are loading, and things appear to be connecting up, but something is clearly unhappy, and I'm always nervous when my log files aren't silent. Aren't you?" ]
[ "apache", "sockets", "sails.js", "mod-proxy" ]
[ "Inserting to next empty row", "I am trying to insert data in the next available row however it keeps missing out lots of rows which are blank. \n\nMy code is below:\n\nSub CommandButton1_Click()\n Application.ScreenUpdating = False\n Dim copySheet As Worksheet\n Dim pasteSheet As Worksheet\n\n Set copySheet = Worksheets(\"Recipe creater\")\n Set pasteSheet = Worksheets(\"Recipes\")\n\n Call Pasterecipedetails\n\n copySheet.Range(\"b6:g6\", Range(\"b6:g6\").End(xlDown)).Copy\n pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues\n Application.CutCopyMode = False\n Application.ScreenUpdating = True\nEnd Sub\n\n\n\nSub Pasterecipedetails()\n\n Application.ScreenUpdating = False\n Dim copySheet As Worksheet\n Dim pasteSheet As Worksheet\n\n Set copySheet = Worksheets(\"Recipe creater\")\n Set pasteSheet = Worksheets(\"Recipes\")\n\n copySheet.Range(\"c2:e2\").Copy\n pasteSheet.Cells(Rows.Count, 11).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues\n Application.CutCopyMode = False\n Application.ScreenUpdating = True\n\nEnd Sub\n\n\nThanks" ]
[ "vba", "excel" ]
[ "How can I perform this type of JOIN in Entity framework with LINQ", "I have a class badge: (e.g)\n\n**Badge**\n -User (Owned by)\n -Title (e.g votesOnThingReached5)\n\n\nUser's own badges through an class UserBadge, (it was required).\n\n**UserBadge:**\n -User\n -Badge\n\n\nSo:\n\nmyUser.UserBadges(); //Gets all user's current badges they own.\ndb.Badges(); //Gets all badges avaialble to be earnt.\n\n\nI need to only get the badges that the user doesn't currently have.\n\nHow can I write this LINQ? Here's my pseduo code example:\n\ndb.Badges(Where(b =>\nnew query(!myUser.UserBadges.contains(b));" ]
[ "c#", "sql", "linq", "entity-framework" ]
[ "UIButton text not updating", "A \"tried and true\" pattern I've used in my iOS Swift app is that I have several areas with UIButtons. When the button is pressed, it fires off some net code that connects to my API. While this is happening, I have the button text say \"please wait, loading\" and I disable the button. When the queued action finishes in my callback I have the button text enable and change back to the original state. It works great.\n\nI recently added something not using NSURL/NSDATA (it's just a file writer). I copied all the same GCD queue code and oddly enough it doesn't update the button text.\n\nHere is my code. When you tap the button, the text becomes invisible until the callback finishes, and then it just restores back. Oddly enough if I change my simulator to iPad Pro it actually works (??) and says \"please wait, downloading\". If I switch to iPhone 6s it doesn't work.\n\n@IBAction func btnGenerateCSV(sender: UIButton) {\n\n //Grab the original text of the button to restore later after done\n let originalButtonText = sender.titleForState(UIControlState.Normal)\n\n //Localized is an extension function I wrote.\n //As you can see I got crazy here adding all the UI States as a last ditch attempt to see if that was the reason.\n sender.setTitle(Localized(\"Downloading\"), forState: UIControlState.Normal)\n sender.setTitle(Localized(\"Downloading\"), forState: UIControlState.Disabled)\n sender.setTitle(Localized(\"Downloading\"), forState: UIControlState.Highlighted)\n //I've tried moving this before the setTitle. No avail.\n sender.enabled = false\n//I've tried the other queues as well, and even just tried dispatch_async(dispatch_get_main_queue()) but no luck\n\ndispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0)) { [unowned self] in\n\n CsvReportWriter.GenerateReport()\n {\n r in\n dispatch_async(dispatch_get_main_queue()) {\n FileManager.WriteToFile(r, filename: self.filename)\n\n if FileManager.FileExists(self.filename) {\n self.docController = UIDocumentInteractionController(URL: FileManager.GetURLOfFile(self.filename))\n self.docController.presentOptionsMenuFromRect(sender.frame, inView:self.view, animated:true)\n }\n //Restore button state and text b/c we're done\n sender.enabled = true\n sender.setTitle(originalButtonText, forState: UIControlState.Normal)\n }\n\n }\n } \n }\n\n\nAny ideas? If I swap out the CsvReportWriter.GenerateReport() code with some other async code that does a call out to my API, it works. \n\nThanks so much!" ]
[ "ios", "swift", "uibutton", "ios9", "grand-central-dispatch" ]
[ "How to wire up the outlets for a heavily nested ember.js route structure", "I have the following routes\n\nApp.Router.map(function(match) {\n this.route(\"days\", { path: \"/\" });\n this.resource(\"day\", { path: \"/:day_id\" }, function() {\n this.resource(\"slots\", { path: \"/slots\" }, function() {\n this.resource(\"slot\", { path: \"/:slot_id\" }, function() {\n this.route(\"edit\", { path: \"/edit\" });\n });\n });\n });\n});\n\n\nI have the following templates for the above\n\nscript/app/templates/application.handlebars\nscript/app/templates/days.handlebars\nscript/app/templates/day.handlebars\nscript/app/templates/day/index.handlebars\nscript/app/templates/slots.handlebars\nscript/app/templates/slots/index.handlebars\nscript/app/templates/slot.handlebars\nscript/app/templates/slot/index.handlebars\nscript/app/templates/slot/edit.handlebars\n\n\n\nis the above correct\nwhat html should be in each handlebars template if I plan to do the below (excluding days)\nwhat routes do I need to define assuming I want to do the below (excluding days)\n\n\nwhen a day is selected I want to show a list of associated models\n(slots in this case) \nwhen a slot is selected I want the html from\nit's index page (showing an individual slot based on the slot id\nparam being passed to the route)\n\n\n\nUPDATE\n\nSo far it looks like the routes marked with \"resource\" need to have an {{outlet}} available for the inner resource or route to drop in some markup.\n\nfor example the day.handlebars template has an {{outlet}} and inside my day/index.handlebars template I drop in a for loop to show each day. Next inside the slots.handlebars template I include an {{outlet}} and inside the slots/index.handlebars template I add another for loop to show each available slot." ]
[ "ember.js" ]
[ "Easy way to duplicate openshift application?", "Is there an easy way to duplicate an openshift application? This would not only copy the code, but also the environment variables and other settings?\n\nI have one now that works well for testing, and I want to have another copy of it for production." ]
[ "openshift" ]
[ "Remote WSH over HTTP via Rails", "I have a Windows game server (Mount & Blade: Warband) that I am trying to control remotely through a Rails application. I found a way to send text to the game server using Windows Script Hosting as follows:\n\nSet ArgObj = WScript.Arguments\nSet WshShell = WScript.CreateObject(\"WScript.Shell\")\nWshShell.AppActivate \"mb_warband_dedicated\"\n\nFor lcv = 0 to ArgObj.Count - 1\n WshShell.SendKeys ArgObj(lcv)\n WshShell.SendKeys \"{Enter}\"\nNext\nWshShell.SendKeys \"start\"\nWshShell.SendKeys \"{Enter}\"\n\n\nWhile this feels fragile, it does seem to work when I try it on my local machine; it successfully shifts focus to the game server, sends its arguments as text to the game server, and starts the game.\n\nMy train of thought was to have my Rails app call the WSH executable when game commands are POSTed (using proper Rails authentication and authorization for security). This works if I'm Remote Desktop'ed into the remote machine running Rails and the game server, but as soon as I disconnect my Remote Desktop session, it doesn't work anymore. The Rails server receives the request, calls the script, but then I'm guessing the 'AppActivate' command can't find the window.\n\nIf it was a Linux machine I think I could use a named pipe. Any ideas here? Powershell? Maybe TCL? I could kill the game server process, edit the config, and then restart the game server, but everyone would be disconnected." ]
[ "ruby-on-rails", "windows", "powershell", "named-pipes", "wsh" ]
[ "SQL error converting data type nvarchar to bigint using DIXF entity with auto generated field from number sequence", "I'm using the DIXF entity for opening balance to import data for a ledger journal into Dynamics AX. To generate the voucher and journal number, I use the Auto-generated checkbox in the source to staging mapping. Sometimes when importing the staging data, this will cause the following error messages:\n\nCannot execute the required database operation. The SQL database has issued an error.\nSQL error description: [Microsoft][SQL Server Native Client 10.0][SQL Server]Error converting data type nvarchar to bigint.\nSQL statement: UPDATE DMFLEDGERJOURNALENTITY SET JOURNALNUM = [dbo].FN_FMT_NUMBERSEQUENCE(N'006-######',JOURNALNUM,159,0) WHERE DEFINITIONGROUP = N'AnlagenAbschreibungAX3.0_006' AND EXECUTIONID = N'AnlagenAbschreibungAX3.0_006_006-1'\nIssue exist in generate staging data\n'82' 'Anfangssaldo' record(s) inserted in staging\n\nThe error is caused by method generateAutoNumbers in class DMFGenerateSSISPackage, but if I put a breakpoint there and try to debug the problem, the error does not occur and after it does not happen again. I have not been able to figure out a reliable way to reproduce the problem, but it usually comes up after I created a new processing group.\nI would like to know why this SQL statement sometimes fails to convert the datatypes and what I can to do prevent the error." ]
[ "sql-server", "type-conversion", "data-migration", "dynamics-ax-2012-r2" ]
[ "Overlay element over ContentControl's ContentPresenter", "I am trying to get this seemingly simple scenario to work.\nI have a ContentControl MyControl, and I would like one of it's elements to overflow on top of the ContentPresenter while remaining an element of a border.\n\n\n\n<Page\n x:Class=\"Playground.MainPage\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n xmlns:local=\"using:Playground\"\n xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n xmlns:controls=\"using:Playground\"\n mc:Ignorable=\"d\"\n Background=\"{ThemeResource ApplicationPageBackgroundThemeBrush}\">\n\n <Page.Resources>\n <Style TargetType=\"local:MyControl\" >\n <Setter Property=\"Template\">\n <Setter.Value>\n <ControlTemplate TargetType=\"local:MyControl\">\n <Grid>\n <Grid.RowDefinitions>\n <RowDefinition Height=\"100\"/>\n <RowDefinition Height=\"*\"/>\n </Grid.RowDefinitions>\n\n <Border Grid.Row=\"0\" BorderBrush=\"GreenYellow\" BorderThickness=\"1\">\n <Grid>\n <Grid.ColumnDefinitions>\n <ColumnDefinition Width=\"*\"/>\n <ColumnDefinition Width=\"2*\"/>\n <ColumnDefinition Width=\"*\"/>\n </Grid.ColumnDefinitions>\n <Rectangle Grid.Column=\"0\" Width=\"50\" Height=\"50\" Fill=\"Silver\" HorizontalAlignment=\"Center\"/>\n <Rectangle x:Name=\"Overflow\" Grid.Column=\"1\" Width=\"100\" Height=\"200\" Fill=\"Gold\" HorizontalAlignment=\"Center\"/>\n <Rectangle Grid.Column=\"2\" Width=\"50\" Height=\"50\" Fill=\"Silver\" HorizontalAlignment=\"Center\"/>\n </Grid>\n </Border>\n\n <ContentPresenter Grid.Row=\"1\"/>\n </Grid>\n </ControlTemplate>\n </Setter.Value>\n </Setter>\n </Style>\n </Page.Resources>\n\n <controls:MyControl Grid.Row=\"0\" BorderBrush=\"Gold\" BorderThickness=\"1\">\n <Ellipse Fill=\"Silver\"/>\n </controls:MyControl>\n</Page>\n\n\nI have tried playing with Canvas.ZIndex but I cannot get this particular scenario to work. Just to re-iterate, I would like the gold rectangle to overflow over all of the content in the ContentPresenter, but I would like the border and two squares to remain as they are.\n\nEdit: The source for this project is here if anybody s interested in playing with it." ]
[ "xaml" ]
[ "Error when serializing EF Code First 5.0 data in WebAPI Controller", "I had originally asked this question:\nHow Do I Resolve "A specified Include path is not valid"? which was answered, and my .Include() is now working, however, when the serializer tries to work it's magic, I get the following error:\n\nYou must write an attribute 'type'='object' after writing the attribute \nwith local name '__type'.\n\n\nHere's what I'm doing to return the data:\n\nvar everything = dc.Categories\n .Include(c => c.Products);\n\n\nMy class definitions are fairly straightforward:\n\npublic class Category\n{\n public int CategoryId { get; set; }\n public string Title { get; set; }\n\n public virtual ICollection<Product> Products { get; set; }\n}\n\npublic class Product\n{\n public int ProductId { get; set; }\n public string Title { get; set; }\n\n public virtual Category Category { get; set; }\n}\n\npublic class ProductDataContext : DbContext\n{\n public DbSet<Category> Categories { get; set; }\n public DbSet<Product> Products { get; set; }\n}\n\n\nI also tried removing 'virtual' but then I get circular references. I tried making the setter on ICollection Products private (as suggested here: http://forums.asp.net/t/1773164.aspx/1), which gets the error to clear, but then my products aren't part of the returned JSON.\n\nWhat do I need to do to get the data to serialize with the categories and their products within? \n\nEDIT\nHere was the stack trace I was getting:\n\n[SerializationException: Object graph for type 'System.Collections.Generic.List`1[[Test.Models.Product, Test.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' contains cycles and cannot be serialized if reference tracking is disabled.]\nSystem.Web.Http.WebHost.HttpControllerHandler.EndProcessRequest(IAsyncResult result) +30206\nSystem.Web.Http.WebHost.HttpControllerHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +10\nSystem.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9478661\nSystem.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +178" ]
[ "ef-code-first", "asp.net-web-api", "entity-framework-5" ]
[ "Make diagnostic errors reported by a C# source generator appear in the Visual Studio editor", "I am attempting to write a C# source generator that throws a warning/error under certain conditions using GeneratorExecutionContext.ReportDiagnostic. My source generator is able to run and output errors successfully upon building a sample project in Visual Studio. However, my errors do not show up as green/red squiggles in the Visual Studio editor. This is supposed to be possible with Roslyn analyzers, according to Microsoft's documentation, but nothing is said of source generators specifically. Since source generators are treated like Roslyn analyzers, though, I imagine this should be possible. I've managed to replicate my issue with a small example, consisting of a source generator project and a test project on which to run the generator. As a test, the generator reports a diagnostic error whenever it sees a method that doesn't return void. I intend for red squiggles to appear under the offending method's name:\nSource generator:\n[Generator]\npublic class SampleGenerator : ISourceGenerator\n{\n public void Execute(GeneratorExecutionContext context)\n {\n DataReceiver r = (DataReceiver)context.SyntaxReceiver;\n foreach(MethodDeclarationSyntax method in r.Methods)\n {\n IMethodSymbol symbol = (IMethodSymbol)context.Compilation.GetSemanticModel(method.SyntaxTree).GetDeclaredSymbol(method);\n if(symbol.ReturnType.SpecialType != SpecialType.System_Void)\n {\n context.ReportDiagnostic(Diagnostic.Create(\n new DiagnosticDescriptor(\n "SG0001",\n "Non-void method return type",\n "Method {0} returns {1}. All methods must return void.",\n "yeet",\n DiagnosticSeverity.Error,\n true), symbol.Locations.FirstOrDefault(), symbol.Name, symbol.ReturnType.Name));\n }\n }\n context.AddSource("yert", "namespace test { public class testclass { } }");\n }\n\n public void Initialize(GeneratorInitializationContext context)\n {\n context.RegisterForSyntaxNotifications(() => new DataReceiver());\n }\n}\n\npublic class DataReceiver : ISyntaxReceiver\n{\n public List<MethodDeclarationSyntax> Methods { get; } = new List<MethodDeclarationSyntax>();\n\n public void OnVisitSyntaxNode(SyntaxNode syntaxNode)\n {\n if(syntaxNode is MethodDeclarationSyntax synt)\n {\n Methods.Add(synt);\n }\n }\n}\n\nExample code:\nclass Program\n{\n static void Main(string[] args)\n {\n Console.WriteLine("Hello World!");\n }\n\n static string ok() => "hello";\n}\n\nWhen I compile the example code with the generator, Visual Studio tells me that the build has errors, and correctly reports the custom diagnostic in the error list. I can click on the custom error, and my cursor moves to the offending method in the editor. However, no red squiggles appear. I know that my source generator is being run by Intellisense, because I am able to see the custom test namespace and class my generator defines.\nDoes Visual Studio support code underlining for diagnostics reported by C# source generators? If so, what is wrong with the above code? Thanks in advance." ]
[ "c#", "visual-studio", "roslyn", "roslyn-code-analysis", "sourcegenerators" ]
[ "How to close Android Soft KeyBoard programmatically?", "I am currently showing softkeyboard using the following code\n\nInputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);\nimm.toggleSoftInput (InputMethodManager.SHOW_FORCED, InputMethodManager.RESULT_HIDDEN);\n\n\nAnd Here I d'not bind the softkeyboard with Edittext because of that I had used the above code.\n\nNow I want to close the SoftKeyboard so i am currently using the below code but it is not working.\n\nimm.toggleSoftInput (InputMethodManager.SHOW_FORCED, InputMethodManager.RESULT_HIDDEN);\n\n\nCan Anyone suggest me what to use for closing the softKeyboard ?\n\n\n\nBased on Below Answer I want to let you clear that I am not using EditText, I use Layout on which I want to show Keyboard and Hide keyboard. I want to send keyboard key event to remote area bcoz of that I didnot used editText." ]
[ "android", "android-softkeyboard" ]
[ "ng2-pdfjs-viewer for extracting text", "Is there any possibility of using ng2-pdfjs-viewer for extracting solely the text of a pdf file, e.g. as a string? I want to extract text and regex it for cutting out certain paragraphs depending on the text inside of them. \n\nThanks in advance" ]
[ "ng2-pdfjs-viewer" ]
[ "When should I create another field as Primary Key?", "I'm developing a home automation system using MySQL. I have some arduinos connected through ethernet shields and a Raspberry Pi that manages them using a MQTT server. This server handles the communication between all the devices (each arduino is only connected to the raspberry, which processes the request and sends another request to the same or another arduino).\n\nAlso, each arduino is identified by its MAC address.\n\nI have an input (for reading switches and sensors) and an output (turning on and off lamps) system using the arduinos. Each value is stored in the input and output tables.\n\ndevice\n\n - id : CHAR(12) PK NOT NULL // The MAC Address\n - type : VARCHAR(5) NOT NULL // I also manage a door lock system\n\n\ninput\n\n - device : CHAR(12) NOT NULL // FK from device table\n - selection : TINYINT NOT NULL // Selects input port\n - value : INT // Stores the input value\n\n\nThe output table is very similar. Both tables have other fields not important to my question.\n\nWhen someone presses a switch a message is sent to the server, the server processes the request, updates the database and sends back other messages to other arduinos according to a set of tables that manages triggers.\n\nI started noticing some delay turning on the lamp and after some code dump I found out that the majority of the time is spent on the database query.\n\nIs it better if instead of using the MAC address as the PK I create another field (INT AUTO_INCREMENT)? What engine is fastest os better for this situation?\n\nPS: The server runs a long running PHP script (it was the best language I knew at the time I started developing this and I was using the web UI as a reference. I know that Python may be better for this case)." ]
[ "mysql", "performance", "primary-key" ]
[ "Publish message on multiple topic strings (IBM Integration Bus)", "I've a scenario where I would receive message using MQ Input node and based on the value of source system present in the message, I need to form topic string and publish the message. This is how my flow looks like: \n\nMQInput -> Compute -> Publication \n\nAnd I populate the value of Topic using: \nSET OutputRoot.Properties.Topic = 'TopicName/' || sourceName ; \n\nThis works fine in case message contains one source system. \n\nHowever there is possibility that message contain multiple source system. Is it possible to use the above mentioned command to publish the messages on multiple topic string? (something like this) \n\nSET OutputRoot.Properties.Topic = 'Topic/' || sourceName1 ; \n\nSET OutputRoot.Properties.Topic = 'Topic/' || sourceName2 ; \n\nAppreciate any suggestions." ]
[ "ibm-mq", "ibm-integration-bus" ]
[ "Download S3 objects in a single operation", "Please, what is the best strategy to download all objects stored on AWS S3? \n\nI need to offer some feature to final users of our system that enable them to download in a single operation all stored objects - .rar or .zip would be great!\n\nI'm using AWS SDK for Java.\n\nTks." ]
[ "java", "amazon-s3" ]
[ "how to get proper data in apigee baas when we inert data by end user in titanium alloy", "index.xml\n\n <Alloy>\n <Window class=\"container\">\n <Label id=\"label\">login here</Label>\n <TextField id=\"txtUser\">username</TextField>\n <TextField id=\"pwd\">password</TextField>\n <Button id=\"btnLogin\" onClick=\"doLogin\"></Button>\n </Window>\n </Alloy>\n\n index.js\n\n function doLogin(e) {\n var name = $.txtUser.value.toString();//txtUser is my textbox id\n var paswd = $.pwd.value.toString(); //pwd is my textbox id\n var jsonobject = {\"username\":'\"'+name+'\"',\"password\":'\"'+ paswd+'\"'}; \n var url=\"api.usergrid.com/DHEERAJ123/DEMO1/logs?\";\n var client = Ti.Network.createHTTPClient({\n onload:{ },\n onerror :{ } \n });\n client.setRequestHeader('content-type', 'JSON');\n client.open(\"POST\", url);\n client.send(JSON.stringify(jsonobject));\n }\n $.index.open();\n\n apigee baas output\n\n {\n \"uuid\": \"6f07d50a-c48b-11e4-939c-ab932c123bc7\",\n \"type\": \"logs\",\n \"created\": 1425706387024,\n \"modified\": 1425706387024,\n \"metadata\": {\n \"path\": \"/logs/6f07d50a-c48b-11e4-939c-ab932c123bc7\"\n },\n \"password\": \"\\\"888\\\"\", // i had sent 888 but it come .....\n \"username\": \"\\\"dheeraj\\\"\"// i had sent dheeraj but it save.....\n }\n\n\nWhen I am inserting data in apigee using titanium alloy through end user, data in apigee is not save in proper format, in apigee additional \\ and \"\" are coming .....\nhow to overcome with this problem....." ]
[ "javascript", "json", "titanium-alloy", "apigee-baas" ]
[ "Repeating a step in a Fortran loop", "I'm trying to write a Fortran 90 program to carry out Euler's method to solve ode's using an adaptive time step.\n\nI have an if statement inside of a do while loop, in which I check that the error at each iteration of the code is less than a certain tolerance. However, if it is not less than certain tolerance, I must change a certain value (the step size) and carry out the calculation again to get a new error to compare with the tolerance.\n\nIt looks something like (and forgive me this is my first time using this website):\n\ndo while (some condition)\n (Get an approximation to the ODE with various subroutine calls)\n (Calculate the error)\nif (error < tol)\n step = step/2\nelse\n step = 2*step\n(Something that will return to the top of my do while loop)\nend if\nend do\n\n\nSay for example, I had do while (i < 4), where i starts at 1, and my error was not less than my tolerance, I would have to repeat the calculation again for i=1 with a new step size.\n\nI hope this makes sense to those of you who read this. If you need any clarification, let me know." ]
[ "fortran", "fortran90", "ode" ]
[ "How to delete keys in ZODB storage?", "I've started working with ZODB in my Python project. It's nice, but how to remove certain entries from storage?\n\nI've tried this:\n\nstorage = FileStorage.FileStorage('stats.fs')\ndb = DB(storage)\nconnection = db.open()\nroot = connection.root()\nroot['key1'] = 'test\nroot.remove('key1')\n\n\nBut I'm getting error \nAttributeError: 'PersistentMapping' object has no attribute 'remove'\n\nHow to remove an entry?" ]
[ "python", "zodb" ]
[ "Cython - using stdlib", "I'm trying to make the c++ library work with cython using the following code: a parent that generates a random number generator and children that use it to generate uniformly distributed random numbers.\n\n[rnd.pyx]\ncdef extern from \"<random>\" namespace \"std\":\n cdef cppclass mt19937:\n mt19937() except +\n mt19937(unsigned int) except +\n cdef cppclass uniform_real_distribution[T]:\n uniform_real_distribution()\n uniform_real_distribution(double, double)\n T operator()(mt19937)\n\ncdef class Child:\n cdef mt19937 *rng\n cdef uniform_real_distribution[double] uniform\n def __cinit__(Child self):\n cdef unsigned int seed = 123154654\n self.rng = NULL\n self.uniform = uniform_real_distribution[double](0.,1.)\n cdef set_rng(Child self, mt19937 rng):\n self.rng = &rng\n def gen_uniform(self):\n return self.uniform(self.rng[0])\n\ncdef class Parent:\n cdef mt19937 rng\n cdef public list children\n def __cinit__(Parent self):\n cdef unsigned int seed = 123154654\n self.rng = mt19937(seed)\n self.children = []\n cpdef make_child(Parent self):\n child = Child()\n child.set_rng(self.rng)\n self.children.append(child)\n\n[rnd.pyxbuild]\nimport os\nfrom distutils.extension import Extension\ndirname = os.path.dirname(__file__)\ndef make_ext(modname, pyxfilename):\n return Extension(\n name=modname,\n sources=[pyxfilename],\n extra_compile_args=[\"-std=c++11\"],\n language=\"c++\",\n include_dirs=[dirname]\n )\n\n[test.py]\nimport pyximport\npyximport.install()\n\nfrom rnd import Child, Parent\n\np = Parent()\n\nfor i in range(300):\n p.make_child()\nfor child in p.children:\n a = child.gen_uniform()\n print(a)\n\n\nHowever, though the code compiles correctly, the output of the gen_uniform function is really not what I would expect: the test.py code generates first 0.941197317223, then 0.743410046664 for ever.\n\nMoreover, though I don't manage to reproduce it, changing Child.gen_uniform, I once manage to get random numbers (much) greater that 1.0\n\nEventually in a more complex code where I pass the rng pointer from a class to another, I get normal numbers, zeros, greater-than-one numbers, then segmentation fault.\n\nCould someone tell me where the problem comes from?" ]
[ "python", "c++", "random", "cython" ]
[ "make limitation for random class in c#", "I want to make limitation for random class in c# like generate random variables from 2 ranges without repeat it? \nexample :\n\nXpoints[i] = random.Next(0, 25);\nYpoints[i] = random.Next(0, 12);\n\n\nwhere 25 we 12 is image dimension so I need all pixels in this image but random ? any suggestion if I use this code i didn't get some pixels and some pixels repeated" ]
[ "c#", "random" ]
[ "can't able zoom in out in mobile devices", "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0\" />\n\n\nI am using the above meta tag to detect the device but I can't use + n - normally we use in the websites, can anyone explain why it is not working? My website url is below,\n\nhttps://ezybeeaustralia.com.au/index.php?page=item&id=33" ]
[ "html" ]
[ "use ! in Reactjs Component in JSX", "I want to change Material-UI Button component.\n<Button>\n\nto\n<Button disabled>\n\nSo my source code is this,but it shows the Parsing error: Unexpected token, expected "..."\n<Button {!this.state.enClick ? "" : disabled }><Button>\n\nNot in Button tag {!A ? B:C } works.\n<Button>\n{!this.state.enClick ? "OK":"No"}\n</Button>\n\nWhat is the best practice for this purpose??" ]
[ "javascript", "reactjs" ]
[ "WebServiceHost: Blocking call in a webservice method blocks whole service", "I have a WCF webservice using the WebServiceHost class.\n\nnew WebServiceHost(typeof(MyServiceClass));\n\nIf I use a blocking call like Thread.Sleep (just an example) in one of my webservice methods and i call this method the whole service is not usable while the blocking call is active.\n\nIs that normal behaviour or is there an error somewhere in my configuration or usage?" ]
[ "c#", "wcf" ]
[ "Not able to set breakpoint in visual studio", "I am using Visual Studio 2013 and I am facing a weird issue from last few days. Whenever I try to set a break point, I get an error \n\n\"The Following breakpoint cannot be set\", \"The breakpoint failed to bind\".\n\nI don't know what settings have changed." ]
[ "visual-studio-2010", "visual-studio-2012", "visual-studio-2013" ]
[ "Facebook login page keeps redirecting me to the same login page when I click continue as 'my username' in safari", "Also when I try a different browser, chrome for example says: \"This page isn’t workingwww.facebook.com redirected you too many times.\nTry clearing your cookies.\nERR_TOO_MANY_REDIRECTS\"\n\nFireFox says: \"The page isn’t redirecting properly\nFirefox has detected that the server is redirecting the request for this address in a way that will never complete.\nThis problem can sometimes be caused by disabling or refusing to accept cookies.\"\nI am able to login to facebook and click continue but after that it goes south.\n\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;\nimport org.springframework.security.oauth2.provider.OAuth2Authentication;\nimport org.springframework.stereotype.Controller;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.RestController;\n\nimport java.security.Principal;\nimport java.util.Map;\n\n@SpringBootApplication\n@Controller\npublic class WappApplication {\n\n @GetMapping(\"/\")\n public static String welcome(Principal principle)\n {\n Map<String,Object> details = (Map<String,Object>) ((OAuth2Authentication) principle).getUserAuthentication().getDetails();\n String userName = (String) details.get(\"name\");\n return\"index\";\n }\n\n public static void main(String[] args) {\n SpringApplication.run(WappApplication.class, args);\n }\n\n\n\n}\n\n\napplications.yml:\n\nspring:\n application:\n name: WappApplication\nsecurity:\n oauth2:\n client:\n clientId: (redacted)\n clientSecret: (redacted)\n accessTokenUri: http://graph.facebook.com/oauth/access_token\n userAuthorizationUri: https://www.facebook.com/dialog/oauth\n tokenName: oauth_token\n autherizationScheme: query\n clientAutherizationScheme: form\n resource:\n userInfoUri: https://graph.facebook.com/me\n\n\nindex.html in templates directory:\n\n<html>\n<body>\n<h1>hello</h1>\n</body>\n</html>" ]
[ "java", "facebook", "spring-boot" ]
[ "getting net::ERR_ABORTED after putting in jquery library source in html file", "So I'm trying to get an alert through jquery code. I have 3 inputs so login.password and button and when writing your login and password you should get an alert (log+pass). The error that i'm getting is:\n\n\n GET http://localhost/php5/jquery-3.3.1.min.js net::ERR_ABORTED.\n\n\nHere is my code.\n\n <!doctype html>\n<html lang=\"en\">\n <head> \n <meta charset=\"UTF-8\">\n <title> PHP </title>\n <script src=\"jquery-3.3.1.min.js\"></script> \n <script>\n $(document).ready(function(){\n $(\"#send\").click(function(){\n var log=$(\"#login\").val()\n var pass=$(\"#password\").val()\n\n alert(log+pass)\n\n\n })\n })\n </script>\n </head>\n <body>\n <input id=\"login\" placeholder=\"Login\"><br>\n <input type=\"password\" id=\"password\" placeholder=\"Password\"><br>\n <input type=\"button\" id=\"send\" value=\"send\">\n <div class=\"status\"></div>\n </body>\n</html>" ]
[ "javascript", "jquery", "html", "input" ]
[ "Calling a servlet from maven", "I want to upload automatically a zip file with Maven build. The uploading of file is done in a servlet. Is there a way to call the servlet from a Maven file?" ]
[ "maven", "servlets", "build" ]
[ "'On Error GoTo ErrorHandler' replace with 'try catch and finally' block", "I have converted VB6 project to VB.NET(VS2005). After converted, i want to replace 'On Error GoTo ErrorHandler' with try catch block. Please give me some examples of the below code to \"try catch finally\" block. Thank you.\n\nPrivate Sub GetMktAccessRights2(ByRef jsonObj As Scripting.Dictionary, ByRef nCount As Short)\n On Error GoTo ErrorHandler\n Dim i As Short\n Dim ctr As Short\n\n If nCount = 0 Then\n WriteErrorToTextFile(ErrorFileName, \"Cannot get market access rights description.\")\n InsertDealerErrorLog(\"FrmMain: GetMktAccessRights(): Cannot get market access rights description.\")\n\n MsgBox(\"Cannot get market access rights description.\", MsgBoxStyle.OKOnly)\n Else\n NumOfExch = 0\n For i = 1 To nCount\n 'UPGRADE_WARNING: Couldn't resolve default property of object jsonObj.Item().Item. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword=\"6A50421D-15FE-4896-8A1B-2EC21E9037B2\"'\n If (AccessRights And jsonObj.Item(\"records\").Item(i).Item(\"DealerRights\")) = jsonObj.Item(\"records\").Item(i).Item(\"DealerRights\") Then\n NumOfExch = NumOfExch + 1\n 'UPGRADE_WARNING: Couldn't resolve default property of object jsonObj.Item().Item. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword=\"6A50421D-15FE-4896-8A1B-2EC21E9037B2\"'\n CFD_data(NumOfExch - 1).Market = Trim(jsonObj.Item(\"records\").Item(i).Item(\"Market\"))\n End If\n Next \n If NumOfExch = 0 Then\n InsertDealerErrorLog(\"FrmMain: GetMktAccessRights(): You cannot access any of the markets.\")\n MsgBox(\"You cannot access any of the markets because you are not assign access to the different markets.\", MsgBoxStyle.OKOnly)\n End If\n End If\n\n Exit Sub\nErrorHandler: \n MsgBox(\"GetMktAccessRights2 Error. Maybe response message error.\")\n Resume Next\n\nEnd Sub\n\nPrivate Function SendDealerInfoToRskMng(ByVal Loginout As Boolean, ByVal DealerID As String, ByVal MarketList As String, ByVal ListidList As String) As Boolean\n On Error GoTo ErrHandler\n\n WriteErrorToTextFile(LogFileName, \"Begin to SendDealerInfoToRskMng.\")\n\n Dim logindata As DealerLoginData\n logindata = New DealerLoginData\n\n Dim strDate As String\n strDate = VB6.Format(Now, \"yyyy-mm-dd hh:MM:ss\")\n\n tcpendpoint.SendOut(logindata.handle)\n\n SendDealerInfoToRskMng = True\n\n 'UPGRADE_NOTE: Object logindata may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword=\"6E35BFF6-CD74-4B09-9689-3E1A43DF8969\"'\n logindata = Nothing\n\n WriteErrorToTextFile(LogFileName, \"Success to SendDealerInfoToRskMng.\")\n Exit Function\nErrHandler: \n MsgBox(\"PMEModule:SendDealerInfoToRskMng()->\" & Err.Description)\n InsertDealerErrorLog(\"PMEModule:SendDealerInfoToRskMng()->\" & Err.Description)\n End\n\nEnd Function" ]
[ "vb.net", "vb6", "vb6-migration" ]
[ "Silverlight Navigation Framework with Unity Container", "I'm using the Silverlight Navigation Framework and have recently been coding my appliation in the following general way:\n\nPublic MasterPageView: UserControl\n{\n private IMasterPageViewModel _ViewModel = null;\n\n public MasterPageView():this(new MasterPageViewModel(), new BusinessObjectProvider())\n {\n }\n\n public MasterPage(IMasterPageViewModel viewModel)\n {\n InitializeComponent();\n\n _ViewModel = viewModel;\n this.DataContext = viewModel;\n }\n}\n\n\nNow that i have the skeleton of my project created, i want to carry out some tidying up, before the heavy development starts. As part of my refactoring process i want to make use of the Unity IOC and take out my Default constructors.\n\nHas anybody used the Silverlight Navigation Framework with Unity? I would appreciate any suggestions on how to go about this.\n\nThe Main Problems and questions i see are\n1) Where do i register the Objects in the Unity Framework?\n2) All Views are created using the URIMAPPER in the Silverlight Navigation Framework, how do we get the URIMAPPER to use Unity to create its Views.\n\nAny help would be greatly appreciated." ]
[ "silverlight", "inversion-of-control", "unity-container" ]
[ "Cannot run new instance of async task at android 4.2", "I have code, which perfectly runs on android 2.3.3, but doesn't run on android 4.2. When activity is starting, it should call instance of Initialize class which extends AsyncTask. But, at first activity start - it works, when I go to other activity and back - progress spinner is rotating and nothing happens, even exception isn't throwing.\n\nI tried to debug this, it go to calling of execute() of new instance of Initialize and doesn't go inside doInBackground() of Initialize\n\nIs this a problem only with android 4.2 or problem in other?\n\n protected void onStart() {\n super.onStart();\n\n if (orders != null) {\n try {\n spinner.setVisibility(View.GONE);\n progress.setVisibility(View.VISIBLE);\n new Initialize().execute();\n\n } catch (Exception e) {\n spinner.setVisibility(View.VISIBLE);\n progress.setVisibility(View.GONE);\n\n Log.d(\"Error\",\"exception: \" + e.getMessage());\n }\n }\n}\n\n\nInitialize\n\nprivate class Initialize extends AsyncTask<Void, Void, Void> {\n\n @Override\n protected Void doInBackground(Void... params) {\n try {\n if (orders == null || orders.isEmpty()) {\n orders = new ArrayList<Order>();\n BaseProcess Proc = new BaseProcess(MainActivity.this);\n orders.addAll(Proc.getOrdersFromBase());\n Proc.database.close();\n Proc.close();\n }\n } catch (Exception ex) {\n Log.d(\"Error\",\"exception \" + ex.getMessage());\n }\n\n return null;\n }\n\n @Override\n protected void onPostExecute(Void result) {\n super.onPostExecute(result);\n\n adapter.notifyDataSetChanged();\n update();\n }\n\n }" ]
[ "java", "android", "android-asynctask" ]
[ "send clicked span element data to outher components using props or emit in vue js", "i have two components...\n\ncomponent ONE have data on span element which is done by for loop with same class name\ncomponent TWO have to receive data from component ONE but clicked span data only\n\n---Component ONE----\n<span class="" v-for="item in list"> {{ list }} </span>\n<component-two :msg="item"></component-two>\n\n----Component two---\n<span>{{ msg }}</span>\n\nlist for component one\nlist=['0':'a','1':b','3':c']" ]
[ "javascript", "vue.js", "npm" ]
[ "Error: Problem with `mutate()` input x `labels` must be unique", "I am trying to recode some labelled variables to a 0 to 1 scale in the following fashion. When I try to calculate the mean of the two variables using c_across() I get this odd error Error: Problem with mutate() input market_liberalism. x labels must be unique.\nIf I delete the value labels then it works. I don't understand what problem the value labels cause.\nThank you.\n#Install car package if necessary\n#install.packages('car')\nlibrary(tidyverse)\nlibrary(car)\nstructure(list(PESE15 = structure(c(3, 5, 5, 8, NA), label = "The Government Should Leave it Entirely to the Private Sector to Create Jobs", na_values = c(8, 9), format.spss = "F1.0", display_width = 0L, labels = c(`Strongly agree` = 1, `Somewhat agree` = 3, Somewhatdisagree = 5, Stronglydisagree = 7,D.K. = 8, Refused = 9), class = c("haven_labelled_spss", "haven_labelled", "vctrs_vctr", "double")), MBSA2 = structure(c(3, 8, 1, 1, NA), label = "People Who Do Not Get Ahead Should Blame Themselves Not the System", na_values = 8, format.spss = "F1.0", display_width = 0L, labels = c(`Strongly agree` = 1, Agree = 2, Disagree = 3, Stronglydisagree = 4, `No opinion` = 8), class = c("haven_labelled_spss", "haven_labelled", "vctrs_vctr", "double"))), row.names = c(NA, -5L), class = c("tbl_df", "tbl", "data.frame"), label = "NSDstat generated file")->out\n\n#use the car::Recode command to convert values to 0 to 1\nout$market1<-Recode(out$PESE15, "1=1; 3=0.75; 5=0.25; 7=0; 8=0.5; else=NA")\nout$market2<-Recode(out$MBSA2, "1=1; 2=0.75; 3=0.25; 4=0; 8=0.5; else=NA")\n\n#Use dplyr to try to calculate the average \nout %>% \n rowwise() %>% \n mutate(market_liberalism=mean(\n c_across(market1:market2))) -> out2\n\n#setting value labels to NULL makes it work.\nval_labels(out$market1)<-NULL\nval_labels(out$market2)<-NULL\n\nout %>% \n rowwise() %>% \n mutate(market_liberalism=mean(\n c_across(market1:market2)))" ]
[ "r", "tidyverse", "r-haven" ]
[ "HBase regions automatic splitting using hbase.hregion.max.filesize", "I'm using the cloudera distribution of HBase (hbase-0.94.6-cdh4.5.0) and the cloudera manager to set up all cluster's configurations.\n\nI have set up the following property for HBase:\n\n<property>\n<name>hbase.hregion.max.filesize</name>\n<value>10737418240</value>\n<source>hbase-default.xml</source>\n</property>\n\n\nNB: 10737418240 <=> 10G\n\nSo, according to all documentation I read, data should be accumulated into a single region until the region size reached 10G.\n\nBut, it doesn't seem to work...\nMaybe I miss something...\n\nHere is all regions of my hbase table and their size:\n\nroot@hadoopmaster01:~# hdfs dfs -du -h /hbase/my_table\n719 /hbase/my_table/.tableinfo.0000000001\n0 /hbase/my_table/.tmp\n222.2 M /hbase/my_table/08e225d0ae802ef805fff65c89a15de6\n602.7 M /hbase/my_table/0f3bb09af53ebdf5e538b50d7f08786e\n735.1 M /hbase/my_table/1152669b3ef439f08614e3785451c305\n2.8 G /hbase/my_table/1203fbc208fc93a702c67130047a1e4f\n379.3 M /hbase/my_table/1742b0e038ece763184829e25067f138\n7.3 G /hbase/my_table/194eae40d50554ce39c82dd8b2785d96\n627.1 M /hbase/my_table/28aa1df8140f4eb289db76a17c583028\n274.6 M /hbase/my_table/2f55b9760dbcaefca0e1064ce5da6f48\n1.5 G /hbase/my_table/392f6070132ec9505d7aaecdc1202418\n1.5 G /hbase/my_table/4396a8d8c5663de237574b967bf49b8a\n1.6 G /hbase/my_table/440964e857d9beee1c24104bd96b7d5c\n1.5 G /hbase/my_table/533369f47a365ab06f863d02c88f89e2\n2.5 G /hbase/my_table/6d86b7199c128ae891b84fd9b1ccfd6e\n1.2 G /hbase/my_table/6e5e6878028841c4d1f4c3b64d04698b\n1.6 G /hbase/my_table/7dc1c717de025f3c15aa087cda5f76d2\n200.2 M /hbase/my_table/8157d48f833bb3b708726c703874569d\n118.0 M /hbase/my_table/85fb1d24bf9d03d748f615d3907589f2\n2.0 G /hbase/my_table/94dd01c81c73dc35c02b6bd2c17d8d22\n265.1 M /hbase/my_table/990d5adb14b2d1c936bd4a9c726f8e03\n335.0 M /hbase/my_table/a9b673c142346014e01d7cf579b0e58a\n502.1 M /hbase/my_table/ae3b1f6f537826f1bdb31bfc89d8ff9a\n763.3 M /hbase/my_table/b6039c539b6cca2826022f863ed76c7b\n470.7 M /hbase/my_table/be091ead2a408df55999950dcff6e7bc\n5.9 G /hbase/my_table/c176cf8c19cc0fffab2af63ee7d1ca45\n512.0 M /hbase/my_table/cb622a8a55ba575549759514281d5841\n1.9 G /hbase/my_table/d201d1630ffdf08e4114dfc691488372\n787.9 M /hbase/my_table/d78b4f682bb8e666488b06d0fd00ef9b\n862.8 M /hbase/my_table/edd72e02de2a90aab086acd296d7da2b\n627.5 M /hbase/my_table/f13a251ff7154f522e47bd54f0d1f921\n1.3 G /hbase/my_table/fde68ec48d68e7f61a0258b7f8898be4\n\nAs you can see, there is a lot of regions and any of them has a size close to 10G...\n\nIf someone has been faced to this kind of issue or know if there is an other configuration to set up, please help me!\n\nThx" ]
[ "hadoop", "split", "hbase", "region" ]
[ "Using Kill command with a network path", "I seem to be having a problem using the kill command to delete a file(s) when I use a network path, such as below wont work:\n\nKill \"\\\\LAPTOP\\SH-FOLDER\\*.pdf\"\n\n\nIf I give the full path name though, fine, no problems. Is there an issue with using network paths?\n\nThanks in advance for any help." ]
[ "ms-access", "vba" ]
[ "performing calculations and comparisons using indices in numpy arrays", "I have a 3D numpy array of voxels, i.e. where the indices of each point correspond to its position in 3D space.\n\nThere are a number of calculations I wish to perform that involve knowing whether the points satisfy various geometric conditions. This means converting the indices into vectors by multiplying by the basis, and then calculating dot and cross products, norms etc.. I am looking for a reasonably fast way to do this, as my efforts so far seem very slow.\n\nIf I have an arbitrary basis a, b, c:\n\nbasis = np.array([[a1, a2, a3],\n [b1, b2, b3],\n [c1, c2, c3]])\n\n\nwhere a1, a2, a3 are the x, y and z components of a, and likewise for b and c.\nI can calculate the Cartesian coordinate p = (x, y, z) of each voxel in the following way:\n\nfor i in range(vox.shape[0]):\n for j in range(vox.shape[1]):\n for k in range(vox.shape[2]):\n p = np.dot(basis, np.array([i, j, k]))\n\n\nwhere \"vox\" is the 3D array of voxels. If, for example, I wish to calculate the dot product of each of these vectors with a single other (Cartesian) vector (e.g. q = np.array([qx, qy, qz])) and store that index if the result meets a given condition (here greater than 0.0), I could do something like this (within the same loop as above):\n\n if np.dot(p, q) > 0.0:\n desired_vox_indices.append([i, j, k])\n\n\nThe problem is that this is very slow. Can I do this in a more pythonic way, or by using more numpy tools? I realise I am not even accessing the values of the vox array at this stage either.\n\nEDIT: attempt at cross product based on answer by Divakar\n\n# Get q_x (matrix multiplication version of cross product)\nq_x = np.array([[0.0, -q[2], q[1]],\n [q[2], 0.0, -q[0]],\n [-q[1], q[0], 0.0]])\n\n# transpose (as per cross product definition) and matrix multiply with basis\nu = np.matmul(q_x.T, basis)\n\n# Get open range arrays\nm,n,r = vox.shape\nI,J,K = np.ogrid[:m,:n,:r]\n\n# writing everything explicitly, since I am unsure how ogrid objects behave\npxq = np.empty(3)\npxq[0] = u[0,0]*I + u[0,1]*J + u[0,2]*K\npxq[1] = u[1,0]*I + u[1,1]*J + u[1,2]*K\npxq[2] = u[2,0]*I + u[2,1]*J + u[2,2]*K\n\n\nwhich might be the same as just:\n\npxq = np.dot(u, np.array([I, J, K]))\n\n\nbut I am not sure..." ]
[ "python", "arrays", "python-3.x", "numpy", "voxel" ]
[ "UNIX: Pattern match and sort", "Input\n\n1 DX\n ADA\n4 O1\n3 I1\n C1\n2 LA\n FTAS\n TT66\n\n\nExpected Output\n\n1 DX\n ADA\n2 LA\n FTAS\n TT66\n3 I1\n C1\n4 O1\n\n\nCommand\n\n\n sort -n Input\n\n\nI tried sorting the file numerically as mentioned above . But it sorted the null values as well , which messed up the strcuture. Thanks for the help." ]
[ "perl", "bash", "unix" ]
[ "Need some ideas for MySQL stored procedures, functions and triggers", "I have a school assignment to design a database and to include:\n\n* 2 stored procedures\n* 2 functions\n* 2 triggers\n\n\nWhile I know how to implement these, I haven't used them IRL and I have a hard time coming up with use-cases.\n\nAny ideas? :-)\n\n(if it helps, my DB design mimics an online bookstore -- e.g. Amazon)" ]
[ "mysql", "database", "database-design", "stored-procedures", "triggers" ]
[ "(Chez) Scheme benchmarks?", "Now that Chez Scheme is open-source, I wonder how it compares to Racket and other Schemes or languages in terms of performance, so that one could make informed choices about using them in one's projects.\n\nUnfortunately, I couldn't find any relevant benchmarks.\n\nI found the following:\n\n\n\nhttps://ecraven.github.io/r7rs-benchmarks/benchmark.html\n\nProblem: no Racket, or other languages (Update 10/13/18: Chez is now included in some of the benchmarks)\n\n\n\nhttp://www.larcenists.org/benchmarksGenuineR6Linux.html\n\nProblem: no Chez Scheme, or other languages\n\n\n\nhttps://benchmarksgame-team.pages.debian.net/benchmarksgame/\n\nProblem: only Racket, questionable comparisions (For example, Python is not allowed to use Numpy where it would clearly help, while Racket is making FFI calls to GMP)\n\n\n\nSo, none of the benchmarks I found allow you to compare Racket to Chez, for example, or Chez to SBCL, or Java. Are there Chez benchmarks that give you a sense of how fast it is?\n\nChez Scheme is often said to be the fastest Scheme/Lisp around. We should know if it's faster than, say, Java for your typical business logic application." ]
[ "functional-programming", "scheme", "lisp", "racket", "chez-scheme" ]
[ "Automatically POST on document creation", "In an HTML-document, i want to have a (if possible: invisible) form that POSTs the contents of one text input field to my server as soon as the document is created or if possible within s seconds. The document is created via javascript's open.\n\nHow can i do that?" ]
[ "javascript", "html", "http" ]
[ "Resolving an Interop Dependency across projects", "Another telegraph-style question. First, my NinjectModule:\n\nusing Ninject.Modules;\nusing Microsoft.Office.Interop.Word;\n\nnamespace NinjectSample.Util.Injection\n{\n public class SampleModule : NinjectModule\n {\n public override void Load()\n {\n Bind<_Application>().ToMethod(ctx => GetApp());\n }\n\n public _Application GetApp()\n {\n return new Application();\n }\n }\n}\n\n\nFirst thing (works!):\n\n IKernel kernel = new StandardKernel(new SampleModule());\n var foo = kernel.Get<_Application>();\n\n\nChanging this to \n\n IKernel kernel = new StandardKernel(new SampleModule());\n var foo = kernel.Get<BusinessClass>();\n\n\nBusinessClass is defined in another Assembly, Code:\n\nnamespace BusinessClassLibrary\n{\n public class BusinessClass\n {\n private _Application _app;\n\n [Inject]\n public BusinessClass(_Application application)\n {\n _app = application;\n }\n }\n}\n\n\nThis will Result in : \n\nError activating _Application\nNo matching bindings are available, and the type is not self-bindable.\nActivation path:\n 2) Injection of dependency _Application into parameter application of constructor of type BusinessClass\n 1) Request for BusinessClass\n\nSuggestions:\n 1) Ensure that you have defined a binding for _Application.\n 2) If the binding was defined in a module, ensure that the module has been loaded into the kernel.\n 3) Ensure you have not accidentally created more than one kernel.\n 4) If you are using constructor arguments, ensure that the parameter name matches the constructors parameter name.\n 5) If you are using automatic module loading, ensure the search path and filters are correct.\n\n\nI'm not too deep into interop, but my basic understanding of .Net lets me stumble across the following:\n\n\nApplication is an interface, just like its base _Application. Nevertheless it is possible to call its constructor. Why?\nI tell Ninject to use a factory Method, which seems to work while the dependency is located in the Assembly that the Kernel is defined in. Why does it try to resolve the Dependency by self-binding when it's located in another assembly?" ]
[ "interop", "ninject", "excel-interop" ]
[ "JSON array of length 1 sent to MVC method is null, 2+ is fine", "I've got a webpage that sends information to an MVC method via AJAX call. The call looks exactly like this:\n\n$.ajax({\n url: url,\n type: \"post\",\n contentType: \"application/json; charset=utf-8\",\n data: JSON.stringify({ model: model }),\n success: function (result) {\n if (result == \"ok\") {\n u.setMessage(\"Reloading\");\n window.location.reload();\n }\n else {\n var text = result == \"long\" ? \"Episode Name is too long.\" : \"\";\n notify(false, text);\n }\n },\n error: function () {\n notify(false);\n u.stop();\n }\n});\n\n\nWithin the model object that I said, there is field called \"Episodes\". If I only send one episode to my controller method, the Episodes field is null. My web console debugger tells me that I am indeed populating the episodes field like this:\n\n\"Episodes\":[{\"ReleaseYear\":\"2020\",\"Name\":\"series episode 0e3\",\"EpisodeNumber\":\"0e3\",\"SeasonId\"\n:\"9202\"}]\n\n\nHowever, if I add an additional entry into the Episodes field, my controller method's object will show an Episodes array with two objects in it.\n\n\"Episodes\":[{\"ReleaseYear\":\"2015\",\"Name\":\"series episode 800a1\",\"EpisodeNumber\":\"800a1\"\n,\"SeasonId\":\"9202\"},{\"ReleaseYear\":\"2015\",\"Name\":\"series episode 800a2\",\"EpisodeNumber\":\"800a2\"\n,\"SeasonId\":\"9202\"}]\n\n\nWhy would my controller method detect the field when it has multiple objects as opposed to just one? I have no idea why this is happening." ]
[ "jquery", "ajax", "json", "asp.net-mvc" ]
[ "What is the node pattern?", "In a book i recently read, the author presented the 'node pattern' which looks close to EAV, but i couldn't find any useful and concrete informations about it.\n\nDo you know any good document to point me to ? or explain what's it exactly ?" ]
[ "design-patterns" ]
[ "How do I keep the context without changing the structure of function?", "How I can keep the context and getting true data from ajax response, adhering to current structure of my code?\n\nFor example:\nIn the second case, I get the correct data. \nHow do I get the same result using the current structure? (first console.log)\n\n\r\n\r\nvar options = {\r\n url: 'http://echo.jsontest.com/key/value'\r\n};\r\n\r\nfunction getJson(options) {\r\n this.init(options);\r\n}\r\n\r\n$.extend(getJson.prototype, {\r\n options: null,\r\n\r\n init: function (options) {\r\n this.options = options;\r\n\r\n return $.get(this.options.url);\r\n }\r\n});\r\n\r\nconsole.log('First:');\r\nconsole.log(new getJson(options.url));\r\nconsole.log('Second:');\r\nconsole.log($.get(options.url));\r\n<script src=\"https://code.jquery.com/jquery-3.3.1.min.js\"></script>" ]
[ "javascript", "jquery", "ajax", "get", "this" ]
[ "What is a bootstrap method?", "I have been reading this presentation about java8 lambdas implementation http://fr.slideshare.net/czechscala/java-8-under-the-hood \n\n\n LambdaMetaFactory contains bootstrap methods for converting lambda expressions to functional interface objects.\n\n\nWhat are these bootstrap methods, and are they related to invokedynamic ?" ]
[ "java" ]
[ "Calling Java varargs method with single null argument?", "If I have a vararg Java method foo(Object ...arg) and I call foo(null, null), I have both arg[0] and arg[1] as nulls. But if I call foo(null), arg itself is null. Why is this happening? \n\nHow should I call foo such that foo.length == 1 && foo[0] == null is true?" ]
[ "null", "language-design", "java", "variadic-functions" ]
[ "requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https", "I'm working with angular-cli, I'm reading txt file by sending XMLHttpRequest using click event and got this error.\n\nXMLHttpRequest cannot load file:///E:/xampp/Angular-\n]cli/Login/src/app/employees.txt. Cross origin requests are only supported for \nprotocol schemes: http, data, chrome, chrome-extension, https.\n\n\nThis is line creating problems. (file.component.ts)\n\n rawFile.send(null);\n\nIf you need more files, tell me.\n\nHere are the files\n\nfile.component.ts\n\nimport { Component, OnInit } from '@angular/core';\n\n@Component(\n{\nselector: \"file\",\ntemplateUrl: \"/filedata.component.html\",\n})\nexport class FileData\n{\nmakeRequest(file)\n{\n let rawFile = new XMLHttpRequest();\n rawFile.open(\"GET\", file, false);\n try\n {\n rawFile.onreadystatechange = () =>\n {\n if(rawFile.readyState === 4)\n {\n if(rawFile.status === 200 || rawFile.status == 0)\n {\n var allText = rawFile.responseText;\n console.log(allText); // Here is the contents of the file\n }\n else\n console.log(\"error contents\");\n }\n else\n console.log(\"error ready status\");\n }\n rawFile.send(null); // Here's the Error!\n }\n catch(e)\n {\n console.log(e);\n }\n}\n}\n\n\nfile.component.html\n\n<div>\n<button type = \"button\" (click) = \"makeRequest('E:/xampp/Angular-cli/Login/src/app/employees.txt')\">File Test</button>\n</div>" ]
[ "angular", "http", "xmlhttprequest" ]
[ "lucene.net sort not working access violation", "I am trying to sort my results in lucene\n\nI keep getting this error however \n\nAn unhandled exception of type 'System.AccessViolationException' occurred in Search.dll\n\nAdditional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.\n\nI have tried setting Field.Index to analysed and not analysed but no joy.\n\nAnalyzer analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29);\n\nvar parser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, \"Title\", analyzer);\nQuery query = parser.Parse(searchTerm.Trim() + \"*\");\n\nvar searcher = new IndexSearcher(directory, true);\n\nvar sortBy = new Lucene.Net.Search.Sort(new Lucene.Net.Search.SortField(\"Title\", Lucene.Net.Search.SortField.STRING, true));\n\nvar filter = new QueryWrapperFilter(query);\n// TopDocs topDocs3 = searcher.Search(query, filter, 500,sortBy);\n// TopDocs topDocs = searcher.Search(query,500);\nTopDocs topDocs2 = searcher.Search(query,null, 500, new Sort(new SortField(\"Title\", SortField.STRING)));\n\nvar re = searcher.Search(query, null, 10, new Sort(new SortField(\"id\", SortField.INT, true)));" ]
[ "c#", "lucene.net" ]
[ "TabItem Header Click not Always Firing", "I wanted to find a method of firing an event when the TabItem of a Page is selected. I had a look around and found that placing a Label on the header and using MouseLeftButtonDown was a way of making this event fire. The XAML looks like this;\n\n <TabItem>\n <TabItem.Header>\n <Label Content=\"Archived Jobs\" MouseLeftButtonDown=\"CallArchivedJobsTabItemSelected\"/>\n </TabItem.Header>\n </TabItem>\n\n\nThere is an issue with this fix though, in that if the user clicks in a specific place under the Label they will be able to select the TabItem without the event firing. How can I program this differently to ensure that they cannot bypass the event firing?" ]
[ "c#", "wpf", "xaml" ]
[ "Convert Word doc to PDF - Python", "I need to fill in a document and then try and convert it into a PDF.\n\nAny idea how I can do this?" ]
[ "python", "pdf", "ms-word" ]
[ "How do I force strtotime() to return date instead of time when given ambiguous $time?", "Good evеning!\n\necho date('r', strtotime('10.01.11'));\n\n\nPrints: Sun, 05 Feb 2012 10:01:11\n\nExpected: Mon, 10 Jan 2011 00:00:00\n\nHow do I force strtotime() to parse the input string as a date only? I have to convert a bunch of dates in different format. DateTime::format is not an option since I don't know all the formats the script will run into, and it's not even installed on the server (and i don't have privileges to do it). \n\nTried\nstrtotime('day 10.01.11'),\nstrtotime('10.01.11 00:00:00'),\nstrtotime('10.01.11 midnight')\n- nothing worked.\n\nAny help is much appreciated" ]
[ "php", "strtotime" ]
[ "Select MAX(value),value2,value3 not returning other's value", "This is my query :\n\nSELECT DISTINCT MAX(nb_played), id_person,id_list FROM `t_stats` ORDER BY MAX(nb_played) DESC;\n\n\ni want to return the max value of nb played for every id list, then return the id person.\n\nso basically, The best nb_played of every id list, with the id_person.\n\nCan't manage to figure it out. anyone could help me ?" ]
[ "mysql", "sql" ]
[ "How can i parse following data in iPhone?", "Hello i am working on web service base iPhone application but the problem is my client provide web service which is in following formate and i don't know how to parse it. i will appreciate for any help or anybody share their experience.\n\n\n {\"message\":\"[{\\\"APPROVER_ID\\\":\\\"DAMIN_V\\\",\\\"APPROVER_USER_NAME\\\":\\\"DAMIN\\\",\\\"START_DATE\\\":\\\"04/04/12\\\",\\\"END_DATE\\\":\\\"\n \\\",\\\"SUBSTITUTE_ID\\\":\\\"HLAD\\\",\\\"SUBSTITUTE_USER_NAME\\\":\\\"James\\\"},{\\\"APPROVER_ID\\\":\\\"DAMIN_V\\\",\\\"APPROVER_USER_NAME\\\":\\\"DAMIN\\\",\\\"START_DATE\\\":\\\"06/01/12\\\",\\\"END_DATE\\\":\\\"\n \\\",\\\"SUBSTITUTE_ID\\\":\\\"LucyE\\\",\\\"SUBSTITUTE_USER_NAME\\\":\\\"Lucy\\\"},{\\\"APPROVER_ID\\\":\\\"HLAD\\\",\\\"APPROVER_USER_NAME\\\":\\\"James\\\",\\\"START_DATE\\\":\\\"04/16/12\\\",\\\"END_DATE\\\":\\\"\n \\\",\\\"SUBSTITUTE_ID\\\":\\\"HT\\\",\\\"SUBSTITUTE_USER_NAME\\\":\\\"HTx\\\"},{\\\"APPROVER_ID\\\":\\\"HLAD\\\",\\\"APPROVER_USER_NAME\\\":\\\"James\\\",\\\"START_DATE\\\":\\\"06/13/12\\\",\\\"END_DATE\\\":\\\"\n \\\",\\\"SUBSTITUTE_ID\\\":\\\"SUPERMAN\\\",\\\"SUBSTITUTE_USER_NAME\\\":\\\"james\\\"},{\\\"APPROVER_ID\\\":\\\"MY\n ORG USER\\\",\\\"APPROVER_USER_NAME\\\":\\\"My ORG user\n 1\\\",\\\"START_DATE\\\":\\\"06/13/12\\\",\\\"END_DATE\\\":\\\"06/16/12\\\",\\\"SUBSTITUTE_ID\\\":\\\"NFALPR1\\\",\\\"SUBSTITUTE_USER_NAME\\\":\\\"Prince\\\"},{\\\"APPROVER_ID\\\":\\\"PEK\\\",\\\"APPROVER_USER_NAME\\\":\\\"Lucy\n E\\\",\\\"START_DATE\\\":\\\"03/01/12\\\",\\\"END_DATE\\\":\\\"08/08/12\\\",\\\"SUBSTITUTE_ID\\\":\\\"HRL\\\",\\\"SUBSTITUTE_USER_NAME\\\":\\\"James\\\"},{\\\"APPROVER_ID\\\":\\\"PNAIR\\\",\\\"APPROVER_USER_NAME\\\":\\\"Carl\\\",\\\"START_DATE\\\":\\\"03/01/12\\\",\\\"END_DATE\\\":\\\"03/09/12\\\",\\\"SUBSTITUTE_ID\\\":\\\"SCHITRE\\\",\\\"SUBSTITUTE_USER_NAME\\\":\\\"Fun\n bobby\\\"},{\\\"APPROVER_ID\\\":\\\"LucyE\\\",\\\"APPROVER_USER_NAME\\\":\\\"Lucy\\\",\\\"START_DATE\\\":\\\"03/01/12\\\",\\\"END_DATE\\\":\\\"03/31/12\\\",\\\"SUBSTITUTE_ID\\\":\\\"HLAD\\\",\\\"SUBSTITUTE_USER_NAME\\\":\\\"James\\\"},{\\\"APPROVER_ID\\\":\\\"LucyE\n E\\\",\\\"APPROVER_USER_NAME\\\":\\\"Lucy\\\",\\\"START_DATE\\\":\\\"04/01/12\\\",\\\"END_DATE\\\":\\\"04/30/12\\\",\\\"SUBSTITUTE_ID\\\":\\\"DAMIN_V\\\",\\\"SUBSTITUTE_USER_NAME\\\":\\\"DAMIN\\\"},{\\\"APPROVER_ID\\\":\\\"LucyE\n E\\\",\\\"APPROVER_USER_NAME\\\":\\\"Lucy\\\",\\\"START_DATE\\\":\\\"05/04/12\\\",\\\"END_DATE\\\":\\\"05/25/12\\\",\\\"SUBSTITUTE_ID\\\":\\\"JOSHIA\\\",\\\"SUBSTITUTE_USER_NAME\\\":\\\"Joye\\\"}]\",\"statusFlag\":true}\n\n\nThanks In Advance,\nNitin." ]
[ "iphone", "ios", "web-services", "parsing" ]
[ "neo4j query performance takes a lot of time", "I am facing a query performance issue. Do let me know if I am making any mistake here.\n\nI have created around 1700 (Router nodes) and around 4000 (interface nodes) where interfaces are connected to their respective routers using relation (has_interface).\n\nNow I want to create a link between these interfaces. A link will be a relation. Every interface has an IfIPAddress prop associated with it. \nWhen I try to create a link using this query, it runs for a very long time, takes a lot of CPU and then do not create any link.\nHere is my query\n\nMATCH (I:Interface), (I2:Interface) \nFOREACH(p in FILTER(z in {props} WHERE z.OrigIPAddress = I.IfIPAddress and z.TermIPAddress = I2.IfIPAddress) |\nMERGE (:Interface {IfIPAddress:p.OrigIPAddress})-[r:link]->(:Interface {IfIPAddress:p.TermIPAddress})\nON CREATE SET r = p\nON MATCH SET r = p)\n\n\nHere is what I provide to neo4j using json and curl\n\n{\n \"params\" : {\n \"props\" : [\n {\n \"AreaId\" : \"\",\n \"OrigIPAddress\" : \"172.16.42.9\",\n \"OrigNodeID\" : \"192.168.1.221\",\n \"TermIPAddress\" : \"172.16.42.10\",\n \"TermNodeID\" : \"10.229.140.28\",\n \"eEntityStatus\" : \"1\",\n \"iTotalBW\" : \"0\"\n }\n ]\n },\n \"query\" : \"MATCH (I:Interface), (I2:Interface) FOREACH(p in FILTER(z in {props} WHERE z.OrigIPAddress = I.IfIPAddress and z.TermIPAddress = I2.IfIPAddress) | MERGE (:Interface {IfIPAddress:p.OrigIPAddress})-[r:link]->(:Interface {IfIPAddress:p.TermIPAddress}) ON CREATE SET r = p ON MATCH SET r = p)\"\n}\n\n\nThis is what I am doing in the query\nFirst in the FILTER I am removing all those links whose OrigIPAddress or TermIPAddress are not present in the neo4j\nAfter that for every props, I am creating a link between the interfaces.\n\nI am using neo4j 2.1. When neo4j server was running with default configurations it gave error as \"OutOFMemory Exception\"\n\nI increased the heap size of the server and it is taking a lot of time\n\nLet me know if anything I have missed.\nDo let me know if you need logs." ]
[ "json", "neo4j" ]
[ "display Livedata using startLeScan()", "Am working on developing an android app which scan the ble devices . I succeeded in scanning them and displaying the scanned response data packets. Now I have modified the ble to transmit scanned data packets which will change for each advertising events. So I need to display the live changing of data in my app.But as of once scan is pressed it will display the immediate value ,it will not update the next data ! am using the mBluetoothAdapter.startLeScan(mLeScanCallback) function . \nso I need to start and stop scanning rapidly to display the new data.I tried to use multiple call of start and stop leScan but it hanged up the app.\n\nHere is the generic function for scanning \n\nprivate void scanLeDevice(final boolean enable) {\n\n if (enable) {\n // Stops scanning after a pre-defined scan period.\n mHandler.postDelayed(new Runnable() {\n @Override\n public void run() {\n mScanning = false;\n mBluetoothAdapter.stopLeScan(mLeScanCallback);\n System.out.println(\"hello\");\n invalidateOptionsMenu();\n }\n }, SCAN_PERIOD);\n\n mScanning = true;\n mBluetoothAdapter.startLeScan(mLeScanCallback);\n } else {\n mScanning = false;\n mBluetoothAdapter.stopLeScan(mLeScanCallback);\n }\n invalidateOptionsMenu();\n}" ]
[ "android" ]
[ "Using openmp for nested loops of varying iteration sizes", "I have an array of constant, small size (specifically the number of threads used) containing int vectors of varying sizes. The workload that each nested iteration will execute varies too, from almost insignificant to relatively heavy (but usually not too heavy). The code looks like that:\n\nfor (int i = 0; i < num_of_threads; ++i) \n for (int j = 0; j = array[i].size(); ++j)\n doStuff(array[i][j]);\n\n\nAs I see it there is no easy way to collapse it and let openmp know the real size of the tasks at hand, since the nested loop's size can vary. So no matter my scheduling policy I worry for cases like the following:\n\nThe array contains 3 vectors of sizes 8, 8 and 48 respectively and 3 threads working. As I understand it, the scheduler will first make a decision for the 8 tasks then for the other 8 and finally for the 48. \n\nIs there an effective way, without flattening the array, to let the scheduler of openmp know to load balance 64 tasks instead of what I previously described?" ]
[ "c++", "for-loop", "nested", "openmp", "load-balancing" ]
[ "How can I create a SSIS package for SQL Server 2008 in a SQL Server 2014 environment?", "We have SQL Server & SSIS 2014 in our local environment, and most of SQL Server 2014 in our production environment, except for the SSIS, which is still 2008.\n\nSo we're creating SSIS packages locally which can't be deployed to production, because the SSIS packages are not backwards-compatible. \n\nIs it possible to create the packages locally to target SSIS 2008? If so, how?\n\nJust to note, the SSIS packages are defined in Visual Studio 2008, so I don't understand why they're dependent on SQL Server 2014." ]
[ "sql-server", "sql-server-2008", "ssis", "sql-server-2014", "ssis-2008" ]
[ "Wildcard in python string", "I need to use the .split()[] to split a string. The issue I am having is that the section that needs to be split also needs to have a wildcard in it. Lets say the string is Mr. Robot S03E04 eps3.3_m3tadata.par2 I would like to use item.split(\"S??E??\", 1)[0]to be able to turn the string into Mr. Robot S03E04 and then put it back into an array.\n\nHere is the code that I am trying to use:\n\nimport feedparser\n\nURL = \"http://followshows.com/feed/ZQU98gqv\"\n\nfeed = feedparser.parse(URL)\n\nfor index in range(len(feed.entries)):\n item = feed.entries[index].title\n print item.split(\"S??E??\", 1)[0]\n\n\nThanks" ]
[ "python", "arrays", "string", "split", "wildcard" ]
[ "How do I add namespaces to an XSD?", "The following is my XML and its associated XSD: \n\n XML \n\n<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!-- <!DOCTYPE people SYSTEM \"validator.dtd\"> -->\n\n<people xmlns:xsi=\"http://www.w3c.org/200/10/XMLSchema-instance\"\nxsi:noNamespaceSchemaLocation=\"student.xsd\">\n <student>\n <name>John</name>\n <course>Computer Technology</course>\n <semester>6</semester>\n <scheme>E</scheme>\n </student>\n\n <student>\n <name>Foo</name>\n <course>Industrial Electronics</course>\n <semester>6</semester>\n <scheme>E</scheme>\n </student>\n</people> \n\n\n XSD \n\n<?xml version=\"1.0\"?>\n\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n <xs:element name=\"people\">\n <xs:complexType>\n <xs:sequence>\n <xs:element name=\"student\" maxOccurs=\"unbounded\">\n <xs:complexType>\n <xs:sequence>\n <xs:element name=\"name\" type=\"xs:string\" />\n <xs:element name=\"course\" type=\"xs:string\" />\n <xs:element name=\"semester\">\n <xs:simpleType>\n <xs:restriction base=\"xs:string\">\n <xs:enumeration value=\"1\" />\n <xs:enumeration value=\"2\" />\n <xs:enumeration value=\"3\" />\n <xs:enumeration value=\"4\" />\n <xs:enumeration value=\"5\" />\n <xs:enumeration value=\"6\" />\n </xs:restriction>\n </xs:simpleType>\n </xs:element>\n <xs:element name=\"scheme\">\n <xs:simpleType>\n <xs:restriction base=\"xs:string\">\n <xs:pattern value = \"E|C\" />\n </xs:restriction>\n </xs:simpleType>\n </xs:element>\n </xs:sequence>\n </xs:complexType>\n </xs:element>\n </xs:sequence>\n </xs:complexType>\n </xs:element>\n</xs:schema> \n\n\n \n\nWhat I now want to do is to add a namespace - a hypothetical university to which the students belong - say, Carnegie Mellon. \n\nI know how to add namespaces to an XML document. That would be as follows:\nxmlns:cmu = \"http://www.carnegiemellon.com/ns/students\"\n and there would be associated prefixes in the XML. \n\nWhat I want to know is: How do I validate the XML with prefixes using the XSD?" ]
[ "xml", "namespaces", "xsd", "xsd-validation" ]
[ "Solving Euler #31 in Haskell", "I compared my solution to the one published on haskell.org http://www.haskell.org/haskellwiki/Euler_problems/31_to_40 and don't know what to think of it. Is what I wrote so non-idiomatic, that an average haskell developer would immediately catapult my code to the moon?\n\nmain =\n print $ length $ split 200\n\nsplit n = split' [200, 100, 50, 20, 10, 5, 2, 1] n\n where split' (1:[]) n = [take n $ repeat 1]\n split' (c:cs) n\n | n > c = map (c:) (split' (c:cs) (n - c)) ++ split' cs n\n | n == c = [[c]] ++ split' cs n\n | otherwise = split' cs n\n\n\nComing from \"enterprisey\" development I kind of value straight and dumb solutions, but on the other side maybe everybody can read one-liners just fine and I just need to pick up my game? Would you recommend compacting the code as an exercise, or is it just for hackers?" ]
[ "haskell" ]
[ "Clarification on the meaning of interpretation of a template", "[temp.res] reads\n\nKnowing which names are type names allows the syntax of every template to be checked. The program is ill-formed, no diagnostic required, if: [...]\n\na hypothetical instantiation of a template immediately following its definition would be ill-formed due to a construct that does not depend on a template parameter, or\n\nthe interpretation of such a construct in the hypothetical instantiation is different from the interpretation of the corresponding construct in any actual instantiation of the template. [...]\n\n\n\nWhat does interpretation here mean? Does it mean that each token must be interpreted as the same operator/entity/whatever grammatical construct, aka syntactically equivalent? Or does it mean that it has to also be semantically equivalent, as in the equivalence defined by the ODR rule?\nAs a side note, [temp.variadic] has the sentence\n\n[...] Such an instantiation does not alter the syntactic interpretation of the enclosing construct [...]\n\nWhich has the explicit "syntactic"." ]
[ "c++", "language-lawyer", "c++17" ]
[ "How to bind CheckBoxFor", "I have a collection of \"permissions\". Each permission would have three properties: Id, Name, and HasPermission. So as an example, consider the following object:\n\npublic class AccessPerm\n{\n int PermId {get;set;}\n string PermName {get;set}\n bool HasPerm {get;set;}\n}\n\npublic class UserProfile\n{\n Collection<AccessPerm> UserPerms {get;set;}\n}\n\n\nSo I want to use the CheckBoxFor helper to create checkboxes so that one can set the user's permissions. If you check the box, then HasPerm should be true. If you uncheck it, HasPerm should be false. The problem I am having is I don't see a way to bind both the PermId and the HasPerm properties to the checkbox. I used the following code to bind the HasPerm property, but it is not useful because I don't know the PermId.\n\n<%\n for(int ix=0; ix< Model.UserProfile.Perms.Count; ix++)\n {\n Html.CheckBoxFor(model => model.UserProfile.Perms[ix].HasPerm);\n }\n%>\n\n\nThis code does indeed bind HasPerm, and the value is correct. However, since I don't have the id, I can't do anything with the value. Please advise." ]
[ "c#", "asp.net-mvc" ]
[ "Change the position of the textbox validation", "The new data validation in silverlight 3 has a red textbox that flies out to the right. This is a problem for me because I have have a textbox to the right that is getting covered by the popup.\n\nHow can I make this popup move somewhere else?" ]
[ "silverlight", "validation", "silverlight-3.0", "textbox" ]
[ "Flutter - IconThemeData. Icon color changes for dark mode but doesn't change for light mode in Drawer()", "IconTheme Color doesn't change in light mode for the icons in drawer but changes color accordingly in dark mode." ]
[ "flutter", "flutter-layout", "flutter-theme" ]
[ "How to use imagick's writeImage() function?", "This works if I keep the script in the same directory as the image being manipulated. And the resultant image \"foo.jpg\" is also generated in the same location.\n\n<?php\n\n$im = new imagick('image.jpg');\n$im->thumbnailImage( 200, 0);\n$im->writeImage(\"foo.jpg\");\n\n?>\n\n\nBut what if the script is in one location and the image I wish to work with is in another and the location I wish to save the thumbnail to is somewhere else, how to specify these paths?\n\nDoing something like this doesn't work:\n\n$im = new imagick('path/to/image.jpg');" ]
[ "php", "image-processing", "imagemagick", "imagick" ]
[ "Spring security - exclude a specific URL from extending session timeout", "I'm in the situation where I need to have an endpoint that could be pinged by the frontend constantly to check if session is still alive but at the same time, I don't want for endpoint to extend the current session.\nI've been looking for ways to exclude it somehow from extending the session but I can't seem to find any.\nAnyone did this or knows how to?\nThanks" ]
[ "spring", "session", "spring-security" ]
[ "How can I change a label when other labels change?", "I am trying to make a label change when other 2 labels change. The 2 labels constantly change randomly.\n\nHere's the code:if ([labes.text isEqualToString:@\"haha\"] && [alizz.text isEqualToString:@\"hoho\"]) {\n laab.text = @\"hello\";\n }\n\nMaybe refreshing every 0.0005 seconds will work?" ]
[ "iphone", "objective-c", "ios" ]
[ "Data getting inserted into database when no request is being sent", "So I have a React JS app that's sending data to my database as well as images to server. When I make a request on the front-end it's sending the data and the image.\nFor some reason even when I don't send data from the front-end INSERTS are being made with that same information but different id's because of the uuid.\n\nNodeJS\n\nconst addData = (request, response) => {\nconst uuid = uuidv4(); \nlet album_id;\n\n db.pool.query('INSERT INTO albums (title, date, description, id) VALUES ($1, $2, $3, $4) ON CONFLICT (id) DO NOTHING RETURNING *' , [request.body.title, request.body.date, request.body.description, uuid])\n .then(res => {\n album_id = res.rows[0].id;\n console.log('INSERT ' + res.rowCount);\n console.log('Request ' + JSON.stringify(request.body));\n }).then(() => {\n const dbQueryPromises = [];\n for (let i = 0; i < request.body.files.length; i++) {\n dbQueryPromises.push(db.pool.query('INSERT INTO songs (id, name, link, index, album_id) VALUES ($1, $2, $3, $4, $5) ON CONFLICT (album_id, index) DO NOTHING RETURNING *', [uuid, request.body.files[i].name, request.body.files[i].link, request.body.files[i].index, album_id]))\n }\n return Promise.all(dbQueryPromises);\n }).then(res => {\n console.log('Array of INSERT result for second insert: ');\n }).then(() => {\n db.pool.query(\n 'INSERT INTO file (name, type, size, path, album_id) VALUES ($1, $2, $3, $4, $5) ON CONFLICT (album_id) DO NOTHING RETURNING *',\n [request.file.filename, request.file.mimetype, request.file.size, request.file.path, album_id]);\n }).then((res) => {\n console.log(\"INSERT INTO file(images) \" + request.body.data);\n }).catch(error => console.log(error));\n\n }\n\n\nNodeJS(What db is in the code above)\n\nconst Pool = require('pg').Pool\nconst pool = new Pool({\n user: 'me',\n host: 'localhost',\n database: 'api',\n password: 'password',\n port: 5432,\n})\n\n\nNodeJS(index.js)\n\nvar storage = multer.diskStorage({\n destination: (req, file, cb) => {\n cb(null, 'public')\n }, \n filename: (req, file, cb) => {\n cb(null, Date.now() + '-' +file.originalname)\n }\n})\n\nvar upload = multer({ storage: storage });\n\napp.post('/albums', upload.single('file'), apiCall.addData);\n\n\nAnd the ReactJS code:\nhttps://gist.github.com/DDavis1025/db77b2f7a44c2ea26a8b18ba7aa70952\n\nAlso I don't believe the re-insert is being made if I leave the page on the front-end and re-render.." ]
[ "javascript", "node.js", "reactjs", "postgresql" ]
[ "gcl_memcpy auto detection of pointer types", "I have a trivial kernel running on OS X that returns a single int. The essential bits are:\n\ncl_int d;\ncl_int* dptr = &d;\n\nvoid* dev_d = gcl_malloc(sizeof(cl_int),NULL,CL_MEM_WRITE_ONLY);\n\n// ... stuff to setup dispatch queue\n\ndispatch_sync(queue, ^{\n\n // ... running the kernel stuff\n\n gcl_memcpy((void*)&d, dev_d, sizeof(cl_int)); // this gives d==0\n gcl_memcpy((void*)dptr, dev_d, sizeof(cl_int)); // this gives correct d\n});\n\n\nQuestion is, what is the difference between &d and dptr? I've always thought of them as essentially interchangeable, but gcl_memcpy seems to be making a distinction. Any ideas? I can obviously just use the dptr solution, but I'm still curious what's happening." ]
[ "opencl" ]
[ "Why check for root element is required in Jaxb2Marshaller?", "I am using Jaxb2Marshaller to marshal Java beans through spring @ResponseBody annotation. For JSON marshaling was working fine. But for xml I was continuously getting HTTP 406 response. Little bit digging in Jaxb2Marshaller class reveals it checks for @XmlRootElement for bounded classes (see below snippet). \n\nWhile generating java code from xsd my pojo does not contain @XmlRootElement and proper message converter was not identified by AnnotationMethodHandlerAdapter and finally result in 406.\n\nInstead of auto generating java code from xsd I have created my own pojo class and used @XmlRootElement. Then marshaling works fine.\n\nI want to understand why it is important of having @XmlRootElement check for bounded classes. Or any way to specify element as @XmlRootElement in xsd.\n\nCode snippet from Jaxb2Marshaller:\n\npublic boolean supports(Class clazz) {\n return supportsInternal(clazz, true);\n}\n\nprivate boolean supportsInternal(Class<?> clazz, boolean checkForXmlRootElement) {\n if (checkForXmlRootElement && clazz.getAnnotation(XmlRootElement.class) == null) {\n return false;\n }\n if (clazz.getAnnotation(XmlType.class) == null) {\n return false;\n }\n if (StringUtils.hasLength(getContextPath())) {\n String className = ClassUtils.getQualifiedName(clazz);\n int lastDotIndex = className.lastIndexOf('.');\n if (lastDotIndex == -1) {\n return false;\n }\n String packageName = className.substring(0, lastDotIndex);\n String[] contextPaths = StringUtils.tokenizeToStringArray(getContextPath(), \":\");\n for (String contextPath : contextPaths) {\n if (contextPath.equals(packageName)) {\n return true;\n }\n }\n return false;\n }\n else if (!ObjectUtils.isEmpty(classesToBeBound)) {\n return Arrays.asList(classesToBeBound).contains(clazz);\n }\n return false;\n}\n\n\nEdit:\nBlaise answer helped me solve @XmlRootElement problem. But still if someone has any information about why check for XmlRootElement is required, will be a good info." ]
[ "java", "spring", "xsd", "jaxb", "marshalling" ]
[ "How to get one day ahead of a given date?", "Suppose I have a date 2010-07-29. Now I would like to check the result of one day ahead. how to do that\n\nFor example,\n\nSELECT * \n from table \n where date = date(\"2010-07-29\")\n\n\nHow to do one day before without changing the string \"2010-07-29\"?\n\nI searched and get some suggestion from web and I tried \n\nSELECT * \n from table \n where date = (date(\"2010-07-29\") - 1 Day)\n\n\nbut failed." ]
[ "sql" ]
[ "Creating a \"heatmap\" colored table in Python", "I'm looking for a way to plot 2d tabular data in a table-format(using Python), with the table-cells colored like a heatmap. Something like this:\n\n\n\nI found quite a few examples for regular heatmaps using matplotlib - but not really something that produces output like in this link. Any hints appreciated." ]
[ "python", "plot", "heatmap", "tabular" ]
[ "How to limit CPU resources / Shockwave Flash", "Can I set a maximum percentage of CPU resources a specific program or process can use? I want to use the executable name instead of its pid, because I would like certain executables to always run with constrained resources.\n\nThe reason I ask for that is that I am bored of the way Shockwave Flash behaves. It is not possible that to draw a few stupid things in my browser it takes 50%, 80%, 99% of my dual core CPU! \n\nThank you,\n\nPietro\n\nMacBook Pro 2009 - \nMacOS X 10.6.4 - \nChrome 6.0 - \nFirefox \n\nP.S.: Now, when my fan starts running I now the reason and I know how to temporarily fix it: I kill Shockwave Flash and everything is back as normal." ]
[ "flash", "adobe", "limit", "cpu-usage", "shockwave" ]
[ "Advice on calling method dynamically and returning corresponding type", "I have many DataObjects that all inherit from a particular class, and these DataObjects each have similar methods that make API calls. I am trying to write an abstract method(s) that will allow me to accept input of API paths and request-method-types (\"Get\", \"Put\", \"Post\", etc.) to make the appropriate API call, and return an object of that type.\n\nNote: I since I will be making API calls I will need to ensure async/await is possible. \n\nThis is non-working code describing what I'd like to do:\n\nvar dict = Dictionary<Tuple<string, string>, Action>>\n{\n //many key/value pairs of RequestMethodType/APIPath tuple keys \n //and API calling method values\n};\n\npublic T APICaller<T>(string requestMethodType, string path)\n{\n //make tuple of rmt and path\n //use tuple to get API calling Action value from dictionary\n //invoke method and return object of correct type\n}\n\n\nI've done a lot of searching over the past few days, and here are some options I am trying/considering:\n\n\nUse a Dictionary, Action> to map the input to the method.\n-issue with void lambda, struggling to return proper type\nUse C# Generics to call API and return correct DataObject\n-Ran into issue where I couldn't return a dynamic type\nUse reflection to make generic method in attempts to solve #2\nUsing dyanmic keyword to allow type to be determined at runtime \n\n\n*I have also tried of mapping the RequestMethodType/Path tuples to a return type, then using the return type as the return type for a generic method making the API call. When trying this I couldn't get past an error saying I was using a variable when a type was expected. (solve by using reflection??)\n\nHere are some links for similar questions I have read:\n\nC# Is it possible to pass a type into a method and have the method return an object of that type?\n\nHow do I use reflection to call a generic method?\n\ngeneric class, how to set the type in runtime?\n-as well as many, many more.\n\nEDIT (Adding code I have been working on):\n\nusing System;\nusing System.Collections.Generic;\n\nnamespace GenericsTest2\n{\n class MainClass\n {\n\n public static Dictionary<Tuple<string, string>, Type> dict = new Dictionary<Tuple<string, string>, Type>()\n {\n {new Tuple<string, string> (\"Get\", \"/path/to/api\"), typeof(Car)}\n };\n\n public static void Main (string[] args)\n {\n string requestType = \"Get\";\n string path = \"user/path\";\n var objType = DetermineType (requestType, path);\n var obj = (Car)(object)GetObject (objType, path);\n Console.WriteLine (obj.Name);\n }\n\n public static Car CarMethod()\n {\n return new Car {Name = \"John\"};\n }\n public static Truck TruckMethod()\n {\n return new Truck {Id = \"ABC123\"};\n }\n\n public static Type DetermineType(string requestMethodType, string path)\n {\n var tuple = Tuple.Create (requestMethodType, path);\n Type myData;\n dict.TryGetValue (tuple, out myData);\n return myData;\n }\n\n public static DataObject GetObject(Type t, string path)\n {\n //here I could use the path to call the actual API, but I'll just call \n //CarMethod or TruckMethod to generate data for testing\n if(path == \"user/path\"){\n return CarMethod ();\n }else if (path == \"settings/path\"){\n return TruckMethod();\n }else{\n throw new Exception (\"something went wrong!\");\n }\n }\n\n public class DataObject\n {\n public string Api { get; set; }\n }\n\n public class Car : DataObject\n {\n public string Name { get; set; }\n }\n\n public class Truck : DataObject\n {\n public string Id { get; set; }\n }\n }\n}" ]
[ "c#", "generics", "dynamic", "reflection", "runtime" ]
[ "Plotting averages with dc.js / crossfilter", "I have some data like this\n\n[\n {type:\"a\", series:[0.1, 0.2, 0.2, 0.1, -0.1]},\n {type:\"b\", series:[0.3, 0.4, 0.5, 0.6, 0.7]},\n]\n\n\nThere is a dimension for type, then I'm doing a group and averaging out each series per type.\n\nIs there a nice way to plot the averaged series per type? Obviously I want it to update with any new filters.\n\nI tried flattening out my data as\n\n[\n {type:\"a\", index:0, value:0.1},\n {type:\"a\", index:1, value:0.2},\n ...\n]\n\n\nand making index a dimension as well. But it's getting a bit slow when I add more data; I never filter the index dimension, so adding it to crossfilter is just an extra cost; and finally it messes up the counts for each type." ]
[ "javascript", "dc.js", "crossfilter" ]
[ "Removing a file from TortoiseHG data source", "I am using TortoiseHG for source code control in Windows, I forgot to edit the \".hgignor\" file, and now I have a huge folder \".hg\" which I know it's because of DLL and EXE and PDB files which I do not need them. Now changing the ignor file does not remove those files.\n\nWhat should I do for deleting these files completely from my TortoiseHg data source?" ]
[ "file", "version-control", "mercurial", "tortoisehg" ]
[ "WatchConnectivity Framework : WKSession is maintain the queue which I requested To Watch", "I have create an application which is sending data to watch for showing.\nWhen the watch is screen is active then it sending data perfectly, but when watch sleeps then an error occurred that device is not active.\n\nMy question is that when the watch is active any how it will get that data which send via using WKSession sendMessage method from my iPhone?" ]
[ "objective-c", "ios9", "apple-watch", "watchos-2", "watchconnectivity" ]
[ "How can I consume data type of Rc> in struct?", "I'm trying to implement an linked list for learning purposes. std::cell::RefCell and stc::rc::{Rc, Weak} are mainly used to store data into the list instance. Now I'm implementing fn pop, which consumes and returns a value in the first location in the list, but I don't know how to consume a value wrapped with Rc and RefCell.\nHere is my code:\nuse std::cell::RefCell;\nuse std::rc::{Rc, Weak};\n\n#[derive(Debug)]\npub struct DbNode<T> {\n data: T,\n next: Option<Rc<RefCell<DbNode<T>>>>,\n prev: Option<Weak<RefCell<DbNode<T>>>>,\n}\n\n#[derive(Debug)]\npub struct DbList<T> {\n first: Option<Rc<RefCell<DbNode<T>>>>,\n last: Option<Weak<RefCell<DbNode<T>>>>,\n}\n\npub fn push_front(&mut self, data: T) {\n match self.first.take() {\n Some(e) => {\n let new_front = Rc::new(RefCell::new(DbNode {\n data,\n next: Some(e.clone()),\n prev: None,\n }));\n let mut me = e.borrow_mut();\n me.prev = Some(Rc::downgrade(&new_front));\n self.first = Some(new_front);\n },\n None => {\n let new_data = Rc::new(RefCell::new(DbNode {\n data,\n next: None,\n prev: None,\n }));\n self.last = Some(Rc::downgrade(&new_data));\n self.first = Some(new_data);\n },\n }\n}\n\npub fn push_back(&mut self, data: T) {\n match self.last.take() {\n Some(l) => {\n let new_back = Rc::new(RefCell::new(DbNode {\n data,\n next: None,\n prev: Some(l.clone()),\n }));\n let st = Weak::upgrade(&l).unwrap();\n let mut ml = st.borrow_mut();\n self.last = Some(Rc::downgrade(&new_back));\n ml.next = Some(new_back);\n },\n None => {\n let new_data = Rc::new(RefCell::new(DbNode {\n data,\n next: None,\n prev: None,\n }));\n self.last = Some(Rc::downgrade(&new_data)); \n self.first = Some(new_data);\n },\n }\n}\n\npub fn pop(&mut self) -> Option<T> {\n match self.first.take() {\n Some(f) => {\n // How can I??\n // let result = Some(f.into_inner().data);\n // result\n },\n None => None,\n }\n}\n\nWhat I want to achieve is to return the inner 'data' value in the struct DbNode located in the 'first' in struct DbList and set None to the 'first' in which the data to be consumed located if 'next' is None, else set 'next' to 'first'.\nAt first, I tried to consume the inner value with using Rc::downcast, but the type of 'f' in matching block was 'RefCell', not 'Rc', then I tried to use RefCell::into_inner(), but compiler says:\n\ncannot move out of an Rc\nmove occurs because value has type std::cell::RefCell<ds::dll::DbNode<T>>, which does not implement the Copy trait\n\nI totally understand what this means, but I don't know what I should do. What is the correct way to do it??" ]
[ "rust" ]
[ "How to retrieve the 'last sync' time for an account?", "Is it possible to retrieve the time an account was last synchronized, like the system Settings->Accounts&Sync app does? I'm using Android 2.2.\n\nLooking at the 2.2 source for AccountSyncSettings.java, I see the status is retrieved using:\n\nSyncStatusInfo status = ContentResolver.getSyncStatus(account, authority);\n\n\nbut SyncStatusInfo and getSyncStatus don't seem to be part of the public API (marked with @hide). Is there some other way to get at this info?" ]
[ "android", "sync", "android-syncadapter" ]
[ "How to Start RServe pre-loaded with library", "I need to load a library every time I am making a new RConnection. Is it possible to have it pre-loaded when I start RServe? \n\nLoading it every time a new RConnection is making it slower." ]
[ "r", "rserve" ]
[ "generalize lapply/map for all permutations of multiple arguments", "I want to test whether a function f, that has multiple arguments works as desired. \n\nf <- function(x1, ..., xm) {...}\n\n\nWhat I want to do is to specify lists \n\nx1_arguments <- list(x1_1, ..., x1_n1)\n...\nxm_arguments <- list(xm_1, ..., xm_nm)\n\n\nand check that f works for all possible combinations of x1, ..., xm.\n\nI could of course \n\n\nWrite e.g. a dataframe such that the rows contain the possible combinations of x1, ... xm arguments. and then loop over the rows\nWrite a nested for / lapply loop\n\n\nI would like to make it prettier however as 1. creates a possibly large object that is absolutely unnecessary and 2. looks ugly\n\nIs there an inbuilt R-function that allows you to do that, e.g. a generalized lapply function that loops over multiple lists?" ]
[ "r", "nested-loops", "lapply", "mapply" ]
[ "select database on userid and password condition", "I have two databases and I want to select a database on userid password condition, but right now it is not working with this condition. How can I achieve it? For now, only the first database gets selected, not the second one.\n\n<?php\n if($_SESSION['s_activId'] == 'om' && isset($_SESSION['s_userType']) == 'om')\n {\n $dbName = \"kal\";\n $link = mysql_connect(\"localhost\",\"root\",\"\");\n mysql_select_db($dbName) or die(\"colud not connect to database\". mysql_error());\n }\n else if($_SESSION['s_activId'] == 'om' && isset($_SESSION['s_userType']) == 'om1')\n {\n $dbName = \"kal1\";\n $link = mysql_connect(\"localhost\",\"root\",\"\");\n mysql_select_db($dbName) or die(\"colud not connect to database\". mysql_error());\n }\n?>" ]
[ "php", "mysql" ]
[ "XNA C# getting 12 triangle faces of a cube, given (MIN,MAX) of BoundingBox", "Is there a easy way or c# class to get 12 triangles of a cube \nwhere, only (MIN,MAX) coordinates are known for the BoundingBox cube \nI want to use PrimitiveType.TriangleList for rendering face of cube but don't know how to get\nstatic indices array of 12 triangles which can be defined by , MIN ,MAX vertices of the cube.\n\nI am using C# with XNA." ]
[ "c#", "xna", "cube" ]
[ "Using Word add-in JavaScript API in Word Online (browser)", "I am trying to use the Word add-in JavaScript API in Word Online (browser) \n\nwhen I run\n\nWord.run(function (context) {\n // Create a proxy object for the document.\n var thisDocument = context.document;\n})\n\n\nIt runs fine in Word 2016 desktop but in Word Online I get an error:\n\n'Word' is undefined\n\nQuestions:\n\n\nIs this Word Api usable in Word Online?\nIf not, when will this Api be usable in Word Online?" ]
[ "ms-word", "ms-office", "add-in", "office365", "office-js" ]
[ "STM32 timer setup for debunce, short press and long press", "I need with interrupt handling, need below functionality\n\nSW1 short press > 50ms -> func1();\nSW2 short press > 50ms -> func2();\nSW1 long press > 5000ms -> func3();\n\nMy timer generate IRQ every 50ms (I think it's good time for debunce)\nEXT1 call from gpio irq\nvoid HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){\n if(GPIO_Pin == SW1_Pin){\n HAL_TIM_Base_Start_IT(&htim3);\n }\n else if(GPIO_Pin == SW2_Pin){\n HAL_TIM_Base_Start_IT(&htim3);\n }\n else {\n __NOP ();\n }\n }\n\n\nvoid HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {\n if(htim->Instance == TIM3) {\n if(HAL_GPIO_ReadPin(SW1_GPIO_Port, SW1_Pin) == GPIO_PIN_RESET) {\n func1();\n HAL_TIM_Base_Stop_IT(&htim3);\n }\n else if(HAL_GPIO_ReadPin(SW2_GPIO_Port, SW2_Pin) == GPIO_PIN_RESET) {\n func2();\n HAL_TIM_Base_Stop_IT(&htim3);\n }\n\n }\n\nCode above is just for debounce, am I doing it correctly?" ]
[ "timer", "stm32" ]
[ "My code generates an infinite loop", "My code paste the same formula throughout all of the H2 column. I dont see anywhere in the code where it should do that.\n\nWorksheets(\"sheet1\").Activate\nRange(\"F2\").Activate\nDo Until IsEmpty(ActiveCell)\n If ActiveCell.Value <> \"\" Then\n Pickle = ActiveCell.Address\n ActiveCell.Offset(0, 2).Select\n ActiveCell.Value = \"=IF(\" + Pickle + \" <TODAY(),\"\"Send Reminder\"\",\"\"Do not Send Reminder\"\") \"\n ActiveCell.Offset(0, -2).Select\n End If \n ActiveCell.Offset(1, 0).Select\nLoop" ]
[ "vba", "excel" ]
[ "if else with multiple conditions and NA", "Using the example provided below I need to use a if else statement with the following conditions:\n\n\nif df$flag = 0 than use df$corrected\nif df$flag = 1 use df$original if it is larger than corrected otherwise use df$corrected\nif df$flag = NA use df$original\n\n\nSample data:\n\ndf <- data.frame(\n original = c(20,40,20,2,20,10,12),\n corrected = c(25,43,22,1,25,7,NA),\n flag = c(0,0,0,1,1,1,NA))\n\n\nThe output should be appended to the df (df$final) and should, for this example output this:\n\ndf$final = c(25,43,22,2,25,10,12)\n\n\nThanks for any suggestions." ]
[ "r" ]
[ "Prevent Collision Forces in Unity Physics in Collision Callback", "How do I prevent a collision from applying forces in Unity? I am using 2D physics and want an arrow to stick into a crate. I can easily remove the rigid body and collider in the collision callback, but it seems that a frame of collision force is still applied to the arrow, causing slight jumps in position and rotation. Settings isKinematic on the rigid bodies in the collision callback also appears to not prevent this one frame of force being applied.\n\nI am hoping to tell Unity to not apply physics for the collision.\n\nUsing kinematic for the life time of the arrow is not an option because the arrow needs to fly realistically until it hits something.\n\nHere is the code for the crate object that handles the collision:\n\nprotected virtual void HandleCollision(ArrowScript arrow, Collision2D coll)\n{\n StickArrow(arrow, coll);\n\n if (DestroyAfterSeconds >= 0.0f)\n {\n Destroy(arrow.gameObject, DestroyAfterSeconds);\n }\n}\n\nprivate void OnCollisionEnter2D(Collision2D coll)\n{\n ArrowScript script = coll.gameObject.GetComponent<ArrowScript>();\n if (script != null)\n {\n HandleCollision(script, coll);\n }\n}\n\nprivate bool StickArrow(ArrowScript arrow, Collision2D coll)\n{\n Vector2 surfaceNormal = coll.contacts[0].normal;\n float surfaceAngle = Mathf.Atan2(surfaceNormal.y, surfaceNormal.x);\n float arrowAngle = Mathf.PI + (arrow.transform.eulerAngles.z * Mathf.Deg2Rad);\n float angleDifference = Mathf.Abs(BowAndArrowUtilities.DifferenceBetweenAngles(surfaceAngle, arrowAngle));\n float penetration = arrow.PercentPenetration * PenetrationPercentageModifier * (1.0f - angleDifference);\n if (penetration <= MinimumPenetrationPercentage)\n {\n arrow.PercentPenetration = 0.0f;\n return false;\n }\n\n // Make the arrow a child of the thing it's stuck to\n arrow.transform.parent = transform;\n arrow.gameObject.transform.Translate(new Vector3(-penetration * arrow.Length, 0.0f, 0.0f));\n\n SpriteRenderer thisSpriteRenderer = GetComponent<SpriteRenderer>();\n if (thisSpriteRenderer != null)\n {\n arrow.GetComponent<SpriteRenderer>().sortingLayerID = thisSpriteRenderer.sortingLayerID;\n arrow.GetComponent<SpriteRenderer>().sortingOrder = Mathf.Max(0, thisSpriteRenderer.sortingOrder - 1);\n }\n\n BowAndArrowUtilities.PlayRandomSound(arrow.CollisionAudioClips, penetration * 5.0f);\n\n // destroy physics objects from the arrow (rigid bodies, colliders, etc.). This unfortunately doesn't prevent this frame from apply force (rotation, position) to the arrow.\n arrow.DestroyPhysicsObjects();\n\n return true;\n}\n\n\nUnity version is 5.3.4." ]
[ "unity3d", "physics" ]
[ "AssertionError is raised when running an example from sklearn library", "import pandas as pd\nimport numpy as np\nfrom sklearn.learning_curve import learning_curve\nimport matplotlib.pyplot as plt\n\n\ndef plot_learning_curve(estimator, title, X, y, ylim=None, cv=None,\n n_jobs=1, train_sizes=np.linspace(.1, 1.0, 5)):\n \"\"\"\n Generate a simple plot of the test and traning learning curve.\n\n Parameters\n ----------\n estimator : object type that implements the \"fit\" and \"predict\" methods\n An object of that type which is cloned for each validation.\n\n title : string\n Title for the chart.\n\n X : array-like, shape (n_samples, n_features)\n Training vector, where n_samples is the number of samples and\n n_features is the number of features.\n\n y : array-like, shape (n_samples) or (n_samples, n_features), optional\n Target relative to X for classification or regression;\n None for unsupervised learning.\n\n ylim : tuple, shape (ymin, ymax), optional\n Defines minimum and maximum yvalues plotted.\n\n cv : integer, cross-validation generator, optional\n If an integer is passed, it is the number of folds (defaults to 3).\n Specific cross-validation objects can be passed, see\n sklearn.cross_validation module for the list of possible objects\n\n n_jobs : integer, optional\n Number of jobs to run in parallel (default 1).\n \"\"\"\n plt.figure()\n plt.title(title)\n if ylim is not None:\n plt.ylim(*ylim)\n plt.xlabel(\"Training examples\")\n plt.ylabel(\"Score\")\n train_sizes, train_scores, test_scores = learning_curve(\n estimator, X, y, cv=cv, n_jobs=n_jobs, train_sizes=train_sizes)\n train_scores_mean = np.mean(train_scores, axis=1)\n train_scores_std = np.std(train_scores, axis=1)\n test_scores_mean = np.mean(test_scores, axis=1)\n test_scores_std = np.std(test_scores, axis=1)\n plt.grid()\n\n plt.fill_between(train_sizes, train_scores_mean - train_scores_std,\n train_scores_mean + train_scores_std, alpha=0.1,\n color=\"r\")\n plt.fill_between(train_sizes, test_scores_mean - test_scores_std,\n test_scores_mean + test_scores_std, alpha=0.1, color=\"g\")\n plt.plot(train_sizes, train_scores_mean, 'o-', color=\"r\",\n label=\"Training score\")\n plt.plot(train_sizes, test_scores_mean, 'o-', color=\"g\",\n label=\"Cross-validation score\")\n\n plt.legend(loc=\"best\")\n return plt\n\n\n\nforest = ensemble.RandomForestClassifier(bootstrap=True, class_weight=None, max_depth=None, max_features='auto', max_leaf_nodes=None,min_samples_leaf=1, min_samples_split=6,min_weight_fraction_leaf=0.0, n_estimators=300, n_jobs=-1,oob_score=False, random_state=111, verbose=0, warm_start=False)\n\ncv = cross_validation.ShuffleSplit(alldata.shape[0], n_iter=10,\n test_size=0.2, random_state=0)\n\ntitle = \"Learning Curve (Random Forest)\"\nplot_learning_curve(forest, title, alldata, y, ylim=None, cv=cv, n_jobs=-1)\n\nplt.show()\n\n\nWhen I run this code in IPython Notebook (Python 2.7), the following error can be seen from cmd. I took the function plot_learning_curve from the following website." ]
[ "python", "scikit-learn" ]
[ "program terminating with uncaught exception of type NSException", "I am trying to go through an xml file and display the contents\n\n int main(int argc, const char * argv[])\n {\n NSString *xmlPath = [[NSBundle mainBundle] pathForResource:@\"xml\" ofType:@\"xml\"];\n NSString *xml = [NSString stringWithContentsOfFile:xmlPath encoding:NSUTF8StringEncoding error:nil];\n NSXMLDocument *xmlDocument = [[NSXMLDocument alloc] initWithXMLString:xml options:0 error:nil];\n NSMutableArray *array = [NSMutableArray array];\n\n for (NSXMLElement *node in [xmlDocument.rootElement nodesForXPath:@\"//app\" error:nil])\n {\n NSMutableDictionary *dict = [NSMutableDictionary dictionary];\n NSMutableArray *photos = [NSMutableArray array];\n\n for (NSXMLElement *subNode in node.children)\n {\n if ([subNode.name isEqualToString:@\"address\"])\n [photos addObject:subNode.stringValue];\n else\n [dict setObject:subNode.stringValue forKey:subNode.name];\n }\n\n [dict setObject:photos forKey:@\"address\"];\n [array addObject:dict];\n }\n\n NSLog(@\"%@\", array);\n return 0;\n\n\n}\n\nBut I'm getting an error in this line\n\nNSXMLDocument *xmlDocument = [[NSXMLDocument alloc] initWithXMLString:xml options:0 error:nil];\n\n\nThe error says\nlibc++abi.dylib: terminating with uncaught exception of type NSException\n(lldb) \n\nplease help" ]
[ "objective-c", "xml", "xcode", "macos" ]
[ "Any way to verify that mocks or stubs are valid?", "Say I have a class and method defined with the following pseudo code\n\nclass Book\n def quick_info\n return title + \" \" + author\n end\nend\n\n\nIf I'm writing a unit test on some other class that uses this Book class I'd create a stub for the method call to Book.quick_info. \n\nNow I figure a problem would arise if my Book class were to change, for example if the quick_info method was renamed to short_description. My unit test would still be using quick_info and it would look like my tests are passing just fine when in fact it should be failing.\n\nI was wondering if there's something that could be run to verify that the stubs/mocks in my test were actually made up of the correct classes and methods. Maybe something like this could be run on a continuous integration server just to verify that things match up?\n\nHrmm....and now a thought just occurred to me. Is it even possible to create a mock/stubbed method that doesn't exist? If not, then this whole question is moot.\n\nEDIT:\n\nI just tried this out using rspec 2 and I know I can create a Book instance and create a method named i_dont_exist and I can call it just fine. So my question still stands. Is there a way to verify my mocks/stubs match up to the classes/objects that are really there?" ]
[ "ruby", "unit-testing", "tdd", "mocking" ]
[ "how to install volume pricing with spree 1.0", "I am working with rails 3.1.1 and Spree 1.0. Now I found a gem that really suits my requirements and that gem is spree volume pricing.\n\nI read that the version of spree should be the same as this gem, so this gem only has the version 0.70 so I guess I have to install Spree 0.7 and now is when everything start crumble.\n\nI would like to see a GemFile running \"volume pricing\" in order to see what do I have to install (and which versions). \nMy idea is to install the latest versions, but of course that is not the simplest way. There are many combinations, and it is a pain when rails is not suitable for spree and spree is not suitable for volume pricing, and so on..." ]
[ "ruby-on-rails", "gem", "installation", "spree" ]
[ "AngularJs: tag usage in angularjs partial", "I need to use <\\object> tag or <\\iframe> inside one of my partial html and use that html in another html page with ng-include. This is my try,\n\n<div class=\"container\">\n <!-- This part is not showing anything in the page -->\n <object ng-attr-data='\"templates/widget_1.html\"' type=\"text/html\"></object>\n\n <!-- This part is showing page in view -->\n <div ng-include src='\"templates/widget_2.html\"'></div> \n</div>\n\n\nOR \n\nIf I want to use <\\iframe> within this page how can I use that?" ]
[ "javascript", "html", "angularjs", "iframe", "partials" ]
[ "Save the binary fingerprint data in the table in database", "I want to save the enrolled fingerprint from my device to database and want to retrieve it during the time of verification either in same table or in different table. I tried some of the codes here like BLOB. But didn't work. I have converted the fingerprint data to binary data using \n\nNBioAPI.Type.FIR biFIR; \nm_NBioAPI.GetFIRFromHandle(hNewFIR, out biFIR);\n\n\nafter successful enrollment of users." ]
[ "database", "binary", "save", "fingerprint" ]