texts
sequence
tags
sequence
[ "Assigning memory dynamically or on the stack based on a condition (if statement)", "I have a C program in which an array of floats has its elements accessed quite often for the duration of the program. The size of the array depends on an argument that a user will input and therefore will vary. Generally, the size will be small enough (~ 125 elements) so that the memory of the array can be placed on the stack and thus allocation and accessing it will be faster. But in rare cases, the array may be large enough such that it requires dynamic allocation. My initial solution for this was the following:\n\nif(size < threshold){\n\n float average[size];\n}\nelse{\n float *average;\n average = (float*)malloc(sizeof(float) * size ); \n}\n\n// Do some stuff with average\n\n\nThis gives an error at compile time. How does one address such a problem?" ]
[ "c", "memory" ]
[ "Borderless Winform with a 1px border", "This might sound like a weird question but I have C# Winform that I set the FormBorderStyle to None. So far everything is good but I was wondering if there was a way to add like a 1px border on around my form ? I know I could do it by creating my own image but I was wondering if there was a more natural way of doing it. \nThanks" ]
[ "c#", "winforms", "visual-studio-2010", "visual-studio", "user-interface" ]
[ "I'm trying to build a new react.js project and have a compile error", "I'm setting up new react project and I try to compile webpack and had syntax error. In my guesses it is due to package.json and webpack.config.js problem\n\nthis is my pacakage.json code\n\n{\n \"name\": \"blog_project\",\n \"version\": \"1.0.0\",\n \"description\": \"\",\n \"main\": \"index.js\",\n \"scripts\": {\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\",\n \"webpack\": \"webpack\"\n },\n \"author\": \"\",\n \"license\": \"ISC\",\n \"devDependencies\": {\n \"@babel/core\": \"^7.5.0\",\n \"@babel/preset-env\": \"^7.5.2\",\n \"@babel/preset-react\": \"^7.0.0\",\n \"babel-loader\": \"^8.0.6\",\n \"babel-preset-env\": \"^1.7.0\",\n \"css-loader\": \"^3.0.0\",\n \"node-sass\": \"^4.12.0\",\n \"webpack\": \"^4.35.3\",\n \"webpack-cli\": \"^3.3.5\"\n },\n \"dependencies\": {\n \"babel-preset-react\": \"^6.24.1\"\n \"react\": \"^16.8.6\",\n \"react-dom\": \"^16.8.6\"\n\n }\n}\n\n\n\nand here is my webpack.config.js code\n\nconst path = require('path');\n\nmodule.exports = {\n mode: 'none',\n entry: {\n app: './src/index.js'\n },\n watch: true,\n devtool: 'source-map',\n output: {\n filename: '[name].bundle.js',\n path: path.resolve(__dirname, 'dist')\n },\n module: {\n rules: [\n {\n test: /\\.js$/,\n exclude: /node_modules/,\n use: ['babel-loader']\n }\n ]\n },\n resolve: {\n extensions: [\n '.js'\n ]\n }\n}\n\n\n\nand index.js code I trying to compile and show some div tag on a webbrowser \n\nimport React from 'react'\nimport ReactDOM from 'react-dom'\n\nclass RootEl extends React.Component {\n\n render() {\n return <div><h1>This is JSX!</h1></div>;\n }\n\n}\n\nReactDOM.render(<RootEl />, document.getElementById(\"root\"))\n\n\nand when I try to compile this code and then webpack shows me error message\n\nERROR in ./src/index.js\nModule build failed (from ./node_modules/babel-loader/lib/index.js):\nSyntaxError: C:\\blog\\blog\\static\\src\\index.js: Unexpected token (7:15)\n\n 5 |\n 6 | render() {\n> 7 | return <div>This is XML!</div>;\n | ^\n 8 | }\n 9 |\n 10 | }" ]
[ "reactjs", "webpack", "syntax-error", "babeljs" ]
[ "wpf trigger Datagrid RowCount", "I have a DataGrid with some columns defined. The rows are bound to an ObservableCollection.\nNext to the Grid is a button which should be visible or not, depending on the number of rows. It should be visible, when there are 2 (or more) rows.\nThe idea is to use DataGrid.Rows.Count or DataGrid.Items.Count.\n\nThe property \"DataGrid.Rows\" or \"DataGrid.Items\" are not known by the compiler. Do you know another way ? I like to have it in Xaml only, and not use a Converter for this. (I know that it could be achieved with a converter that counts the itemcollection) Is there a smarter way ?\n\n<Grid>\n\n<DataGrid Name=\"dg1\">\n <DataGrid.Columns> \n ...\n </DataGrid.Columns>\n</DataGrid>\n<Button Name=\"btn1\" Visibility=\"Visibility\">\n</Button>\n<Grid.Triggers>\n <Trigger SourceName=\"dg1\" Property=\"DataGrid.Items.Count\" Value=\"0\">\n <Setter TargetName=\"btn1\" Property=\"Visibility\" Value=\"Hidden\"></Setter>\n </Trigger>\n <Trigger SourceName=\"dg1\" Property=\"DataGrid.Items.Count\" Value=\"1\">\n <Setter TargetName=\"btn1\" Property=\"Visibility\" Value=\"Hidden\"></Setter>\n </Trigger>\n</Grid.Triggers>" ]
[ "wpf", "datagrid", "rowcount" ]
[ "Delete Saved Proxy Credentials in Firefox", "I have my proxy credentials saved in a Firefox Portable that I want to share with my friend but I don't want him to sue my credentials. I've looked around for hours but can't find any way to clear the proxy credentials.\n\nI just want the authentication box to pop up and be empty.\n\nCan anybody point me in the right direction?\n\nSteve" ]
[ "firefox", "proxy" ]
[ "Getting Checkmarx Vulnerability issue : Authentication.Credentials. Unprotected", "We have recently start Checkmarx scan on our codebase in which we are getting below vulnerability issue which is coming due to flat password mention in connectionstring in web.config like below:\n <connectionStrings> \n <add\n name="sqlServer"\n providerName="System.Data.SqlClient"\n connectionString="Data Source=localhost;Initial Catalog=StockDB;User Id=vturner;Password=some_password;" />\n</connectionStrings>\n\nError:\n\nAuthentication.Credentials. Unprotected\n\nI have tried some solution like encryption , parameterized config , encrypted web.config but nothing worked. Can someone suggest on this?" ]
[ "c#", "web-config", "checkmarx", "secure-coding", "sast" ]
[ "spring data jpa generate wrong sql", "Entity DSSchema:\n\n@Entity\n@Table(name = \"DS_SCHEMA\", schema = \"DSUSER\")\npublic class DSSchema {\n\n @Id\n @GenericGenerator(name = \"idGenerator\", strategy = \"uuid2\")\n @GeneratedValue(generator = \"idGenerator\")\n private String id;\n\n}\n\n\nEntity DSTableRelation: \n\n@Entity\n@Table(name = \"DS_TABLE_RELATION\", schema = \"DSUSER\")\npublic class DSTableRelation {\n\n @Id\n @GenericGenerator(name = \"idGenerator\", strategy = \"uuid2\")\n @GeneratedValue(generator = \"idGenerator\")\n private String id;\n\n @ManyToOne(fetch = FetchType.LAZY)\n @JoinColumn(name = \"SCHEMA_ID\", nullable = false)\n private DSSchema schema;\n\n}\n\n\nEntity DSColumnRelation: \n\n@Entity\n@Table(name = \"DS_COLUMN_RELATION\", schema = \"DSUSER\")\npublic class DSColumnRelation {\n\n @Id\n @GenericGenerator(name = \"idGenerator\", strategy = \"uuid2\")\n @GeneratedValue(generator = \"idGenerator\")\n private String id;\n\n @ManyToOne(fetch = FetchType.LAZY)\n @JoinColumn(name = \"TABLE_RELATION_ID\", nullable = false)\n private DSTableRelation tableRelation;\n\n}\n\n\nRepository DSColumnRelationRepository:\n\npublic interface DSColumnRelationRepository extends JpaRepository<DSColumnRelation, String> {\n\n @Modifying\n @Query(\"delete from DSColumnRelation c where c.tableRelation.schema.id = ?1\")\n void deleteBySchemaId(String schemaId);\n\n}\n\n\nExcute the method 'deleteBySchemaId', and check the generated sql:\n\ndelete \nfrom\n DSUSER.DS_COLUMN_RELATION cross \njoin\n DSUSER.DS_TABLE_RELATION dstablerel1_ \nwhere\n SCHEMA_ID=?\n\n\nthis sql is wrong sql, please tell me why using spring data jpa cause error,thanks." ]
[ "java", "spring", "jpa", "spring-data-jpa" ]
[ "Convert Pandas Dataframe to nested JSON", "I am new to Python and Pandas. I am trying to convert a Pandas Dataframe to a nested JSON. The function .to_json() doens't give me enough flexibility for my aim.\n\nHere are some data points of the dataframe (in csv, comma separated):\n\n,ID,Location,Country,Latitude,Longitude,timestamp,tide \n0,1,BREST,FRA,48.383,-4.495,1807-01-01,6905.0 \n1,1,BREST,FRA,48.383,-4.495,1807-02-01,6931.0 \n2,1,BREST,FRA,48.383,-4.495,1807-03-01,6896.0 \n3,1,BREST,FRA,48.383,-4.495,1807-04-01,6953.0 \n4,1,BREST,FRA,48.383,-4.495,1807-05-01,7043.0 \n2508,7,CUXHAVEN 2,DEU,53.867,8.717,1843-01-01,7093.0 \n2509,7,CUXHAVEN 2,DEU,53.867,8.717,1843-02-01,6688.0 \n2510,7,CUXHAVEN 2,DEU,53.867,8.717,1843-03-01,6493.0 \n2511,7,CUXHAVEN 2,DEU,53.867,8.717,1843-04-01,6723.0 \n2512,7,CUXHAVEN 2,DEU,53.867,8.717,1843-05-01,6533.0 \n4525,9,MAASSLUIS,NLD,51.918,4.25,1848-02-01,6880.0 \n4526,9,MAASSLUIS,NLD,51.918,4.25,1848-03-01,6700.0 \n4527,9,MAASSLUIS,NLD,51.918,4.25,1848-04-01,6775.0 \n4528,9,MAASSLUIS,NLD,51.918,4.25,1848-05-01,6580.0 \n4529,9,MAASSLUIS,NLD,51.918,4.25,1848-06-01,6685.0 \n6540,8,WISMAR 2,DEU,53.898999999999994,11.458,1848-07-01,6957.0 \n6541,8,WISMAR 2,DEU,53.898999999999994,11.458,1848-08-01,6944.0 \n6542,8,WISMAR 2,DEU,53.898999999999994,11.458,1848-09-01,7084.0 \n6543,8,WISMAR 2,DEU,53.898999999999994,11.458,1848-10-01,6898.0 \n6544,8,WISMAR 2,DEU,53.898999999999994,11.458,1848-11-01,6859.0 \n8538,10,SAN FRANCISCO,USA,37.806999999999995,-122.465,1854-07-01,6909.0 \n8539,10,SAN FRANCISCO,USA,37.806999999999995,-122.465,1854-08-01,6940.0 \n8540,10,SAN FRANCISCO,USA,37.806999999999995,-122.465,1854-09-01,6961.0 \n8541,10,SAN FRANCISCO,USA,37.806999999999995,-122.465,1854-10-01,6952.0 \n8542,10,SAN FRANCISCO,USA,37.806999999999995,-122.465,1854-11-01,6952.0 \n\n\nThere is a lot of repetitive information and I would like to have a JSON like this:\n\n[\n{\n \"ID\": 1,\n \"Location\": \"BREST\",\n \"Latitude\": 48.383,\n \"Longitude\": -4.495,\n \"Country\": \"FRA\",\n \"Tide-Data\": {\n \"1807-02-01\": 6931,\n \"1807-03-01\": 6896,\n \"1807-04-01\": 6953,\n \"1807-05-01\": 7043\n }\n},\n{\n \"ID\": 5,\n \"Location\": \"HOLYHEAD\",\n \"Latitude\": 53.31399999999999,\n \"Longitude\": -4.62,\n \"Country\": \"GBR\",\n \"Tide-Data\": {\n \"1807-02-01\": 6931,\n \"1807-03-01\": 6896,\n \"1807-04-01\": 6953,\n \"1807-05-01\": 7043\n }\n}\n]\n\n\nHow could I achieve this?\n\nEDIT: \n\nCode to reproduce the dataframe:\n\n# input json\njson_str = '[{\"ID\":1,\"Location\":\"BREST\",\"Country\":\"FRA\",\"Latitude\":48.383,\"Longitude\":-4.495,\"timestamp\":\"1807-01-01\",\"tide\":6905},{\"ID\":1,\"Location\":\"BREST\",\"Country\":\"FRA\",\"Latitude\":48.383,\"Longitude\":-4.495,\"timestamp\":\"1807-02-01\",\"tide\":6931},{\"ID\":1,\"Location\":\"BREST\",\"Country\":\"DEU\",\"Latitude\":48.383,\"Longitude\":-4.495,\"timestamp\":\"1807-03-01\",\"tide\":6896},{\"ID\":7,\"Location\":\"CUXHAVEN 2\",\"Country\":\"DEU\",\"Latitude\":53.867,\"Longitude\":-8.717,\"timestamp\":\"1843-01-01\",\"tide\":7093},{\"ID\":7,\"Location\":\"CUXHAVEN 2\",\"Country\":\"DEU\",\"Latitude\":53.867,\"Longitude\":-8.717,\"timestamp\":\"1843-02-01\",\"tide\":6688},{\"ID\":7,\"Location\":\"CUXHAVEN 2\",\"Country\":\"DEU\",\"Latitude\":53.867,\"Longitude\":-8.717,\"timestamp\":\"1843-03-01\",\"tide\":6493}]'\n\n# load json object\ndata_list = json.loads(json_str)\n\n# create dataframe\ndf = json_normalize(data_list, None, None)" ]
[ "python", "json", "pandas", "dataframe" ]
[ "C# ASP.NET Custom Control not showing up", "I'm trying to construct a custom control for ASP.NET \nI started by creating a Web Application in VS2010 and creating a new .ascx page. The page is called \"TestBox\" and it's just a single TextBox control with \"This is a test\" as the text.\n\nI built the project and then included the DLL in another website in order to make sure I would be able to move controls. Based on a tutorial I found here I added the following line of code to the top of the page:\n\n<%@ Register TagPrefix=\"TestControl\" Namespace=\"TestControl\" Assembly=\"TestControl\" %>\n\n\nThen I added this to the page itself:\n\n<TestControl:TestBox ID=\"TestBox1\" runat=\"server\" />\n\n\nThe code compiles and the page loads without throwing up any errors, but when it loads it's completely blank. By introducing a deliberate runtime error, I determined that the TextBox is definitely being loaded, but the control itself still isn't showing up.\n\nAm I missing something?\n\nCode for the TestControl:\n\n<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"TestBox.ascx.cs\" Inherits=\"TestControl.TestBox\" %>\n<asp:TextBox ID=\"TextBox1\" runat=\"server\" ontextchanged=\"TextBox1_TextChanged\">This is a test</asp:TextBox>\n\n\nI haven't touched the Designer code or the .cs code in any way.\n\nEDIT: Figured it out. I had declared a namespace for the .CS file but not the .ASPX file itself." ]
[ "c#", "asp.net", "custom-controls", "ascx" ]
[ "Provision device with JSON/MQTT IOT AGENT FIWARE", "curl -X POST -vv -H \"Fiware-Service: myHome\" -H \"Fiware-ServicePath: /environment\" -H \"Content-Type: application/json\" -H \"Cache-Control: no-cache\" -d '{\n \"devices\": [\n {\n \"device_id\": \"0000000000000000\",\n \"entity_name\": \"BedRoomSensor\",\n \"entity_type\": \"multiSensor\",\n \"attributes\": [\n { \"object_id\": \"t\", \"name\": \"Temperature\", \"type\": \"celsius\" },\n { \"object_id\": \"h\", \"name\": \"Humidity\", \"type\": \"degrees\" }\n ]\n }\n ]\n} 'http://localhost:4041/iot/devices'\n\nI execute the above curl commmand in order to provision my device.However it doesn't show anything and the command never ends.\nWhat i missunderstood?" ]
[ "json", "mqtt", "iot", "fiware", "fiware-orion" ]
[ "How to use single letters to form words", "Hey I currently have this code. It gets the user to input strings into an array, with a limit of 5. I plan to use the array to then form words from the array. How can I achieve this?\n\n const int row = 5;\n char array[row];\n char count = 0;\n char letter;\n while (count < 5)\n {\n cout << \"Enter a letter: \";\n cin >> letter;\n array[count] = letter;\n count++;\n }\n cout << \"Letter inputed\" << endl;\n for (count = 0; count < 5; count++)\n {\n cout << array[count] << \" \" << endl;\n }\n system(\"pause\");" ]
[ "c++" ]
[ "Is there an efficient way to load png-Images into a TImage object in FMX while it’s running?", "In order to show many different sized PNG-Images (with transparent background) i Need to load them out of the resources of the program. In VCL, this is easy as you are able to simply use the TPngImage to load and assign them. In Firemonkey this doesn’t exist, so I need another way to do this. Is there a function in FMX in order to do that? Thanks" ]
[ "delphi", "png", "firemonkey" ]
[ "Session_Start/_End, what happens behind the scenes if they are not included in global?", "What happens behind the scenes if you don't explicitly define Session_Start and Session_End in the global.asax? Does your program just assume that it's there? \n\nHave an internal app I was working on recently who's global didn't have these defined, and the program started having a few session timeout issues. They seemed to be resolved once I added these functions." ]
[ "asp.net", "asp.net-mvc" ]
[ "ClipToBounds and TranslateTransform", "I do text smoothly moving from right to left.\nfor motion I use TranslateTransform.\nThe right part of the text that gets abroad Grid should appear when scrolling.\nBut it is cut off (Clip) on the right edge of the Grid. And not restored even when shifted to the left.\nWhat should I do to clipping was not?\n\n <Grid HorizontalAlignment=\"Left\" Height=\"100\" Width=\"180\" VerticalAlignment=\"Top\">\n <Label Content=\"Test Text\" HorizontalAlignment=\"Left\" VerticalAlignment=\"Top\" FontSize=\"72\" RenderTransformOrigin=\"0.5,0.5\">\n <Label.RenderTransform>\n <TransformGroup>\n <ScaleTransform/>\n <SkewTransform/>\n <RotateTransform/>\n <TranslateTransform X=\"-60\"/>\n </TransformGroup>\n </Label.RenderTransform>\n </Label>\n </Grid>" ]
[ "wpf", "text", "scroll" ]
[ "How to retrieve data from a System.Object property in model during POST action?", "I currently have a model which contains an object property that can either be an int, a string or a MyClass object (which contains 3-4 properties) in runtime. Here is the general idea of my model:\n\npublic class MyModel\n{\n // Can be int, string, or MyClass during runtime.\n public object Value { get; set; }\n}\n\n\nHere is the general idea of MyClass:\n\npublic class MyClass\n{\n // These are correctly displayed in the EditorFor template.\n public int Quantity { get; set; }\n public string Name { get; set; }\n public bool IsAvailable { get; set; }\n}\n\n\nIn my view, I have an EditorFor(m => m.Value) that correctly selects a template based on its runtime type.\n\nDuring POST, the data from the view is correctly bound to the model and sent back to the controller as a parameter, but only if it's a string or an int. In fact, when Value is a MyClass object, it seems to be completely empty as if it came right out of a \"= new Object();\" statement. I cannot inspect it, as seen below:\n\n\n\nI suspect this behavior is because on POST, the Value object is recreated using an empty constructor without having its runtime type specified, so when the binding happens, the properties don't match with a plain System.Object object.\n\nIf this is the case, how can I specify the object's runtime type during its re-creation? If not, how can I fix this binding issue?\n\nExtra info: The MyClass properties are accessible through Request during controller POST (for example, Request[\"MyModel.Quantity\"] would return the proper int value from the view). They just can't seem to get in the model.\n\nEdit: As requested, here is what my view looks like:\n\n@model MyModel\n\n<div class=\"section\">\n <div class=\"editor\">\n <div class=\"editor-title\">The Value field</div>\n <div class=\"editor-container\">\n @Html.EditorFor(m => m.Value)\n </div>\n </div>\n</div>" ]
[ "c#", "asp.net-mvc" ]
[ "What to consider when strong name signing a managed application?", "I want to strong name a managed application which references many managed assemblies and ActiveX and COM components (written in C++) via interop. And because a strongly named assembly cannot reference weakly named assemblies, could you please tell me what problems that I should be prepared for, what you have run into, especially when dealing with those ActiveX and COM interops?\n\nThe solution for this application is big. It's composed of 50+ projects of managed C#, Vb.net, native C++, and managed C++/CLI. Therefore, the more information, real life stories you give, the better I can prepare and save myself from headache.\n\nThanks." ]
[ ".net", "visual-studio", "strongname", "snk" ]
[ "What is the Artemis Pool?", "Artemis seems like an excellent framework for ECS, but the documentation is to say at the least, lacking. I am new to ECS and have no idea what I am doing, but I want to learn.\n\nMy objective is to draw something to the screen. I am using MonoGame and Visual Studio 2012 (with Artemis). I have spent many hours scouring thru the StarWarrior code without any success. I cannot find the link between the SpatialFormComponent and the thing I want to draw (such as PlayerShip).\n\nMy best guess for the issue is that I am using the pool wrong. So my 2 questions:\n\n1. What is the Pool in Artemis? (What does AddComponentFromPool() do?)\n\n2. How do I draw something to the screen using Artemis? (What is the missing link?)\n\nI am sorry if that question does not appear well researched, but I assure you it is. That being said, if you find a source which resolves my problem (I doubt you will), then I welcome the downvotes." ]
[ "c#", "entity", "components", "system", "artemis" ]
[ "Javascript Locale Date Conversions", "I have a string coming into a function, this string is a date from Sweden and is formatted 2016 maj 01. Passed into this function is the country code for the locale sv-se. I need to convert the date string into a valid date object, to which I can then apply the locale. \n\nThis is for global date validation. \n\nSO far I have \n\nvar date = new Date();\nIntl.dateTimeFormat(locale, options).format(date);\n\n\nI want to be able to have new Date(\"2016 maj 01\") however since this is not English this is an invalid date. Can I using the locale convert this to a valid date object?\n\nIt was suggested my problem is similar to another. The way my problem is different is that I have the month coming in as the months abbreviated name. If the month was displayed numerically this would not be an issue" ]
[ "javascript", "date", "locale" ]
[ "install4j and pref-jre.cfg", "We have a few customers who are getting a JVM Error when running our application which is built with install4j. In most cases they have a pref-jre.cfg file in the .install4j folder which is incorrect. Such as they upgraded their java version, and the java reference in pref-jre.cfg no longer exists. So editing that file to point to the right location fixes the problem.\n\nHowever, I cannot figure out how the pref-jre.cfg got there in the first place. The application install does not create it, we didn't advise them about that, and they are not sophisticated enough to create one. \n\nDoes anyone have any idea about what situations might automatically create that file?\n\nOr, in general, how is install4j supposed to be handling updates of the Java environment?\n\nThanks" ]
[ "java", "install4j" ]
[ "How to dismiss a Game View Controller after performing a segue to another View Controller in an iOS Game?", "When a player taps "PLAY" on the Main V.C. it performs a segue to the Game V.C.! The Game V.C. starts the game when the player touches on the screen. Now, after the game is over I perform a segue from the Game V.C. to the Result V.C. But, now, the Game V.C. is still not dismissed and if a player touches anywhere on the Result V.C. the app crashes! So, how can I dismiss the Game V.C. after performing a segue to the Result V.C.? Would appreciate your help! Thanks!\nHere is the code in my Game V.C to detect touches and perform a segue to the Result V.C. after the game is over:-\noverride func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {\n // First touch to start the game\n if gameState == .ready {\n startGame()\n }\n \n if let touchLocation = event?.allTouches?.first?.location(in: self.view) {\n // Move the player to the new position\n movePlayer(to: touchLocation)\n \n // Move all enemies to the new position to trace the player\n moveEnemies(to: touchLocation)\n }\n\n}\n\nfunc gameOver() {\n stopGame()\n performSegue(withIdentifier: "2to7segue", sender: self)\n}" ]
[ "ios", "swift" ]
[ "Using System.IO.Delete to remove certain files from a directory?", "I have 2 images inside a folder called Pics..... Image1.jpg and Image2.jpg.\n\nWhat code must i place inside my Submit button to just delete Image1.jpg located here \"~/Pics/Image1.jpg\"\n\nAny help would be great!!!" ]
[ "c#", "asp.net", "vb.net", "image", "directory" ]
[ "Mutliround Feistel network in Java", "For some student stuff I need to implement a Feistel network in Java.\n\nI started with 3 manual rounds, like this:\n\n // round 1\n int[] left1 = right;\n int[] right1 = new int[right.length];\n\n for(int i = 0; i < right.length; i++){\n right1[i] = left[i] ^ (right[i] ^ keys[0]);\n }\n\n // round 2\n int[] left2 = right1;\n int[] right2 = new int[right.length];\n\n for(int i = 0; i < right.length; i++){\n right2[i] = left1[i] ^ (right1[i] ^ keys[1]);\n }\n\n // round 3\n int[] left3 = right2;\n int[] right3 = new int[right.length];\n\n for(int i = 0; i < right.length; i++){\n right3[i] = left2[i] ^ ( right2[i] ^ keys[2]);\n }\n\n\nIf I want to have 10 rounds I would need to copy this stuff 10 times and adjust the variables, is there a better way to do this? Maybe it's too late but I can't think of a solution..." ]
[ "java", "encryption", "feistel-cipher" ]
[ "Set extbase Controller Action in plugin", "I have set up an extbase extension in a TYPO3 4.5 site with the extension builder, containing just the default listAction in the controller.\n\nNow I would like to add a new Action, and it doesn't work.\n\nI don't need (aka. can't get to work) a flexform to choose the controller action. \n\nAs there's a field \"Plugin mode\", I thought I could just manually enter the action here:\n\n\n\nAnd extend the plugin configuration as such in ext_localconf.php:\n\nTx_Extbase_Utility_Extension::configurePlugin(\n $_EXTKEY,\n 'Pluginname',\n array(\n 'Controllername' => 'list,listfeatured',\n ),\n);\n\n\nAlso, in the controller, I have added a new action.\n\n/**\n * action listfeatured\n *\n * @return void\n */\npublic function listfeaturedAction() {\n // do something\n}\n\n\nBut, alas, the action is not called at all.\n\nDid I interpret the field \"plugin mode\" wrong?\nDid I miss something?\n\nAlternatively: Can I set the action for a \"backend\" plugin via TS as well?" ]
[ "typo3", "extbase", "typo3-4.5" ]
[ "session gets cleared once method finish", "I have two methods in my webservice.cs page like below.\n\n[WebMethod(EnableSession = true)]\n public void checkEmployee(string emailId, string password)\n {\n List<Employee> ListEmp = new List<Employee>();\n string cs = ConfigurationManager.ConnectionStrings[\"rushDB\"].ConnectionString;\n using (SqlConnection con = new SqlConnection(cs))\n {\n SqlCommand cmd = new SqlCommand(\"select * from Employees where Email='\" + emailId + \"' AND Password='\" + password + \"'\", con);\n string personName = null;\n string personEmail = null;\n string personDeptName = null;\n con.Open();\n SqlDataReader rdr = cmd.ExecuteReader();\n if (rdr.HasRows == true)\n {\n while (rdr.Read())\n {\n Employee empChild = new Employee();\n\n empChild.ID = Convert.ToInt16(rdr[\"ID\"]);\n empChild.Name = rdr[\"Name\"].ToString();\n empChild.Email = rdr[\"Email\"].ToString();\n empChild.Password = rdr[\"Password\"].ToString();\n empChild.DepartName = rdr[\"DepartName\"].ToString();\n\n personName = rdr[\"Name\"].ToString();\n personEmail = rdr[\"Email\"].ToString();\n personDeptName = rdr[\"DepartName\"].ToString();\n\n ListEmp.Add(empChild);\n }\n HttpContext.Current.Session[\"NamePerson\"] = personName;\n HttpContext.Current.Session[\"EmailPerson\"] = personEmail;\n HttpContext.Current.Session[\"DepartPerson\"] = personDeptName;\n JavaScriptSerializer js = new JavaScriptSerializer();\n Context.Response.Write(js.Serialize(ListEmp));\n }\n }\n }\n\n [WebMethod(EnableSession = true)]\n public void GetCurrentData()\n {\n Employee ListEmp = new Employee();\n\n if (HttpContext.Current.Session[\"NamePerson\"] != null)\n ListEmp.Name = HttpContext.Current.Session[\"NamePerson\"].ToString();\n if (HttpContext.Current.Session[\"EmailPerson\"] != null)\n ListEmp.Email = HttpContext.Current.Session[\"EmailPerson\"].ToString();\n if (HttpContext.Current.Session[\"DepartPerson\"] != null)\n ListEmp.DepartName = HttpContext.Current.Session[\"DepartPerson\"].ToString();\n\n JavaScriptSerializer js = new JavaScriptSerializer();\n Context.Response.Write(js.Serialize(ListEmp));\n }\n\n\nMy issue is that the session created in checkEmployee gets vanished after that method checkEmployee finishes its execution.\n\nI want to retrieve the session values in GetCurrentData but i am unable to do so. Any solution would help me. i have googled it but that didn't helped." ]
[ "asp.net", "web-services", "session" ]
[ "How to find a file on the $PATH in Bash?", "The utility which will find a program on the path but what about an arbitrary data file?\n\nI must be searching for the wrong stuff but I can't find any way to do this with a standard utility so I thought of writing a little Bash script to do it.\n\nThe $PATH environment variable is separated by colons, but trying to set IFS=':' and then iterate over the results is not working for me. Here's what I've got so far:\n\nIFS=':' DIRS=($PATH)\nfor d in $DIRS; do echo $d; done\n\n\nAt this point it only outputs the first entry in my path rather than all of them.\n\nThoughts? If there's already a standard command that does this then there's no reason to write a script ..." ]
[ "bash", "path", "posix" ]
[ "Server side event (SSE) in Flask pushes constantly instead of on request", "I have a Python Flask application that is supposed to push a server side event (SSE) to my webpage when specific events are triggered (e.g. via an interval timer, when the user pushes a specific button on the page etc.).\n\nHowever, I do not get Flask to push a message only when I request the app to do so. Instead, after starting the app, it constantly keeps pushing a message to the server every few seconds which is not what I want.\n\nMy minimal example for this behaviour looks like this:\n\nfrom flask import Flask\nfrom flask import render_template, Response\n\nfrom random import randint\n\napp = Flask(__name__)\n\n# function to push data to the server\ndef pushData():\n\n # randint is just to make every message not look the same\n number = randint(0,9)\n\n print('I push data to the server: {0}'.format(number))\n yield 'data: %s\\n\\n' % 'I am data that has been pushed to the server: {0}'.format(number)\n\n# provide SSE stream to the web browser\[email protected]('/listenForPushes')\ndef stream():\n\n return Response(pushData(), mimetype=\"text/event-stream\")\n\n# render a simple HTML page to the browser\[email protected]('/html')\ndef html():\n return render_template('webpage.html')\n\n# run this when the app starts. this should execute exactly one push at app start.\[email protected]_first_request\ndef _run_on_start():\n pushData()\n\nif __name__ == \"__main__\":\n\n app.run(host='0.0.0.0', debug=True, threaded=True, use_reloader=False, port=3000)\n\n\nThe HTML page with the event listener for SSE called webpage.html (put in the folder templates so that Flask can find it without any further configuration) looks like this:\n\n<html>\n<head></head>\n <body>This is a test page, please check the console output.\n\n <script type=\"text/javascript\">\n\n var source = new EventSource('/listenForPushes');\n source.onmessage = function(event) {\n console.log(event.data);\n }\n\n </script>\n\n </body>\n</html>\n\n\nWhen I now start the application, I get constantly messages pushed to the page every 2-3 seconds so that the output in the Python console and the browser's console look like this (right click the image and click 'view image' to get it enlarged):\n\n\n\nInstead, I would it expect to only push once when the app is started and then no more. How could the desired behaviour be achieved, or rather how can I trigger the push manually (e.g. via a scheduler, a click on the page etc.)?" ]
[ "javascript", "python", "flask" ]
[ "Using large txt files in JavaFX(TextArea alternatives?)", "I created a simple GUI where I have a TextArea. The TextArea itself will be populated by an Array, which contains scanned Strings out of a .txt file.\n\nThis works great for smaller size files. When using large files(~5MB per txt.-file) however, the TextArea(and only the TextArea) feels laggy and slow(not as responsive as I would like). Is there an alternative to the TextArea(doesnt have to be in JavaFX)? \n\nI'm looking for something very simple, which basically allows me to get & set text. Slidercontrol, as in JavaFX TextArea, would be very handy.\n\nThank you and have a great day!\n\nEdit: a very basic example of my code:\n\npublic class Main extends Application {\n\npublic void start(Stage stage) {\n Pane pane = new Pane();\n TextField filePath = new TextField(\"Filepath goes in here...\");\n TextArea file = new TextArea(\"Imported file strings go here...\");\n file.relocate(0, 60);\n Button btnImport = new Button(\"Import file\");\n btnImport.relocate(0, 30);\n ArrayList<String> data = new ArrayList<>();\n\n btnImport.setOnAction(e -> {\n File fileToImport = new File(filePath.getText());\n try {\n Scanner scanner = new Scanner(fileToImport);\n while(scanner.hasNextLine()) {\n data.add(scanner.nextLine());\n }\n file.setText(data.toString());\n } catch (FileNotFoundException e1) {\n e1.printStackTrace();\n }\n });\n\n pane.getChildren().addAll(filePath, file, btnImport);\n Scene scene = new Scene(pane);\n stage.setScene(scene);\n stage.show();\n}\n\npublic static void main(String[] args){\n launch();\n}\n}" ]
[ "java", "javafx" ]
[ "bulk insert using hibernate and sql server", "I am using hibernate(3.3 vesion) with sql server 2005. I have to insert 100 thousands records in to database. Since I am using IDENTITY for primary generation strategy, I am not able do bulk insert in hibernate. I tried StatelessSession and couldn't gain any performance.\n\nCould anyone please suggest a way to improve performance?\n\nPlease help." ]
[ "java", "hibernate", "sql-server-2005" ]
[ "What determines the current directory in a web application", "I have a MVC web application.\nThe start url is //foo/login/index.\nOn a view I show a picture images/bar.jpg.\nThe image is in de directory //foo/images\n\nOn my working station this works but when I install it on the test server the site can't find the image because it url to the image is:\n//foo/login/images/bar.jpg instead of //foo/images/bar.jpg\n\nSo my current directory on my workstation differs from that on the test server.\n\nMy question: What determines the current directory in a mvc web application" ]
[ "asp.net-mvc", "url" ]
[ "vlookup but the name of the cell that will return not the value in the cell", "just like to ask if you know a formula like in the vlookup style but the cell name that it will return not the value of the cell? thanks! \n\nI want to put the value of sal in the Application.WorksheetFunction.VLookup(name, Sheet2.Range(\"Table6\"), 5, False) but in this function the value inside the cell will return not the name of the cell\n\nSub purchase()\n\nDim name As String\nname = ActiveSheet.Range(\"C3\")\nsal = Application.WorksheetFunction.VLookup(name, Sheet2.Range(\"Table6\"), 5, False) - ActiveSheet.Range(\"d3\").Value\n\nMsgBox \" remaining: \" & sal \n\nEnd Sub" ]
[ "excel", "vlookup", "vba" ]
[ "Monaco editor how to highlight function argument name", "I want highlight the argument name title and type in Monaco editor(it is a language write myself)\nmyfunc(1, title ="aab", type="int")\n\nI add this regex. it not work(test url https://microsoft.github.io/monaco-editor/monarch.html, select python language)\nargname:[\n [/(?<=[(,])\\s*([a-z]+)\\s*(?=\\=)/g,'argname']\n ]," ]
[ "regex", "highlight", "monaco-editor" ]
[ "Changing axis in autoplot.survfit", "I am trying to change the y-axis for my Kaplan Meier survival function. I am using autoplot to create a ggplot for a survfit object. It is in the survMisc library. \n\nThe output currently has the y-axis from 0 to 1, but I would like to change it to 0.5 to 1. There does not appear to be an argument within autoplot that allows me to change the axis. \n\nIf this is possible, I would also like to change the intervals of my tick marks. It currently has it at every 2.5 years (minor axis) but I would like it every year. \n\nI have attached a sample survival code from the UCLA website, but my autoplot code is the same as in my script. Thanks.\n\nhmohiv<-read.table(\"http://www.ats.ucla.edu/stat/r/examples/asa/hmohiv.csv\", sep=\",\", header = TRUE) \nlibrary(survival)\nlibrary(ggplot2)\nlibrary(Hmisc)\nlibrary(ggfortify)\nattach(hmohiv)\n\nhmohiv.surv <- survfit( Surv(time, censor)~ 1)\nsummary(hmohiv.surv)\nautoplot(hmohiv.surv, type = \"CI\", palette=\"Set2\", pVal=TRUE, \n title=\"Recurrence Free Survival\", \n\n legTitle = \"Adjuvant Treatment\", \n xLab=\"Years to Recurrence\", yLab=\"Probability\", \n censSize = 2,\n alpha = 0.9,\n tabTitle = \"Number at Risk\",\n tabTitleSize = 14,\n tabLabSize = 2,\n nRiskSize = 4,\n timeTicks = \"minor\"\n) + scale_y_continuous(limits=c(0.5,1))\n\n\nIt runs fine without the\n\n+ scale_y_continuous(limits=c(0.5,1))\n\n\nbut when I run it with the scale, it gives me the following error:\n\n\n Error in autoplot(hmohiv.surv, type = \"CI\", palette = \"Set2\", pVal = TRUE, : \n non-numeric argument to binary operator" ]
[ "r", "ggplot2" ]
[ "Circular Dependency Error autoloading constant", "I keep getting the error \"Circular dependency detected while autoloading constant API::V1::CitysController\" when I try load my api page. Everything I've searched seems to suggest their might be a typo but I don't think there is one.\n\nMy routes:\n\nnamespace :api , defaults: {format: 'json'} do\n namespace :v1 do\n resources :citys\n end\nend\n\n\nmy controller is in app/controllers/api/v1/citys_controller.rb\n\nTheres nothing in it really at the moment\n\nclass Api::V1::CitysController < ApplicationController\n respond_to :json\n\n def index\n\n end\nend\n\n\nNot sure what else is relevant to the problem? It should just load a blank page without any errors when I go to localhost:3000/api/v1/citys\n\nAdded routes\n\nPrefix Verb URI Pattern Controller#Action\n pages_home GET /pages/home(.:format) pages#home\n root GET / pages#home\napi_v1_citys GET /api/v1/citys(.:format) api/v1/citys#index {:format=>\"json\"}\n POST /api/v1/citys(.:format) api/v1/citys#create {:format=>\"json\"}\n new_api_v1_city GET /api/v1/citys/new(.:format) api/v1/citys#new {:format=>\"json\"}\nedit_api_v1_city GET /api/v1/citys/:id/edit(.:format) api/v1/citys#edit {:format=>\"json\"}\n api_v1_city GET /api/v1/citys/:id(.:format) api/v1/citys#show {:format=>\"json\"}\n PATCH /api/v1/citys/:id(.:format) api/v1/citys#update {:format=>\"json\"}\n PUT /api/v1/citys/:id(.:format) api/v1/citys#update {:format=>\"json\"}\n DELETE /api/v1/citys/:id(.:format) api/v1/citys#destroy {:format=>\"json\"}" ]
[ "ruby-on-rails", "ruby-on-rails-4" ]
[ "IF ELSE Statement in SQL Server jobs", "I have a SQL Server job defined as follows but it shows error while executing. Please help sort out the problem\n\n-- First clear out the destination table fast and easy without \nTRUNCATE TABLE [etimetracklite1].[dbo].[devicelogs];\n\n-- Create table\nDECLARE @tablename AS nvarchar(14);\nDECLARE @yearnam AS nvarchar(4);\nDECLARE @tabnam AS nvarchar(18);\n\nIF MONTH(GETDATE()) = 1\nBEGIN\n SET @tablename = [devicelogs_1_]\nEND\nELSEIF MONTH(GETDATE()) = 2\nBEGIN\n SET @tablename = '[devicelogs_2_]\nEND\nELSEIF MONTH(GETDATE()) = 3\nBEGIN\n SET @tablename = [devicelogs_3_]\nEND\nELSEIF MONTH(GETDATE()) = 4\nBEGIN\n SET @tablename = [devicelogs_4_]\nEND\nENDIIF MONTH(GETDATE()) = 5\nBEGIN\n SET @tablename = [devicelogs_5_]\nEND\nELSEIF MONTH(GETDATE()) = 6\nBEGIN\n SET @tablename = [devicelogs_6_]\nEND\nELSEIF MONTH(GETDATE()) = 7\nBEGIN\n SET @tablename = [devicelogs_7_]\nEND\nELSEIF MONTH(GETDATE()) = 8\nBEGIN\n SET @tablename = [devicelogs_8_]\nEND\nELSEIF MONTH(GETDATE()) = 9\nBEGIN\n SET @tablename = [devicelogs_8_]\nEND\nELSEIF MONTH(GETDATE()) = 10\nBEGIN\n SET @tablename = [devicelogs_10_]\nEND\nELSEIF MONTH(GETDATE()) = 11\nBEGIN\n SET @tablename = [devicelogs_11_]\nEND\nELSEIF MONTH(GETDATE()) = 12\n SET @tablename = [devicelogs_12_]\nEND\n\nSET @yearnam = YEAR(GETDATE());\nSET @tabnam = @tablename + @yearnam;\n\n-- Execute a query\nDECLARE @query_a AS nvarchar(500);\n\nSET @query_a = 'INSERT INTO etimetracklite1.dbo.devicelogs SELECT * \nFROM etimetracklite1.dbo.' + [@tabnam];\n\nEXECUTE sp_executesql @query_a;\n\n\nThe error I am getting is SQL error 102." ]
[ "sql", "sql-server" ]
[ "apply bsxfun or arrayfun to every row of a matrix", "There are two matrices, A and B with size m-by-4 and n-by-4 respectively. My question is how to apply a function f, which takes two 1x4 vectors as input, on every row of A and B. The result will be a matrix with size mxn. The element [i, j] in result is f(A(i, :), B(j, :)).\n\nFor example:\n\nA = rand(3, 4);\nB = rand(5, 4);\nfor i = 1 : 3\n for j = 1 : 5\n result(i, j) = rectint(A(i, :), B(j, :));\n end\nend\n\n\nCan I use bsxfun or arrayfun to do this job?" ]
[ "arrays", "matlab", "matrix", "bsxfun" ]
[ "Double Records Added After Enabling Client Side Validation And Submitting form in Yii", "I have a following simple form in Yii that is submitted by AJAX:\n\n<?php $form = $this->beginWidget('CActiveForm', array(\n 'id' => 'application-form',\n 'enableAjaxValidation' => true,\n 'enableClientValidation' => true,\n 'htmlOptions' => array(\n 'enctype' => 'multipart/form-data',\n 'onsubmit'=>\"return send();\"\n ),\n 'clientOptions'=>array('validateOnSubmit'=>true)\n\n)); ?>\n<div class=\"row\">\n <?php echo $form->labelEx($model, 'name'); ?>\n <?php echo $form->textField($model, 'name', array('size' => 60,'maxlength' => 255)); ?>\n <?php echo $form->error($model, 'name'); ?>\n </div>\n<div class=\"row buttons\">\n <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>\n </div>\n\n\nAnd function for submitting:\n\nfunction send (){\n\nvar data_form=$(\"#application-form\").serialize();\n\n$.ajax({\n type: \"POST\",\n url: \"<?php echo Yii::app()->createUrl('admin/application/create') ?>\",\n dataType:'json',\n data: data_form,\n success: function (data, textStatus, jqXHR) {\n console.log(data);\n alert(\"success\",textStatus);\n },\n error: function (jqXHR, textStatus, errorThrown) {\n // console.log( errorThrown);\n\n }\n});\nreturn false;\n}\n\n\nMy create controller:\n\npublic function actionCreate()\n {\n $model = new Application;\n $model->setScenario('create');\n\n $this->performAjaxValidation($model);\n\n if (isset($_POST['Application'])) {\n\n if ( $model->save()){\n\n echo CJSON::encode(array('success' => 'true','id'=>$model->id));\n Yii::app()->end();\n }\n }\n\n $this->render('create', array(\n 'model' => $model\n ));\n }\n\n\nFiled name is required and that is only validation for now. When I try to submit form without field name inputted, validation messages appear as they supposed to do in Yii. But when I fill form correctly, my model is inputted twice in database. If I remove following property:\n\n'clientOptions'=>array('validateOnSubmit'=>true)\n\n\nmodel gets saved correctly (only one time), but no validation messages appear. \n\nHow can I get default validation messages in Yii to appear, when I submit my form via ajax and model not to be saved twice. I need to submit form this way, because I will return model id in Ajax response for processing in JavaScript.\n\nI searched the web for this and tried all suggestions, but none of them work.\n\nThank you all!" ]
[ "javascript", "php", "ajax", "validation", "yii" ]
[ "source/spec files for jdk 1.7", "I have the rpm from Oracle's site, but I want to make some configuration changes and repackage the rpm. I don't see a source or spec file listed on their site and I don't want to have to build this whole thing out on my own...anyone have any suggestions or links to where I might be able to find this?" ]
[ "java", "java-7", "rpm", "rpmbuild", "rpm-spec" ]
[ "Symfony: Weird routing issue", "I've got following URL in symfony (specifics not important):\n\n/frontend_dev.php/something/25/apple\n\n\n... and a routing rule:\n\n/something/:id/:word\n\n\nThe URL works fine when clicked through to on the site, but not when I type in the URL. Instead, symfony says:\n\nUnable to find a matching route to generate url for params \"NULL\".\n\n\nThe weird thing is that I can navigate to this page and it works, but when hitting Enter in the browser address bar, it no longer finds it.\n\nAny thoughts on what might be the cause of something like this generally?\n\nI should also add that the URL was working fine when typed in the address bar earlier, but doesn't anymore, and I'm not sure what's there that might be interfering with it.\n\nThanks in advance.\n\nUPDATE:\n\nThe exact routing rule:\n\nprofile:\n url: /profile/:id/:un\n param: {module: profile, action: profile}\n\n\nUPDATE:\n\nDebug toolbar log (the higlighted part):\n\nUnable to find a matching route to generate url for params \"NULL\". Toggle debug stack\n#4 » in sfException::outputStackTrace() from SF_ROOT_DIR\\lib\\vendor\\symfony\\lib\\exception\\sfException.class.php line 110\n#3 » in sfException->printStackTrace() from SF_ROOT_DIR\\lib\\vendor\\symfony\\lib\\controller\\sfFrontWebController.class.php line 52\n#2 » in sfFrontWebController->dispatch() from SF_ROOT_DIR\\lib\\vendor\\symfony\\lib\\util\\sfContext.class.php line 170\n#1 » in sfContext->dispatch() from SF_ROOT_DIR\\web\\frontend_dev.php line 13\n\n\nRESOLVED:\n\nFound it....\n\nI had this in my code on the failing page:\n\n<?php echo link_to(__('Back to previous page').' ›', $sf_request->getReferer()) ?>\n\n\nThe referer fails when typing address into bar." ]
[ "url", "parameters", "routing", "symfony1", "request" ]
[ "Exhaustively walking the AST tree in Groovy", "This is related to my question on intercepting all accesses to a field in a given class, rather than just those done in a manner consistent with Groovy 'property' style accesses. You can view that here: intercepting LOCAL property access in groovy.\n\nOne way I've found that will definitely resolve my issue there is to use AST at compile time re-write any non-property accesses with property accesses. For example, a if a class looks like this:\n\nclass Foo {\n def x = 1\n def getter() {\n x\n }\n def getProperty(String name) {\n this.\"$name\" ++\n }\n}\n\nfoo = new Foo()\nassert foo.getter() == 1\nassert foo.x == 2\n\n\nThese assert statements will work out because the getter method access x directly and the foo.x goes through getProperty(\"x\") which increments x before returning.\n\nAfter some trial and error I can use an AST transformation to change the behavior of the code such that the expression 'x' in the 'getter' method is actually accessed as a Property rather than as a local field. So far so good!\n\nNow, how do I go about getting to ALL accesses of local fields in a given class? I've been combing the internet looking for an AST tree walker helper of some kind but haven't found one. Do I really need to implement an expression walker for all 38 expression types here http://groovy.codehaus.org/api/org/codehaus/groovy/ast/expr/package-summary.html and all 18 statement types here http://groovy.codehaus.org/api/org/codehaus/groovy/ast/stmt/package-summary.html? That seems like something that someone must have already written (since it would be integral to building an AST tree in the first place) but I can't seem to find it." ]
[ "groovy", "abstract-syntax-tree" ]
[ "Multi-Line Excel to New Row Per Line", "I have a large excel file, 5000 Rows Sample of it is upload here.\n\nthe file contains data about employees as following:\n\nFirst Column: Employee Name\nSecond: Employee ID\nColumns 3-7: Experiences (Multiline Values)\n3: Career Name\n4: Rank\n5: From\n6: To\n7: Reason For Leaving\nColumns 8-13: Managerial Jobs\nColumns 14-17: Education\nColumns 18-26: Courses\n\n\nNow each employee will have many multi line values for Experiences, Managerial Jobs, Education and Courses, in other words, he have many courses one at each line on the same row\n\nNow what is needed is as following:\nExcel Macro (VBA): \n\n\nTo Move every employee (Row) with the header to a new worksheet in this same workbook, and name the sheet with employee ID which is located in Column 2 (The Code of this is ready)\nFor Each multi line value (Education For Example), it should add each line in a separate row\nIf Possible Sort every multiline values by date, from older to newer. \nand thats it,\n\n\nIn the attached excel file, I've made the first employee, it is it possible to repeat this operation for about 5000 employees, if not, what database do you suggest to use, can Microsoft Access do it?" ]
[ "database", "vba", "excel", "ms-access" ]
[ "Amazon CloudSearch Gem", "Is there a gem other than:\n\n\nhttps://github.com/wellbredgrapefruit/asari\nhttps://github.com/spokesoftware/aws_cloud_search\n\n\nfor using aws cloud search in ruby? I'm trying to evaluate which one to use and want to make sure I'm not missing the_gem_one_that_everyone_uses." ]
[ "ruby", "amazon-cloudsearch" ]
[ "need to use HTML's tag MAP in joomla site", "I need to use Map HTML tag to make my image work as hyperlink, linked to different social sites, but map tag is not working in Joomla!, but it was working in HTML site.\n\nThis is the code I'm using\n\n<img src=\"images/social_media_icons.jpg\" border=\"0\" alt=\"social media icons\" width=\"365\" height=\"44\" /> <map id=\"Map\" name=\"Map\"> \n<area shape=\"rect\" coords=\"18,6,56,39\" href=\"twitter_Link\" target=\"_blank\" />\n\n<area shape=\"rect\" coords=\"77,6,112,39\" href=\"facebook_Link\" target=\"_blank\" />\n\n<area shape=\"rect\" coords=\"191,6,229,38\" href=\"youtube_link\" target=\"_blank\" />\n\n </map>" ]
[ "php" ]
[ "dynamic memory allocation using new operator , issue in type cast", "uint8_t hello = 50; \nuint8_t *data;\n\ndata = new uint8_t(hello); //issue when using "new"\ndata = (uint8_t*)malloc(hello); //worked fine\n\nI want to allocate memory like above mentioned code. If I delete this data ptr at the end of the scope, there is some sort of memory leak. Moreover, have I allocated the memory correctly? Is there any casting needed like I did for malloc?" ]
[ "c++" ]
[ "Xamarin C# iAd Banner view Bottom example", "I created an IOS App in Xamarin and I want to have an iAd view at the bottom of the only View (SingleView). I only found solutions for multi-view Apps and so on, but I just want a simple iAd view at the bottom. How I can do that? I searched Xamarin and Apple Dev. help, but I could not find anything helpful." ]
[ "c#", "ios", "xamarin", "iad", "ads" ]
[ "kendo ui mobile events in templates not fireing", "I using this approach for my new app.\n\nhttp://blogs.telerik.com/blogs/14-03-27/structuring-hybrid-mobile-applications\n\nBut I running in a problem with click events when I calling templates in my view.\n\nEverything else like data binding init kendo widgets works fine. \n\nWhat I missing here?\n\n<div data-role=\"view\" id=\"home\" data-model=\"APP.home.model\" data-init=\"APP.home.events.init\" data-after-show=\"APP.home.events.afterShow\" style=\"display: none;\">\n<header data-role=\"header\">\n<div data-role=\"navbar\">\n <a data-role=\"button\" data-rel=\"drawer\" href=\"#categories\" data-icon=\"drawer-button\" data-align=\"left\"></a>\n <span data-role=\"view-title\"></span>\n <div data-role=\"button\" data-bind=\"click: hello\" data-align=\"right\" data-icon=\"compose\">a</div>\n</div>\n</header>\n<div>TEST me</div>\n<div data-role=\"button\" data-bind=\"click: hello\" data-align=\"right\" data-icon=\"compose\">a</div>\n<div id=\"testMe\">\n</div>\n<div id=\"home-grid\" class=\"grid home-grid\"></div>\n</div>\n\n<script>\nvar events = {\n init: function (e) {\n navbar = e.view.header.find('.km-navbar').data('kendoMobileNavBar');\n var template = kendo.template($(\"#testMe_tmp\").html());\n $(\"#testMe\").html(template({}));\n kendo.mobile.init($(\"#testMe\"));\n },\n afterShow: function (e) {\n navbar.title(\"b\");\n\n }\n};\n</script>\n\n\nThanks in advance\n\nT.S" ]
[ "kendo-mobile", "kendo-mvvm", "kendo-template" ]
[ "Getting an error in the backend of website tool", "The website tool is connected to a 3 sql views. \n\nFor one view the code included contains many parts. For the view -The number of columns has not changed but for the underlying table they have increased. \n\nThe Website throws an error when specific data is added. If the data is removed and cache is re-set for the website tool, it works. \n\nMsg 511, Level 16, State 1, Line 1\nCannot create a row of size 8111 which is greater than the allowable maximum row size of 8060.\nWarning: Null value is eliminated by an aggregate or other SET operation.\n\nHope the above makes sense? Could anyone please guide me as to what can be done to resolve." ]
[ "sql" ]
[ "Codeigniter Call to a member function result() on a non-object", "I have this code:\n\npublic function getJccLineItem($id,$action)\n{\n $res = array();\n $q = 'SELECT * FROM jcc_line_items jli,ipo_line_item ili ,line_items li\n WHERE jli.line_item_id= ili.id and li.id = jli.line_item_id\n and ili.dn_number_id in ( Select dn_number from ipo where project_id= '.$id.')';\n $res = $this->db->query($q);\n echo $this->db->last_query();\n $jccLineItemArray = array();\n echo $id;\n print_r($res->result());\n\n if($action == 'array')\n {\n\n foreach ( $res->result() as $key => $value) // The error comes in this line\n {\n $jccLineItemArray[ $value->id ] = $value->item_description;\n }\n $res = $jccLineItemArray;\n\n\n } \n else \n {\n\n $res = $res->result();\n }\n\n return $res;\n}\n\n\nThe error is in the foreach loop. I have printed the result and it shows the result in object array but when it goes to foreach loop. It show this error \n\n\n \"Call to a member function result() on a non-object \" \n\n\nBut when I set db['default']['db_debug']=true , it shows that the $id is missing from the query whereas when it was false it was showing result in object array and giving error at loop. Any Help would be appreciated.Thanks\n\nController Code\n\npublic function createInvoice( $id = \"\" ) \n{ \n if (empty($id)) \n {\n $id = $this->input->post('dataid');\n }\n echo $id;\n $data['jcc_line_list'] = $this->product_model->getJccLineItem($id,'array');\n $data['jcc_line_lists'] = $this->product_model->getJccLineItem($id,'');\n $data['items'] = $this->product_model->getAllSubInvoice($id);\n $data['single_project'] = $this->product_model->getSingleProject($id);\n $data['site'] = $this->product_model->getAllSiteArray();\n $data['job_types'] = $this->product_model->getAllJobTypeArray();\n $data['title'] = 'Invoice';\n $data['operation'] = 'Create';\n $data['buttonText'] = 'Save';\n $data['id'] = $id;\n $this->load->helper(array('form', 'url'));\n $this->load->helper('security');\n\n $this->form_validation->set_rules('line_item_id', 'Line Item', 'required|xss_clean|max_length[50]');\n $this->form_validation->set_rules('job_type_id', 'Job Type', 'required|xss_clean|max_length[50]');\n $this->form_validation->set_rules('site_id', 'Site', 'required|xss_clean|max_length[50]');\n $this->form_validation->set_rules('milestone', 'Milestone', 'required|xss_clean|max_length[50]');\n $this->form_validation->set_error_delimiters('<span class=\"error\">', '</span>');\n\n\n if ($this->form_validation->run() == FALSE) {\n $this->session->set_flashdata('error_message', validation_errors());\n $this->load->view('admin/viewinvoicesub', $data);\n } else if ($this->form_validation->run() == TRUE) {\n\n $formData = array(\n 'invoice_id' => $id,\n 'line_item_id' => $this->form_validation->set_value('line_item_id'),\n 'job_type_id' => $this->form_validation->set_value('job_type_id'),\n 'site_id' => $this->form_validation->set_value('site_id'),\n 'milestone' => $this->form_validation->set_value('milestone'),\n );\n $this->product_model->insertInvoiceSub($formData);\n $this->session->set_flashdata('sucess_message', \"Data successfully save !\");\n redirect('Products/createInvoice', \"refresh\");\n } else {\n $this->load->view('admin/viewinvoicesub', $data);\n }\n}" ]
[ "php", "codeigniter", "mysqli" ]
[ "Loops in column with multiple elements with the same value in matlab", "As the question says. I have a column in a matrix that out of the 300000 entries the same value exists in multiple elements. For example \n\n1000\n1000\n1000\n3000\n3000\n6000\n6000\n\n\nI want to do a loop in which with each different value executes another function. For clarification I want my program to do something for the three rows that have the value 1000, and then something else for the rows that have value 3000 and another thing for the rows that have value 6000. I made a switch loop, but I don't believe it's logically correct. Here it is:\n\na = M(1,6)\n\nswitch a\n case M(:,6) == a \n y=sinx; \n case M(:,6) != a \n b = M(:,6)\n y = 4\n case M(:,6) != b\n c = M(:,6)\n z = 5\n otherwise M(:,6) != c\n d = M(:,6)\n w = 6\nend" ]
[ "matlab", "loops" ]
[ "Deletion of Read only files on a windows machine running a python script", "I have some files on a windows machine(directory d:/test/temp/). For some of the files i have read only permission. For the deletion of the files/folder in the above directory I use a python scripts which recursively iterates over the directory and deletes every file in it.\n\nFollowing is the snippet of code used for the deletion: \n\nfor entry in listdir(dest_folder): \n if isfile(join(dest_folder,entry)) and basename(filename) != entry: \n remove(join(dest_folder,entry))\n\n\nI use a user named: tectt which has all permissions to delete the file.\n\nWhen I logged into the windows machine with that user I was able to delete the read only files manually. But when I try to delete the read only files through python scripts, I was unable to delete the files. \n\nAn error was thrown saying: [Error 5] Access is denied\n\nI'm new to python scripting. Can some please help me out:\n1. To delete these read only files with scripts?\n2. Am i missing any things, if so, what would have been them?\n\nRegards,\nVijay" ]
[ "python", "python-2.6" ]
[ "Deployment failing with HTTP Error 400: Bad Request", "I am trying to deploy changes to an existing project. This worked yesterday. My command line is:\n\nappcfg.py update . --noauth_local_webserver --verbose\n\n\nI get this \"Bad request\" error today back from app engine. I have reauthenticated and then blew away my local copy of the project and re-downloaded it but neither have fixed this problem What gives?\n\n12:21 PM Starting deployment.\n2016-04-15 12:21:10,849 INFO appcfg.py:1693 Send: /api/appversion/deploy, params={'version': '1', 'app_id': 'cynomix3', 'module': 'default'} \n2016-04-15 12:21:11,468 INFO appcfg.py:2559 HTTP Error (HTTP Error 400: Bad Request Unexpected HTTP status 400) \n12:21 PM Rolling back the update.\n2016-04-15 12:21:11,469 INFO appcfg.py:1693 Send: /api/appversion/rollback, params={'version': '1', 'app_id': 'cynomix3', 'module': 'default'} \nError 400: --- begin server output ---\n\nClient Error (400)\nThe request is invalid for an unspecified reason.\n--- end server output ---" ]
[ "python", "google-app-engine" ]
[ "Kotlin: Retain, replace or remove each map entry in-place", "I have a mutable map (a LinkedHashMap to be specific) in Kotlin. For each map entry, I want to conditionally perform one of three actions:\n\n\nRetain the entry as-is\nReplace the entry's value\nRemove the entry\n\n\nIn old Java, I would probably use an Iterator over the map's entrySet() for this purpose (using Iterator.remove() or Entry.setValue() accordingly). However, I wondered if there is a more elegant, functional approach present in Kotlin to do the same (i.e. apply a lambda to each entry in-place, similar to using replaceAll(), but with the ability to also remove entries).\n\n\n\nIn Kotlin, the following combination of replaceAll() and retainAll() does the same thing:\n\nval map = LinkedHashMap<String,Int>(mapOf(\"a\" to 1, \"b\" to 2, \"c\" to 3))\nmap.replaceAll { key, value ->\n if(key.startsWith(\"a\")) {\n value * 2\n } else {\n value\n }\n}\nmap.entries.retainAll { entry ->\n entry.key.startsWith(\"a\") || entry.key.startsWith(\"b\")\n}\n\n\nHowever, this iterates the map twice and requires splitting up the predicate/transformation. I would prefer a compute()-style all-in-one solution, just for all entries." ]
[ "java", "dictionary", "kotlin", "functional-programming" ]
[ "retrieve byte from 32 bit integer using bitwise operators", "Here is the problem and what I currently have, I just don't understand how it is wrong...\n\n\n getByte - Extract byte n from word x Bytes numbered from 0 (LSB) to\n 3 (MSB) Examples: getByte(0x12345678,1) = 0x56 Legal ops: ! ~ &\n ^ | + << >> Max ops: 6 Rating: 2\n\n\nint getByte(int x, int n) {\n return ((x << (24 - 8 * n)) >> (8 * n));\n}" ]
[ "c" ]
[ "Wix doesn't remove its files if I remove mine", "I have a Wix installer which installs and removes fine if I don't execute my custom actions. But if I do execute them then my custom action does its job, and the uninstall does succeed, but all of the files installed remain in the program files application directory.\n\nOn install, my custom action (After=\"InstallFiles\") extracts a number of files from a Zip into directories under the main install directory. I also capture a list of all files extracted (added). This works perfectly.\n\nOn uninstall, my custom action (After=\"MsiUnpublishAssemblies\") runs through the list and removes the added files, added sub-directories and the file list itself. This works fine - my added files are removed. But the primary files originally installed by the installer are left behind even though the installer goes through all the steps (as far as I can tell by the log file) and ends successfully.\n\nAny ideas would be a great help here.\n\nThanks!\n\nUpdate:\nI have tentatively solved this the brute-force way, but I would still like a real answer. Here's my brute-force code. I call it with a DirectoryInfo of my InstallDir.\n\n private static void CleanupTheRest(DirectoryInfo dirInfo)\n {\n // until I figure out why the unistall won't remove these after executing my CA\n foreach (var subDirInfo in dirInfo.GetDirectories())\n {\n CleanupTheRest(subDirInfo);\n }\n foreach (var file in dirInfo.GetFiles())\n {\n file.Delete();\n }\n dirInfo.Delete();\n }" ]
[ "c#", "wix", "custom-action" ]
[ "Paytabs Payment Gateway", "My question is related to payment gateway for paytabs.\nI would like to tell you that when we send currency BHD,USD,BED so in this case payment goes to successfully but when we send currency INR,KWD so in this case payment goes to rejected.\nHow to integrate paytabs with INR,KWD currencies actually I want to integrate paytabs payment gateway with KWD currency.\nPlease solve my problem.\nenter image description here" ]
[ "paytabs" ]
[ "WSO2 APIM Analytics not populating Log Analyzer links in Admin Portal", "We have setup WSO2 API-M v2.1.0 with API-M Analytics v2.1.0 with Postgresql and HAProxy on CentOS. The API analytics reports are being shown as expected from the Publisher and the Store side and even the api availability from the Admin Portal.\n\nThis is a distributed set-up comprising separate publisher, store, key manager, traffic manager, gateway manager/worker and analytics. Consul service discovery is providing local DNS resolution.\n\nOn the gateway worker we have enabled log analyzer; also HAProxy is forwarding /portal and /shindig to the Admin Portal publisher node.\n\nAlso note the publisher was started on its api-publisher product profile, however this resulted in missing alert configurations, see\njira issue.\n\nThis is easily resolved by reverting to the default profile; still none of the log analyzer links are being populated when logged into the Admin Portal application.\n\nWhen attempting any of the Log analyzer links from the Admin Portal the browsers javascript console is displaying the following errors :\n\n\"Failed to preload gadget https://<HOSTNAME>/portal/store/carbon.super/fs/gadget/LiveLogViewer/index.xml.\" \n\n\nand \n\n\"Detailed error: 503 Unable to retrieve spec for https://<HOSTNAME>/portal/store/carbon.super/fs/gadget/LiveLogViewer/index.xml. HTTP error 503\"\n\n\nFrom the analytics carbon console I can validate my gateway log analzyer configuration from the data explorer seen here\n\n\n\nThe docs seem to suggest the need to edit js code for the log analyzer??" ]
[ "wso2", "wso2-am", "wso2-das", "jaggery-js", "apache-shindig" ]
[ "Soap error: Content is not allowed in prolog", "When I execute a SOAP request, I get the response Content is not allowed in prolog.\n\nSo far I have tried:\n\n\nadding a declaration (with different parameters)\nchanging the encoding\nremoving any characters in prolog (there aren't any)\nchanging the namespace order\nand more I cannot probably remember\n\n\nThe XML is valid and well formed, so I have no idea, where my mistake is.\n\nHere is my code:\n\n // Set the request text.\n string text = @\"<ns2:Envelope xmlns:ns2=\"\"http://www.w3.org/2003/05/soap-envelope\"\">\n <ns2:Header>\n ...\n </ns2:Header>\n <ns2:Body>\n ...\n </ns2:Body>\n </ns2:Envelope>\";\n\n // Create the XDocument object.\n var reqDocument = new XDocument(new XDeclaration(\"1.0\", \"UTF-8\", \"yes\"), XElement.Parse(text));\n\n // Create the web request.\n var request = (HttpWebRequest)WebRequest.Create(@\"https://example.com\");\n request.Method = \"POST\";\n\n // Send the web request.\n using (Stream stream = request.GetRequestStream())\n reqDocument.Save(stream);\n\n // Get the response.\n string response = null;\n using (WebResponse ws = request.GetResponse())\n using (var rd = new StreamReader(ws.GetResponseStream()))\n response = rd.ReadToEnd();\n\n\nI also tried to include the header in the request. Same result.\n\nHere is another (anonymous) example:\n\n<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<ns2:Envelope xmlns=\"http://example.com\" xmlns:ns2=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:ns3=\"http://example.com\">\n <ns2:Header>\n <Auth>\n <UserName>user</UserName>\n </Auth>\n </ns2:Header>\n <ns2:Body>\n <ns3:Customer>\n <CustomerCode>22222222</CustomerCode>\n </ns3:Customer>\n </ns2:Body>\n</ns2:Envelope>" ]
[ "c#", "xml", "soap" ]
[ "Ansible: How to call a playbook from another?", "I have written a simple playbook to print java process ID and other information of that PID \n\n[root@server thebigone]# cat check_java_pid.yaml\n---\n- hosts: all\n gather_facts: no\n\n tasks:\n - name: Check PID of existing Java process\n shell: \"ps -ef | grep [j]ava\"\n register: java_status\n\n - debug: var=java_status.stdout\n\n\nAnd when I am calling this with ansible-playbook check_java_pid.yamlit's working fine. \n\nNow I am trying to call the above playbook from another one but only for a specific host. So I have written the 2nd playbook as below \n\n [root@server thebigone]# cat instance_restart.yaml\n ---\n - hosts: instance_1\n gather_facts: no\n\n tasks:\n - include: check_java_pid.yaml\n\n\nBut while doing ansible-playbook instance_restart.yaml, I am getting below errors\n\n ERROR! no action detected in task. This often indicates a misspelled \n module name, or incorrect module path.\n\n The error appears to have been in \n '/home/root/ansible/thebigone/check_java_pid.yaml': line 2, column 3, but \n may be elsewhere in the file depending on the exact syntax problem.\n\n The offending line appears to be:\n\n ---\n - hosts: all\n ^ here\n\n\n The error appears to have been in \n '/home/root/ansible/thebigone/check_java_pid.yaml': line 2, column 3, \n but may be elsewhere in the file depending on the exact syntax problem.\n\n The offending line appears to be:\n\n ---\n - hosts: all\n ^ here\n\n\nIts saying syntax error but there isn't one really AFAIK as I have executed Playbook check_java_pid.yaml without any issues.\n\nRequesting your help on understanding this issue." ]
[ "ansible" ]
[ "Variable inside variable Azure Pipelines", "I have an issue using Azure Vault to store my secrets and .properties file to store the secret name (so it is not hardcoded in the pipeline) and access it later from the Azure DevOps Pipeline:\n.properties file:\n\n...\nSERVER_ADMIN_SECRET_NAME=server-password-test\n...\n\n\nI am using template pipeline which reads the file and exports all key=values as $(property) with corresponding value as a global property (##vso[task.setvariable variable=$KEY]$VAL). \nWhen I call Azure Key Vault, it returns the key name and export variable $(server-password-test) so it can be used later. However, I am unable to access it, because the variable name is the value of another variable $(SERVER_ADMIN_SECRET_NAME). The solution should be using a variable inside variable $($(SERVER_ADMIN_SECRET_NAME)), but this does not work in Azure Pipelines.\n\nMy pipeline looks like this:\n\n...\n- template: read_properties.yml\n parameters:\n file: config.properties\n\n- task: AzureKeyVault@1\n inputs:\n azureSubscription: 'vault-service-connection'\n KeyVaultName: 'test-playground'\n SecretsFilter: '$(SERVER_ADMIN_SECRET_NAME)'\n\n# TODO : How to fix this??\n- task: CmdLine@2\n inputs:\n script: |\n echo $($(SERVER_ADMIN_SECRET_NAME))\n...\n\n\nDiagram:" ]
[ "azure", "azure-devops" ]
[ "Simple calculation using apache spark", "I have JavaPairRDD (String, Tuple2) out of join operation.\nbelow is the data detail - [Userid, [(name, rating)]]\n\nOutput: [(user2,[(John,5)]), (user3,[(Mac,3), (Mac,2)]), (user1,[(Phil,3), (Phil,4)])]\n\n\nI want to calculate min, max and average for each user. Not sure which transformation/action can help me here." ]
[ "apache-spark" ]
[ "Is 2048x1536 a Common Camera Resolution on Android Devices?", "My app is optimized for handling images with the size of 2048x1536. Am I safe to assume that most modern Android phones with at least a 5MP camera support this resolution?\n\nI will not rely completely on the availability of this resolution, but I wanted to know if this is a good common denominator that covers most common devices." ]
[ "android", "camera", "resolution" ]
[ "Console application using java collection framework and OOPS", "I want to write a Console application using java collection framework and OOPS using eclipse IDE. Please guide me how should i begin and with some sample codes that might be helpful. Thanks in advance" ]
[ "java" ]
[ "How do i plot pair of points from an array", "I have a matrix:\n\nimg = [1 1 2 2 \n 1 1 2 2 \n 3 2 2 2 \n 3 2 2 2 \n 3 3 3 2];\n\n\nfrom which I obtained the array of points:\n\nA = [3 2; 5 4];\n\n\nI need to plot each pair of points (y,x) row-by-row (i.e (3,2), (5,4), etc) and i have tried the code:\n\nfor i = 1: size(A, 2)\n plot(A(i, 1), A(i, 2), '*') \nend\n\n\nThis however does not give the expected positions of the points. Please, what could be wrong with my code and what can I do to make this work?" ]
[ "arrays", "matlab", "plot" ]
[ "jQuery radialIndicator auto (without refreshing page) based on value", "I'm using jQuery radialIndicator.\n\nAs you can see the function will run after page loaded. But now if I have data from database and I want it show live without refreshing the page. How to do that?\n\nHere is the code:\n\nJS\n\n$(function () {\n var getVal = $('#get').html();\n\n var radialObj7 = $('#indicatorContainer7').radialIndicator({\n minValue: 0,\n maxValue: 1250\n }).data('radialIndicator').animate(getVal); //to get the value\n});\n\n\nHTML\n\n<div class=\"prg-cont rad-prg\" id=\"indicatorContainer7\"><div id=\"get\"><?php include('load.php'); ?></div></div>\n\n\nPHP(load.php)\n\n700\n\n\nJS Autorefresh\n\nvar auto_refresh = setInterval\n(\n function ()\n {\n $('#get').load('load').fadeIn(\"slow\");\n }, 1000\n);\n\n\nI tried above my code, the value is auto update but the indicator not change based on value." ]
[ "javascript", "php", "jquery" ]
[ "Varnish http accelerator failed", "I tried to service varnish start but it won't start. \n\n/etc/init.d/varnish: 33: ulimit: error setting limit (operation not permitted)\n/etc/init.d/varnish: 36: ulimit: error setting limit (operation not permitted)\n * Starting HTTP accelerator varnishd [fail]\n/var/run/varnishd.pid: permission denied" ]
[ "linux", "caching", "memcached", "varnish", "ubuntu-server" ]
[ "Registration form won't display input", "I am making a registration form and have made some simple php to process the email as a test:\n\n Hello <?php echo $_POST[\"email\"]; ?>\n\n\nI am using the post method, and although the atom editor was displaying the Hello, it doesn't display the email.\n\nAnd in case anyone needs it, here is the html I am using:\n\n <form action=\"welcome.php\" method=\"post\">\n <div class=\"container\">\n <h1>Register</h1>\n <p>Please fill in this form to create an account.</p>\n <hr>\n\n <label for=\"email\"><b>Email</b></label>\n <input type=\"text\" placeholder=\"Enter Email\" name=\"email\" required>\n\n <label for=\"psw\"><b>Password</b></label>\n <input type=\"password\" placeholder=\"Enter Password\" name=\"psw\" \n required>\n\n <label for=\"psw-repeat\"><b>Repeat Password</b></label>\n <input type=\"password\" placeholder=\"Repeat Password\" name=\"psw- \n repeat\" \n required>\n <hr>\n <p>By creating an account you agree to our <a href=\"#\">Terms & \n Privacy</a>.</p>\n\n <button type=\"submit\" class=\"registerbtn\">Register</button>\n </div>\n\n <div class=\"container signin\">\n <p>Already have an account? <a href=\"#\">Sign in</a>.</p>\n </div>\n </form>" ]
[ "php", "forms", "registration" ]
[ "Jawbone API - faulty node - Service Unavailable", "It seems like the Jawbone API has a problem on one of its nodes. When calling the endpoints below sometimes requests succeed and sometimes fail with an \"Service Unavailable\" response. The requests are the same an I have tried the calls from different machines.\nAny one else experiencing the same problem?\n\nEndpoints: \nhttps://jawbone.com/nudge/api/v.1.1/users/@me/moves\nhttps://jawbone.com/nudge/api/v.1.1/users/@me/workouts" ]
[ "jawbone" ]
[ "UIScrollview resting at incorrect contentOffset (-20 px, not 0px)", "I have a UIScrollview that expands in the y-axis and calls this delegate method: \n\n-(void)scrollViewDidScroll:(UIScrollView *)scrollView {\n\n float yOff = scrollView.contentOffset.y;\n NSLog(@\"y off is %f\", yOff);\n}\n\n\nAs the scrollView is moved to the top (ie. yOff == 0), it actually comes to rest at -20px on most phones and -44px on the iPhoneX. How do I switch this behaviour off, and what are the risks of doing so?" ]
[ "ios", "objective-c", "uiscrollview" ]
[ "Regex in Javascript to match routes", "I'd like to use a regex, to find matching Strings in Javascript.\n\nfor instance:\n\n/bla/* should match /bla/something\n/bla/*/* should match /bla/something/someOhther\n/bla/*/*/blub should match /bla/something/someOhther/blub\n\n\nSo actually the * are placeholder and can be anything. I didn't find a good way to do this in regex, but I'm pretty sure there's an easy way.. Could you assist?" ]
[ "javascript", "regex" ]
[ "DataGridViewComboBoxColumn in two tabs", "I am using C# in Visual Studio 2010. I have two tabs. In each tab, I have a DataGridView (1 and 2) table with a ComboBoxColumn (1 and 2). I would like to make it so that when the user selects an index from the ComboBoxColumn1 in tab1, tab2 indicates that selection in one of the columns of that DataGridView in text form. Does anyone know how to do this? Any help would be much appreciated.\n\nThanks" ]
[ "c#", "visual-studio-2010", "datagridview", "combobox", "datagridcomboboxcolumn" ]
[ "when displaying buttons the sheet behind is not clickable", "I am using a code below to display my \"macro buttons\" in Excel. Once they appear on the screen they work fine but the sheet behind them isn't clickable which prevents some of my macros that involve moving around the sheet from working. Please help!\n\nSub ShowButtons()\n\nButtons.Show\n\nEnd Sub" ]
[ "excel", "vba", "button", "userform", "floating" ]
[ "Connect items to a (specific index in) an array from Interface Builder", "This one ought to be a softball for the Objective-C pros out there:\n\nIs there a way to connect an interface builder object to an element of an NSArray in Objective-C? The connecting would normally be done with IBOutlet, as in:\n\n@interface ViewController : UIViewController {\n IBOutlet UILabel *label1;\n IBOutlet UILabel *label2;\n IBOutlet UILabel *label3;\n //...\n}\n\n\nCan I put the labels in an NSArray and still attach them to objects in interface builder?" ]
[ "objective-c", "interface-builder" ]
[ "List Comprehension - Python 2.7", "I tried to convert the following into a list comprehension, but it's giving me an invalid syntax error. I tried a few solutions such as zipping the combinations, but I can't get it to work.\n\nI'm obviously missing some fundamental understanding of what I can and cannot do with list comprehensions. What is my mistake?\n\nWorks\n\ndef myfun(x, y, z):\n for c in (x,y,z), (x,z,y), (y,x,z), (y,z,x), (z,x,y), (z,y,x):\n print(c)\n\n\nDoes not work\n\ndef myfun(x, y, z):\n [print(c) for c in (x,y,z), (x,z,y), (y,x,z), (y,z,x), (z,x,y), (z,y,x)]" ]
[ "python", "python-2.7", "list-comprehension" ]
[ "Adjust line height in direct labels", "I have a line chart to which I want to add labels. The lables have new lines (\\n). How do I adjust the lineheight of these labels? I've tried adjusting the text in theme, but it has no apparent effect. (I'd like the lineheight to be reduced in this instance).\n\nlibrary(ggplot2)\nlibrary(directlabels)\ntx <- time(mdeaths)\nTime <- ISOdate(floor(tx),round(tx%%1 * 12)+1,1,0,0,0)\nuk.lung <- rbind(data.frame(Time,sex=\"male\\n(men)\",deaths=as.integer(mdeaths)),\n data.frame(Time,sex=\"female\\n(women)\",deaths=as.integer(fdeaths)))\np <- qplot(Time,deaths,data=uk.lung,colour=sex,geom=\"line\")+\n xlim(ISOdate(1973,9,1),ISOdate(1980,4,1)) + \n theme(text = element_text(lineheight = 0.5)) # this seems to have no effect\ndirect.label(p,\"last.points\")" ]
[ "r", "ggplot2", "direct-labels" ]
[ "Ambari server can not start", "I have completed Ambari setup in CentOS 6.5, and started Ambari server successfully. But when I run netstat|grep Ambari command, nothing is shown. \n\nI can not access the Ambari server with my browser. Please give me a hand, many thanks.\n\nAmbari server start status:\n\nps -ef|grep Ambari\nroot 31424 1 10 17:45 pts/0 00:00:27 /usr/lib/jdk1.7.0_45/bin/java -server -XX:NewRatio=3 -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -XX:CMSInitiatingOccupancyFraction=60 -Xms512m -Xmx2048m -Djava.security.auth.login.config=/etc/ambari-server/conf/krb5JAASLogin.conf -Djava.security.krb5.conf=/etc/krb5.conf -Djavax.security.auth.useSubjectCredsOnly=false -cp /etc/ambari-server/conf:/usr/lib/ambari-server/*:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/lib/ambari-server/* org.apache.ambari.server.controller.AmbariServer\n\n\nambari-config-changes.log:\n\n17:48:03,591 INFO [Thread-22] AbstractPoolBackedDataSource:462 - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1bqon9k938saoxzky1njv|3d0c29a1, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> org.postgresql.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1bqon9k938saoxzky1njv|3d0c29a1, idleConnectionTestPeriod -> 50, initialPoolSize -> 3, jdbcUrl -> jdbc:postgresql://localhost/ambari, lastAcquisitionFailureDefaultUser -> null, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 5, maxStatements -> 0, maxStatementsPerConnection -> 120, minPoolSize -> 1, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> select 0, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> true, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]\n17:48:03,676 INFO [Thread-22] JobStoreTX:861 - Freed 0 triggers from 'acquired' / 'blocked' state.\n17:48:03,694 INFO [Thread-22] JobStoreTX:871 - Recovering 0 jobs that were in-progress at the time of the last shut-down.\n17:48:03,694 INFO [Thread-22] JobStoreTX:884 - Recovery complete.\n17:48:03,695 INFO [Thread-22] JobStoreTX:891 - Removed 0 'complete' triggers.\n17:48:03,696 INFO [Thread-22] JobStoreTX:896 - Removed 0 stale fired job entries.\n17:48:03,708 INFO [Thread-22] QuartzScheduler:575 - Scheduler ExecutionScheduler_$_NON_CLUSTERED started." ]
[ "linux", "postgresql", "hadoop" ]
[ "Text Form Twitter API?", "I'm making a Twitter account statistics program that reads tweets, retweet counts, and favorite counts. I could attempt to read the user's Twitter account URL line by line and parse the information from there, but I was wondering if there was a public API or part of Twitter that just spits out the raw data without formatting it all pretty for web browsers? Not only would this be more efficient in the program, but would also be much neater.\n\nIt seems as though API 1.1 uses JSON to fetch data, but I need to make a developer account and create unique identifiers in order to access such data. Is it worth it? Is there some sort of alternative that would be faster and easier?" ]
[ "json", "api", "parsing", "twitter", "format" ]
[ "Adding scroll to GWT SuggestBox", "Does anyone know how to:\n\n1) Add a scroll to the popup created by the SuggestBox?\n\n2) How to customize the looks (CSS) of the SuggestBox efficiently?\n\nI want to make above changes without touching the actual implementation as much as possible.\nAlso this solution should support (IE7-IE8, FF, Chrome).\n\nThanks." ]
[ "css", "gwt", "scroll", "suggestbox" ]
[ "What does PUSHing an address do before execution reaches another function with a RET?", "Why we are storing SECONDRELOCATION value in AX and then why we are pushing AX in stack\n\ni am going through basic understanding of MSDOS programming, i \nam unable to understood how and why control is being transferred between three OFFSETS (at line1,line43 and line53. These lines are explicitly indicated by me as comments) \n\n CLI\n MOV AX,CS\n MOV SS,AX\n MOV SP,OFFSET LOCSTACK ;line4\n\n ASSUME SS:SYSINITSEG\n\n IF NOT ALTVECT\n STI ; Leave INTs disabled \n ;for ALTVECT\n ENDIF\n LOCSTACK LABEL BYTE\n\n CALL MSDOS\n MOV WORD PTR [DOSINFO+2],ES ; SAVE POINTER TO DOS \n ;INFO\n MOV WORD PTR [DOSINFO],DI\n\n IF NOT IBM\n IF NOT IBMJAPVER\n CALL RE_INIT ; Re-call the BIOS\n ENDIF\n ENDIF\n\n STI\n CLD\n\n IF HIGHMEM\n PUSH DS\n MOV BX,DS\n ADD BX,10H\n MOV ES,BX\n PUSH CS\n POP DS\n XOR SI,SI\n MOV DI,SI\n MOV CX,OFFSET SYSSIZE + 1\n SHR CX,1 ; Divide by 2 to get \n ;words\n REP MOVSW\n POP DS\n PUSH ES\n MOV AX,OFFSET SECONDRELOC ;line43 (why we are storing offset value \n ;of SECONDRELOC in AX, if we are moving \n ;there already ofter RE_INIT PROC one more \n ;point is that why we are PUSHing AX value \n ;in stack)\n PUSH AX ;<-------\n RE_INIT PROC FAR\n ....some code here..... \n RET\n RE_INIT ENDP\n\n SECONDRELOC:\n MOV AX,CS\n CLI\n MOV SS,AX\n MOV SP,OFFSET LOCSTACK ;line53\n STI" ]
[ "assembly", "x86-16" ]
[ "startActivity() on a RecyclerView Item", "I need to start an activity based on the item a user clicks on a RecyclerView. The code below has the position as a reference. Does anyone knows how to get this done? I need something like Intent intent = new Intent (MainActivity.this, Target.class). The target class changes depending on the item clicked of course. \n\n mRecyclerView.addOnItemTouchListener(\n new RecyclerItemClickListener(this, new RecyclerItemClickListener.OnItemClickListener() {\n @Override public void onItemClick(View view, int position) {\n\n Intent intent = new Intent(MainActivity.this, ???);\n startActivity(intent);\n\n }\n })\n );" ]
[ "android", "onitemclick", "android-recyclerview" ]
[ "Turn strings in list to object(?)", "Sorry for the unclear title, but i basically want to go from this:\n['StraightPipe', 'BentPipe', 'BentPipe', 'CrossPipe']\n\nTo this:\n[StraightPipe, BentPipe, BentPipe, CrossPipe]" ]
[ "python-3.x" ]
[ "Newly installed theme on sugarcrm tabs not functioning", "I am trying to install Modern Aqua theme on SugarCRM 6.4.0. But few tabs are not functioning. If I enable the default theme it simply works fine. Could you please help me how to fix the this issue?\nI have copied Modern Aqua theme to /theme/ directory on sugarcrm root folder. Then I have modified the themedef.php same as default theme themedef.php file.\nThen I have renamed the default theme from Sugar5 to Sugar5_off\nThen I have modified the config.php file variable as below:\n'default_theme' => 'ModernAqua',\nDone!\nIt simply loads great for me with new installed theme. But the thing is all Menu tabs are not functioning. Only Calender, Documents, Email & campaign tabs are working. Other tabs like Home, Leads, opportunities, Contacts, Accounts etc. are not working. If I click on the tabs nothing will reflect.\nCould you please assist me in resolving this issue." ]
[ "sugarcrm" ]
[ "How to make Text inside Div Unselectable/uncopyable?", "I have made a slider with simple combined JavaScript and CSS. I want to make the text inside the <div> unselectable. even if it's selected, I want it to be selected as one <div> or as an object, how do I achieve this?\n\nIf possible I don't want to use any jQuery library usage" ]
[ "javascript", "html", "css" ]
[ "bootstrap table-bordered remove horizontal line", "I would like to remove the bootstrap table-bordered horizontal line and keep the vertical line.\n\nI have tried many solutions and done many of the research but I still cannot find the solution.\n\n\n\n<div class=\"container\">\n <div class=\"row\">\n <div class=\"col-md-12\">\n <table class=\"table table-bordered\">\n <thead>\n <tr>\n <th>First Name</th>\n <th>Last Name</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Otto</td>\n <td>@mdo</td>\n </tr>\n <tr>\n <td>Otto</td>\n <td>@TwBootstrap</td>\n </tr>\n <tr>\n <td>Thornton</td>\n <td>@fat</td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n</div>" ]
[ "html", "css", "twitter-bootstrap" ]
[ "for-loop stuck in endless loop", "Hi I know this will be quite an easy question but i'm quite a beginner yet.\n\nI was practicing on \"for\"-loops on C and wanted to write a program that asks you to input a number and that recognises whether your input is really a number. in case it isn't a number the program has to reiterate the question until the input is actually a number.\n\nThe code i came up with is the following:\n\n#include <stdio.h>\n\nint main () {\n float a;\n int n;\n for(n = 0; n == 0;) {\n printf(\"Insert your number:\\n\");\n n = scanf(\"%f\", &a);\n }\n printf(\"You wrote a number!\\n\");\n}\n\n\nn is supposed to be the number of conversions the scanf function performed, so when that value is 1 we know the user actually wrote a number and not a character. this code looked fine but when i ran it I found a strange error. if I put a number in it just runs smoothly and straight out tells me i wrote a number. If i try to put a character in, let's say for example the letter 'a', it goes in an infinite loop and just keeps prinitng \"Insert your number:\" in the terminal endlessly.\n\nit looks like he understands that n is not equal to one so it starrts executing the commands in the for{} function but for some reason it keeps skipping the \"scanf\" command. thus the n-value never changes and the program keeps running the cicle for ever.\n\nWhat causes this error? and how do I fix it?" ]
[ "c", "for-loop" ]
[ "Can't make Django Tastypie create resources with deeply related resources", "My models look like:\n\nclass LocAddress(models.Model):\n property_number = models.CharField(max_length=8)\n street_name = models.CharField(max_length=50)\n postal_code = models.CharField(max_length=6)\n city_name = models.CharField(max_length=50)\n\nclass LluOrder(models.Model):\n # [...]\n address = models.ForeignKey(LocAddress, db_column='address')\n\nclass OrderItem(models.Model):\n # [...]\n llu = models.ForeignKey(LluOrder, db_column='llu', null=True, blank=True)\n\n\nAnd resources:\n\nclass LocAddressResource(ModelResource):\n class Meta(ModelResource.Meta):\n queryset = LocAddress.objects.all()\n\n\nclass LluOrderResource(ModelResource):\n address = fields.ToOneField(LocAddressResource, 'address', full=True)\n\n class Meta(ModelResource.Meta):\n queryset = LluOrder.objects.all()\n\n\nclass OrderItemResource(ModelResource):\n llu = fields.ToOneField(LluOrderResource, 'llu', full=True, null=True)\n\n class Meta(ModelResource.Meta):\n queryset = OrderItem.objects.all()\n\n\nWhen I'm posting following data to `http://localhost:8000/api/v1/orderitem/:\n\n{\n \"someotherattr\": 12,\n \"llu\":{\n \"address\":{\n \"city_name\":\"Warszawa\",\n \"postal_code\":\"05-600\",\n \"property_number\":\"34\",\n \"street_name\":\"Gr\\u00f3jeckas\"\n }\n }\n}\n\n\nI get IntegrityError:\n\nTraceback (most recent call last):\n File \"/Users/mmetelko/.virtualenvs/sor_interface/lib/python2.7/site-packages/tastypie/resources.py\", line 192, in wrapper\n response = callback(request, *args, **kwargs)\n File \"/Users/mmetelko/.virtualenvs/sor_interface/lib/python2.7/site-packages/tastypie/resources.py\", line 397, in dispatch_list\n return self.dispatch('list', request, **kwargs)\n File \"/Users/mmetelko/.virtualenvs/sor_interface/lib/python2.7/site-packages/tastypie/resources.py\", line 427, in dispatch\n response = method(request, **kwargs)\n File \"/Users/mmetelko/.virtualenvs/sor_interface/lib/python2.7/site-packages/tastypie/resources.py\", line 1165, in post_list\n updated_bundle = self.obj_create(bundle, request=request, **self.remove_api_resource_names(kwargs))\n File \"/Users/mmetelko/.virtualenvs/sor_interface/lib/python2.7/site-packages/tastypie/resources.py\", line 1777, in obj_create\n self.save_related(bundle)\n File \"/Users/mmetelko/.virtualenvs/sor_interface/lib/python2.7/site-packages/tastypie/resources.py\", line 1918, in save_related\n related_obj.save()\n File \"/Users/mmetelko/.virtualenvs/sor_interface/lib/python2.7/site-packages/django/db/models/base.py\", line 463, in save\n self.save_base(using=using, force_insert=force_insert, force_update=force_update)\n File \"/Users/mmetelko/.virtualenvs/sor_interface/lib/python2.7/site-packages/django/db/models/base.py\", line 551, in save_base\n result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)\n File \"/Users/mmetelko/.virtualenvs/sor_interface/lib/python2.7/site-packages/django/db/models/manager.py\", line 203, in _insert\n return insert_query(self.model, objs, fields, **kwargs)\n File \"/Users/mmetelko/.virtualenvs/sor_interface/lib/python2.7/site-packages/django/db/models/query.py\", line 1576, in insert_query\n return query.get_compiler(using=using).execute_sql(return_id)\n File \"/Users/mmetelko/.virtualenvs/sor_interface/lib/python2.7/site-packages/django/db/models/sql/compiler.py\", line 917, in execute_sql\n cursor.execute(sql, params)\n File \"/Users/mmetelko/.virtualenvs/sor_interface/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py\", line 52, in execute\n return self.cursor.execute(query, args)\nIntegrityError: null value in column \"address\" violates not-null constraint\n\n\nAm I missing something? What sould I override to make tastypie creating nested LocAddress resource?" ]
[ "python", "django", "tastypie" ]
[ "Away3D with Starling", "I have an Away3D 4.0 application with UI made in old flash display API, which can be only partly hardware accelerated.\n\nOn PC works fine, but the frame rate of UI on mobile devices is too low, hence I am porting it to Starling.\n\nSo I tried using both Away3D and Starling, but they don't work together (it compiles but there are run-time errors). What do I have to change? Specifically or generally for maybe another 2D library such as ND2D. Are there libraries that support this out of the box?\n\nEdit: First I add an Away3D content and there are no errors. When initialising Starling, the error is in Starling.as (a library class) on line 249. I also tried this as someone suggested, but didn't make any difference (also information is 3 months old and libraries are being updated).\n\nEdit 2: The error was caused by having a different enableDepthAndStencil value as is in Away3D, which is hardcoded in Sparling as false, because it doesn't really need it. Well, after \"fixing\" this there are no runtime errors: Away 3D content displays, but then I add Starling and the canvas becomes black. I guess I will have to dive into the Away3D source." ]
[ "actionscript-3", "away3d" ]
[ "How to solve .htaccess issue for a live server that's working on localhost?", "It's working perfectly on localhost but not working on client live server. I used this code to rewrite the url: \n\n<IfModule mod_rewrite.c> \nRewriteEngine On \nRewriteCond %{REQUEST_FILENAME} !-f \nRewriteRule ^([^\\.]+)$ $1.html [NC,L] \n</IfModule>\n\n\nbut it's not working." ]
[ ".htaccess", "mod-rewrite" ]
[ "Wrap a crystal object into a custom root object in JSON", "I have a class like the following\n\nclass Foo \n JSON.mapping(\n bar: String,\n baz: String,\n )\nend\n\n\nI know that I can wrap single attributes in JSON objects by specifying {root: \"name of node\"} inside of JSON.mapping. But is there any way to do it for the entire Foo class?\n\nSo that the output would look like this?\n\n{\n \"foo\": {\n \"bar\": \"\",\n \"baz\": \"\"\n }\n}" ]
[ "json", "crystal-lang" ]
[ "CodeIgniter : 3.0 database migration through composer", "Iam working on CodeIgniter database Migrations.\nI create table using Migrate.php controller in my project and it's work fine.\n\n\n Question is it possible to migrate database using cmd like laravel database Migrations?." ]
[ "php", "mysql", "codeigniter", "database-migration", "codeigniter-3" ]
[ "IIS-Express SSL settings", "I use Visual studio 2019. When I start debugging my web app I get Error:\n\n\n HTTP Error 403.4 – Forbidden The page you are trying to access is\n secured with Secure Sockets Layer (SSL).\n\n\nI have already set in project properties SSL enabled to false. I also deleted applicationhost.config in .vs\\config. I also deleted applicationhost.config in location C:\\Users...\\Documents\\IISExpress\\config.\n\nBut all with no success. I am still geting the same error.\nWhat am I missing?" ]
[ "visual-studio", "iis", "iis-express" ]
[ "What's the way to just calculate a variable when it's called in a function?", "It's very difficult to ask this question to explain my real problem, but i try it here. I have a function, inside of it are some variables, and inside the function is another function, which is an always changing function. This may be complicated for first look, but let me explain in this code:\n\nvar a, b, x;\n\nfunction myF(y, fn) {\n x = y;\n a = x * 2;\n b = x * 3;\n //in my real code a and b are much complicated, and there are 10 variables,\n //and almost all of them are always changing (depending on scroll)\n //i need them to be defined, but i don't always use them\n //how which is used depends on the fn.\n return fn();\n}\n\nfunction innerOne() {\n return a * x;\n}\n\nfunction innerTwo() {\n return b * x;\n}\n\nmyF(3, innerOne);\n//when this function called, the b is also calculated, but never used\nmyF(6, innerTwo);\n//same situation, but with a\n\n\nI want to improve my code's performance, by not calculating actually unnecesarry variables, so i want to know if are there a way to check the elements used by fn(), and just calculate those.\n\nMy original code looks like this" ]
[ "javascript" ]
[ "SwingWorker issue, method doInBackground not executed?", "Sometimes the doInBackgorund() method of my SwingWorker seems not to be executed, it goes directly to the done() method without saving or printing anything on some of my clients machines, so i suppose it's a random thing , and i can't figure out why. Here 's my code : \n\npublic class saveCmdWorker extends SwingWorker<Integer, Integer> {\n\n Order ord;\n\n public saveCmdWorker(Order ord) {\n this.ord = ord;\n }\n\n @Override\n public Integer doInBackground() {\n if(999 != ord.getCaissier().getIdCaissier()) \n saveCmd(ord); // database queries\n else\n JOptionPane.showMessageDialog(null,\"Error\",JOptionPane.WARNING_MESSAGE);\n\n if(ord.isIsProd() == false){\n try {\n // print via serial port\n Printer.print(ord, false, Restaurant.numCaisse); \n } catch (Exception ex) {\n PosO2.errorLogger.log(Level.SEVERE, \"Printing error\", ex);\n\n }\n }\n try {\n\n Printer.printFacture(ord, false);\n\n if(btnDuplicata.getForeground() == Color.red)\n Printer.printFacture(ord, true);\n\n\n } catch (Exception ex) {\n PosO2.errorLogger.log(Level.SEVERE, \"Printing error\", ex);\n }\n\n return 1;\n }\n\n @Override\n protected void done() {\n try {\n\n btnDuplicata.setForeground(Color.black); \n ARendre = 0.0;\n ord.clear();\n\n for (int j = 0; j < tab_paiement.size(); j++) {\n tab_paiement.get(j).setVisible(true);\n }\n\n montantRestant.setBackground(Color.red);\n } catch(Exception e) {\n PosO2.errorLogger.log(Level.SEVERE, \"Refresh Error\", e);\n }\n }\n}\n\n\nI execute this worker via this actionlistener :\n\nActionListener encaissListener = new ActionListener() {\n\n @Override\n public void actionPerformed(ActionEvent e) {\n\n worker = new saveCmdWorker(cmd);\n worker.execute();\n\n }\n };\n\n\nI don't have any logs available so i assume no exception is caught. I saw that a JOptionPane was fired in the doInBackground()(consider as ui modification in an other thread?) but the problem exists when the application doesn't go in the else statement. Can this be the cause of my problems? I don't have this bug on my computer, it just works fine." ]
[ "java", "swing", "swingworker" ]
[ "adding to a list inside a custom class, then convert it to json String", "I created these two classes to save a list in sharedpreferences.\nMy questions:\n\nhow to access the list and add to it? I tried Segments.segments but no good.\nhow do I convert the list tojson using the class?\nhow to retrieve the items inside the list.\n\nI saw so many examples and videos, but I still don't get it.\nclass Segment {\n final String chapter;\n final String from;\n final String to;\n\n Segment({this.chapter, this.from, this.to});\n\n factory Segment.fromJson(Map<String, dynamic> json) {\n return Segment(\n chapter: json['chapter'],\n from: json['from'],\n to: json['to'],\n );\n }\n\n Map<String, dynamic> toJson() {\n return {\n 'chapter': chapter,\n 'from': from,\n 'to': to,\n };\n }\n}\n\n&\nclass Segments {\n List<Segment> segments;\n\n Segments({this.segments});\n\n Segments.fromJson(Map<String, dynamic> json) {\n if (json['segments'] != null) {\n segments = [];\n json['segments'].forEach((v) {\n segments.add(new Segment.fromJson(v));\n });\n }\n }\n\n Map<String, dynamic> toJson() {\n final Map<String, dynamic> data = new Map<String, dynamic>();\n if (this.segments != null) {\n data['segments'] = this.segments.map((v) => v.toJson()).toList();\n }\n return data;\n }\n}" ]
[ "json", "list", "flutter", "dart", "sharedpreferences" ]
[ "Cleaning Twitter Data in Excel", "I am working on a project for school, but now with online instruction it is much harder to get help. I have a dataset in excel and there are links and emojis that I need to remove.\n\nThis is what my data looks like now. I want to get rid of the https://t.co/....... link, the emojis and some of the weird characters.\n\n\n\nDoes anyone have any suggestions on how to do this in excel? or maybe python?" ]
[ "python", "excel", "twitter" ]
[ "Fragment vs Activity with LinearLayout in Android", "I have a dynamic UI that I need to generate and I would like to know what the best approach would be to do this and why? The application that I need to make will either way only have a single activity in which to display various different views which are generated by code, so not in an XML file.\n\nSo basically I want to draw one set of views and have a user interact with them (textview, button, radio button, edittexts etc). Then save the data he generated, clear the canvas or screen and within the same activity generate the next set of views for the user to interact with.\n\nI have done extensive research and I know that I can use either a Fragment or an Activity with a LinearLayout to achieve this, but I am not sure which would be better and why?\n\nThanks,\nWihan" ]
[ "android", "android-fragments", "android-linearlayout" ]
[ "SQL query (in SQL, relational algebra and tuple relational calculus)", "Im doing a test exam where I've gotten stuck on one particular query, in both its SQL code, relational algebra and tuple relational calculus.\n\nThe query states:\nFind the (city,state) pairs which house a branch of every type which is listed in the Branch\nrelation.\n\nWhere Branch is:\n\nBranch_ID (Primary key)\nBranch_City\nBranch_State\nBranch_Type\n\n\nand City is:\n\nCity_Name (Primary key)\nState_Name (Primary key)\nPopulation\n\n\nAnd Branch_City and Branch_State is a foreign key to City_Name and State_Name respectively.\n\nThe \"rules\" are that aggregate functions, such as COUNT,MAX etc may not be used.\n\nThe query must be \"understood\" by MySQL and PostgreSQL however functions like EXCEPT, INTERSECT available in PostgreSQL but not in MySQL can be used.\n\nNo subqueries in the FROM clause\n\nAs said, it would be greatly appreciated if answers could be provided for sQL, relational algebra and tuple relational calculus. Those questions has stalled me.\n\nThanks in advance!" ]
[ "sql", "postgresql", "relational-algebra", "relational-division", "tuple-relational-calculus" ]
[ "Toolbar is not visible in lollipop?", "Toolbar is visible in android 4.4 and previous version.when I install my App in lollipop version,Toolbar is hide by the Frame layout. How to fix this problem?\n\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"match_parent\"\nandroid:orientation=\"vertical\">\n <android.support.v4.widget.DrawerLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n xmlns:tools=\"http://schemas.android.com/tools\"\n android:id=\"@+id/drawer_layout\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:fitsSystemWindows=\"true\"\n tools:openDrawer=\"hide\">\n <LinearLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:orientation=\"vertical\">\n <android.support.v7.widget.Toolbar\n android:id=\"@+id/toolbar\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"?attr/actionBarSize\"\n android:background=\"@color/white\"\n app:theme=\"@style/ThemeOverlay.AppCompat.ActionBar\"\n app:popupTheme=\"@style/ThemeOverlay.AppCompat.Light\"\n >\n</android.support.v7.widget.Toolbar>\n\n<FrameLayout\n\n android:id=\"@+id/content_frame\"\n android:layout_below=\"@+id/toolbar\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\" />\n\n\n\n\nJava code:\n\n Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n getSupportActionBar().setDisplayShowTitleEnabled(false);\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowCustomEnabled(true); // enable overriding the default toolbar layout\n getSupportActionBar().setDisplayShowTitleEnabled(false);" ]
[ "android", "toolbar" ]
[ "AfxGetInstanceHandle() triggers an assertion failure", "I am using MFC in my C++ program (using Visual Studio 2008). I have to call AfxGetInstanceHandle() at the begining of my program.\n\nThis function triggers a break point:\n\nAFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()\n{ ASSERT(afxCurrentInstanceHandle != NULL);\nreturn afxCurrentInstanceHandle; }\n\n\nThe ASSERT statement fails. Is there something special that needs to be done in order to initialize the afxCurrentInstanceHandle before we try to access it?\n\nPS: I am using MFC in a shared dll.\n\nEDIT\n\nMy code is like that:\n\nint _tmain(int argc, _TCHAR* argv[])\n{\n\n CoInitialize(NULL);\n AfxGetInstanceHandle();\n return 0;\n}\n\n\nI would like to use the InstanceHandle in order to initialize a CComModule and then use it to manipulate com object." ]
[ "c++", "visual-studio", "com", "mfc" ]
[ "React native setState updates array with empty object", "I have a class constructed as follows -:\n\n constructor(props) {\n super(props);\n this.state = {\n name: '',\n guestsStore:[],\n };\n }\n\n\nAnd I have a form that takes a text input and that is supposed to add the submitted name to the guestsStore array by calling this.handleNameSubmit\n\nThe following code doesn't work even if I have seen it in multiple code examples. It updates state but with an empty object-:\n\n handleNameSubmit = (name) => {\n this.setState({\n guestsStore: [...this.state.guestsStore, name],\n });\n };\n\n\nThe following code works and updates state with the name.\n\nhandleNameSubmit = (name) => {\n this.setState({\n guestsStore:[...this.state.guestsStore, {name:this.state.name}],\n })\n }\n\n\nI am new to React Native and would like to understand why this happens. Why in this case does the first code example fail even if it works in so many other cases" ]
[ "javascript", "reactjs", "react-native" ]
[ "Refresh the contents of RootViewController when Back button is Pressed in Navigationbar", "I have a problem in uinavigationcontroller. In my application i have two view controllers VC1 and VC2. VC1 is the rootviewcontroller. In VC1 i have one textfield and one button to choose the value from the VC2. If the user clicks the button in VC1 it will navigate the user to VC2 and allow him to select any value from the tableview.\n\nIf the user selects any row in the list, i simply pops one view controller and the user is redirected to rootviewcontroller(VC1). Now i will set that selected option in the textfield in VC1. \n\nBut i don't know how to update the value if the user clicks the back button or selects any option in the list?" ]
[ "ios", "uinavigationcontroller" ]
[ "C# Async Sockets (*Async, SocketAsyncEventArgs)", "I've been working with the .NET 3.5 asynchronous socket API and found that ll of the *Async methods return a bool, which is false if the operation completed synchronously. \n\nI'm a little confused as to how/why this could happen. It's not always an error condition, right? The MSDN examples immediately call the event handler manually in this case. Is that a good practice to follow?\n\nAdditionally, when I call Socket.SendAsync for instance, and attach a handler to SocketAsyncEventArgs.Completed, am I guaranteed that \"Completed\" is fired (or SendAsync returns false) only after all of my data has been sent? Or is it possible that it will call my handler somewhere in the middle?" ]
[ "c#", "sockets", "asynchronous" ]