texts
sequence | tags
sequence |
---|---|
[
"Header reapting itself in react",
"I want to have ONE a header above all the other stuff, but it just get repeated. I tried to but the header div above the section also but it just errored.\nimport React from "react";\nexport const Album = (props) => {\n return (\n <section className="musicList">\n <div clasName="header">New albums and singles</div>\n <div className="card">\n <div className="images">\n <a className="album-link" href={props.albumUrl} target="_blank"><img className="image" src={props.image} /></a>\n <div className="middle">\n <div className="icons">\n <img src="icons/heart.svg" className="heart"></img>\n <img src="icons/play.svg" className="play"></img>\n <img src="icons/dots.svg" className="dots"></img>\n </div>\n </div>\n\n\n </div>\n\n\n <div className="song">\n {props.song}\n </div>\n\n <div className="artist">\n {props.artist.map((artists) => {\n return <span key={artists.id}><a className="artist-link" href={artists.external_urls.spotify} target="_blank">{artists.name}</a><span>,&nbsp;</span></span>\n\n })}\n </div>\n\n </div>\n\n </section>\n )\n};"
] | [
"javascript",
"reactjs"
] |
[
"Click file:// url does not download the file in browser?",
"We have a software on server A (192.168.1.10) and generates an excel file (123.xlsx), now, we have a asp.net website on server B. The site generates a link for that file:\n\n<a target='_blank' href='file://192.168.1.10/share/123(copy 1).xlsx'>Data</a>\n\n\nWhen the page loads, click the link, for some reasons, the browser does not either asks whether save the file or shows the file directly.\n\nHowever, if I put the url in browser directly, it works.\n\nWhat causes this? How to make it works for clicking?"
] | [
"html",
"asp.net"
] |
[
"How can i get Internet certificates into Notes ID File programatically?",
"Blockquote\n\nI have imported my internet certificate into my Notes ID File. I am interested to use an Notes application that get this certificate to make a digital signature of some data o file. Can I access to this internet certificate whithin Notes?\n\nThank you\n\nBlockquote"
] | [
"x509certificate",
"lotus-domino"
] |
[
"Issue when resizing browser windows",
"I'm having a strange issue on one of my website which is driving me mad.\n\nWhen you resize the browser window to the point where you get the scroll bars a white void is created. It seems to be coming from the body tag but I can seem to figure out why.\n\nUpdate : the website addess is http://www.computerrepairssolihull.co.uk/"
] | [
"html",
"css"
] |
[
"Django template - hide a form if a specific item is selected in another form",
"I have two forms like these (each one is a drop-down menu), used for creating a model:\n\n<label for=\"id_section\" ><strong>text</strong></label> \n\n{{ form.section }} \n\n<label for=\"id_area\" ><strong>text</strong></label>\n\n{{ form.area }}\n\n\nI want to hide the second form if a specific item in the first one is selected.\nThere is a way to accomplish this using django tags and filters and javascript, and not only with javascript?\n\n[edit] Solution with js:\n\n\n\nvar selectOne = document.getElementById(\"id_section\");\n\nselectOne.addEventListener(\"change\", function() {\nif (this.options[this.selectedIndex].value == 'value'){\n document.getElementById('id_area').style.display = \"none\";\n} else {\n document.getElementById('id_area').style.display = \"inline\";\n }\n }, false);"
] | [
"javascript",
"html",
"django",
"forms",
"hide"
] |
[
"Not the normal Failed to decrypt protected XML node \"DTS:Password\"",
"I got the:\n\n\n Failed to decrypt XML node \"DTS:Password\" with error 0c8009000B \"Key\n not valid for use in specified state.\" bla bla bla\n\n\nerror on the server today. The thing is this is a job that has been in production since 3/16/14 running daily and never had this issue before. I had the server re-run it with no changes and it worked.\n\nI have searched on this error and all I can find are questions from people who don't know/understand about protection level settings. I could not find anything about a production job that throws this error after working for 5 months. I would like to figure out why this happened so I can prevent it from happing again. I don't like having random ticking time bombs in my system. Any ideas/suggestions would be appreciated. Thanks!"
] | [
"sql-server",
"ssis"
] |
[
"Flink - using rebalance affect event time processing",
"Using rebalance before assign watermark function affects event time processing\n\nConfiguration config = new Configuration();\n StreamExecutionEnvironment see = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(config);\n\n see.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);\n\n\n DataStream<String> stream = see\n .addSource(new FlinkKafkaConsumer<>(\"testTopic3\", new SimpleStringSchema(), properties));\n\n\n stream.rebalance()\n .map(event->{\n JSONObject jsonEvent = new JSONObject(event);\n Event formedEvent = new Event();\n formedEvent.setTimestamp(Long.parseLong(jsonEvent.getString(\"time\")));\n System.out.println(\"formed event : \"+formedEvent.getTimestamp());\n return formedEvent;\n })\n .assignTimestampsAndWatermarks(new TimestampExtractor())\n .keyBy(event->{\n return \"1\";\n }).window(SlidingEventTimeWindows.of(Time.seconds(5), Time.seconds(5)))\n .trigger(new TriggerFunc())\n .process(new ProcessWindowFunction());\n\n see.execute();\n\n\nThe event time triggers don't trigger when I use rebalance. Once it is removed, it seems to work fine. Is there a reason why this does not work?\n\nThe following seems to work:\n\nConfiguration config = new Configuration();\n StreamExecutionEnvironment see = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(config);\n\n see.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);\n\n\n DataStream<String> stream = see\n .addSource(new FlinkKafkaConsumer<>(\"testTopic3\", new SimpleStringSchema(), properties));\n\n\n stream\n .map(event->{\n JSONObject jsonEvent = new JSONObject(event);\n Event formedEvent = new Event();\n formedEvent.setTimestamp(Long.parseLong(jsonEvent.getString(\"time\")));\n System.out.println(\"formed event : \"+formedEvent.getTimestamp());\n return formedEvent;\n })\n .assignTimestampsAndWatermarks(new TimestampExtractor())\n.rebalance()\n .keyBy(event->{\n return \"1\";\n }).window(SlidingEventTimeWindows.of(Time.seconds(5), Time.seconds(5)))\n .trigger(new TriggerFunc())\n .process(new ProcessWindowFunction());\n\n see.execute();\n\n\nAdding my Trigger Function. My trigger function is not doing much. Just printing a statement\n\npublic class TriggerFunc extends Trigger<Event, TimeWindow>{\n\n private static final long serialVersionUID = 1L;\n @Override\n public TriggerResult onProcessingTime(long time, TimeWindow window, TriggerContext ctx) throws Exception {\n System.out.println(\"On processing time purging : \" + window.getStart());\n return TriggerResult.FIRE;\n }\n\n @Override\n public TriggerResult onEventTime(long time, TimeWindow window, TriggerContext ctx) throws Exception {\n System.out.println(\"On eventTime time\");\n return TriggerResult.FIRE_AND_PURGE;\n }\n\n @Override\n public void clear(TimeWindow window, TriggerContext ctx) throws Exception {\n\n }\n\n @Override\n public TriggerResult onElement(ThresholdEvent element, long timestamp, TimeWindow window, TriggerContext ctx)\n throws Exception {\n System.out.println(\"On element\");\n return TriggerResult.CONTINUE;\n }\n}"
] | [
"apache-flink",
"flink-streaming"
] |
[
"rails: what are activeadmin 'comments on resources'",
"When you first install activeadmin on a rails application, there is a tab called \"Comments\" in the /admin dashboard.\n\nI'm surprised to see this, because I don't have a table as such in my database.\n\nWhat is this for exactly? The documentation says\n\n\n By default Active Admin includes comments on resources. Sometimes,\n this is undesired.\n\n\nCan someone elaborate what's meant by 'comments on resources'"
] | [
"ruby-on-rails",
"activeadmin"
] |
[
"Add attribute to tinymce formats",
"I'm going to add dir:left to code tags.\n\n<code dir=\"left\">my inline code </code>\n\n\ni know from here how to add style to custom format but i need to add this attribute (not style) to all code tags"
] | [
"tinymce-4"
] |
[
"While add firesbase via cmd $flutter pub add firebase_auth, the file generated_plugin_registrant.dart shows error (in Red color)",
"In generated_plugin_registrant.dart file\nOnly for this thing have no error. If the "_web" lines are comes when I install firebase via cmd\nvoid registerPlugins(Registrar registrar) {\n FirebaseCoreWeb.registerWith(registrar);\n registrar.registerMessageHandler();\n}"
] | [
"firebase"
] |
[
"Does the IP address of a mobile device change as it connects to different cell towers?",
"Does the IP address change as a phone moves area and connects to different cell towers?"
] | [
"ip-address"
] |
[
"EXC Bad Access on Button Click",
"Thoroughly stumped. \nI open an action sheet with a view controller in it, and when I click a button in the view controller to launch an SLComposeViewController, I get the error.\n\nThis is how I initialize the action sheet with the view controller in it:\n\nUIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil\n delegate:self\n cancelButtonTitle:nil\n\n destructiveButtonTitle:nil\n otherButtonTitles:@\"1\",@\"2\",nil];\n[actionSheet setBounds:CGRectMake(0,0, 320, 285)];\nExportVC*innerView = [[ExportVC alloc] initWithNibName:@\"ExportVC\" bundle:nil];\ninnerView.view.frame = actionSheet.bounds;\n[actionSheet addSubview:innerView.view];\n\n[actionSheet showFromTabBar:self.tabBarController.tabBar];\n\n\nThis is the ExportVC.h file:\n\n#import <UIKit/UIKit.h>\n#import <Social/Social.h>\n\n\n@interface ExportVC : UIViewController{\n}\n\n- (IBAction)tweet:(id)sender;\n\n\n@end\n\n\nAnd here's the ExportVC.m file, where the IBAction launches the SLComposeViewController:\n\n#import \"ExportVC.h\"\n#import <Social/Social.h>\n\n\n@interface ExportVC ()\n\n@end\n\n@implementation ExportVC\n\n\n\n-(IBAction)tweet:(id)sender{\nNSLog(@\"button works\");\nif ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])\n{\n SLComposeViewController* tweetSheet = [SLComposeViewController\n composeViewControllerForServiceType:SLServiceTypeTwitter];\n [tweetSheet setInitialText:@\"Hi\"];\n [self presentViewController:tweetSheet animated:YES completion:nil];\n}\n}\n\n\nThe connections are fine. I don't have anything in the viewdidload of the ExportVC. Whenever I click the button attached to the \"tweet\" action however, I get the EXC Bad Access error.\nAny help would be appreciated."
] | [
"xcode",
"memory-management",
"exc-bad-access"
] |
[
"Deferred observable call",
"I have 5 observables say\n\nObservable<String> obs1 = getObs1();\nObservable<String> obs2 = getObs2();\nObservable<String> obs3 = getObs3();\nObservable<String> obs4 = getObs4();\nObservable<String> obs5 = getObs5();\n\n\nThe implementation of getObsX() is to do a network call through RxNetty.\n\nSince all are independent calls I need to start them at the same time.\n\nOn completion of obs1 and obs2, I need to start call getObs6() which depends on obs1 and obs2. I can do something like this.\n\n Observable.zip(obs1, obs2, (obs1, obs2) -> {\n return getObs6()\n })\n\n;\n\n\nOnce I get obs6, then I need to use obs1, obs2, obs3, obs4, obs5 and obs6 to fetch obs7.\n\nSo how can I subscribe obs1 twice, once to get obs5 and another"
] | [
"rx-java",
"reactive-programming",
"rx-java2"
] |
[
"MODX - why getting {$modx->getOption('')} on frontend?",
"I'm not an expert in MODX. But I work with PHP / Wordpress.\n\nI got one MODX website to fix and I'm getting multiple pieces of text like: {$modx->getOption('<identifiers>')} on the frontend.\n\nCould you give me a hint on how to start solving this?\n\nI think that for some reason, that piece of code is not getting rendered on the frontend when it should do it."
] | [
"php",
"modx",
"modx-revolution",
"modx-templates"
] |
[
"Android activity lifecycle: state order when new activity starts",
"If I launch Activity2 from Activity1 by this way: startActivity(Activity2); what executes first: onStop() (Activity1) or onStart() (Activity2) ?\n\nDo they work simultaneously or in turn? If one after another, what is first?\n\nSo in general : what is the activity's state order when first activity starts second, if this order exists?"
] | [
"android",
"android-activity",
"lifecycle"
] |
[
"devexpress row deleting event",
"Deletebutton doesn't raise OnRowDeleting event\n\ni created devexpress gridview on runtime it s working good until click the delete button ,when i click it ,it doesn't work .on debug it doesnt fire \"rowdeleting\". What can i do?\n\n dovizgrd.Width = Unit.Percentage(50);\n dovizgrd.EnableCallBacks = false;\n dovizgrd.Settings.ShowFooter = false;\n dovizgrd.Settings.ShowColumnHeaders = false;\n dovizgrd.Settings.ShowFilterBar = GridViewStatusBarMode.Hidden;\n dovizgrd.SettingsPager.Visible = true;\n dovizgrd.SettingsPager.Mode = GridViewPagerMode.ShowPager;\n dovizgrd.Styles.Header.Wrap = DevExpress.Utils.DefaultBoolean.True;\n dovizgrd.SettingsPager.PageSize = 10;\n\n DevExpress.Web.ASPxGridView.GridViewCommandColumn col0 =\n new DevExpress.Web.ASPxGridView.GridViewCommandColumn();\n col0.ShowSelectCheckbox = true;\n col0.Caption = \" \";\n col0.Width = Unit.Pixel(30);\n col0.VisibleIndex = 0;\n\n DevExpress.Web.ASPxGridView.GridViewDataTextColumn col1 =new DevExpress.Web.ASPxGridView.GridViewDataTextColumn();\n col1.FieldName = \"example1\";\n col1.Visible = false;\n col1.VisibleIndex = 1;\n\n DevExpress.Web.ASPxGridView.GridViewDataTextColumn col2 = \n new DevExpress.Web.ASPxGridView.GridViewDataTextColumn();\n col2.FieldName = \"example2\";\n col2.Visible = false;\n col2.VisibleIndex = 2;\n\n DevExpress.Web.ASPxGridView.GridViewDataTextColumn col3 = new DevExpress.Web.ASPxGridView.GridViewDataTextColumn();\n col3.FieldName = \"example3\";\n col3.Caption = \"Döviz Çeşidi\";\n col3.Width = Unit.Pixel(100);\n col3.VisibleIndex = 3;\n\n DevExpress.Web.ASPxGridView.GridViewCommandColumn col4 = new DevExpress.Web.ASPxGridView.GridViewCommandColumn();\n col4.Caption = \" \";\n //col4.EditButton.Visible = false;\n col4.DeleteButton.Visible = true;\n //col4.NewButton.Visible = false;\n col4.ButtonType = ButtonType.Image;\n\n col4.DeleteButton.Image.Url = \"~/Images/icons/delete.gif\";\n\n col4.Width = Unit.Pixel(35);\n col4.VisibleIndex = 4;\n\n dovizgrd.Columns.Add(col0);\n dovizgrd.Columns.Add(col1);\n dovizgrd.Columns.Add(col2);\n dovizgrd.Columns.Add(col3);\n dovizgrd.Columns.Add(col4);\n grdPH.Controls.Add(dovizgrd);\n dovizgrd.DataBind();\n\n dovizgrd.RowDeleting += new DevExpress.Web.Data.ASPxDataDeletingEventHandler(grd_RowDeleting);"
] | [
"c#",
"asp.net",
"devexpress",
"aspxgridview"
] |
[
"How to setup chrome.printerProvider API to find and print to usb printer?",
"so I have a Chrome App, which Google has deprecated and no longer supports, but I still have an app running in kiosk mode on Acer Chromebox that I have to support. I am trying to use the chrome.printProvider API to find a usb printer that is plugged in, and then simply print to it. With Google Cloud print also being deprecated, there is no viable print method. Not sure if I understand the API document or the setup required, and Google has removed majority of their Chrome App examples/samples. Where does the code go, into the background.js file? How would one set this up to listen for printers and then print using the print manager or even just silent print to the detected printer? Any help will be much appreciated as I am stuck since 15hours ago.\nchrome.printerProvider.onGetPrintersRequested.addListener(listener: function)"
] | [
"javascript",
"api",
"google-chrome",
"google-chrome-app",
"kiosk-mode"
] |
[
"Kotlin Callback unit test",
"I'm writing a unit test for my app. I need to test a function that handles the login inside my app. This login handler uses a Callback that notifies when the login is complete. This is my Login Handler\nclass LoginManager {\n\nprivate var auth: FirebaseAuth = Firebase.auth\n\nfun loginWithEmail(\n email: String,\n password: String,\n loginCallback: LoginCallback\n) {\n auth.signInWithEmailAndPassword(email, password).addOnCompleteListener { loginTask ->\n if (loginTask.isSuccessful) {\n auth.currentUser?.let { user ->\n loginCallback.onLoginSuccess(user)\n return@addOnCompleteListener\n }\n }\n\n loginCallback.onLoginFailure(loginTask.exception)\n }\n} }\n\nLoginCallback is a simple interface\ninterface LoginCallback {\nfun onLoginSuccess(user: FirebaseUser)\nfun onLoginFailure(error: Exception?) }\n\nI need to test the loginWithEmail function. In my test I try this code\nHandler(getMainLooper()).post {\n var firebaseUser: FirebaseUser? = null\n val loginCallback = object : LoginCallback {\n override fun onLoginSuccess(user: FirebaseUser) {\n firebaseUser = user\n }\n\n override fun onLoginFailure(error: Exception?) {\n //No action needed\n }\n\n }\n\n val loginManager = LoginManager(loginCallback)\n\n loginManager.loginWithEmail(EXISTING_EMAIL_ADDRESS, CORRECT_PASSWORD)\n Thread.sleep(5000)\n assert(firebaseUser != null)\n }\n\n shadowOf(getMainLooper()).idle()\n\nBut the callback is never being called. I also try with an ArgumentCaptor\nHandler(getMainLooper()).post {\n val captor = ArgumentCaptor.forClass(LoginCallback::class.java)\n val loginManager = LoginManager()\n loginManager.loginWithEmail(EXISTING_EMAIL_ADDRESS, CORRECT_PASSWORD, captor.capture())\n }\n\n shadowOf(getMainLooper()).idle()\n\nBut with this code, I'm getting this error java.lang.NullPointerException: captor.capture() must not be null\nIs there a way to test my function?"
] | [
"android",
"unit-testing",
"kotlin",
"mockito"
] |
[
"IOS Audio Recording, How to Check if Mic / Playback is Busy Before Taking Mic",
"If anything is playing, recording, how to we check to see if the MIC is available (idle) for recording? Currently using \n\nAVCaptureDevice *audioCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];\nAVCaptureSession *captureSession = [[AVCaptureSession alloc] init];\nVCaptureDeviceInput *audioInput = [AVCaptureDeviceInput deviceInputWithDevice : audioCaptureDevice error:&error];\nAVCaptureAudioDataOutput *audioOutput = [[AVCaptureAudioDataOutput alloc] init];\n[captureSession addInput : audioInput];\n[captureSession addOutput : audioOutput];\n[captureSession startRunning];\n\n\nNeed to check before grabbing the MIC / Playback from something that is already has it."
] | [
"ios",
"audio-recording"
] |
[
"JavaScript callback function when working withing a loop",
"This is what the code below does:\n\n\nGoes to a table in a database and retrieves some search criteria I will send to Google API (the PHP file is getSearchSon.php)\nAfter having the results, I want to loop around it, call the Google API (searchCriteriasFuc) and store the results in an array\nThe last part of the code is doing an update to two different tables with the results returned from Google API (updateSearchDb.php)\n\n\nIn my code, I am using setTimeout in a few occasions which I don't like. Instead of using setTimeout, I would like to properly use callback functions in a more efficient way (This might be the cause of my problem) What is the best way of me doing that?\n\n$(document).ready(function() {\n\n\n $.ajax({ \n\n url: 'getSearchSon.php', \n\n type: 'POST',\n\n async: true,\n\n dataType: 'Text',\n\n /*data: { }, */\n\n error: function(a, b, c) { alert(a+b+c); } \n\n }).done(function(data) {\n\n\n if(data != \"connection\")\n {\n var dataSent = data.split(\"|\");\n\n var search_criterias = JSON.parse(dataSent[0]);\n\n var date_length = dataSent[1];\n\n var divison_factor = dataSent[2];\n\n var length = search_criterias.length;\n\n var arrXhr = [];\n\n var totalResultsArr = [];\n\n var helperFunc = function(arrayIndex)\n {\n return function()\n {\n var totalResults = 0;\n\n if (arrXhr[arrayIndex].readyState === 4 && arrXhr[arrayIndex].status == 200) \n {\n totalResults = JSON.parse(arrXhr[arrayIndex].responseText).queries.nextPage[0].totalResults;\n\n totalResultsArr.push(totalResults);\n }\n }\n }\n\n var searchCriteriasFuc = function getTotalResults(searchParam, callback) \n { \n var searchParamLength = searchParam.length;\n\n var url = \"\";\n\n for(var i=0;i<searchParamLength;i++)\n {\n url = \"https://www.googleapis.com/customsearch/v1?q=\" + searchParam[i] + \"&cx=005894674626506192190:j1zrf-as6vg&key=AIzaSyCanPMUPsyt3mXQd2GOhMZgD4l472jcDNM&dateRestrict=\" + date_length;\n\n arrXhr[i] = new XMLHttpRequest();\n\n arrXhr[i].open(\"GET\", url, true);\n\n arrXhr[i].send();\n\n arrXhr[i].onreadystatechange = helperFunc(i);\n }\n\n setTimeout(function()\n { \n if (typeof callback == \"function\") callback.apply(totalResultsArr);\n }, 4000);\n\n\n return searchParam;\n } \n\n function callbackFunction()\n { \n var results_arr = this.sort();\n\n var countResultsArr = JSON.stringify(results_arr);\n\n $.ajax({\n\n url: 'updateSearchDb.php', \n\n type: 'POST',\n\n async: true,\n\n dataType: 'Text',\n\n data: { 'countResultsArr': countResultsArr },\n\n error: function(a, b, c) { alert(a+b+c); } \n\n }).done(function(data) {\n\n var resultsDiv = document.getElementById(\"search\");\n\n if(data == \"NORECORD\") resultsDiv.innerHTML = 'Updated failed. There was a problem with the database';\n\n else resultsDiv.innerHTML = 'Update was successful';\n\n }); //end second ajax call\n }\n\n //llamando funcion principal\n var arrSearchCriterias = searchCriteriasFuc(search_criterias, callbackFunction);\n\n }\n else\n {\n alert(\"Problem with MySQL connection.\");\n }\n\n }); // end ajax \n\n});"
] | [
"javascript"
] |
[
"Need an explanation of the recursive calls in \"Towers of Hanoi\"",
"I understand the concept of recursion and how it stacks up with each call. But I fail to explain how recursive calls are working and gets printed when there are two function call separated by a printf command. Can anyone explain to me how this recursive call is working?\n\nI have found an example regarding a game called \"Towers of Hanoi\". Ut was used as an example of recursion. The code:\n\n#include <stdio.h>\n\nvoid transfer(int n, char from, char to, char temp);\n\nint main()\n{\n int n;\n\n printf(\"how many disk\");\n scanf(\"%d\", &n);\n printf(\"\\n\");\n transfer(n, 'L', 'R', 'C');\n return 0;\n}\n\n/*\n * n = number of disk,\n * from = origin,\n * to = destination,\n * temp = temporary storage\n */\nvoid transfer(int n, char from, char to, char temp)\n{\n if (n > 0) {\n // Move n-1 disks from origin to temporary\n transfer(n - 1, from, temp, to);\n\n // Move n th disk from origin to destination\n printf(\"move disk %d from %c to %c\\n\", n, from, to);\n\n // Move n-1 disks from temporary to destination\n transfer(n - 1, temp, to, from);\n }\n}\n\n\nfor n=3 it gives output like this\n\n\nmove disk 1 from L to R //\nmove disk 2 from L to C // \nmove disk 1 from R to C // \nmove disk 3 from L to R // \nmove disk 1 form C to L // \nmove disk 2 from C to R //\nmove disk 1 from L to R //"
] | [
"c",
"recursion",
"towers-of-hanoi"
] |
[
"WP7: Get current PivotItem for data-bound Pivot",
"I have a Pivot, whose ItemsSource is set to a collection of data objects, and I use an ItemTemplate to transform the items into UI content (I also use a HeaderTemplate).\n\nWhen tombstoning, I normally get the ScrollViewer from the current PivotItem and save the current position away, so that I can scroll back to the right position if the user navigates back to my app. This works fine if I hard-code the PivotItems in my XAML.\n\nMy issue is that the when the Pivot is bound to my data object collection using ItemsSource, SelectedItem returns one of my data objects - not the PivotItem. I can't see how to get to the current PivotItem (or the UI elements generated from my ItemTemplate). I've noticed protected members to go from a ItemsSource item to its corresponding container - perhaps I need to derive from Pivot to make use of these?\n\nThanks!\n\nDamian"
] | [
"windows-phone-7"
] |
[
"Draw elevation shadows to canvas",
"I use the code below to draw a view on to a bitmap/canvas.\n\nBitmap bitmap = Bitmap.createBitmap(\n viewGroup.getWidth (), viewGroup.getHeight (), Bitmap.Config.ARGB_8888);\nviewGroup.draw(new Canvas(bitmap));\n\n\nIt works great, with one small problem: it doesn't draw elevation shadows. I assume that the shadows aren't drawn in the draw method. So where are they drawn and how can I transfer them to my canvas?"
] | [
"android",
"android-canvas",
"android-elevation"
] |
[
"Detaching a SQL Server 2005 database that has had it's MDF/LDF file moved or lost",
"I created a document management system for a client which uses SharePoint and SQL Server to store PDF documents. Due to some SAN misconfiguration 3 disks that were holding both MDF and LDF database files dissapeared from the OS one day. We are in the process of recovering the data of the SAN but my question is how do I detach an existing database when it's possible that it's MDF or LDF or both files are no longer where the database expects it to be. I've noticed that even when I try to look at properties SQL Server complains that it can't find one of the files.\n\nDo I need to reestablish the disk with the folder structure and MDF/LDF file as it was originally configured for the database in question or can I just configure the database to point to the MDF/LDF in a new location?"
] | [
"database",
"sql-server-2005",
"backup"
] |
[
"How to structure Laravel .htaccess in order to point straight to public folder & remove index.php",
"I am attempting to create htaccess files that can be used on development and production server. The development server's folder structure is like this:\n\nServer Root (www)\n -laravel\n -public\n -index.php\n -controller/method... etc\n\n\nThe production server does not have a document root that is not publicly accessible. I am deploying this on appfog, and it requires .htaccess to do this. This is mentioned on Appfog's documentation: https://docs.appfog.com/languages/php#custom\n\nRewriteEngine on\nRewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]\nRewriteCond %{HTTP_HOST} ^www.domain.com$\nRewriteCond %{REQUEST_URI} !public/\nRewriteRule (.*) /public/$1 [L]\n\n\nThe production server's folder structure will be like this (it simply removes the laravel folder):\n\nServer Root (www)\n -public\n -index.php\n -controller/method... etc\n\n\nI would like to achieve this without the use of apache httpd, only using htaccess because the development environment will change constantly.\n\nI would like to be able to do this:\n\n\nVisit http://localhost/laravel/X/X (where X is anything)\nGet redirected to http://localhost/laravel/public/index.php/X/X (with the public/index.php hidden from the url to prevent duplicate urls)\nVisit http://example.com/X/X (where X is anything)\nGet redirected to http://example.com/public/index.php/X/X (with the public/index.php hidden from the url to prevent duplicate urls)\nPrevent access to directories/files outside of public folder, and prevent access to directories in public folder, but not files.\nAll without having to change configurations on between production and development\n\n\nThe question, how do I do this and how many .htaccess files do I need?\n\nMy progress so far has been going through the laravel documentation and this forum post, but no matter what I do, I keep either getting 404s or 500 server errors when I just go to http://localhost/laravel/"
] | [
".htaccess",
"environment-variables",
"environment",
"laravel",
"clean-urls"
] |
[
"Pandas '9999-12-31' datetime representation",
"I`m trying to read into pandas dataframe a csv file with two columns containing dates:\n\ncustomer_id,name,surname,date_from,date_to\n1,John,Smith,2010-01-04,2018-09-06\n2,Jake,Sarti,2011-09-02,2017-11-03\n3,Jim,Sayer,2012-06-12,9999-12-31\n4,James,Scheer,2011-09-02,9999-12-31\n\n\nWhile date_from is a column of datetime64[ns] as expected, the problem in date_to seems to be 'end of the world' dates.\n\nThis obviously is a consequence of nanosecond granularity of datetime64.\n\nI thought about using converters parameter, but I`m not sure if it will be an efficient way.\n\nThe problem with read_csv also occurs with read_sql while reading date columns containing hight dates.\n\nI already tried na_values = ['9999-12-31'] , which works, but I would be forced to change the way we select valid records in our database environment and calculate fields indicating not valid records.\n\nimport pandas as pd\ncust = pd.read_csv('customers.csv', parse_dates=['date_from', 'date_to'])\n\ncust.dtypes\n\n\n[Out]\ncustomer_id int64\nname object\nsurname object\ndate_from datetime64[ns]\ndate_to object\ndtype: object\n\n\nIs it possible to downgrade datetime type granularity to days, hours, .., seconds so reading csv and databases will not require manipulation of data in datetime column?"
] | [
"python",
"pandas",
"datetime"
] |
[
"Creating forms without using VCL",
"I need to create a form (using CreateWindow functions) without any help from the VCL (or any visual control) only using the Windows API.\n\nThis form will have an InputBox, a Button and a BitMap (like TImage does).\n\nI was not able to find any sample on internet. Does anyone know a good place where I can download a sample besides MSDN?"
] | [
"forms",
"delphi",
"winapi"
] |
[
"Iron Router - Get Route URL as Variable/String",
"In Iron Router, I can get the URL of the route and redirect by doing...\n\nRouter.go('ROUTE_NAME', { param: parm })\n\n\nThis returns the url (i.e. /whatever/whatever) and then redirects to that url.\n\nHow can I get JUST the URL and NOT redirect?"
] | [
"meteor",
"iron-router"
] |
[
"How to extract information and transform true to 1?",
"I got this code :\n\nforeach($data['matches'] as $matches){\n$win += $matches['participants'][0]['stats']['winner'];\nif ($win == true){\n$winner+= '1';\n}\n}\n\n\nThis code extract information from an API, and what I want is how much the value \"true\" is in the API, soo I've tried to convert \"true\" to 1, but still not working well.\nIn the api there are 8 \"true\" but when I've tried to print $winner I got just 2.\n\nWhat to do please to correct the code ?"
] | [
"php",
"arrays",
"string",
"multidimensional-array"
] |
[
"object has no attribute show",
"I have installed wxpython successfully which i verified by \n\nimport wx\n\n\nBut when I write a code \n\nimport wx\nclass gui(wx.Frame):\n def __init__(self,parent,id):\n wx.Frame.__init__(self, parent,id,'Visualisation for Telecom Customer Data', size = (300,200))\n\nif __name__ =='__main__':\n app = wx.PySimpleApp()\n frame = gui(parent = None, id = -1)\n frame.show()\n app.MainLoop()\n\n\nit shows error \n\nTraceback (most recent call last):\n File \"D:\\Bishnu\\BE\\4th year\\7th semester\\Major Project I\\Workspace\\Wxpython\\default\\GUI.py\", line 13, in <module>\n frame.show()\nAttributeError: 'gui' object has no attribute 'show'\n\n\nwhat may be the solution ?"
] | [
"python",
"python-2.7",
"wxpython"
] |
[
"Ocsigen/Eliom: How to remove unnecessary JavaScript?",
"I'm taking my first steps in web programming with the Ocsigen framework. I can build simple apps, but I've noticed that Ocsigen generates loads of unnecessary JavaScript code. Even the Hello world example, which has no interactive components at all, generates and includes a 400 KB JavaScript file. Is there a way to tell it not to do that?\n\nI first noticed this issue while testing a simple app that was using internal links; testing with JavaScript turned off worked fine, but with JavaScript turned back on, I noticed that each link actually had an associated piece of JavaScript that I didn't write and can't control. Obviously, this code is not needed if the site works just as well without it. I would really like to avoid that. Any tips?"
] | [
"ocaml",
"ocsigen"
] |
[
"Export-csv in Powershell v3 - output different than PS v2",
"This is a strange one. Whenever I try to export something to csv using export-csv, the only data in the .csv is the length property. Why is that? So for example:\n\n$boogers = \"string data\"\n$boogers | export-csv c:\\script\\boogers.csv -notypeinformation\n\n\nNow the output will look like this: \n\nLength\n11\n\n\nWhat gives? Maybe it's just me, but I can't seem to find very good information on this cmdlet out on the google machine yet. The get-help file is, as per Microsoft tradition, less than helpful.\n\nAny advice you guys could give me would be greatly appreciated."
] | [
"powershell",
"powershell-2.0",
"powershell-3.0"
] |
[
"Element appearing on load and then disappears",
"I'm making a horizontal scrolling site. I'm using this script for letting an element fade in when user scrolls past 1500px. \n\n <script type=\"text/javascript\">\n$(document).scroll(function () {\nvar x = $(this).scrollTop();\nif (x > 1500) {\n$('#form_1_container').fadeIn(150);\n} else {\n$('#form_1_container').fadeOut(150);\n}\n});\n</script>\n\n\nProblem is: on page load the element appears. When I start scrolling it disappears and re appears when I hit 1500px. I want it to be invisible until I reach 1500px. \n\nThis is the site: http://stilld.nl/brrreuk/"
] | [
"javascript",
"scroll",
"fadein",
"scrolltop"
] |
[
"How to do variable substitution in Kubernetes manifests?",
"I am learning Kubernetes and planning to do continuous deployment of my apps with Kubernetes manifests. \n\nI'd like to have my app defined as a Deployment and a Service in a manifest, and have my CD system run kubectl apply -f on the manifest file. \n\nHowever, our current setup is to tag our Docker images with the SHA of the git commit for that version of the app. \n\nIs there a Kubernetes-native way to express the image tag as a variable, and have the CD system set that variable to the correct git SHA?"
] | [
"kubernetes"
] |
[
"R package caret, function avNNet, allow parallel does not seem to work",
"I am using avNNet from R's caret package to fit a regression model. From what I understand, the function fits a number of neural networks and then averages the estimates.\n\nThere is an option called allowParallel which, if true, should use a parallel backend if loaded and available. For that purpose, I load the doMC package and set the number of cores like so:\n\nlibrary(doMC)\nregisterDoMC(cores=4)\n\n\nAnd then I estimate the fit like so:\n\nfit <- avNNet(formula, data = training, repeats=10, size=20, decay=0.1, linout=TRUE, maxit = 3000, allowParallel=TRUE)\n\n\nHowever, whether I set allowParallel to TRUE or FALSE I do not get any noticeable difference in computation time or processor load. I have a four-core processor which in both cases is loaded at around 25%.\n\nAm I doing something wrong?\n\nAlso, is there a good way to optimize the values of the options passed to avNNet, like maxit, size or decay?\n\nThank you very much in advance."
] | [
"r",
"parallel-processing",
"r-caret"
] |
[
"Wordpress JSON API to POST custom field data",
"I'm using the Plugin JSON API and i can't post nothing on \"custom_fields\".\nOn Postman (what i'm using to test) no matter what i put on value (i have tryied form-data and raw) but i can't post anything.\n\nIt stay on \"custom_fields\": {}"
] | [
"json",
"wordpress",
"postman"
] |
[
"composer autoload + facebook sdk",
"i'm confused about composer. I read in other post \"Every package should be responsible for autoloading itself\" but i can't resolve the problem.\n\ni have this composer.json file in root project folder:\n\n{\n \"require\": {\n \"facebook/php-sdk-v4\": \"4.0.*\"\n }\n}\n\n\nI run composer install and it creates this structure:\n\nvendor/\n|-- autoload.php\n|-- composer\n| |-- autoload_classmap.php\n| |-- autoload_namespaces.php\n| |-- autoload_real.php\n| |-- ClassLoader.php\n| `-- installed.json\n`-- facebook\n `-- php-sdk-v4\n |-- autoload.php\n |-- composer.json\n |-- CONTRIBUTING.md\n |-- LICENSE\n |-- phpunit.xml.dist\n |-- README.md\n |-- src\n | `-- Facebook\n | |-- Entities\n | | |-- AccessToken.php\n | | `-- SignedRequest.php\n | |-- FacebookAuthorizationException.php\n | |-- FacebookCanvasLoginHelper.php\n | |-- FacebookClientException.php\n | |-- FacebookJavaScriptLoginHelper.php\n | |-- FacebookOtherException.php\n | |-- FacebookPageTabHelper.php\n | |-- FacebookPermissionException.php\n | |-- FacebookRedirectLoginHelper.php\n | |-- FacebookRequestException.php\n | |-- FacebookRequest.php\n | |-- FacebookResponse.php\n | |-- FacebookSDKException.php\n | |-- FacebookServerException.php\n | |-- FacebookSession.php\n | |-- FacebookSignedRequestFromInputHelper.php\n | |-- FacebookThrottleException.php\n [...]\n\n\nvendor/facebook/php-sdk-v4/composer.json file shows:\n\n\"autoload\": {\n \"psr-4\": {\n \"Facebook\\\\\": \"src/Facebook/\"\n }\n}\n\n\nand autoload_classmap.php and autoload_namespaces.php return empty arrays.\n\nWhen run index.php throws this error:\n\nPHP Fatal error: Class 'Facebook\\FacebookSession' not found on line 33\n\nrequire 'vendor/autoload.php';\n\nuse Facebook\\FacebookSession;\nuse Facebook\\FacebookRequest;\nuse Facebook\\GraphUser;\nuse Facebook\\FacebookRequestException;\n\nFacebookSession::setDefaultApplication('x','y');\n\n\nI don't know if i have to put in this files (in this arrays that are returned) or composer must include them automatically.\nCan Composer autoload classes declared in file vendor/facebook/php-sdk-v4/composer.json?\n\nThank you in advance, i really appreciate help"
] | [
"php",
"facebook",
"composer-php"
] |
[
"Problems with Kentico and Wildcard URLs after upgrade to 11",
"Foreword:\nThis question may be too specific for Stack Overflow.\nI have also posted it on the Kentico forums: https://devnet.kentico.com/questions/problems-with-kentico-and-wildcard-urls-after-upgrade-to-11\nSynopsis:\nAfter upgrading to Kentico 11, the wildcard setup I have no longer seems to be working properly. After a lot of digging and research, I think the problem is somewhere in the mechanism that Kentico uses to map the wildcard values to URL parameters... but I don't know how to look into that process to try and figure out where it's going wrong and/or how to fix it.\nDetails:\nI have a page set up with the following "Standard URL or wildcard" value set:\n/Invest/Communities/{ProvinceName}/{EconomicRegionName}/{RegionalDistrictName}/{CommunityName} This page also has a single alias of /Invest/Communities/Province but I'm not sure that's doing anything for me.\nThe page itself contains a single custom control, which has a User control virtual path of ~/<project>/WebControls/Communities/Community.ascx\nPrior to the upgrade, this URL: /Invest/communities/myProvince/myEconomic/myRegional/myCommunity/ worked fine - if I set a breakpoint at the start of the Community.ascx.cs Page_Load {} method, the breakpoint would get hit, and I could pull those four values out of the query string (via e.g. HttpContext.Current.Request["ProvinceName"]).\nAfter the upgrade, the same URL is not hitting the breakpoint, and is instead directing me to a 404 error. However, if I manually re-write the URL to /invest/communities/profile/?ProvinceName=myProvince&EconomicRegionName=myEconomic&RegionalDistrictName=myRegional&CommunityName=myCommunity the page works as expected. Breakpoint hit, values can be pulled from Request object.\nIt seems as though something has gone wrong with whatever mechanism does the value mapping... but as that's stuff built into Kentico, I'm not clear on how to look deeper into it to see where it's failing.\nOther things I have tried:\n\nRe-signing all macros. This fixed a different problem I had after the upgrade, but did not help with this issue.\nOn the Pages > URLs tab: changing from Standard URL or wildcard to Route\nFound this advice in a forum post somewhere; doing this made it so that I would hit the breakpoint in the control again properly, however none of the wildcard values were available in the Request object any more. Not good.\n'Saving' on the page tab, the URLs tab, and other places in case somehow there was something corrupted that re-saving would somehow reset. Total shot in the dark, but in very rare cases this has worked before. No help here."
] | [
"url-routing",
"wildcard",
"kentico"
] |
[
"Create a NuGet package after a TFS buld and deploy",
"What is the best way to make a .dll available as a NuGet package in a local environment so that others can download that and use it whenever they want. We use TFS as the CI server and I want NuGet package (with a version number) to be copied to a location in the intranet after every build so that users can pull it when they want. (Do not want to push). I want this to happen from the all the feature branches, any feature branch other than main needs to package this as a beta. Thanks."
] | [
"c#",
"tfs",
"msbuild",
"nuget"
] |
[
"Allowing multiple choices instead of just one",
"I have a code that is used for adding a channel to an IPTV platform!\nCurrently we have the option to put a channel in single category/genre... What we want to do is instead of this drop box to a have something like checklist or space to write the genres/categories... I have tried everything I remembered I knew, but nothing worked! Thank you\n\nfunction get_genres() {\n\n global $tv_genre_id;\n\n $genres = Mysql::getInstance()->from('tv_genre')->get()->all();\n\n $option = '';\n\n foreach ($genres as $arr){\n $selected = '';\n\n if ($tv_genre_id == $arr['id']){\n $selected = 'selected';\n }\n $option .= \"<option value={$arr['id']} $selected>\"._($arr['title']).\"\\n\";\n }\n return $option;\n}"
] | [
"categories",
"iptv"
] |
[
"Can I change the same filter in multiple reports quickly?",
"We have about 10 tfs reports around work items that filter on \"Iteration Path\" multiple times. Every sprint we have to make 25-30 edits to the reports to get them to query the new sprint. Sometimes we miss changing one or two.\n\nAND [Iteration Path] = [Product\\R2016\\December 2015 - R16 - Dev]\n\n\nIs there a quicker and more consistent way to accomplish this? \n\nCan you define a constant for the reports to use or something similar?"
] | [
"tfs-reports"
] |
[
"Extend existing Firefox extension/Use functionality of existing Firefox extension in own extension",
"I am planning to start writing a Firefox extension in the near future and found out that part of the functionality I would like my extension to have is already done in another extension. Now I am wondering if it is possible to program an extension that uses the functionality of another extension (i.e. that the existing extension would have to be installed before mine). Is there for example the possibility to call another extensions functions? \nI am not trying to pass off somebody elses work as my own (hence the dependency on the existing extension), I just think it might not be necessary to program the same functionality twice. \n\nI would assume that other people also had this problem/question, but unfortunately I could not find any answer on Stackoverflow or the internet in general. Apparently it is possible to change an existing extension, but this is not exactly what i want.\n\nI'm happy for any tips or pointers!\nThanks in advance!"
] | [
"firefox",
"firefox-addon",
"dependencies"
] |
[
"Insertion sort and taking related arrays with it",
"I need a bit of help with this insertion sort, The code I have so far is this:\n\nPrivate Sub SortedList_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load\n Dim currentitem As Integer = 2\n While currentitem <= numitems\n currentdataitem = frmEntry.starname(currentitem)\n comparison = 1\n finish = False\n While comparison < currentitem And finish = False\n If currentdataitem < frmEntry.starname(comparison) Then\n shuffleitem = currentitem\n While shuffleitem > comparison\n frmEntry.starname(shuffleitem) = frmEntry.starname(shuffleitem - 1)\n shuffleitem = shuffleitem - 1\n End While\n frmEntry.starname(comparison) = currentdataitem\n finish = True\n End If\n comparison = comparison + 1\n End While\n currentitem = currentitem + 1\n End While\n arrayindex = 0\n For Me.arrayindex = 1 To numitems\n lstsorted.Items.Clear()\n lstsorted.Items.Add(frmEntry.starname(arrayindex))\n lstsorted.Items.Add(frmEntry.DOB(arrayindex))\n lstsorted.Items.Add(frmEntry.rank(arrayindex))\n Next\nEnd Sub\n\n\nThis insertion sorts their names, but I also need to take their DOB and their rank with it, at what point in my visual basic code do I put this?"
] | [
"vb.net"
] |
[
"issue with condition in angular with if",
"In my code the ng-if doesn't seems to verify the conditions. The 'hello' always displays before the table.\n\n<div ng-repeat=\"(key, value) in data\">\n <h3>{{key}}</h3> \n <div ng-if=\"_.isNumber('hello')\">\n <h2>hello</h2>\n </div>\n <table class=\"table table-striped table-bordered table-condensed table-hover\">\n <tr ng-repeat=\"(k,v) in value\">\n <td><strong>{{k}}</strong></td>\n <td>{{v}}</td>\n </tr>\n </table>\n</div>"
] | [
"angularjs"
] |
[
"FAILED (errors=4) Destroying test database for alias 'default'",
"I got an error,\n\nFAILED (errors=4)\nDestroying test database for alias 'default'...\n\n\nI wrote in tests.py \n\n#coding:utf-8\nfrom django.test import TestCase\nfrom app.models import User\n\n# Create your tests here.\nclass UserModelTests(TestCase):\n def setUp(self):\n self.user1 = User.objects.create(name='Tom', group = 'A',age=20,rank=1)\n\n def test_user1_name(self):\n self.assertEqual(self.user1.name, 'Tom')\n\n def test_user1_group(self):\n self.assertEqual(self.user1.group, 'A')\n\n def test_user1_age(self):\n self.assertEqual(self.user1.age, 20)\n\n def test_user1_rank(self):\n self.assertEqual(self.user1.rank, 1)\n\n\nTraceback shows\n ValueError: invalid literal for int() with base 10: ''\n\nmodels.py is\n\nclass User(models.Model):\n name = models.CharField(max_length=200,null=True)\n group = models.CharField(max_length=200,null=True)\n age = models.IntegerField(max_length=10,null=True)\n rank = models.IntegerField(max_length=10,null=True)\n\n\nI cannot understand why int error happens because I use int type in age.\nHow can I fix this?What should I write?\n\nFull traceback is\nFile \"/Users/myenv/lib/python3.5/site-packages/django/db/models/manager.py\", line 85, in manager_method\n return getattr(self.get_queryset(), name)(*args, **kwargs)\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/query.py\", line 393, in create\n obj.save(force_insert=True, using=self.db)\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/base.py\", line 806, in save\n force_update=force_update, update_fields=update_fields)\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/base.py\", line 836, in save_base\n updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/base.py\", line 922, in _save_table\n result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/base.py\", line 961, in _do_insert\n using=using, raw=raw)\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/manager.py\", line 85, in manager_method\n return getattr(self.get_queryset(), name)(*args, **kwargs)\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/query.py\", line 1060, in _insert\n return query.get_compiler(using=using).execute_sql(return_id)\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/sql/compiler.py\", line 1098, in execute_sql\n for sql, params in self.as_sql():\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/sql/compiler.py\", line 1051, in as_sql\n for obj in self.query.objs\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/sql/compiler.py\", line 1051, in <listcomp>\n for obj in self.query.objs\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/sql/compiler.py\", line 1050, in <listcomp>\n [self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields]\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/sql/compiler.py\", line 990, in prepare_value\n value = field.get_db_prep_save(value, connection=self.connection)\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/fields/__init__.py\", line 766, in get_db_prep_save\n prepared=False)\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/fields/__init__.py\", line 758, in get_db_prep_value\n value = self.get_prep_value(value)\n File \"/Users/myenv/lib/python3.5/site-packages/django/db/models/fields/__init__.py\", line 1849, in get_prep_value\n return int(value)\nValueError: invalid literal for int() with base 10: ''\n\n----------------------------------------------------------------------\nRan 25 tests in 0.143s\n\nFAILED (errors=25)\nDestroying test database for alias 'default'...\n(myenv) CA2641:app uu121291$"
] | [
"python",
"django"
] |
[
"Format issue when using vba Userform",
"I have previous made a punch in clock worksheet in Excel. The normal function of the punch in clock is when I press the punch in button, a macro find time (and date) via the vba inbulid variable Time (and Date) and put them into defined cells. And the same happens, when I punch out, but here it also calculates the daily working hours and a running balance with flextime\n\nThis part works fine\n\nI have recently wanted to extend my program, so it is possible to via the vba userform change the time (punch in or out) of a specific date and then recalculate the flextime balance.\nIt has been possible to get the userform to find and change the time of a specific date, but when I try to recalculate the working hours and flextime, I get a format missing match error. When in debug, I hover over the variable, I can see that the changed cell is formatted as hh:mm:ss, but the the existing cells are formatted as decimal numbers even though, they are display as time in the worksheet. \n\nHow can I the formats to be similar?\n\nPrivate Sub cmdOK_Click()\nDim w1 As Worksheet\nSet w1 = Sheets(\"Aktuel måned\")\n\nnumofDateRows = w1.Range(\"I1\").Offset(w1.Rows.Count - 1, 0).End(xlUp).Row 'find last cell with dates\n\n\nFor i = 1 To numofDateRows\n If w1.Range(\"I\" & i) = DTPicker1 Then 'find row with choosen date\n If chbInd.value = True Then 'if punch in time is going to be change\n w1.Range(\"J\" & i) = txbTid 'inserts the new time\n w1.Range(\"L\" & i) = w1.Range(\"K\" & i) - w1.Range(\"J\" & i) + w1.Range(\"F12\").MergeArea.Cells(1, 1) 'recaculate working hours\n w1.Range(\"M\" & i) = w1.Range(\"L\" & i) + w1.Range(\"M\" & (i - 1)) - w1.Range(\"F14\") 'recalculate flextime balance\n End If\nNext\n\nEnd Sub"
] | [
"vba",
"excel",
"format"
] |
[
"Extend text on hover",
"I'm using two initials and I want that if a user hovers it it will show the rest of the text but I can't make it to display the rest of the text correctly: the part of the first letter it's being displayed next to the text of the second initial.\n\njsfiddle\n\n#logo .short{\n position: relative;\n margin-top: 0;\n padding: 0 10px;\n font-size: 36px;\n display: inline-block;\n text-transform: uppercase;\n transition: all .3s ease-out;\n}\n .short:after{\n position: relative;\n margin-left: -20px;\n content: \"est1\";\n opacity: 0;\n -webkit-transition: all .3s ease-out;\n}\n\n .short:hover:after{\n opacity: 1;\n display: inline-block;\n margin-left: -10px;\n }\n#logo span{\n position: relative;\n transition: margin .3s ease-out;\n}\nspan:hover{\n margin-left: 20px;\n}\nspan:after{\n position: relative;\n margin-left: -20px;\n content: \"est2\";\n opacity: 0;\n -webkit-transition: all .3s ease-out;\n }\n\nspan:hover:after{\n opacity: 1; \n margin-left: -10px;\n }"
] | [
"css",
"html",
"twitter-bootstrap",
"sass"
] |
[
"Does MongoDB Panache support change streams?",
"Does MongoDB Panache offer support for change streams? I cannot find any information about it online."
] | [
"quarkus",
"quarkus-panache"
] |
[
"$(\"\")[0].click(); not working after ajax called",
"I would simulate click to download a file after called ajax to generate a link.\n\nJquery :\n\n$(document).ready(function(){\n $(\".vignette-dl\").click(function() {\n var id = $(this).find(\"a\").attr(\"value\");\n $.ajax({\n type: \"POST\", \n url: \"testDL.php\",\n data: { dossier: $(\"#selectDossier\").val(), id_doc: id },\n success: function(result){\n $(\"#secretDiv\").html(result);\n }\n });\n\n $(document).ajaxComplete(function(){\n alert(\"test\");\n $(\"#forcedl\")[0].click(function(){\n alert(\"test42\");\n }); \n });\n });\n});\n\n\nresult var add an html link with id=\"forcedl\" in secretDiv and work perfectly.\n\najaxComplete function is called because i see my alert test, but the click simulate did not work and i didn't see the alert test42.\n\nAnd i don't know why.."
] | [
"jquery",
"ajax",
"click"
] |
[
"Contextual gadgets are not loading on sender account in Gmail",
"We are trying to test contextual gadget Hello World as given on \n https://developers.google.com/gmail/contextual_gadgets.\nBut we are facing problem in loading gadget.\nWe have loaded gadget in gmail before 4 days and after that it is deleted now. But yesterday we have added new gadget but with different name, but still old gadget is loading in gmail.\n So, how should we know which gadget XML path is loaded in gmail?\n\n \n\n\n \n\n<!-- This one is not specific to Gmail contextual gadgets. -->\n<Require feature=\"dynamic-height\"/>\n <!-- The next feature, google.contentmatch, is required for all\n Gmail contextual gadgets.\n <Param> - specify one or more comma-separated extractor IDs in\n a param named \"extractors\". This line is overridden by the extractor ID\n in the manifest, but is still expected to be present. -->\n<Require feature=\"google.contentmatch\">\n <Param name=\"extractors\">\n google.com:HelloWorld,google.com:SenderEmailExtractor\n </Param>\n </Require>\n </ModulePrefs>\n\n<!-- Define the content type and display location. The settings\n\"html\" and \"card\" are required for all Gmail contextual gadgets. -->\n<Content type=\"html\" view=\"card\">\n<![CDATA[\n <!-- Start with Single Sign-On -->\n <script type=\"text/javascript\" src=\"https://example.com/gadgets/sso.js\"></script>\n <script type=\"text/javascript\">\n alert(\"google\");\n <!-- Fetch the array of content matches. -->\n matches = google.contentmatch.getContentMatches();\n var matchList = document.createElement('UL');\n var listItem;\n var extractedText;\n <!-- Iterate through the array and display output for each match. -->\n for (var match in matches) {\n for (var key in matches[match]) {\n listItem = document.createElement('LI');\n\n extractedText = document.createTextNode( \": dm\" );\n extractedText = document.createTextNode(key + \": \" + matches[match][key]);\n listItem.appendChild(extractedText);\n matchList.appendChild(listItem);\n }\n }\n document.body.appendChild(matchList);\n gadgets.window.adjustHeight(100);\n </script>\n ]]>\n </Content>\n\n\n\n\nEven if gadget is deleted in account but still gadget get loaded in email. We have tried &nogadgetcache=1 in address bar but it doesn't work after again signing in to gmail account."
] | [
"xml",
"google-api",
"google-gadget",
"gmail-contextual-gadgets"
] |
[
"sensor fusion with rotation vector sensor",
"I’m working on a project. I want to combine three sensors: accelerometer, gyroscope and magnetometer. I found Complementary filter or Kalman filter can be use for this. Then I came across with rotation vector: “Virtual sensor fuses Accelerometer, Magnetometer and Gyroscope in a Kalman filter”. This sentence confused me. So this means I can just use rotation vector for combining sensors and I don’t need to use filters I mentioned above? Hope you can answer me. At least some suggestions about this topic might help me. I will be glad.\nThanks for your time."
] | [
"android",
"rotation",
"android-sensors",
"sensor-fusion"
] |
[
"NSOutlineView Image & Text table cell view unable to assign value",
"I have a cell-based NSOutlineView with one \"Image & text Table Cell view\" in one column. I can assign values to the text-cell via the traditional NSOutlineViewDelegate functions just fine, but I can't figure out how to set an image value to the NSImageCell.\n\nWhat I've tried:\n\n\nLink the NSImageCell to a referencing outlet (resulted into an error thrown by Xcode);\nBind the NSImageCell's objectValue to a NSImage @property (results in Xcode deep-frying my CPU while hanging forever on building the storyboard.\n\n\nIt may be a silly thing but what am I not seeing here?"
] | [
"objective-c",
"xcode",
"macos",
"interface-builder",
"nsoutlineview"
] |
[
"CSS - Label & checkbox not aligning same as other labels and checkbox",
"I'm making a small survey and my \"checkbox-label\" & checkboxes will not align the same as the other labels.\nAll the labels have the same class. I need it to align the same as the others.\n\nHere is a link to my codepen to show you what I mean:\n\nhttps://codepen.io/Saharalara/pen/xMGqPa\n\n\r\n\r\n.labels {\r\n display: inline-block;\r\n text-align: right;\r\n vertical-align: top;\r\n margin-top: 20px;\r\n width: 40%;\r\n padding: 5px;\r\n}\r\n\r\n.rightTab {\r\n display: inline-block;\r\n text-align: left;\r\n margin-top: 20px;\r\n vertical-align: middle;\r\n width: 48%;\r\n padding: 5px;\r\n}\r\n\r\n.radio,\r\n.checkbox {\r\n position: relative;\r\n left: -44px;\r\n display: block;\r\n padding-bottom: 10px;\r\n}\r\n<div class=\"rowTab\">\r\n <div class=\"labels\">\r\n <label id=\"checkbox-label\" for=\"changes\">What do you think we should do to improve our fabulous toilet if any...</br>there should'nt be any but choose please:</label>\r\n </div>\r\n <div class \"rightTab\">\r\n <ul id=\"changes\">\r\n <li class=\"checkbox\"><label><input name=\"prefer\" value=\"1\" type=\"checkbox\" class=\"userRatings\">Cleanliness</label></li>\r\n <li class=\"checkbox\"><label><input name=\"prefer\" value=\"2\" type=\"checkbox\" class=\"userRatings\">Friendliness</label></li>\r\n <li class=\"checkbox\"><label><input name=\"prefer\" value=\"3\" type=\"checkbox\" class=\"userRatings\">Everything, it's shite</label></li>\r\n <li class=\"checkbox\"><label><input name=\"prefer\" value=\"4\" type=\"checkbox\" class=\"userRatings\">Nothing, it's fantastic</label></li>\r\n <li class=\"checkbox\"><label><input name=\"prefer\" value=\"5\" type=\"checkbox\" class=\"userRatings\">No changes required, it's is the best toilet I've ever been to</label></li>\r\n </ul>\r\n </div>\r\n</div>"
] | [
"html",
"css",
"checkbox",
"label",
"alignment"
] |
[
"Creates an array that stores character by character in c",
"I'm trying to create an array that allows me to enter the characters depending on the number that the user has previously entered, if I enter 10 I only want the user to enter 10 characters, A or F. The problem is that it does not work as expected, when entering the number it sends me to the while loop and does not let me exit.\n#include <stdio.h>\n\nint main() {\n int i, students;\n char grade[100];\n\n printf("Welcome, enter the number of students to assign school grade: \\n");\n scanf("%d", &students);\n\n printf("Enter A (Approved) or F (Failure)\\n");\n for (i = 0; i < students; i++) {\n printf("School grade for student %d: \\n", i + 1);\n scanf("%c", &grade[i]);\n while (grade[i] != 'A' || grade[i] != 'F') {\n printf("Please enter a valid school grade: ");\n scanf("%c", &grade[i]);\n }\n }\n return 0;\n}\n\nAfter I enter the number 10, the program skips the second scanf and sends me into the while loop.\n\nBy changing scanf("%c", &grade[i]) into scanf (" %c", &grade[i]), the problem is that now the while loop is held even when I enter A or F."
] | [
"arrays",
"c",
"char",
"scanf"
] |
[
"How read csv file only specific columns using javascript",
"I have created a function for csv reader using react-file-reader. It´s working fine and data is successfully uploaded into the database but that csv file have more than 10 columns. I want only the first three and fifth column. \n\nThat´s my code\n\nconst reader = new FileReader();\nreader.readAsText(files[0]);\nreader.onload = (x) => {\n console.log('check data 1 :', x);\n console.log('check data :', x.currentTarget.result.split('/n'));\n\n const lines = x.currentTarget.result.split('\\n');\n\n const result = [];\n\n for (let i = 0; i < lines.length - 1; i++) {\n const obj = {};\n //const newObj = lines.splice(4,1);\n const currentline = lines[i].split(',');\n const headers = ['ac_no', 'name', 'date_time', 'check_type'];\n for (let j = 0; j < headers.length; j++) {\n\n obj[headers[j]] = currentline[j];\n\n }\n\n result.push(obj);\n\n }\n\n\nCan you help me?"
] | [
"javascript",
"reactjs",
"csv"
] |
[
"Simulink-Simulation with parfor (Parallel Computing)",
"I asked today a question about Parallel Computing with Matlab-Simulink. Since my earlier question is a bit messy and there are a lot of things in the code which doesnt really belong to the problem.\nMy problem is\nI want to simulate something in a parfor-Loop, while my Simulink-Simulation uses the "From Workspace" block to integrate the needed Data from the workspace into the simulation. For some reason it doesnt work.\nMy code looks as follows:\nload DemoData\npath = pwd;\n\napool = gcp('nocreate');\nif isempty(apool)\n apool = parpool('local');\nend\n\nparfor k = 1 : 2\n load_system(strcat(path,'\\DemoMDL'))\n set_param('DemoMDL/Mask', 'DataInput', 'DemoData')\n\n\n SimOut(k) = sim('DemoMDL')\n end\n\ndelete(apool);\n\nMy simulation looks as follows\n\nThe DemoData-File is just a zeros(100,20)-Matrix. It's an example for Data.\nNow if I simulate the Script following error message occures:\nErrors\n\nError using DemoScript (line 9)\nError evaluating parameter 'DataInput' in 'DemoMDL/Mask'\n\nCaused by:\n\nError using parallel_function>make_general_channel/channel_general (line 907)\nError evaluating parameter 'DataInput' in 'DemoMDL/Mask'\n Error using parallel_function>make_general_channel/channel_general (line 907)\n\n Undefined function or variable 'DemoData'.\n\n\nNow do you have an idea why this happens??\nThe strange thing is, that if I try to acces the 'DemoData' inside the parfor-Loop it works. For excample with that code:\nload DemoData\npath = pwd;\n\napool = gcp('nocreate');\nif isempty(apool)\n apool = parpool('local');\nend\n\nparfor k = 1 : 2\n load_system(strcat(path,'\\DemoMDL'))\n set_param('DemoMDL/Mask', 'DataInput', 'DemoData')\n fprintf(num2str(DemoData))\nend\n\ndelete(apool);\n\nThats my output without simulating and displaying the Data\n'>>'DemoScript\n00000000000000000 .....\nThanks a lot. That's the original question with a lot more (unnecessary) details:\nEarlierQuestion"
] | [
"matlab",
"parallel-processing",
"simulink",
"parfor"
] |
[
"Get Height from Floor Level React Native",
"Is it possible to get the height from the floor level in React Native? Assume I'm in the 2nd floor of a building. I want to get the current height I'm holding the device from the floor level?"
] | [
"react-native"
] |
[
"python - pyinstaller \"RuntimeWarning: Parent module 'PyInstaller.hooks.hook-PIL' not found while handling absolute import\" and \"tcl\" related errors",
"I get a warning message while trying to create exectable file using pyinstaller. This warning appeared after installing Pillow. Previously i nevre got any warnings and was able to make it through.\n\nthe warning i get by pyinstaller is:\n\n7314 INFO: Analyzing main.py\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/hooks/hook-PIL.Image.py:14: RuntimeWarning: Parent module 'PyInstaller.hooks.hook-PIL' not found while handling absolute import\n from PyInstaller.hooks.shared_PIL_Image import *\n\n\nAlso when i tried to run the executable's exe/consol version of my code that lies inside the dist folder created by the pyinstaller (dist/main/main), these are displayed..\n\nTraceback (most recent call last):\n File \"<string>\", line 26, in <module>\n File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/loader/pyi_importers.py\", line 276, in load_module\n exec(bytecode, module.__dict__)\n File \"/Users/..../build/main/out00-PYZ.pyz/PIL.PngImagePlugin\", line 40, in <module>\n File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/loader/pyi_importers.py\", line 276, in load_module\n exec(bytecode, module.__dict__)\n File \"/Users/..../build/main/out00-PYZ.pyz/PIL.Image\", line 53, in <module>\n File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/loader/pyi_importers.py\", line 276, in load_module\n exec(bytecode, module.__dict__)\n File \"/Users/..../build/main/out00-PYZ.pyz/FixTk\", line 74, in <module>\nOSError: [Errno 20] Not a directory: '/Users/.../dist/main/tcl'\nlogout\n\n[Process completed]\n\n\nso, i tried by uninstalling pillow, installing tk tcl dev version. And then installed pillow. Even that didnt helped.\n\nI also tried reinstalling pyinstaller,. didnt help too\n\nUpdate 1:\n\nIt seems Pyinstaller.hooks.hook-PIL.py file was missing in the Pyinstaller/hooks directory. And it was missing on all platforms(Mac, windows and linux). This is the warning/error message that i get on windows, which is the same i got on mac and on linux.\nLater i found a link which said, its just to need Python import machinery happy. so i created as said so. Then i dont get the same error on all platforms, But on mac i still get the PILImagePlugin,Image and FixTk errors"
] | [
"python",
"macos",
"tcl",
"pyinstaller",
"pillow"
] |
[
"Django refuses to accept my one-off default value for FloatField",
"I have a class and I'm trying to add a new FloatField to it. Django wants a default value to populate existing rows (reasonable). However, it refuses to accept any value I give it.\n\nYou are trying to add a non-nullable field 'FIELDNAME' to CLASS without a default; we can't do that (the database needs something to populate existing rows).\nPlease select a fix:\n 1) Provide a one-off default now (will be set on all existing rows with a null value for this column)\n 2) Quit, and let me add a default in models.py\nSelect an option: -1\nPlease select a valid option: -1\nPlease select a valid option: -1\nPlease select a valid option: float(-1)\nPlease select a valid option: -1.0\nPlease select a valid option: float(-1.0)\nPlease select a valid option: \n\n\nHow do I get it to accept my value?"
] | [
"python",
"django"
] |
[
"Preferred menus for C# application",
"Which of the menu tools do you use for C# windows applications? I began with MainMenu, but when I moved to VS2005, only MenuStrip appeared in the Toolbox, so I assumed it was new and better. However, the merge/replace action seems to require a lot more time and effort, and leave one open to maintenance problems. (Perhaps my real question is \"what were they thinking when they created MenuStrip?)\n\nDo you drag/drop the menus, or do you write the code? Do you use MainMenu, MenuStrip, or some other alternatives?"
] | [
"c#",
"menu",
"menustrip"
] |
[
"Excel byte[] (OLE) to xls c#",
"I'm trying to parse a .xls document that is saved in a SQL database using VB for Access. It's saved as an OLE document.\n\nWhat I do is write the document using a binary writer\n\nFileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.ReadWrite);\nBinaryWriter bw = new BinaryWriter(fs, document.GetTextEncoding());\nbw.Write(document);\nbw.Close();\nfs.Close();\n\n\nSo, the file is saved but when I open it on Office365 it gives me a grey page:\n\n\nBut, Windows explorer preview shows the document!!!!\n\n\n\nI've tryed to open file and save with Microsoft Interop but I got the same results. I've tryed to copy to a new file with HSSFWorkbook but the same ocurrs. With .doc, .jpg , .pdf I first try to allocate the header in the file to get the start position for the binary writer but I cannot figure out if .xls has this kind of header. (Most of those .pdf, .doc, .jpg document can be opened)\n\nThis is Interop code:\n\n excel.Workbooks.Open(filePath, Notify: false, CorruptLoad: Microsoft.Office.Interop.Excel.XlCorruptLoad.xlRepairFile).\n SaveAs(filePath, Microsoft.Office.Interop.Excel.XlFileFormat.xlExcel5, Type.Missing, Type.Missing, true, false, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, XlSaveConflictResolution.xlLocalSessionChanges, Type.Missing, Type.Missing);\n\n\nHave tryed changing the XLFileFormat, even sometimes I can't preview it.\n\nHSSF code:\n\nHSSFWorkbook hssfwb;\n\nusing (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read))\n {\n hssfwb = new HSSFWorkbook(file);\n file.Close();\n }\n\n FileStream file2 = new FileStream(filePath+ \"_mod\", FileMode.Create, FileAccess.Write);\n\n hssfwb.Write(file2);\n file2.Close();\n\n\nHappens the same, can preview but can't open.\n\nEDIT\n\ndocument:\n\nbyte[] doc = (byte[])reader[\"DEX_Documento\"];\n\n\nIt's read from database, it's a hex string parsed to byte. Unfortunately, is hard to find a document that I can give you the string due to legal terms.\n\nAlso, I can read the rows with the HSSF solution, but the problem persists."
] | [
"c#",
"excel",
"office-interop",
"excel-interop",
"hssfworkbook"
] |
[
"Use of frame layout to render multiple views",
"I typically organize my code/logic by a fragment represent one layout. Now I am in need of few relatively simple forms to get input data from user, which are somewhat related in purpose. \n\nSay I hav 3 screens, and I could create 3 fragments to handle them (display view, read input, submit, ..). Or should I use one fragment, and use FrameLayout create a stack of layouts. I was thinking like, stacking all 3 views and hide/display the view I like. But the documentation say \n\n\n Generally, FrameLayout should be used to hold a single child view,\n because it can be difficult to organize child views in a way that's\n scalable to different screen sizes without the children overlapping\n each other\n\n\nAny good way to do this or should I create multiple fragments for this (the down side of this is lot of small classes and repeated code. I may use a base class, still like to explore other options)\n\nThanks."
] | [
"android",
"android-layout"
] |
[
"apktool is not generating apk file",
"I used apktool 2.0.0 rc4 version and unpackaged CP.apk file using the tool, then modified a file and trying to re-package it using \" apktool b CP test.apk \" command\n\nand output goes as below , however there is no test.apk in working directory.\n\n...\\apktool>apktool b CP test.apk\nI: Using Apktool 2.0.0-RC3 on CP\nI: Checking whether sources has changed...\nI: Smaling smali folder into classes.dex...\nI: Checking whether resources has changed...\nI: Copying raw resources...\nI: Building apk file...\nI: Copying unknown files/dir...\n\n\nAm I missing anything ?"
] | [
"android",
"apktool"
] |
[
"Find duplicated element in array of objects",
"I have few arrays of JSON objects.I need to iterate over the arrays and return true if there are two or more elements with the same userId value.\n\n[{\n\"name\":\"John\",\n\"age\":30,\n\"userId\": 5,\n}],\n\n[{\n\"name\":\"Benjamin\",\n\"age\":17,\n\"userId\": 5,\n}],\n\n[{\n\"name\":\"Johnatan\",\n\"age\":35,\n\"userId\": 10,\n}]\n\n\nHere is my method so far, I'm iterating over the array and checking is there a user with 506 userId presence.\n\nisPostedMultiple = (data) => {\n for (let j = 0; j < data.length; j++) {\n if (data[j].UserId == '506') {\n console.log('506 data :', data[j]);\n } else {\n console.log('not 506 data'); \n }\n }\n}"
] | [
"javascript",
"reactjs"
] |
[
"Saving image from app / camera",
"I have this code in MainActivity: \nonCreate() : \n\nmtestImage = (ImageView) findViewById(R.id.testImage);\nmtestImage.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);\n startActivityForResult(intent, RESULT_LOAD_IMAGE);\n }\n });\n\n\npublic void onActivityResult(int reqCode, int resCode, Intent data):\n\nif (resCode == RESULT_OK) {\n if (reqCode == 1) {\n mtestImage.setImageURI(data.getData());\n }\n }\n\n\nIt works and ImageView shows me the picture that I opened, but if I restart Activity :\n\nIntent intent = getIntent();\n finish();\n startActivity(intent);\n\n\nThe ImageView is restore default picture. How Can I save image that I took to work with it in future? (I'm trying to change BG of DrawerMenu with new pictures, that user can choose). \nI founud some code in internet, but I'm not sure how I can combine it with my code:\n\nprivate File createImageFile() throws IOException\n {\n String timeSnap = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeSnap + \" \";\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);\n File image = File.createTempFile(imageFileName, \".jpg\", storageDir);\n return image;\n }\n\n\nTHANK YOU!"
] | [
"java",
"android"
] |
[
"Gruntfile.js SASS Task Configuration",
"Line 'css/???????': 'sass/???????' of the following is what I can not sort out. I have sass-globbing installed due to having multiple directories and levels of SASS files. There are 4 independently compiled sass files in my /sass directory.\n\nmodule.exports = function (grunt) {\n grunt.initConfig({\n pkg: grunt.file.readJSON('package.json'),\n watch: {\n sass: {\n files: ['sass/{,**/}*.{scss,sass}'],\n tasks: ['sass:dist']\n },\n },\n sass: {\n options: {\n sourceMap: false,\n outputStyle: 'expanded'\n },\n dist: {\n files: {\n 'css/???????': 'sass/???????'\n }\n }\n }\n });\n grunt.registerTask('default', ['sass:dist', 'watch']);\n grunt.loadNpmTasks('grunt-sass');\n grunt.loadNpmTasks('grunt-contrib-watch');\n};"
] | [
"css",
"ruby",
"node.js",
"sass",
"gruntjs"
] |
[
"Flutter: How to get Name of a Place using Lat Long in Flutter Google Maps",
"I'm working on an Alert app then sends a link of Google Maps that will open up user's location in Google Maps Application.\n\nAlong with the link I want to send Address of that place in String as well.\n\nFor example\n\nLat : 33.038484 & Long: 66.384858\n\nLets say that these are the co-ordinates of Square Times, New York\n\nI want to send https://maps.google.com/q=33.038484,66.384858 Square Times, New York\n\nIs there a way to get the Name/Address using Lat Long?"
] | [
"flutter",
"dart",
"flutter-dependencies"
] |
[
"ASP.net MVC HTTP Request error with payload",
"I am creating an ASP.net MVC website with a RESTful API to a SQL database. I have implemented a controller which holds the HTTP commands.\n\nOne of the commands is a POSTcommand:\n\n // POST: api/PoolTests\n [ResponseType(typeof(PoolTest))]\n public IHttpActionResult PostPoolTest(PoolTest poolTest)\n {\n if (!ModelState.IsValid)\n {\n return BadRequest(ModelState);\n }\n\n db.PoolTests.Add(poolTest);\n db.SaveChanges();\n\n return CreatedAtRoute(\"DefaultApi\", new { id = poolTest.Id }, poolTest);\n }\n\n\nI am using Fiddler to test out the function and I am getting some strange results. According to the automatically generated API documents the request format should be JSON with this structure (These are the fields to the connect SQL database):\n\n {\n \"Id\": 1,\n \"SiteID\": \"sample string 2\",\n \"Date\": \"sample string 3\",\n \"Tub\": \"sample string 4\",\n \"par1\": 5.1,\n \"par2\": 6.1,\n \"par3\": 7.1,\n \"par4\": 8.1\n }\n\n\nIn the fiddler composer I select POST and http://localhost:53660/api/PoolTests and the JSON payload {\"Id\": 1,\"SiteID\": \"sample string 2\", \"Date\": \"sample string 3\",\"Tub\": \"sample string 4\",\"par1\": 5.1, \"par2\": 6.1,\"par3\": 7.1,\"par4\": 8.1}\n\nThis results in a HTTP 400 error code.\n\nIf I send the same request with no JSON (payload) then it breaks at the line db.PoolTests.Add(poolTest); because the payload is null.\n\nWith payload if I place a break point at line if (!ModelState.IsValid) the breakpoint is never reached. It is almost like with payload the actual HTTP command is not being recognised.\n\nAny thoughts - I appreciate that there may be some details missing.\n\nADDED: PoolTest Class\n\npublic class PoolTest\n{\n public int Id { get; set; }\n public string SiteID { get; set; }\n public string Date { get; set; }\n public string Tub { get; set; }\n public double par1 { get; set; }\n public double par2 { get; set; }\n public double par3 { get; set; }\n public double par4 { get; set; }\n}\n\n\nFIDDLER Screenshot Added:\n\nI have added the content-type and now I hit the breakpoint, but the Pooltest is reported as being null"
] | [
"asp.net",
"json",
"asp.net-mvc",
"http"
] |
[
"Python -0.000000e+00 struct pack return wrong value",
"Hi I have problem with parsing -0.000000e+00 on linux( on windows is working). \n\nstruct.pack( \"d\", -0.000000e+00 )\n\n\nOn linux struct.pack change -0.000000e+00 to 0.000000e+00. When i print value before pack is correct but result of struct.pack is like it was 0.000000e+00.\n\nIs there any solution to solve this problem.\n\nI think i need to add negative number witch is closest to 0. How to do that?\n\nEDIT\nstruct.pack( \"d\", -0.000000e+00 ) result '\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x80'\n\nstruct.pack( \"!d\", -0.000000e+00 )result '\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00'\n\nstruct.pack( \"<d\", -0.000000e+00 )result '\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00'\n\nstruct.pack( \">d\", -0.000000e+00 )result '\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00'\nI want to use \"< d\" and \" > d\".\n\nEDIT Sry not error."
] | [
"python",
"data-conversion",
"python-2.4",
"struct.pack"
] |
[
"Oracle query with minus operator issue",
"Im trying to extract certain users in my database by comparing two tables. My query is this:\nselect 'alter user '||username||' identified by "kRobGc3$vs0cmzX";'\nfrom dba_users\nwhere default_tablespace='APPS_TS_TX_DATA'\nand username not in ('John','Stacey','Mark','Jim')\nminus \nselect oracle_username from FND_ORACLE_USERID;\n\nSo when i execute above query it returns users that are filtered by my first select, and somehow bypass minus second select.\nAny idea how to manage this?\nThank you"
] | [
"oracle",
"plsql"
] |
[
"Runspace.open uses application pool indentity instead of identity impersonate",
"I have an identity impersonate setting on webconfig. I am trying to connect to the exchange mail server from c# but instead of using identity impersonate from web.config, the runspace.open() command uses identity from application pool. And ends up giving me access denied error.\n\nI have checked the identity impersonate is working for that page.\n\nIf i put the same credentials as web.config impersonate on applications pool identity, then it works but I dont want the whole application to run using that credential. I want to run just the single page that connects to mail server using the identity in web.config?\n\nMy problem is similar to the unsolved problem here.\n\nhttp://forums.asp.net/p/1771787/5554766.aspx?Re+net+and+remote+powershell+sessions\n\nCan anyone help me?"
] | [
"c#",
"iis",
"powershell",
"impersonation",
"exchange-server-2010"
] |
[
"Initialize an NSArray with the numbers in a sequential manner when the count of the array is known",
"I want to initialize an NSArray with numbers starting from 0,1,2,3... I know the count of the array. For example:\n\nI have an array that needs to be initialized with 5 (count) as capacity. Now I want to initialize this array with 0,1,2,3,4 and I need to initialize it dynamically.\n\nIf the count of the array is 10, I need to initialize the array with 0,1,2,3,4,5,6,7,8,9 at respective indexes. The problem is that count of the array changes dynamically and I need to initialize it accordingly.\n\nCan someone suggest me any idea on how to implement this?"
] | [
"iphone",
"objective-c",
"ios",
"nsarray"
] |
[
"In Python, how do I check if a string has alphabets or numbers?",
"If the string has an alphabet or a number, return true. Otherwise, return false.\n\nI have to do this, right?\n\nreturn re.match('[A-Z0-9]',thestring)"
] | [
"python",
"regex"
] |
[
"Deserialize CSV with ServiceStack.Text",
"I'm trying to use ServiceStack.Text for deserializing a csv file containing \";\" as the seperator.\n\nThe test csv contains this data \n\n---------------\n| Col1 | Col2 |\n---------------\n| Val1 | Val2 |\n---------------\n| Val3 | Val4 |\n---------------\n\npublic class Line\n{\n public string Col1 { get; set; }\n public string Col2 { get; set; }\n}\n\n\nThe code that works: \n\nvar CsvWithComma = \"Col1,Col2\" + Environment.NewLine + \n\"Val1,Val2\" + Environment.NewLine +\n\"Val3,Val3\" + Environment.NewLine;\n\nvar r1 = ServiceStack.Text.CsvSerializer.DeserializeFromString<List<Line>>(CsvWithComma);\n\nAssert.That(r1.Count() == 2, \"It should be 2 rows\");\nAssert.That(r1[0].Col1 == \"Val1\", \"Expected Val1\");\nAssert.That(r1[0].Col2 == \"Val2\", \"Expected Val2\");\n\n\nThe code that fails:\n\nServiceStack.Text.CsvConfig.ItemSeperatorString = \";\";\n\nvar CsvWithSemicolon = \"Col1;Col2\" + Environment.NewLine +\n\"Val1;Val2\" + Environment.NewLine +\n\"Val3;Val3\" + Environment.NewLine;\n\nvar r2 = ServiceStack.Text.CsvSerializer.DeserializeFromString<List<Line>>(CsvWithSemicolon);\n\nAssert.That(r2.Count() == 2, \"It should be 2 rows\");\nAssert.That(r2[0].Col1 == \"Val1\", \"Expected Val1\");\nAssert.That(r2[0].Col2 == \"Val2\", \"Expected Val2\");\n\n\nWhen I dig into the ServiceStack code is seems like it's using the ServiceStack.Text.Common.JsWriter.ItemSeperator as a seperator for the CSV reader and not the ServiceStack.Text.CsvConfig.ItemSeperatorString. \n\nHas anyone got this working?"
] | [
"c#",
"csv",
"servicestack",
"servicestack-text"
] |
[
"Returning a recursive iterator from a function",
"I have a function that returns a flat-mapped Vec over children of a tree:\n\nuse std::iter;\n\n#[derive(Clone)]\nstruct Tree {\n value: String,\n children: Vec<Tree>,\n}\n\nstruct NoClone;\n\nimpl NoClone {\n pub fn children(&self, from: &Tree) -> Vec<Tree> {\n from.children.clone()\n }\n\n pub fn descendants_vec<'a>(&'a self, from: Tree) -> Vec<Tree> {\n let children = self.children(&from);\n iter::once(from)\n .chain(children.into_iter().flat_map(|child| self.descendants_vec(child)))\n .collect::<Vec<Tree>>()\n }\n\n pub fn descendants_iter<'a>(&'a self, from: Tree) -> Box<Iterator<Item = Tree> + 'a> {\n let children = self.children(&from);\n Box::new(iter::once(from)\n .chain(children.into_iter().flat_map(move |child| {\n self.descendants_iter(child)\n })))\n }\n}\n\nfn main() {\n //println!(\"Flattened (Iter): {:?}\", mapped_iter());\n println!(\"Flattened (Vec): {:?}\", mapped_vec());\n}\n\nfn tree() -> Tree {\n let tree_a = Tree {\n value: \"a\".to_owned(),\n children: Vec::new(),\n };\n\n let tree_b = Tree {\n value: \"b\".to_owned(),\n children: Vec::new(),\n };\n\n let tree_c = Tree {\n value: \"c\".to_owned(),\n children: Vec::new(),\n };\n\n Tree {\n value: \"abc\".to_owned(),\n children: vec![tree_a, tree_b, tree_c],\n }\n}\n\n/*fn mapped_iter() -> Vec<String> {\n let tree = tree();\n let no_clone = NoClone;\n no_clone.descendants_iter(tree).map(|x| x.value).collect::<Vec<String>>()\n}*/\n\nfn mapped_vec() -> Vec<String> {\n let tree = tree();\n let no_clone = NoClone;\n no_clone.descendants_vec(tree)\n .into_iter()\n .map(|x| x.value)\n .collect::<Vec<String>>()\n}\n\n\nI would like to avoid the intermediate collect/iter and use descendants_iter which returns an Iterator (boxed until we get impl traits).\n\nHowever, uncommenting the blocks calling this function causes the compiler to complain with the following error:\n\nerror: `no_clone` does not live long enough\n --> <anon>:63:1\n |\n62 | no_clone.descendants_iter(tree).map(|x| x.value).collect::<Vec<String>>()\n | -------- borrow occurs here\n63 | }\n | ^ `no_clone` dropped here while still borrowed\n |\n = note: values in a scope are dropped in the opposite order they are created\n\nerror: aborting due to previous error\n\n\nAny ideas about how to use the descendants_iter function?"
] | [
"rust"
] |
[
"Why Update Unit Test during O&M?",
"I've worked on 2 software development teams.\n\nThe first team did not keep unit tests up-to-date due to:\n\n\nlack of time\nlack of skill with a newly introduced unit test tool\ncomplex code that O&M developers did not fully understand, and thus know how to unit test properly\n\n\nThe second team wants to keep unit tests up-to-date, even during O&M.\n\nWhat say you?"
] | [
"unit-testing"
] |
[
"Can you search in current project and all referenced projects within solution?",
"I have some memory leaking. I am creating a big object graph and then derefencing it.\n\n var a = MyDomainModel.Create();\n a = null;\n //GC.Collect();\n Console.ReadLine();\n\n\nThere is no unmanaged stuff in there. JustTrace and ANTS (version 6) are both reporting that the objects are held in place by \"System.Object[]\". \nI am assuming that there is a static field (list/dictionary/hashset) hidden somewhere that is using an ArrayList internally. I am planning to do a bit of text searching (probably some regex in there, too).\nIt is a pretty big solution with 30 projects. Is there any way I can do Visual Studio text search in \"current project and all projects within the solution that are referenced directly/indirectly by current project\"? The underlying physical file folders are not organized in a way that would meaningfully represent these dependencies."
] | [
"visual-studio-2010",
"c#-4.0",
"memory-leaks",
"red-gate-ants"
] |
[
"BigQuery Syntax Error",
"I'm getting this error in BigQuery:\nError: syntax error at: 2:1 expecting: end of query but got: \"CASE\"\n\nQuery that I'm using is:\n\nSELECT DISTINCT \n\n CASE \n WHEN\n t1.x<=t2.x \n THEN \n t1.x \n ELSE\n t2.x \n END id1, \n\n CASE \n WHEN\n t1.x<=t2.x \n THEN \n t2.x \n ELSE \n t1.x \n END id2 \n\n FROM test1 t1 \n CROSS JOIN test1 t2 \n WHERE NOT t1.x = t2.x\n\n\nWorks in mysql but not in BigQuery."
] | [
"mysql",
"google-bigquery"
] |
[
"Is there a way to detect data traffic in an Internet Explorer window with AutoIt?",
"Is there a way to detect and save incoming and outgoing data through an Internet Explorer window with AutoIt like an Event Listener or Fiddler ?\n\nOr is there any other way to do this with another browser ?"
] | [
"internet-explorer",
"network-programming",
"fiddler",
"autoit"
] |
[
"How to prevent redundant api calls in vuejs?",
"Following is my code:\ncreated() {\nthis.$validator.extend('available', {\n getMessage: () => 'This user already exists.',\n validate: async (value, args) => {\n const result = await this.emailValidation(value, args);\n\n return result;\n },\n});\n},\n\nmethods(){ \nasync emailValidation(value, args) {\n if (value !== null && args.indexOf(value) === -1) {\n const request = {\n email: value,\n id: store.state.id,\n };\n const response = await this.verifyEmail(request);\n\n return response && response.data ? response.data.available : false;\n }\n\n return true;\n}, \n},\n\nAnd following is the text field:\n<v-text-field\n v-model="email"\n v-validate="\n dialogLabel !== 'Add User' ? 'required|email|available:' + email : 'required|email|available'\n "\n data-test-id="email"\n :error-messages="errors.first('email')"\n data-vv-name="email"\n label="Email"\n placeholder="Email"\n required\n clearable\n @change="changeEmail()"\n/>\n\nWhen I add full email id, at that time also it gives API call i.e. before loosing the focus and also on blur it gives API call again to validate email id.\nI want to make only one call. How can I do it?"
] | [
"javascript",
"vue.js"
] |
[
"Redirect upon buton condition clicked",
"I have my home page that I would like to automatically redirect to another page. On the other hand I would like to be able to access it if I click on the button of my menu.\nIn my header file :\n <a class="header__menu-url header__menu-requests" href="/hc/en-us/" id="Home" >\n\nIn my home page :\n <script>\ndocument.getElementById('Home').onclick = handleClick;\n\nfunction handleClick(e) {\n var sender = (e && e.target) || (window.event && window.event.srcElement);\n if (sender.id != "Home") {\n window.location.href = '/hc/fr-fr/requests' \n }\n}\n</script>\n<div class="container">\n <div id="main-content">\n <h1 class="page__header pright-lg">\n Toolkits\n </h1>\n <div class="hero-inner">\n <h2 class="visibility-hidden">{{ t 'search' }}</h2>\n <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" focusable="false" viewBox="0 0 12 12"\n class="search-icon" aria-hidden="true">\n <circle cx="4.5" cy="4.5" r="4" fill="none" stroke="currentColor" />\n <path stroke="currentColor" stroke-linecap="round" d="M11 11L7.5 7.5" />\n </svg>\n {{search submit=false instant=settings.instant_search class='search search-full'}}\n </div>\n </div>\n</div>\n\nThanks"
] | [
"javascript"
] |
[
"Create user in SQL Server 2008",
"I have SQL Server user in the database and for some reason, user is not able to view the tables when connecting\n\nHere are the commands that I am using to create that user. I do not want to make the user dbuser the owner of the schema. \n\ncreate user dbuser for login dbuser'\n\n--on the specific database, I am using these commands.\nexec sp_addrolemember @rolename = 'db_datareader', @membername = 'dbuser'\nexec sp_addrolemember @rolename = 'db_datawriter', @membername = 'dbuser'\n\ngrant select on schema :: [schema1] TO [dbuser]\ngrant insert on schema :: [schema1] TO [dbuser]\ngrant update on schema :: [schema1] TO [dbuser]\ngrant execute on schema :: [schema1] TO [dbuser]\n\ngrant select on schema :: [schema2] TO [dbuser]\ngrant insert on schema :: [schema2] TO [dbuser]\ngrant update on schema :: [schema2] TO [dbuser]\ngrant execute on schema :: [schema2] TO [dbuser]\n\n\nEven though I am granting all insert and update access on the schema.. the user when logged in with dbuser is not able to view the any of the tables from any of the schema. He just sees the system tables tab when the user tries to connect to the database. User needs to see all the tables under the schema1,schema2, schema3 \n\nthanks"
] | [
"sql",
"sql-server",
"sql-server-2008",
"permissions"
] |
[
"What's the best way to wrap an ES6 library?",
"What's the best way to setup an ES6 library so that it's modular and transpiles into one ES5 UMD file? I looked at the way async.js and lodash do it, but it's hard to understand what's going on.\n\nFor example, index.js:\n\nimport doSomething from './doSomething';\n\nclass Example {\n constructor() {\n this.name = 'Example';\n }\n}\n\nObject.assign(Example.prototype, {\n doSomething\n});\n\nexport default Example;\n\n\nand doSomething.js:\n\nexport default function doSomething() {\n return this.name;\n}\n\n\nSo that user can do something like this:\n\nvar example = new Example();\nexample.doSomething(); // Example\n\n\nI'm having no luck with Babel, as transform-es2015-modules-umd is not evaluating paths correctly, and Babel's not bundling it all into one ES5 file either. Anyone have a simple example for something like this?"
] | [
"javascript",
"ecmascript-6",
"babeljs",
"umd"
] |
[
"Fill in a Custom Ribbon ComboBox (Runtime)",
"I have a combobox in a custom Ribbon created with CustomEditor (XML).\n\nI would like to modify combobox elements when I press a command button located in a Excel Sheet.\n\n <comboBox id=\"Combo3\" getItemCount=\"Módulo4.Número_Elementos_Combobox\" getItemID=\"Módulo4.Identificador_Items\" getItemLabel=\"Módulo4.Texto_Items\" image=\"Foto_Excel\" onChange=\"Módulo1.Todos_Los_Combos\">\n </comboBox>\n\n\nMany thanks in advance.\nRegards.\nJosé."
] | [
"excel",
"vba",
"ribbon",
"ribbon-control",
"ribbonx"
] |
[
"Gmail Add-on Create Radio Group with Text Input",
"I am working on a Gmail Add-on with a dynamically created radio group, something like:\n\n\nHow can I insert an input text box as one of the radio options?\n\nThis is what I have so far:\n\nvar urlGroup = CardService.newSelectionInput()\n .setType(CardService.SelectionInputType.RADIO_BUTTON)\n .setTitle(\"Please select a link\")\n .setFieldName(\"radio_group\")\n\n\n //How do I get a text input field here as one of the radio options\n // This is the line I cannot figure out\n urlGroup.addItem(** insert input textbox here **)\n\n for (var g = 0; (g < getURLsection.length); g++) {\n //shorten long links to fit in card\n if (getURLsection[g].length > 21) {\n var URLname = getURLsection[g].slice(0, 22) + \"...\" + getURLsection[g].slice(-5);\n } else {\n var URLname = getURLsection[g]\n }\n\n urlGroup.addItem(URLname, getURLsection[g], false)\n }\n\n // create radio button group\n var section = CardService.newCardSection()\n .addWidget(urlGroup)\n\n\nAny ideas on how to do this?\nPreferably I would like to remove the word Other: and just have it as a .setTitle(\"enter link here\") within the textbook."
] | [
"javascript",
"google-apps-script",
"gmail-api",
"gmail-addons",
"gsuite-addons"
] |
[
"how to extract xml node using LinqtoXml",
"using the XML below how can we extract the value of lat and lng using linq to xml lambda queries\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<GeocodeResponse>\n<status>OK</status>\n<result>\n <type>premise</type>\n <formatted_address>Livingston, West Lothian EH54, UK</formatted_address>\n <address_component>\n <long_name>United Kingdom</long_name>\n <short_name>GB</short_name>\n <type>country</type>\n <type>political</type>\n </address_component>\n <geometry>\n <location>\n <lat>55.8831307</lat>\n <lng>-3.5162945</lng>\n </location>\n <location_type>APPROXIMATE</location_type>\n </geometry>\n <partial_match>true</partial_match>\n</result>\n\n\n\n\nI m using something like this to extract other nodes\n\n var xDoc = XDocument.Parse(doc.OuterXml);\n\n model = xDoc.Descendants(\"result\").Select(c =>\n new\n {\n FullAddress = c.Element(\"formatted_address\").Value,\n CountryName = c.Descendants(\"address_component\")\n .First(e => e.Element(\"type\").Value == \"country\").Element(\"long_name\").Value,\n }).First();"
] | [
"c#",
"linq",
"linq-to-xml"
] |
[
"Migrate SVN-Repositories into Gitblit",
"we would like to change from svn to git. We have a svn-server in our intranet and would like to have the equivalent for git. \n\ngitblit seems interesting to use because there is tomcat running on our server. \n\nSo, what's the easiest way to migrate all the repositories from svn? \n\nOne way I could think of is the following: \n\n\nmigrate each repository somewhere to a git client (something like this)\ncreate the git-repo on gitblit\npush to gitblit\n\n\nShould we go for this?"
] | [
"git",
"svn",
"gitblit"
] |
[
"How to create a new file with fs in Heroku",
"Always when I'm trying to create a file with fs in Heroku, I'm recieving the code 'ENOENT', because of course I don't have that file, can I create a new file, and then pass the information inside it?"
] | [
"java",
"node.js",
"fs"
] |
[
"PHP SESSION Logout Error",
"Many people may use a PHP mySQL function for login sections for a website\n\nI am trying to use this code;\n\nON EACH CONTENT PAGE - TO CHECK IF LOGGED IN (in the header of every content page)\n\n<?php\nsession_start();\nif(! isset($_SESSION[\"myusername\"]) ){\nheader(\"location:main_login.php\");\n}\n?>\n<html>\n<body>\nPage Content Here\n</body>\n</html>\n\n\nTHE LOGIN SCRIPT (which is referred to by my main_login.php page)\n\n<?php\n\nob_start();\n$host=\"ClubEvents.db.9606426.hostedresource.com\"; // Host name \n$username=\"ClubEventsRead\"; // Mysql username \n$password=\"Pa55word!\"; // Mysql password \n$db_name=\"ClubEvents\"; // Database name \n$tbl_name=\"members\"; // Table name \n\n// Connect to server and select databse.\nmysql_connect(\"$host\", \"$username\", \"$password\")or die(\"cannot connect\"); \nmysql_select_db(\"$db_name\")or die(\"cannot select DB\");\n\n// Define $myusername and $mypassword \n$myusername=$_POST['myusername']; \n$mypassword=$_POST['mypassword']; \n\n// To protect MySQL injection (more detail about MySQL injection)\n$myusername = stripslashes($myusername);\n$mypassword = stripslashes($mypassword);\n$myusername = mysql_real_escape_string($myusername);\n$mypassword = mysql_real_escape_string($mypassword);\n$sql=\"SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'\";\n$result=mysql_query($sql);\n\n// Mysql_num_row is counting table row\n$count=mysql_num_rows($result);\n\n// If result matched $myusername and $mypassword, table row must be 1 row\nif($count==1){\n\n// Register $myusername, $mypassword and redirect to file \"login_success.php\"\nsession_register(\"myusername\");\nsession_register(\"mypassword\"); \nheader(\"location:login_success.php\");\n}\nelse {\necho \"Wrong Username or Password\";\n}\nob_end_flush();\n?>\n\n\nTHE LOGOUT CODE\n\n<?\nsession_start();\nsession_destroy();\n\nheader(\"location:main_login.php\");\nexit();\n?> \n\n\nMAIN_LOGIN.php\n\n<table width=\"300\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">\n<tr>\n<form name=\"form1\" method=\"post\" action=\"checklogin.php\">\n<td>\n<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#FFFFFF\">\n<tr>\n<td colspan=\"3\"><strong>Member Login </strong></td>\n</tr>\n<tr>\n<td width=\"78\">Username</td>\n<td width=\"6\">:</td>\n<td width=\"294\"><input name=\"myusername\" type=\"text\" id=\"myusername\"></td>\n</tr>\n<tr>\n<td>Password</td>\n<td>:</td>\n<td><input name=\"mypassword\" type=\"text\" id=\"mypassword\"></td>\n</tr>\n<tr>\n<td>&nbsp;</td>\n<td>&nbsp;</td>\n<td><input type=\"submit\" name=\"Submit\" value=\"Login\"></td>\n</tr>\n</table>\n</td>\n</form>\n</tr>\n</table>\n<?php\nphpinfo()\n?>\n\n\nbut something isnt working, the page login_success.php should only be accessable when logged in, so either the logout isnt working, or, the login_success.php check isnt working. But I don't know how to tell, I have tried playing around with them both, and still no further forward\n\nRegards\n\nHenry"
] | [
"php",
"session",
"login"
] |
[
"PHP mail script using up huge amounts of resources",
"I need to send a few hundred emails at a time to registered users and I'm running into a problem. The PHP script I use (and have used before with no issues on a different hosting service) lags the entire server (which has 8GB RAM by the way) for as long as it is sending emails.\n\nNow, I talked to the hosting support people, asking if something's wrong with their mail server, or if there are some outgoing mail limitations or whatever, and they said no. In fact, they are adamantly claiming that it's a coding issue. I highly doubt that, but it's possible the script was slightly altered since its last use a few months back, so I'm sharing the script below, and a typical email I would be sending is in the $content variable.\n\nThe question is, can someone see a reason why this code would eat up resources like crazy?\n\nI have checked the MySQL logs, and the query itself (which gets emails from the database) isn't slow. So it's the mailing itself.\n\nPHP mail_sender file:\n\n$content=\"<p style='line-height:20px;margin:10px 0;'>Hello,</p>\n\n<p style='line-height:20px;margin:10px 0;'>This is an email to notify you etc etc.</p>\n\n<p style='line-height:20px;margin:10px 0;'>This is line 2 of the email, it's usually not much longer than this example.</p>\n\n<p style='line-height:20px;margin:10px 0;'>Regards,<br/>Site Name staff</p>\";\n\n$result=mysql_query(\"select email from members where tipster_by_email='1' \") or die(mysql_error());\nwhile($row=mysql_fetch_assoc($result)){\n sendToUser($row['email'],$admin_email,\"Email Title\",$content);\n}\n\n\nAnd this is the function itself:\n\n//generic HTML-formatted e-mail sender\nfunction sendToUser($email,$admin_email,$subject,$content){\n\n//define the receiver of the email\n$to = $email;\n//create a boundary string. It must be unique\n//so we use the MD5 algorithm to generate a random hash\n$random_hash = md5(date('r', time()));\n//define the headers we want passed. Note that they are separated with \\r\\n\n$headers=\"From: Site Name <$admin_email>\";\n$headers.=\"\\r\\nReply-To: $admin_email\";\n//add boundary string and mime type specification\n$headers .= \"\\r\\nMIME-Version: 1.0\"; \n$headers .= \"\\r\\nContent-Type: text/html; \";\n//define the body of the message.\nob_start(); //Turn on output buffering \n?>\n\n<div style=\"width:730px;text-align:justify;margin-bottom:25px;\">\n\n<?php echo stripslashes($content); ?>\n\n<div style='width:100%;height:1px;background:#ccc;margin:10px 0;'></div>\n\n<div style='width:100%;color:#333;font-size:12px;'>\n <p style='line-height:12px;margin-top:10px;'>Site Name is owned by Company Name</p>\n <p style='line-height:12px;margin-top:10px;'>All rights reserved.</p>\n <p style='line-height:12px;margin-top:10px;'><a style='color:blue;' href='facebookurl'>Like us on Facebook</a> or <a style='color:#b04141;' href='twitterurl'>follow us on Twitter</a></p>\n</div>\n\n</div>\n\n<?php\n//copy current buffer contents into $message variable and delete current output buffer\n$message = ob_get_clean();\n//send the email\nmail( $to, $subject, $message, $headers );\n}\n\n\nIs there any reason whatsoever for this to use up resources or have a slow execution? The server is very fast and doesn't have a problem with anything else.\n\nMail settings in php.ini:\n\nMail SMTP Used under Windows only: host name or IP address of the SMTP server PHP should use for mail sent with the mail() function. [strikethrough]localhost[/strikethrough] **DEFAULT**, Click to Edit\nMail sendmail_from [strikethrough][email protected][/strikethrough] **DEFAULT**, Click to Edit\nMail sendmail_path /usr/sbin/sendmail -t -i\nMail smtp_port 25"
] | [
"php",
"email"
] |
[
"Deserialize Object inside object",
"Is this possible?\n\nPublic Class Foo\n public var as string\n\n public sub Load(byval filename as string)\n 'This is done\n [...]\n oItem = [...] 'Code to deserialize\n\n me = oItem 'THIS LINE\n end sub\nend class\n\n\nSo that you can load foo from the serialized file like so:\n\nPublic Sub Main\n Dim f as Foo = new Foo()\n f.load(\"myFile\")\nend sub\n\n\nUp until now i've had a function that that returns Foo as Object (I'm trying to make the serialize / deserialize process general so I can just copy and paste and avoid explicitly setting each variable)"
] | [
"vb.net",
"serialization",
".net-2.0"
] |
[
"Simple Javascript animation in Gatsby",
"I'm new to learning React and Gatsby, and am trying to find the best way to apply simple a Javascript animation to a DOM element within a component. I know how to handle component events with onClick etc, but say for example I want to continuously change the colour of a <span> in my Header.js component every 2 seconds.\nimport React from 'react';\n\nexport default function Header() {\n return (\n <header>\n <p>This is a <span>test!</span></p>\n </header>\n )\n}\n\nI'd then want to use some JS like:\nconst spanEl = document.querySelector('header span');\nlet counter = 0;\nconst changeColor = () => {\n if (counter % 2 == 0) {\n spanEl.style.color = "red";\n } else {\n spanEl.style.color = "blue";\n }\n counter++;\n if (counter == 10) counter = 0;\n}\nsetInterval(changeColor, 2000);\n\nI found that I could put this inside a script tag in html.js before the closing body tag, but is there a way to keep this functionality within the component? Do I need to completely rethink my approach when working within this framework?"
] | [
"javascript",
"reactjs",
"gatsby"
] |
[
"Object references of model getting lost on view",
"I'm triying to implement a view where I pass it an object with certain references to other objects, edit some fields and get it back to persis, the problem is those references are coming back as null once i get the object back, heres my implementation:\n\nthis is the model i pass to the view:\n\npublic class TicketCreationModel\n{\n\n\n public SupportItem item { get; set; }\n public Ticket ticket{ get; set; }\n public Employee employee{ get; set; }\n\n\n\n\n}\n\n\npretty simple, the model has a ticket, a support item and an employee. Now heres the method where I pass my model to the view:\n\npublic ActionResult AssignSupportItem(int supportItemId)\n {\n\n Ticket ticket = GetTicket();\n ticket.Item = repo.GetSupportItemFromId(supportItemId);\n TicketCreationModel model = new TicketCreationModel();\n model.employee = ticket.AccountableEmployee;\n model.item = ticket.Item;\n model.ticket = ticket;\n return View(model);\n }\n\n\nGetTicket() method on the first line returns the session object, here's the implementation:\n\nprivate Ticket GetTicket()\n {\n Ticket ticket = (Ticket)Session[\"Ticket\"];\n if (ticket == null)\n {\n ticket = new Ticket();\n Session[\"Ticket\"] = ticket;\n }\n return ticket;\n }\n\n\nNow heres the view that takes the model and enables some edit fields for the ticket:\n\n@model WebUI.Controllers.TicketCreationModel\n\n\n@{\nViewBag.Title = \"AssignSupportItem\";\n}\n\n<h2>AssignSupportItem</h2>\n\n\n@using (Html.BeginForm()) {\n @Html.ValidationSummary(true)\n\n<fieldset>\n <legend>Creación ticket</legend>\n\n <label>Descripción del problema</label>\n <div class=\"editor-field\">\n @Html.EditorFor(model => model.ticket.Description)\n @Html.ValidationMessageFor(model => model.ticket.Description)\n </div>\n\n @Html.HiddenFor(model => model.ticket.TicketId)\n @Html.HiddenFor(model => model.item)\n @Html.HiddenFor(model => model.employee)\n\n <label>Solución aportada</label>\n <div class=\"editor-field\">\n @Html.EditorFor(model => model.ticket.Solution)\n @Html.ValidationMessageFor(model => model.ticket.Solution)\n </div>\n\n <label>Estado</label>\n <div class=\"editor-field\">\n @Html.EditorFor(model => model.ticket.Status)\n @Html.ValidationMessageFor(model => model.ticket.Status)\n </div>\n\n <p>\n <input type=\"submit\" value=\"Save\" />\n </p>\n</fieldset>\n}\n\n\n\n@section Scripts {\n @Scripts.Render(\"~/bundles/jqueryval\")\n}\n\n\nAnd finally heres the method called by the form on the view which recieves the model object:\n\n[HttpPost]\n public ActionResult AssignSupportItem(TicketCreationModel model)\n {\n\n Ticket final = model.ticket;\n final.Item = GetTicket().Item;\n final.AccountableEmployee = GetTicket().AccountableEmployee;\n\n repo.SaveTicket(final);\n ViewBag.Message = \"Su ticket ha sido agregado al sistema\";\n return View(\"AssignSupportItemResponse\");\n\n }\n\n\nThe problem is that the model object i receive has the employee and item attributes as null, why is this happenning? I'm sending those objects on my model why are they getting lost? I tried to restore them with the session object but as soon as I try to persis the object on my context class i get \n\n“An entity object cannot be referenced by multiple instances of IEntityChangeTracker”\n\nexception.\n\nAny help will be appreciated, thanks in advance."
] | [
"asp.net",
"asp.net-mvc",
"asp.net-mvc-3",
"entity-framework",
"asp.net-mvc-4"
] |
[
"How to find C# entry point for Non exe program?",
"All information I read regarding C# entry point class relate to:\n\nstatic int Main(string[] args)\n\n\nAs this is specific to an EXE program.\n\nBut my program is a C# Automation Test framework (.cs within the solution), designed with Specflow feature files and step definitions.\n\nI have now added an (entry point) class called Program.cs - Int Main class but I’ve noticed that this entry point class is not called any time when running my automation tests. Most likely because my program is not an EXE program but a Test framework.\n\nHow can I find the C# entry point for Non exe program?\n\nAs I want to use utilise my 'Reporting' code from one class that will be called every time I run a test:\n\nnamespace Project.Core\n{\n public class Program\n {\n public static int Main(string[] args)\n {\n Adapter.DefaultSearchTimeout = 5000;\n\n int error;\n try\n {\n error = TestSuiteRunner.Run(typeof (Program), Environment.CommandLine);\n }\n catch (Exception e)\n {\n TestReport.Setup(ReportLevel.Debug, \"myReport.rxlog\", true);\n Report.Screenshot();\n throw new ApplicationException(\"Error Found\", e);\n }\n return error;\n }\n }\n}"
] | [
"c#",
"entry-point"
] |
[
"Getting null from intent",
"I am trying to pass two strings from AddNote to MainActivity. But it keeps getting null.\nUnable to start activity (MainActivity) \n\njava.lang.IllegalStateException: callingIntent.getStringExtra(\"intentTitle\") must not be null \n\n\nclass MainActivity : AppCompatActivity() {\n\n private val notes = arrayListOf<Note>()\n\n private val db by lazy {\n Room.databaseBuilder(this\n ,NoteDatabase::class.java\n ,\"NoteDatabase.db\")\n .allowMainThreadQueries()\n .build() }\n\n lateinit var adapter: adapter\n\n lateinit var title: String\n lateinit var content: String\n\n override fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n setContentView(R.layout.activity_main)\n\n notes.addAll(db.dao().getNotes())\n\n AddNote.setOnClickListener {\n val i = Intent(this@MainActivity,AddNote::class.java)\n startActivity(i)\n }\n\n // startActivity(Intent(this, AddNote::class.java))\n\n val callingIntent = intent\n\n title = callingIntent.getStringExtra(\"intentTitle\")\n content = callingIntent.getStringExtra(\"intentContent\")\n\n val note = Note(title,content)\n\n val id = db.dao().insert(note)\n note.id = id.toInt()\n\n notes.add(note)\n\n adapter = adapter(notes, db)\n rootView.layoutManager = LinearLayoutManager(this)\n rootView.adapter = adapter\n }\n\n override fun onResume() {\n super.onResume()\n notes.clear()\n notes.addAll(db.dao().getNotes())\n adapter.notifyDataSetChanged()\n }\n}\n\n\nclass AddNote : AppCompatActivity() {\n\n override fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n setContentView(R.layout.add_note)\n\n var intentTitle = \"Title\"\n var intentContent = \"Content\"\n\n saveNote.setOnClickListener {\n\n intentTitle = addTitle.text.toString()\n intentContent = addContent.text.toString()\n\n }\n\n val i = Intent()\n\n i.putExtra(\"title\",intentTitle)\n i.putExtra(\"content\",intentContent)\n\n startActivity(i)\n }\n}"
] | [
"android",
"android-intent",
"kotlin"
] |
[
"Select from another table if result not matched",
"This has been asked but I dont quite match existing questions with my case. \nI have two tables, the first table is credentials with id username and email \n\nand an email-alias table with user-id (which corresponds to credentials.id) and email. Emails in credentials are more often \"[email protected]\" while in alias they'd be \"[email protected]\".\n\nAll I have now is \n\nSELECT `username` FROM `credentials` WHERE `email` LIKE ?\n\n\nBut the email will not always match if I query with \"[email protected]\". What I want to do is get the username with one query which would fall back to email-alias and use \"[email protected]\" to get an user-id from there to be used again in credentials to match a username\n\nThe pitfall is that the supplied email could be either an aliased one \"usern@..\" or \"user.name@..\"\n\nmysql> describe `email-alias`;\n+---------+--------------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+---------+--------------+------+-----+---------+----------------+\n| id | int(11) | NO | PRI | NULL | auto_increment |\n| user-id | int(11) | NO | UNI | NULL | |\n| email | varchar(100) | YES | | NULL | |\n+---------+--------------+------+-----+---------+----------------+\n\n\nmysql> describe `credentials`;\n+-----------------+--------------+------+-----+---------------------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+-----------------+--------------+------+-----+---------------------+----------------+\n| id | int(11) | NO | PRI | NULL | auto_increment |\n| username | varchar(100) | NO | UNI | NULL | |\n| email | varchar(100) | NO | | NULL | |\n+-----------------+--------------+------+-----+---------------------+----------------+"
] | [
"mysql"
] |
[
"Finding the correct possibility",
"The problem is :\n\nZ=(89x-y) /10\n\n\nThere are 504 possibile combinations of X, Y and Z but only one is correct\n\nHere's the code I wrote :\n\nfor x in range (1,10):\n for y in range (1,10):\n for z in range (1,10):\n if x=y or x=z or y=z :\n break\n print (x, y, z)"
] | [
"python",
"math"
] |
[
"Call a method or function from Objective-c in AppleScript",
"I'm trying to use LestMove to be more precise\nthe second implementation method where it says:\n\nOption 2:\n\nCopy the following files into your project:\n\nPFMoveApplication.h\nPFMoveApplication.m\nIf your project has ARC enabled, you'll want to disable ARC on the above files. You can do so by adding -fno-objc-arc compiler flag to your PFMoveApplication.m source file. See How can I disable ARC for a single file in a project?\n\nIf your application is localized, also copy the 'MoveApplication.string' files into your project.\n\nLink your application against Security.framework.\n\nIn your app delegate's \"-[applicationWillFinishLaunching:]\" method, call the PFMoveToApplicationsFolderIfNecessary function at the very top.\n\nbut I'm not able to call the method / Class, could someone help me with this issue? Thanks in advance!"
] | [
"applescript-objc"
] |
[
"curl error HTTP status code 0-- empty reply from server",
"I'm trying to scrap a website but it always said that Empty Reply from server\ncan any one look at the code and tell me what am I doing wrong?\n\nHere is the code\n\nfunction spider($url){\n $header = array(\n \"Host\" => \"www.example.net\",\n //\"Accept-Encoding:gzip,deflate,sdch\",\n \"Accept-Language:en-US,en;q=0.8\",\n \"Cache-Control:max-age=0\",\n \"Connection:keep-alive\",\"Content-Length:725\",\"Content-Type:application/x-www-form-urlencoded\",\n 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'\n ,\"X-Requested-With:XMLHttpRequest\"\n );\n $cookie = \"cookie.txt\";\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_HTTPHEADER, $header);\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_HEADER, 0); // return headers 0 no 1 yes\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return page 1:yes\n curl_setopt($ch, CURLOPT_TIMEOUT, 200); // http request time-out 20 seconds\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Follow redirects, need this if the URL changes\n curl_setopt($ch, CURLOPT_MAXREDIRS, 2); //if http server gives redirection response\n curl_setopt($ch, CURLOPT_USERAGENT,\n \"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7\");\n curl_setopt($ch, CURLOPT_COOKIEJAR, realpath( $cookie)); // cookies storage / here the changes have been made\n curl_setopt($ch, CURLOPT_COOKIEFILE, realpath( $cookie));\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // false for https\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);\n curl_setopt($ch, CURLOPT_POST, true);\n curl_setopt($ch, CURLOPT_POSTFIELDS,\"view=ViewDistrict&param=7&uniqueid=1397991494188&PHPSESSID=f134vrnv7glosgojvf4n1mp7o2&page=http%3A%2F%2Fwww.example.com%2Fxhr.php\");\n curl_setopt($ch, CURLOPT_REFERER, $url);\n curl_setopt($ch, CURLOPT_REFERER, \"http://www.example.com/\");\n $data = curl_exec($ch); // execute the http request\n $info = curl_getinfo($ch);\n curl_close($ch); // close the connection\n\n return $data;\n}\n\n\nHere is function call\n\necho spider(\"http://www.example.net/\");\n\n\nEdit\n\nArray ( [url] => http://www.example.net/ [content_type] => text/html [http_code] => 301 [header_size] => 196 [request_size] => 840 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 1 [total_time] => 61.359 [namelookup_time] => 0 [connect_time] => 0.281 [pretransfer_time] => 0.281 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => 178 [upload_content_length] => 0 [starttransfer_time] => 60.593 [redirect_time] => 0.766 [certinfo] => Array ( ) [redirect_url] => ) Empty reply from server\n\n\nthis is the header now\nalso I'd updated my post data\nit's now \ncurl_setopt($ch, CURLOPT_POSTFIELDS,\"view=ViewDistrict&param=7&uniqueid=\".time(). rand(101,500).\"&PHPSESSID=f134vrnv7glosgojvf4n1mp7o2&page=http%3A%2F%2Fexample.com%2Fxhr.php\"); \n\nand also had removed \"X-Requested-With:XMLHttpRequest\" from headers"
] | [
"php",
"curl"
] |
[
"Bootstrap responsive image not working",
"I am new with bootstrap. I have the following problem with responsive image using bootstrap. My image doesn't seem to scale. I have no idea what might have gone wrong.\n\n<head>\n <meta charset=\"utf-8\">\n\n <meta name=\"viewport\" content=\"width=device-width, maximum-scale=1\">\n\n <link rel=\"stylesheet\" href=\"bootstrap.min.css\" />\n\n</head>\n\n<body>\n\n <div class = \"container\"> \n\n <div class = \"col-small-12\">\n\n <div class = \"row\">\n\n <a href=\"***\"> <img src=\"images/web.png\" class=\"img-responsive\" alt=\"Responsive image\"> </a>\n\n </div>\n\n </div>\n\n </div>\n\n</body>"
] | [
"image"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.