texts
sequence | tags
sequence |
---|---|
[
"Scrape for Absolute URL with html.parse and remove duplicates",
"I am trying to make sure that the relative links are saved as absolute links into this CSV. (URL parse) I am also trying to remove duplicates, which is why I created the variable \"ddupe\". \n\nI keep getting all the relative URLs saved when I open the csv in the desktop.\nCan someone please help me figure this out? I thought about calling the \"set\" just like this page: How do you remove duplicates from a list whilst preserving order? \n\n#Importing the request library to make HTTP requests\n#Importing the bs4 library to extract / parse html and xml files\n#utlize urlparse to change relative URL to absolute URL\n#import csv (built in package) to read / write to Microsoft Excel\nfrom bs4 import BeautifulSoup \nimport requests\nfrom urllib.parse import urlparse\nimport csv\n\n#create the page variable\n#associate page to request to obtain the information from raw_html\n#store the html information in a text\npage = requests.get('https://www.census.gov/programs-surveys/popest.html')\nparsed = urlparse(page)\nraw_html = page.text # declare the raw_html variable\n\nsoup = BeautifulSoup(raw_html, 'html.parser') # parse the html\n\n#remove duplicate htmls\nddupe = open(‘page.text’, ‘r’).readlines() \nddupe_set = set(ddupe)\nout = open(‘page.text’, ‘w’)\nfor ddupe in ddupe_set:\n out.write(ddupe)\n\nT = [[\"US Census Bureau Links\"]] #Title\n\n#Finds all the links\nlinks = map(lambda link: link['href'], soup.find_all('a', href=True)) \n\nwith open(\"US_Census_Bureau_links.csv\",\"w\",newline=\"\") as f: \n cw=csv.writer(f, quoting=csv.QUOTE_ALL) #Create a file handle for csv writer \n cw.writerows(T) #Creates the Title\n for link in links: #Parses the links in the csv\n cw.writerow([link]) \n\nf.close() #closes the program"
] | [
"html",
"python-3.x",
"parsing",
"beautifulsoup",
"duplicates"
] |
[
"Adding iddentifiable non-field errors",
"I am doing some custom validation in the clean method in a ModelForm. I want to add custom non-field error messages, but I need them to be identifiable by some kind of key, so this doesn't work:\n\nself.add_error(None, 'Custom error message 1')\nself.add_error(None, 'Custom error message 2')\nself.add_error(None, 'Custom error message 3')\n\n\nI need to be able to tell these apart to render them in an appropriate place in the invalid form template instead of having them all grouped as None non-field errors.\n\nHow can I do that?"
] | [
"python",
"django",
"django-1.8"
] |
[
"Write HTML received as string to browser",
"I have a basic HTML file which looks like this:\n\n<!DOCTYPE html>\n<html>\n<head>\n <title>Home</title>\n</head>\n<body>\n <h1>Welcome!</h1>\n</body>\n</html>\n\n\nI am receiving the file in python and storing it as a string. I want to know, is there a way I can write this out to a web browser? \n\nThe file is on my computer, so my goal is not to save it as an html file and then execute it, but rather execute this from within python to the browser. \n\nI know that with JavaScript I can use Document.write() to inject content to a webpage, but that is already being done in the browser. I want to achieve something similar."
] | [
"python",
"html"
] |
[
"C# Property SetValue cannot handle generic List type",
"In my WinForm application, I'm actually using the LightweightDAL project which provide a nice method to fill up my datamodel. All works fine except for a properties set as List of another model. This is my model class:\n\npublic class SchedaFamiglia\n{\n [DBField(\"Id\")]\n public int Id { get; set; }\n\n [DBField(\"IdFamiglia\")]\n public int IdFamiglia { get; set; }\n\n [DBField(\"IdMamma\")]\n public int IdMamma { get; set; }\n\n [DBField(\"IdPapa\")]\n public int IdPapa { get; set; }\n\n [DBField(\"IdBambino\")]\n public List<SchedaBambino> Figli { get; set; }\n\n public SchedaFamiglia()\n {\n }}\n\n\nThe model SchedaBambino above, is just a list of base type properties (int32, string...).\n\nAnd this is the snippet of GetItemFromReader method:\n\nprivate static T GetItemFromReader<T>(IDataReader rdr) where T : class\n {\n Type type = typeof(T);\n T item = Activator.CreateInstance<T>();\n PropertyInfo[] properties = type.GetProperties();\n\n foreach (PropertyInfo property in properties)\n {\n // for each property declared in the type provided check if the property is\n // decorated with the DBField attribute\n if (Attribute.IsDefined(property, typeof(DBFieldAttribute)))\n {\n DBFieldAttribute attrib = (DBFieldAttribute)Attribute.GetCustomAttribute(property, typeof(DBFieldAttribute));\n\n if (Convert.IsDBNull(rdr[attrib.FieldName])) // data in database is null, so do not set the value of the property\n continue;\n\n if (property.PropertyType == rdr[attrib.FieldName].GetType()) // if the property and database field are the same\n property.SetValue(item, rdr[attrib.FieldName], null); // set the value of property\n else\n {\n // change the type of the data in table to that of property and set the value of the property\n property.SetValue(item, Convert.ChangeType(rdr[attrib.FieldName], property.PropertyType), null);\n }\n }\n }\n\n\nThe method above unfortunately can't handle List of generic and I've no idea how to implement. \n\nSomeone could help me?"
] | [
"c#",
"winforms",
"generics",
"system.reflection",
"setvalue"
] |
[
"Setting arguments to fragment causes IllegalStateException",
"I am setting arguments to fragments inflated from XML using the following code:\n\n fragment_phone=(AddNewFragment)fm.findFragmentById(R.I'd.phone_fragment);\n Bundle args=fragment_phone.getArguments();\n if(args==null)\n {\n args=new Bundle();\n args.putString(\"hint\",\"Phone\");\n fragment_phone.set arguments(args);\n }\n else\n args.putString(\"hint\",\"Phone\");\n\n //Similarly for two other fragments that are also instances of AddNewFragment\n\n\nI use three Bundle objects,one for each fragment.\nThe Logcat says Fragment is already active java.lang.IllegalStateException at android.support.v4.app.setArguments\n\nI have tried removing setArguments which causes NullPointerException when I call this:\n\n Bundle args=get arguments();\n String hint=args.getString(\"hint\");\n Log.d(TAG,\" Hint :\"+hint);"
] | [
"android",
"android-fragments",
"nullpointerexception",
"illegalstateexception"
] |
[
"Android VideoView not call onSurfaceCreated until click to it",
"I am use VideoView to play mp4 and m3u8 files. I am load VideoView in a fragment and put it in a Activity, here is a code load video url in the fragment:\n\nif(currentPossition == 0 || isCompleted) {\n Uri path = Uri.parse(videoUrl);\n videoView.setVideoURI(path);\n videoView.requestFocus();\n controller.setAnchorView(videoView);\n controller.setMediaPlayer(videoView);\n videoView.setMediaController(controller);\n }else{\n videoView.seekTo(currentPossition);\n videoView.start();\n }\n videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {\n @Override\n public void onPrepared(MediaPlayer mp) { \n mp.start();\n }\n });\n\n\nAnd in class VideoView, I have found a callback SurfaceHolder.Callback mSHCallback and function surfaceCreated(SurfaceHolder holder) called when surface created on the first times. So, my video play in the first times, problems is when I am destroy fragment (surfaceDestroyed(SurfaceHolder holder) called and mSurfaceHolder = null) and replace again in the getSupportFragmentManager, the callback SurfaceHolder.Callback not called until I am touch in VideoVideo or click a button control in the Activity. Any help this problems ?"
] | [
"android",
"android-fragments",
"surfaceview",
"android-videoview"
] |
[
"Jquery datetimepicker startDate not working properly",
"I am using jquery datetimepicker plugin for my project. I have created JavaScript function for create datepicker daynamically. Its working fine for all input text box. But i want to set startdate dynamically on show function. I have write code for it in setfromDate_limit function. In this function i have passed date control object. Its set min and max date perfectly but not start date. So please help me how to set startdate dynamically \n\nDatetimepicker URL :http://xdsoft.net/jqplugins/datetimepicker/\n\nfunction create_datepicker(controlId,idx,flg_day,startday)\n{\n var control=\"#\"+controlId;\n var startdayflag=0;\n\n var cnt=jQuery(control).datetimepicker({\n format:'Y-m-d',\n scrollMonth:false,\n scrollInput:false,\n defineCustomWeekend:true,\n defaultSelect:defaultselect.replace(/\\-/g, '/'),\n startDate:\"<?php echo date('Y-m-d'); ?>\",\n onClose:function(){\n if(flg_day)\n {\n calulate_days(idx);\n }\n },\n onChangeDateTime:function(){\n if(flg_day)\n {\n for (i = idx+1; i < $( \"input[name ^=end_dt]\").length; i++) { \n $(\"#start_dt_\"+i).val(\"\");\n $(\"#end_dt_\"+i).val(\"\");\n $(\"#no_of_days_\"+i).val(\"\");\n }\n }\n },\n onShow:function(){\n if(flg_day)\n { \n setDate_limit(this,idx) // to date\n }\n else{\n setfromDate_limit(this,idx) // from date\n }\n },\n timepicker:false\n });\n}\n\n\nfunction setfromDate_limit(obj,idx)\n {\n if(idx == 0)\n return;\n else if(idx == 0 && obj=='')\n return;\n else\n var full_date=get_prev_date(idx);\n if(full_date != '')\n {\n var actualDate = new Date(full_date);\n //alert(actualDate);\n actualDate.setDate(actualDate.getDate()+1);\n full_date=actualDate.getFullYear()+\"/\"+(actualDate.getMonth()+1)+\"/\"+actualDate.getDate();\n var startday=actualDate.getFullYear()+\"-\"+(actualDate.getMonth()+1)+\"-\"+actualDate.getDate();\n var mindt=full_date;\n //obj.startDate=\"2015-09-19\";\n obj.setOptions({\n startDate:startday,\n minDate:mindt,\n maxDate:mindt\n })\n\n return;\n }\n return;\n }"
] | [
"jquery",
"jquerydatetimepicker"
] |
[
"Database-first EF7-beta7 dnx ef dbcontext scaffold command fails",
"In an asp.net 5 beta 7 project no matter how the command is written I get an unrecognized argument trying to scaffold the dbcontext from an existing db:\n\nC:\\Dev\\Project>dnx ef dbcontext scaffold provider EntityFramework.SqlServer connection \n \"Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=ubercrew_relation;Integrated Security=True\"\n\n\nI've tried all possible combinations of the two arguments connection and provider\n\nDo you know the right syntax for executing the scaffold command?"
] | [
"sql-server",
"asp.net-core",
"dnx",
"entity-framework-core"
] |
[
"How to use angular-google-maps directive?",
"I'm using angular-google-maps in my project.\nI'm trying to add multiple markers, using objects of the following definition:\nvehicles = [\n{\n stuff: "stuff",\n last_known_location: {\n latitude: number,\n longitude: number\n }\n \n},\n{\n stuff: "stuff",\n last_known_location: {\n latitude: number,\n longitude: number\n }\n \n},//...etc\n]\n\nMy directive looks like:\n<markers models='vehicles'\n coords='vehicles.last_known_location' >\n</markers>\n\nVehicles is an array of objects as described above.\nThis doesn't work. If I change my model to just have properties of latitude and longitude and completely lose the last_known_location property and change my directive coords='self' then it works fine. What do I need to do to get this working with my json structure?"
] | [
"javascript",
"angularjs",
"google-maps"
] |
[
"How to remove mipmap directory, colors.xml, and styles.xml files programmatically?",
"I'm developing an Android studio plugin for my company. We need to develop a plugin using minimal resources. So, I wanted to remove layout file, colors.xml, styles.xml files, drawable and mipmap folders programmatically.\n\nI am able to not generate layouts files from receipe.xml.ftl. However, I can not able to stop generating other .xml files which are automatically generated by an Android Studio at the time of new project creation.\n\nThanks in advance."
] | [
"android",
"plugins"
] |
[
"jquery file upload how to delete from db table",
"I am using the blueimp file upload program. The problem I am having\nis in being able to update the db table when a file is deleted. \n\nWhen two different users enter the same file name for an upload, it is\nregistered in the mysql table as two different records with the same file name and different userid's. The problem is when you go to \"Delete\" the file name, it deletes all files with that name. This is the code for the file upload section that works fine:\n\nprotected function handle_file_upload($uploaded_file, $name, $size, $type, $error,\n $index = null, $content_range = null) {\n $file = parent::handle_file_upload(\n $uploaded_file, $name, $size, $type, $error, $index, $content_range\n );\n if (empty($file->error)) {\n $sql = 'INSERT INTO `'.$this->options['db_table']\n .'` (`name`, `size`, `type`, `url`, `listid`, `dorder`, `link`)'\n .' VALUES (?, ?, ?, ?, ?, ?, ?)';\n $query = $this->db->prepare($sql);\n $query->bind_param(\n 'sisssss',\n $file->name,\n $file->size,\n $file->type,\n $file->url,\n $file->listid,\n $file->dorder,\n $file->link\n );\n $query->execute();\n $file->id = $this->db->insert_id;\n }\n return $file;\n}\n\n\nThe problem I am having is being able to add the \"listid\" variable to the\nWHERE clause of the mysql query below. Listid identifies the user. This is \nthe delete code that removes the filename from the db table:\n\npublic function delete($print_response = true) {\n $response = parent::delete(false);\n foreach ($response as $name => $deleted) {\n if ($deleted) {\n $sql = 'DELETE FROM `'\n .$this->options['db_table'].'` WHERE `name`=?' ;\n $query = $this->db->prepare($sql);\n $query->bind_param(\n 's', \n $name\n );\n $query->execute();\n }\n } \n return $this->generate_response($response, $print_response);\n}\n\n\nAny assistance is greatly appreciated and I have attempted multiple solutions\nto no avail."
] | [
"php",
"jquery",
"mysql",
"ajax"
] |
[
"How to properly cast a global memory array using the uint4 vector in CUDA to increase memory throughput?",
"There are generally two techniques to increase the memory throughput of the global memory on a CUDA kernel on compute capability 1.3 GPUs; memory accesses coalescence and accessing words of at least 4 bytes. With the first technique accesses to the same memory segment by threads of the same half-warp are coalesced to fewer transactions while be accessing words of at least 4 bytes this memory segment is effectively increased from 32 bytes to 128.\n\nUpdate: solution based on talonmies answer. To access 16-byte instead of 1-byte words when there are unsigned chars stored in the global memory, the uint4 vector is commonly used by casting the memory array to uint4. To get the values from the uint4 vector, it can be recasted to uchar4 as below:\n\n#include <cuda.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n__global__ void kernel ( unsigned char *d_text, unsigned char *d_out ) {\n\n int idx = blockIdx.x * blockDim.x + threadIdx.x;\n\n extern __shared__ unsigned char s_array[];\n\n uint4 *uint4_text = reinterpret_cast<uint4 *>(d_text);\n uint4 uint4_var;\n\n //memory transaction\n uint4_var = uint4_text[0];\n\n //recast data to uchar4\n uchar4 c0 = *reinterpret_cast<uchar4 *>(&uint4_var.x);\n uchar4 c4 = *reinterpret_cast<uchar4 *>(&uint4_var.y);\n uchar4 c8 = *reinterpret_cast<uchar4 *>(&uint4_var.z);\n uchar4 c12 = *reinterpret_cast<uchar4 *>(&uint4_var.w);\n\n d_out[idx] = c0.y;\n}\n\nint main ( void ) {\n\n unsigned char *d_text, *d_out;\n\n unsigned char *h_out = ( unsigned char * ) malloc ( 16 * sizeof ( unsigned char ) );\n unsigned char *h_text = ( unsigned char * ) malloc ( 16 * sizeof ( unsigned char ) );\n\n int i;\n\n for ( i = 0; i < 16; i++ )\n h_text[i] = 65 + i;\n\n cudaMalloc ( ( void** ) &d_text, 16 * sizeof ( unsigned char ) );\n cudaMalloc ( ( void** ) &d_out, 16 * sizeof ( unsigned char ) );\n\n cudaMemcpy ( d_text, h_text, 16 * sizeof ( unsigned char ), cudaMemcpyHostToDevice );\n\n kernel<<<1,16>>>(d_text, d_out );\n\n cudaMemcpy ( h_out, d_out, 16 * sizeof ( unsigned char ), cudaMemcpyDeviceToHost );\n\n for ( i = 0; i < 16; i++ )\n printf(\"%c\\n\", h_out[i]);\n\n return 0;\n}"
] | [
"c",
"optimization",
"cuda"
] |
[
"how to use global function with plugin to show notification in vue.js?",
"I'm trying to make a global function with help of plugin which it worked fine but i couldn't show my notification. I was doing my homework and i tried to not write everywhere those show notification methods, so I've searched and i found this solution and i managed to add plugin now i wan to use it in my component. here's the code :\n\nAppNotifications.js\n\nexport default {\n failedNotification(title, data) {\n return this.$vs.notify({\n title:title,\n text:data,\n color:'danger',\n position:'bottom-center',\n });\n }\n};\n\n\nApp.js\n\nimport Vue from 'vue'\nimport notifications from './Helpers/AppNotifications'\n\nconst plugin = {\n install () {\n Vue.notifications = notifications\n Vue.prototype.$notifications = notifications\n }\n}\n\nVue.use(plugin)\n\nconst app = new Vue({\n vuetify,\n el: '#app',\n render: h => h(App),\n router\n});\n\n\nAnd in componenets when i use a button with @click=\"SomeMethod\" i use plugin like this :\n\nthis.$notifications.failedNotification('Test','Just Failed, yay')\n\n\nSo function work but i get this error\n\nError in v-on handler: \"TypeError: Cannot read property 'notify' of undefined\"\n\nSince I'm in learning process i wasn't familiar with this issue and I've tried to import vue and notification component itself but didn't worked. \n\nEdit 01 : Notification is belong to Vuesax library and it's already imported in App.js and it's working fine when i use it in vue components but it's not working when i use it in AppNotification.js"
] | [
"vue.js"
] |
[
"how to get full time-stamp value from oracle",
"I have a column in oracle in time stamp format, it has a value like this 05-MAY-17 11.01.17.939951000 AM. when my java code picks that roe and when I do a ResultSet.getString(\"coulmn name\"), I am getting value like this\n 2017-05-05 11:01:17.939. is there a way I can get full value for that field."
] | [
"java",
"oracle",
"oracle12c"
] |
[
"Combine provided queryDSL predicates with predefined queries",
"In context of Spring Data REST I would like to expose search/filter functionality on the result of the single query.\nIf my query was findAll that would be out of the box (it would be enough to extend QueryDslPredicateExecutor). But how can I combine my custom query (findMyNotes) with additional filtering provided by the user (that are marked as done). I mean something like:\n\n@Entity\nclass Note {\n @Id\n private UUID id;\n private UUID personId;\n private String status;\n private String text;\n}\n\n@RepositoryRestResource(path = \"notes\", itemResourceRel = \"notes\", collectionResourceRel = \"notes\")\ninterface NoteRepository extends JpaRepository<Note, UUID>, QueryDslPredicateExecutor<Note> {\n\n @RestResource(path=\"notes/my\")\n @Query(\"select n from Note n where n.personId=:creatorId\")\n Page<Note> findDone(@Param(\"creatorId\") UUID creatorId, Predicate predicate, Pageable pageable);\n}\n\n\nI didn't find anything out of the box. Therefore I was thinking to use AOP and:\n\n\nhave multiple paths (multiple @RestResource ?) that map to org.springframework.data.querydsl.QueryDslPredicateExecutor#findAll(Predicate, org.springframework.data.domain.Pageable)\nhave my own annotation that would point me to the method that returns the original queryDSL Predicate (contents of @Query in my example)\nby AOP calculate AND of those two predicates and pass it as a parameter to findAll method\n\n\nThe problem is that I don't know how to do the first point (apart from hacking it in servlet filters) - map multiple paths to the same findAll method.\n\nOr alternatively is there maybe something working out of the box that I missed?"
] | [
"spring",
"spring-data-rest"
] |
[
"pug meta TypeError: Cannot read property '(' of undefined - running on Heroku",
"I having very curious issues on this simple pug code when deployed on heroku.\n\nUsing \"pug\": \"2.0.0-rc.4\"\nnode 8.1.4, npm 5.0.3\n\nLocally works fine.\n\ndoctype html\n html\n head\n title= \"hello\"\n meta(charset=\"UTF-8\")\n body\n\n h1 hello\n\n\nI run some tests and the issue is with meta tag.\nIf I just cut the line it runs.\n\nAny idea?\n\nError stack\n\n TypeError: Cannot read property '(' of undefined\n at Lexer.bracketExpression (/app/node_modules/pug-lexer/index.js:212:40)\n at Lexer.attrs (/app/node_modules/pug-lexer/index.js:1011:24)\n at Lexer.callLexerFunction (/app/node_modules/pug-lexer/index.js:1319:23)\n at Lexer.advance (/app/node_modules/pug-lexer/index.js:1356:15)\n at Lexer.callLexerFunction (/app/node_modules/pug-lexer/index.js:1319:23)\n at Lexer.getTokens (/app/node_modules/pug-lexer/index.js:1375:12)\n at lex (/app/node_modules/pug-lexer/index.js:12:42)\n at Object.lex (/app/node_modules/pug/lib/index.js:99:27)\n at Function.loadString [as string] (/app/node_modules/pug-load/index.js:44:24)\n at compileBody (/app/node_modules/pug/lib/index.js:86:18)"
] | [
"heroku",
"pug",
"meta"
] |
[
"How do I update my security in my login script from MD5 to something more secure?",
"I have a PHP login script with salt on the database, but in my register script I see:\n\n$qry = \"INSERT INTO accounts(username, firstname, lastname, password) \" . \nVALUES('$username','$fname','$lname','\" . md5($_POST['password']) . \"')\";\n\n\nand for the login:\n\n$qry=\"SELECT * FROM accounts WHERE username='$username' AND password='\" .\nmd5($_POST['password']) . \"'\";\n\n\nIs there some code that can replace the MD5? Something more secure?\n\nI've heard of SHA1 or something."
] | [
"php",
"security",
"hash",
"login",
"password-hash"
] |
[
"Creating a table from JSON response in Flutter",
"I am trying to make a data table in Flutter that is very dynamical, in the sense that it changes completely with every response. Is there any packages or widgets to make a data table from a JSON response like this:\n\n{\"array\":[[\"mr\", \"500\", \"140,00\", \"7,00\", \"147,00\"], [\"vrijednost\", \"140.00\", \"Kn\"], [\"jm ko\\u010dna Glena\", \"\", \"KOM 20000. 7,00.\", \"Vrijednost bez PDV-a\", \"Iznos PDV-a :\", \"UKUPNO SA PDV-om\"], [\"poreza\", \"7,00\"], [\"naziv artikla-usluge\", \"\", \"BIJELI KRUH 600 gr\", \"\", \"osnovica iznos\", \"140.00\"], [\"\\u017eovratni\", \"\\u0161ifra artikla\", \"more\", \"%\", \"5,00\"]]}\n\n\nThank You very much for your response."
] | [
"arrays",
"json",
"flutter",
"datatable"
] |
[
"How to store Guava Multimap entries into Java Util List?",
"I ran into a requirement to store multiple values for a single key so I came to learn about Multimap of Guava.\n\nNow in my code there is requirement to retrieve Key: Value K: V[] where in this case the value will be an array as I am storing multiple values for same key, into a list as:\n\nList<Map.Entry<String, String>\n\nBelow is how I tried to get it done:\n\nList<Map.Entry<String, String>> mapCall = (List<Map.Entry<String, String>>) multimap.entries();\n\n\nAbove code is supposed to return a Collection, here a List, of each Entry<String, String>. \n\nAnd below is how it has failed: Error:\n\njava.lang.ClassCastException: com.google.common.collect.AbstractMultimap$4 cannot be cast to java.util.List\n\n\nI think the Collection returned here by calling entries() method on Multimap is not of the Java Collections type. Unable to find an exact way to get it done.\n\nWhat should be the proper way to achieve this??"
] | [
"java"
] |
[
"Why is my Mongo document not saving properly through Mongoose?",
"//reportconfig.js \n//Load up the report model\nvar Report = require('../models/report');\nconsole.log('Report ' + Report);\n\n//expose this function to our app using module.exports\nmodule.exports = function(req) {\n console.log('exporting' + req.body.address);\n var newReport = new Report();\n console.log('local ' + newReport.local.address);\n\n newReport.address = req.body.address;\n newReport.city = req.body.city;\n newReport.state = req.body.state;\n\n console.log('save ' + newReport.save);\n\n newReport.save(function(err) {\n console.log('saving ' + newReport.address);\n if(err) {\n console.log('error ' + err);\n throw err;\n }\n //return newReport;\n })\n}\n\n\n//server.js\n\n//set up=======================================================\n//get all the tools we need\nvar express = require('express');\nvar app = express();\nvar port = process.env.PORT || 8080;\nvar mongoose = require('mongoose');\nvar passport = require('passport');\nvar flash = require('connect-flash');\n\nvar morgan = require('morgan');\nvar cookieParser = require('cookie-parser');\nvar bodyParser = require('body-parser');\nvar session = require('express-session');\n\nvar configDB = require('./config/database.js');\n\n// configuration =============================================================================\nmongoose.connect(configDB.url);//I NEED TO FIGURE OUT HOW TO CONNECT TO MY LOCAL DB\n\nrequire('./config/passport')(passport);//pass passport for configuration\nvar report = require('./config/reportconfig');\n\n//set up our express application\napp.use(morgan('dev'));//log every request to the console\napp.use(cookieParser());//read cookies (needed for auth)\napp.use(bodyParser());//get information from html forms\n\napp.set('view engine', 'ejs'); //set up ejs for templating\n\n//required for passport\napp.use(session({secret: 'ilovescotchscotchyscotchscotch'}));//session secret\napp.use(passport.initialize());\napp.use(passport.session());//persistent login sessions\napp.use(flash());//use connect-flash for flash messages stored in session\n\n//routes ======================================================================================\nrequire('./routes/routes.js')(app, passport, report);// load our routes and pass in our app and fully configured passport\n\n//launch ======================================================================================\napp.listen(port);\nconsole.log('The magic happens on port ' + port);\n\n//routes.js\n app.post('/report', function(req, res) {\n report(req);\n console.log('res ' + res);\n res.redirect('/profile');\n });\n\n\n// app/models/report.js\n// load the things we need\nconsole.log('model');\nvar mongoose = require('mongoose');\n\n\n// define the schema for our user model\nvar reportSchema = mongoose.Schema({\n\n local : {\n\n address : String,\n city : String,\n state : String\n\n }\n\n});\n\n\n// create the model for users and expose it to our app\nmodule.exports = mongoose.model('Report', reportSchema);\n\n\nWhat happens when I post to /report is that the model gets invoked and save is called. The database gets a new entry, but it only has _id, not any of the other fields. There is no error. Any idea what I'm doing wrong? I can supply more information if you ask. The code above is from three separate files\nThe model is loading correctly because printing Report works. All fields of newReport are valid as well."
] | [
"mongoose"
] |
[
"nginx rewrite rule missing slash",
"I have a thumbnail class and it accepts external hosts too. It works like this right now :\n\nhttp://mysite.com/resize/src=http://google.com/logo.png&w=50&h=50\n\n\nI want to make it clean url with my \"resize.mysite.com\" subdomain like this :\n\nhttp://resize.mysite.com/400x200/http://google.com/logo.png\n\n\nI almost done it with this rewrite rule :\n\nrewrite ^/([^x]*)x([^/]*)/(.*)$ /resize.php?w=$1&h=$2&src=$3 last;\n\n\nBut it's sending \"src\" without second slash after \"http:\" and it causes to resize class error, like this :\n\nhttp:/google.com/logo.png\nhttp://google.com/logo.png (what I expect)\n\n\nHow this can be fixed?"
] | [
"nginx",
"rewrite"
] |
[
"Hybrid composite key in rails - using jsonb field and db column",
"I need to add a composite primary key to my project but the issue i'm facing is that one of the fields i want to use is in a jsonb field, and the other key is a regular foreign key. \n\nIs it somehow possible for me to set up a hybrid composite key index?\n\nSomething like this:\n\nadd_index :users, [:phone_number, :department_id], unique: true\n\nWhere phone_number is stored in a jsonb field \n\nmeta_data: {phone_number: \"987654321\"}"
] | [
"ruby-on-rails"
] |
[
"Is routing key in rabbitmq case sensitive?",
"I am trying to send rabbit mq message on a exchange - exchange-X to a message queue - queque-X with routing key -mc, its being received well on my local rabbit mq but on production rabbit mq the message does not appear. The exchange and the queue is binded with the specified routing key. In the below message isSent is true always but actually message does not reach at the queue only on prod rabbitmq env. Is routing key mc case sensitive ? \n\npublic void sendMessageCenterNotification(Map<String, Object> headerMap,String correlationId,String message) {\n boolean isSent = false;\n try { \n isSent = rabbitMQ.messageSender(message, headerMap, \"mc\", correlationId); \n } catch (Exception e) {\n logger.error(correlationId + \" - Exception occured in sendMessageCenterNotification:\", e);\n } finally {\n logger.info(correlationId\n + \"-inside sendMessageCenterNotification message sending to message center was \"+(isSent?\"successfull\":\"failed\")+\", message:\"\n + message);\n }\n}"
] | [
"java",
"rabbitmq"
] |
[
"How can I get rough location (country) forAndroid Tablets",
"I'm looking for a way to know the country-level location.\nHow to do it on a phone, or devices that have cellular network connectivity or GPS is clear. But what about devices that don't have that?\n\nI know from Google Analytics that Google has that kind of location information, \n\n\nHow?\nHow can I get that information as well? Maybe from the play-store locale or something?\nBy \"Tablets\" I mean devices that have no GPS and no GSM / cellular network connection.\n\n\n10x"
] | [
"android",
"geolocation",
"tablet"
] |
[
"Using SelectFirst with a condition that relies on the input",
"I'm trying to find the first instance in a list, a, for which the element is not a member of another list, b. I'm thinking to use something similar to this:\n\na = {r,j,k};\nb = {r,m,n};\nfirstnonmatch = SelectFirst[a,MemberQ[b,a_i]==False]\n\n\nwhere firstnonmatch would return m. But I'm not sure how to refer to elements of the list in the conditions when using SelectFirst[]. Is there a good way to do this?"
] | [
"list",
"search",
"wolfram-mathematica",
"conditional-statements"
] |
[
"Check for duplicate entries in a PHP array",
"Is there any tool I can run PHP code through that would pick up if I typed something like this?\n\n$myarray = array(\n 'foo' => 'hello',\n 'bar' => 'goodbye',\n 'foo' => 'hello again' // <= need to pick up the duplicate key on this line\n);\n\n\nEDIT: I want something like this, except not proprietary."
] | [
"php",
"arrays"
] |
[
"How can I return a changing variable without ending the function in Python?",
"I'm trying to return the answer of the code below into a variable, the variable should change every 5 seconds therefore I can't use 'return' since it ends the function.\n\nexample:\n\nfrom time import sleep\n\ndef printit():\n cpt = 1\n while True:\n if cpt < 3:\n number = (\"images[\" + str(cpt) + \"].jpg\")\n return number #here is the return\n sleep(5)\n cpt+=1\n else:\n printit()\n\nanswer = printit() \nprint(answer) #only 1 answer is printed, then the function ends because of the 'return'\n\n\nWhat is the solution to resolve this problem? \n\nThe variable answer should change every 5 seconds without ending the function."
] | [
"python",
"python-3.x"
] |
[
"PHP - how to set which printed info from file is the JSON response?",
"So, when i sent json it waits resonse and all what happends in the file where is sent the json is treat as response. How to set which echo/printed information, because there will be also other things than echoes/ exactly is the response? For example i have this code and i want to do something else than the resonse in this if:\nPHP:\n\nif($_POST){\n $return=\"Success.\";\n echo json_encode($return);\n exit;\n}\n\n\njQuery:\n\n $.ajax({\n url: \"./index.php\",\n type: \"POST\",\n data: { \n example:\"example\",\n example2:$(\".content\").text()\n },\n dataType: \"json\"\n }).done(function(data){\n $('#response').append('<p style=\"color:red;\">'+data+'</p>');\n }).fail(function(){\n $('#response').append('<p style=\"color:red;\">Error</p>');\n });"
] | [
"php",
"jquery",
"json",
"response"
] |
[
"Setting access control for different contexts in LDAP through JNDI",
"I am creating separate contexts (eg: ou=marketing, ou=finance) in LDAP to store user entries of different departments under different contexts. \n\nI need to set the access control at the creation of each context, such that I can give out the url for each context to an admin user of a particular department and he is capable of connecting to the relevant context using any other application or a LDAP browser and view only the user entries under that particular context, but not the other contexts.\n\nIs the above possible to do? After searching on this, I found that in ApacheDS, it is possible to set access control at partition level, but did not find how to set it in context level.\n\nFurther, I have the requirement that my application should be able to connected to any LDAP server (like openLDAP, ApacheDS etc..) that user specifies and perform above operations. So I though of using JNDI for that. Is it possible to achieve what I have mentioned above using JNDI programetically?\n\nI would highly appreciate any help on this. Even a reference would be sufficient.\n\nThanks in advance.\nHasini."
] | [
"ldap",
"jndi"
] |
[
"Create Executable From Assembly Code",
"I need to create an executable from the next assembly code:\n\n.MODEL SMALL\n.DATA\nTEXT DB 'Hello world!$'\n\n.CODE\n.STACK 20\n.STARTUP\nMOV AX, @DATA\nMOV DS, AX\nMOV AH, 9\nMOV BL, 02H\nINT 10H\nMOV Dx, OFFSET TEXT\nINT 21H\nMOV AH, 4CH\nINT 21H\nEND\n\n\nIt works with Turbo Assembler (tasm.exe), but I don't want to continue working with it, because it doesn't run in Windows 7.\n\nThanks."
] | [
"windows-7",
"x86",
"assembly"
] |
[
"java JFrame giving me java.lang.NullPointerException and I can't figure out why",
"Before you mark this post as duplicate and referance What is a NullPointerException, and how do I fix it?, I have read that and (I am still new to java and might not understand this correctly) can't seem to see how that is connected to my error.\n\nI am trying to dispose a java swing JFrame and load another in it's place and have gotten this to work. Even though it is doing exactly what I want, it still gives me the java.lang.NullPointerException error. As far as I understand the code that the error is connected to is functioning as I want it to.\n\nHere is my relevant code. If you need me to include any other code I did not think was necessary please let me know and I will edit.\n\nEDIT\n\nI removed all my previous code and have added mcve code for you.\n\npackage test;\n\npublic final class Test {\n\n private static GUI1 gui1;\n private static GUI2 gui2;\n\n public static void main(String[] args) {\n startGUI1();\n }\n\n public static void startGUI1() {\n gui1 = new GUI1();\n }\n\n public static GUI1 getGUI1() {\n return gui1;\n }\n\n public static void startGUI2() {\n gui2 = new GUI2();\n }\n\n public static GUI2 getGUI2() {\n return gui2;\n }\n}\n\n\npackage test;\n\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.util.Scanner;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\nimport javax.swing.JComponent;\nimport javax.swing.JFrame;\nimport javax.swing.JLabel;\n\npublic class GUI1 {\n\n JFrame frame;\n\n public GUI1() {\n frame = new JFrame();\n\n frame.setVisible(true);\n frame.setSize(500, 500);\n frame.setLocationRelativeTo(null);\n frame.add(new Pane());\n }\n\n public class Pane extends JComponent {\n\n public Pane() {\n try {\n Scanner read = new Scanner(new File(\"user.txt\"));\n\n if (read.nextInt() != 0) {\n test.Test.startGUI2();\n test.Test.getGUI1().frame.dispose();\n }\n } catch (FileNotFoundException ex) {\n Logger.getLogger(GUI1.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }\n}\n\n\npackage test;\n\nimport java.awt.BasicStroke;\nimport java.awt.Color;\nimport java.awt.Graphics;\nimport java.awt.Graphics2D;\nimport javax.swing.JButton;\nimport javax.swing.JComponent;\nimport javax.swing.JFrame;\nimport javax.swing.JLabel;\n\npublic class GUI2 {\n\n JFrame frame;\n\n public GUI2() {\n frame = new JFrame();\n\n frame.setVisible(true);\n frame.setSize(500, 500);\n frame.setLocationRelativeTo(null);\n frame.add(new Pane());\n }\n\n public class Pane extends JComponent {\n\n JLabel label = new JLabel(\"GUI2\");\n JButton button = new JButton(\"Start Gui1\");\n\n public Pane() {\n }\n\n @Override\n protected void paintComponent(Graphics g) {\n Graphics2D g2d = (Graphics2D) g;\n\n g2d.setColor(new Color(5, 5, 5));\n g2d.fillRect(0, 0, getWidth(), getHeight());\n\n g2d.setStroke(new BasicStroke(5.0F));\n }\n }\n}\n\n\nthis produces the same error"
] | [
"java",
"swing",
"nullpointerexception"
] |
[
"K8S - get config map data issue",
"we need that each pod which use our binary will have the ability to read a specific config map\n\nwe use for that the Go API to read the config map.\n\nhttps://github.com/kubernetes/client-go \n\nThe tricky part here that some of the pods have the following config automountServiceAccountToken: false (unfortunately we cannot change it :( ) \n\nHence Im getting the following error:\n\n open /var/run/secrets/kubernetes.io/serviceaccount/token:no such file or directory\n\n\nAny idea how to avoid this ? \n\nis there is other solution how to provide specific env variable to be available on all the pods and all the namespace ? \n\nhttps://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server"
] | [
"azure",
"go",
"kubernetes"
] |
[
"Prefill form fields as values in Rails",
"TL;DR Is it possible to prefill from one model in the same form builder to another model? Is there a correct way of solving this problem?\n\n\nI have a form that takes several methods that requires to be passed in: name, email, bio, location, homepage, work.\n\nEmail method will need to be retrieved via Devise user model.\n\nIn my new.html.erb, it works fine as normal but it returns nil from the email field whenever I do the following:\n\n<%= form_for :profile, url: profiles_path do |f| %>\n ...\n <div><% if current_user.email.present? %><%= f.label :email %><br>\n <%= f.email_field current_user.email %><% end %></div>\n<% end %>\n\n\nProfilesController.rb:\n\nclass ProfilesController < ApplicationController\n before_action :authenticate_user!, except: [:show]\n before_action :find_profile_by_id, only: [:show, :edit, :update]\n after_filter :destroy_user!, only: [:destroy]\n\ndef index\n if @profile.blank?\n render :new\n else\n render :show\n end\nend\n\ndef new\n @profile = current_user.profiles.build\n @user = current_user.where('email=?')\nend\n\ndef create\n @profile = current_user.profiles.build(profile_params)\n\n if @profile.save\n redirect_to @profile\n else\n render :new\n end\nend\n\ndef show\nend\n\ndef edit\nend\n\ndef update\n if @profile.update(profile_params)\n redirect_to @profile\n else\n render :edit\n end\nend\n\ndef destroy\n @user.destroy\n @profile.destroy\n redirect_to root_path\nend\n\nprivate\n\ndef profile_params\n params.require(:profile).permit(:name, :email, :bio, :location, :homepage, :work)\nend\n\ndef find_profile_by_id\n @profile = Profile.find(params[:id])\nend\n\ndef destroy_user!\n @user = User.find(params[:id])\nend\nend\n\n\nIs this the correct solution for this?"
] | [
"ruby-on-rails",
"ruby",
"devise"
] |
[
"Flutter failed for task app:mergeDebugNativeLibs and app:mergeDebugJavaResource",
"FAILURE: Build completed with 2 failures.\n1: Task failed with an exception.\n\nWhat went wrong:\nExecution failed for task ':app:mergeDebugNativeLibs'.\n\n\nA failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade\nFile 'com.android.builder.files.ZipCentralDirectory@6f58452a' was deleted, but previous version not found in cache\n\n\n\n\nTry:\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.\n2: Task failed with an exception.\n\nWhat went wrong:\nExecution failed for task ':app:mergeDebugJavaResource'.\n\n\nA failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade\nFile 'com.android.builder.files.ZipCentralDirectory@48b70346' was deleted, but previous version not found in cache\n\n\n\n\nTry:\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.\n\nGet more help at https://help.gradle.org\n\nBUILD FAILED in 23s\nRunning Gradle task 'assembleDebug'...\nRunning Gradle task 'assembleDebug'... Done 23.9s\nException: Gradle task assembleDebug failed with exit code 1"
] | [
"flutter",
"dart",
"visual-studio-code"
] |
[
"how can I draw a arc with goocanvasmm",
"Is it possible to draw only a part of a circle with goocanvasmm:\n\nm_ellipse = Goocanvas::Ellipse::create( x, y, radius.x, radius.y );\nroot->add_child( m_ellipse );\n\n\nworks fine and draw a full circle.\n\nHow can I draw only an arc?\n\nIs that based on a circle or must i calculate a long list of points for a polyline? If so, is there an example anywhere?"
] | [
"c++",
"gtkmm"
] |
[
"DHTMLX addMarkedTimeSpan blocks time every week instead of specific date",
"I am using the dhtmlx scheduler and wanting to add a marked timespan using the addMarkedTimeSpan method as describer here: http://docs.dhtmlx.com/scheduler/api__scheduler_addmarkedtimespan.html\n\nWhen applying the following:\n\nscheduler.addMarkedTimespan({\n days: new Date('2015-11-21'),\n zones: [12*60, 14*60, 16*60, 17*60],\n css: \"medium_lines_section\",\n sections: {\n unit: 462\n }\n});\n\nscheduler.updateView();\n\n\nIt created a markedTimeSpan for the specific date and time for the unit I am specifying. However, it is also creating one for every week in the scheduler object. So it creates a marked timespan for 2015-11-21, 2015-11- 28, etc despite specifying the exact date and zones to apply the marked TimeSpan to.\n\nHas anyone else experienced this before?\n\nI have tried with the latest and older versions of the libraries with the same result."
] | [
"javascript",
"scheduler",
"dhtmlx",
"dhtmlx-scheduler"
] |
[
"phpcs Is there a rule to disallow empty lines?",
"Is there a rule that I can use with phpcs that limits the number of consecutive empty lines to e.g. 3? I currently use PSR2, which does not take this into consideration at all."
] | [
"php",
"phpcs",
"psr-2"
] |
[
"Anyone know what Javascript library is used here?",
"I was reading an article, and it had an image, and when I clicked on it it had a really interesting way to display the full size. I was wondering if anyone know which javascript library. Here is the link:\n\nhttp://www.rogueamoeba.com/utm/2009/11/13/airfoil-speakers-touch-1-0-1-finally-ships/\n\nClick the image in the middle of the article.\n\nCheer!\nShawn"
] | [
"javascript",
"html",
"image"
] |
[
"Java: catching specific Exceptions",
"say I have the following\n\ntry{\n//something\n}catch(Exception generic){\n//catch all\n}catch(SpecificException se){\n//catch specific exception only\n}\n\n\nWhat would happen when it comes across SpecificException ? Does it catch it as a generic exception first, and then catch the specificexception ?\n\nOr does it only catch SpecificException while ignoring generic exceptions.\n\nI don't want both generic and specificexception being caught."
] | [
"java"
] |
[
"android RuntimeException: Can't create handler inside thread that has not called Looper.prepare()",
"I have to run a function in the background and while the function is performing I have to show a progress dialog.\nthis is how I call the function\n.setPositiveButton(getString(R.string.str_accept)) { _, _ ->\n CoroutineScope(Dispatchers.Default).launch {\n pdfReportRequest()\n }\n\nand this is how I perform Coroutine task\nprivate suspend fun pdfReportRequest() {\n val alertDialog: AlertDialog?\n progressDialogBuilder.setView(progressBinding.root)\n .setTitle(context?.getString(R.string.exporting_as_pdf_file))\n .show()\n withContext(Dispatchers.Default) {\n getResultFromApi()\n }\n alertDialog = progressDialogBuilder.create()\n alertDialog.dismiss()\n }\n\nbut it gives me this error\n\njava.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()"
] | [
"android",
"kotlin"
] |
[
"code first join between table not appeared",
"I am having 3 tables with a join tables between the user and the type tables.\n\n\n\n\nI import the tables as code first from database, I have the contexts fine, DBset, DBSet, and\n\n modelBuilder.Entity<User>()\n .HasMany(e => e.Type)\n .WithMany(e => e.Users)\n .Map(m => m.ToTable(\"UserType\").MapLeftKey(\"ut_use_id\").MapRightKey(\"ut_ut_id\"));\n\nHowever, I have no idea how to retrieve with linq to sql a table with 3 columns User.name, User.firstname, and Type.type_description==1 ?\n\n\nI started and tried \n\n using (MyContext db = new MyContext())\n {\n var query = (from u in db.Users....\n\n\nBut there is no table db.UserType ?\n\nThanks for your helps\nCheers"
] | [
"sql",
"linq",
"entity-framework",
"linq-to-sql",
"ef-code-first"
] |
[
"Spring MVC : retrieve Http Request header",
"I implemented a micro-services architecture. Before accessing each micro-service the request gets through a gateway that checks the authentication and in the process adds an X-User header containing the user id.\nIn each of my micro-services, I would like to be able to retrieve this user (X-User) in an elegant way: without adding the HttpRequest/@RequestHeader to all my Controllers and pass it to the services, etc.\nUsing something like "SecurityContextHolder.getContext().getAuthentication().getUserId();" would be perfect but as I don't manage the Authentication in my micro services it's not possible."
] | [
"java",
"spring",
"spring-security",
"oauth-2.0"
] |
[
"In Vuejs select list box getting same value for all rows",
"I am creating 4 rows with 3 columns (2 text box and 1 select box). What ever the value selected in select component getting updated with other 4 rows also.\n\nHere is my code\n\n<tr\n v-for=\"ingredient in ingredients\"\n v-bind:key=\"ingredient.id\"\n> \n <td>\n <input\n type=\"text\"\n class=\"form-control\"\n id=\"\"\n v-model=\"ingredient.item_name\"\n />\n </td>\n <td>\n <input\n type=\"text\"\n class=\"form-control\"\n id=\"\"\n v-model=\"ingredient.quantity\"\n />\n </td>\n <td>\n <select v-model=\"selected\"> \n <option v-for=\"unit in units\" v-bind:key=\"unit\" > {{ unit }} </option>\n </select>\n </td>\n</tr>\n\n\n\nHere is my data\n\nexport default {\n data() {\n return {\n selected:[],\n units: ['gms', 'pound', 'kgs']\n };\n },"
] | [
"vue.js",
"vuejs2",
"vue-component",
"vuex"
] |
[
"MySQL User Defined Procedure Returns \"boo!\" when called",
"ere is a summation of my procedure code.\n\nEverything runs, except the call statement:\n\ncall rlbsddb.Get_TD_Roles('userid', 'dbname', 'tblname', '@TS')\nError Message Returned: boo!\n\n\nI know MySQL has bad error messaging, but 'boo!'???\n\nThe overall goal of the code, is to run 3 statements gathering details about access. Return the DateTime of the insertion, and then use that pull the actual results.\n\nActual results is anywhere from 0-10 rows which were inserted in the code. \nWhy isn't this working?\n\nDELIMITER $$\nDROP PROCEDURE IF EXISTS rlbsddb.Get_TD_Roles$$\n\ncreate PROCEDURE rlbsddb.Get_TD_Roles (in pEID varchar(30), \n in pDBName varchar(30), in pTBLName varchar(30), out RUN_TS datetime)\n LANGUAGE SQL\n NOT DETERMINISTIC\n SQL SECURITY DEFINER\nBEGIN\n\nset @CURR_TS = current_timestamp;\nselect @CURR_TS into RUN_TS;\n\n/* Do Some Stuff */\n/* Original Code uses variables to locate a multiple row response \n Multiple row response is then added into the tmp_for_example_only table\n and after call, information is pulled using a select */\n\ninsert into rlbsddb.tmp_for_example_only\nselect pEID, pDBName, pTBLName, @CURR_TS;\n\nEND $$\n\ncall rlbsddb.Get_TD_Roles('userid', 'dbname', 'tblname', @TS)$$\n/* I've tried this with '@TS' as well */\n/* I've also tried \"show warnings$$\" in front of the call and just after the call, nothing returned */\n\nselect * \nfrom rlbsddb.tmp_for_example_only\nwhere inserted_dtim = @TS\nand user_id = 'userid'\nand DBName = 'dbname'\nand TBLName = 'tblname'$$"
] | [
"mysql"
] |
[
"Use image as background of another element",
"Attempted JS\n\nfunction preview(element) {\n var x = document.getElementById(\"photos\").getElementsByTagName(\"LI\");\n var nodes = document.getElementById(element).childNodes;\n\n for (i=0; i<x.length; i++){\n x[i].style.width = \"10vw\";\n x[i].style.height = \"10vw\";\n }\n\n document.getElementById('previewBox').style.background = nodes[0];\n viewClose();\n}\n\n\nHTML\n\n<ul id = \"photos\">\n <li onclick=\"preview('pic1')\" id = \"pic1\">\n <img src = \"https://38.media.tumblr.com/d88beaf3fe2964af04e8b3d57aa32e97/tumblr_n9gnc0n0Gu1tgkx81o1_1280.jpg\">\n </li>\n</ul>\n\n\nCSS\n\n#photos li {\n width: 100%;\n display: inline-block;\n}\n\n#photos li{\n float: left;\n width: 18vw;\n height: 18vw;\n margin: 1.03vw;\n overflow: hidden;\n background: black;\n}\n\n#photos li > img{\n position: relative;\n bottom: 10px;\n /*-webkit-background-size: cover center center; \n -moz-background-size: cover; \n -o-background-size: cover; \n background-size: cover center center;*/\n width: 140%;\n}\n\n#previewBox{\n width: 90vw;\n height: 50vw;\n}\n\n\nWHAT I WANT:\n\nTake the img from the li and make it the background of #previewBox.\nNothing seems to really work and I have tried many.(I understand that nodes must have a loop or sub number). Any other approaches? I have learned HTML, CSS, Javascript language, no jquery."
] | [
"javascript",
"html",
"css"
] |
[
"How to deploy SSRS reports to my web server",
"I finished setting up my SSRS reports on my local machine by installing reporting services and configuraturing this to work with my local machine. My question is to deloy the reporting services to a web server so that I can run the reports from where my website is hosted?"
] | [
"reporting-services"
] |
[
"Image compression web app,can you suggest steps to achieve it",
"I'm building a web app,which actually does image compression for the user's image,I want to ask, the image compression algortithm's that we implement in MATLAB like Kekre's Algorithm,zero tree algo,predictive encoding, is it possible to implement them in php.\n\nSo, can anybody suggest ,how can I achieve those things in php, or provide me some reference links,which can help me to build a online Compression tool.\nor if anybody done anything like converting program logic of image manipulation from matlab to php. I have a high level DFD of my tool is: you can find it here"
] | [
"php",
"matlab",
"image-processing",
"compression",
"online-storage"
] |
[
"NSControl's setCellClass is deprecated in OS X 10.10 what's the alternative for overriding NSTextField's cell class?",
"I'm attempting to follow the post linked below to override the NSCell of a NSTextField but it looks like the setCellClass method is now deprecated in OSX 10.10.\n\nHow to make NSTextField use custom subclass of NSTextFieldCell?\n\nHow should one override the NSTextField's cell substituting it for a subclass?\n\nThe reason for doing this is to vertically centre the text of a NSTextField cell which Apple have made very difficult."
] | [
"macos",
"osx-yosemite",
"nstextfield",
"nstextfieldcell"
] |
[
"Get default namespace from XMLDocument in JS",
"I loaded XMLDocument with XMLHttpRequest.\n\n<root xmlns=\"http://somesite.org/ns\">\n</root>\n\n\nhttp://somesite.org/ns is the default namespace. I can use function Node.isDefaultNamespace for check if some namespace is default (true/false) and it's work well. \n\nBut how can I get default namespace from XMLDocument?\n\nIs there somethink like DOMString Node.getDefaultNamespace()?"
] | [
"javascript",
"html",
"xml",
"dom",
"xml-namespaces"
] |
[
"onChangeListener on numberPicker",
"is it possible to have an onChangeListener for an numberPicker only when a number was entered by the softkeyboard?\nThe Listener should not be executed when the number is changed gy +/-. Only when the user entered a number from the softkeyboard.\n\nThe goal is that the the next pickeritem should get the focus after a user entered a number in the previous item.\nSo the user gets ready to enter a number like \"12345\" and each pickeritem gets its own value:\n\nPicker0=1\nPicker1=2\nPicker3=3\nPicker4=4\nPicker5=5\n\n\nIst that possible or is that the wrong way?"
] | [
"android",
"keyboard",
"focus",
"android-softkeyboard",
"picker"
] |
[
"Dealing with multiple options and logging not found scenarios",
"When I have multiple Options and I have to process something only when all of them have a value, the for comprehension provides a great way to write code\n\nfor {\n a <- aOption\n b <- bOption\n c <- cOption\n d <- dOption\n} yield {...process...}\n\n\nAlthough this is very useful and elegant and concise way of writing code, I miss the ability to log if say \"cOption\" got a none value and thus the processing did not happen.\n\nIs there a nice way in the code above, to be able to log the missing value without resorting to nested ifs."
] | [
"scala"
] |
[
"Creating Visual on Line and Clustered Column Chart",
"I have line and clustered column chart (shown on "Graph" image) and I want to add a visual like drawn on "Graph" image\nClustered Columns : Planned Labor Data and Actual Labor Data\nLines : Cumulative Planned Labor data and Cumulative Labor Data\nI keep data for both planned (P_Planned_Labor) and actual (Z_Labor) in 2 column table (date and data). Also I have a Date table (Z_Tarih) and it has only dates which has relation with planned and actual tables.\nDax Measures:\n\n[Toplam Bugdeted] = Sum of Planned Bugdet\n\nColumns;\n\nLabor_Earned % İlerleme = DIVIDE(sum(Z_Labor[Değer]),[Toplam Budgeted],0) "percentage of actual labor of this week)\nLabor_Plan % İlerleme = DIVIDE(SUM(P_Planned_Labor[Değer]),[Toplam Budgeted],0) "percentage of planned labor of this week)\n\nLines;\n\nLabor_Earned Küm. % İlerleme = DIVIDE(CALCULATE(SUM(Z_Labor[Değer]),FILTER(ALL(Z_Tarih),Z_Tarih[Tarih]<=MAX(Z_Labor[Tarih]))),[Toplam Budgeted],0) "percentage of all actual from begining"\nLabor_Plan Küm. % İlerleme = DIVIDE(CALCULATE(SUM(P_Planned_Labor[Değer]),FILTER(ALL(Z_Tarih),Z_Tarih[Tarih]<=MAX(Z_Tarih[Tarih]))),[Toplam Budgeted],0) "percentage of all planned from begining"\n\nthe chart i used doesnt allow (or i couldn't figure it out) to add visual which show difference value among lines.\nIs there any chart that allow me to do that ?\nor what measure should i add ?\nGraph\nData"
] | [
"powerbi",
"dax",
"powerbi-desktop"
] |
[
"UINavigationController: viewDidLoad is called but doesn't affect the UI",
"I have this in the App Delegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions\n{\n self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\n // Override point for customization after application launch.\n self.window.backgroundColor = [UIColor whiteColor];\n\n OneViewController *vc = [[OneViewController alloc] initWithNibName:@\"OneViewController\" bundle:nil];\n UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];\n\n [self.window setRootViewController:nav];\n [self.window makeKeyAndVisible];\n return YES;\n}\n\n\nand this in OneViewController\n\n- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil\n{\n self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];\n if (self) {\n // Custom initialization\n }\n return self;\n}\n\n- (void)viewDidLoad\n{\n [super viewDidLoad];\n // Do any additional setup after loading the view from its nib.\n UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];\n [button setTitle:@\"Hi\" forState:UIControlStateNormal];\n [self.view addSubview:button];\n}\n\n\nBut when I run the app in the simulator, the OneViewController screen is blank. It has a xib file which is just the default blank xib."
] | [
"ios",
"objective-c",
"uinavigationcontroller",
"viewdidload"
] |
[
"Data frame shift functionality",
"I currently have two data frames and wish to create a third data frame based upon two conditions both being satisfied: TRUE if the corresponding value in data frame 1 has just broken through 2 AND the value of data frame 2 is <= 0.2, else FALSE.\n\ndf1\n\n\n\ndf2\n\n\n\nAnd the code should create df3 as follows:\n\n\n\ni.e condition is only TRUE for 5y on 13-aug-17 as 5y has broken above 2 AND the value in df2 <=0.2.\n\nThe purpose of this is to replicate what has been done here mean reversion strategy over an entire data frame, rather than just for a single time-series, i.e for each of the steps in the example do the process at the data frame, rather than time series level.\n\nSo the question is how to apply the shift function below at the dataframe rather than column level.\n\ndf4['short entry'] = ((df4.zScore < - entryZscore) & ( df4.zScore.shift(1) > - entryZscore)&(df4['hurst'] < hurstentry))"
] | [
"python",
"pandas"
] |
[
"How to present all CSS features in NSAttributedString",
"In my app I need to present an HTML file in TextView not in WebView, and this file has a complex CSS, not just text color, bold, etc. \n\nMy CSS is like the one below: \n\ntable {\n width: 100%;\n}\n\ntable td {\n padding: 10px;\n border-bottom: 1px solid #eee;\n box-sizing: border-box;\n}\n\n/* -------------------------------------------------- */\n\n.btn {\n float: left;\n font-size: 11px;\n color: #FFF!important;\n text-transform: uppercase;\n background: #a8353a;\n padding: 0 14px;\n margin: 10px 0 0!important;\n cursor: pointer;\n line-height:30px;\n}\n.btn:hover {\n background: #d8474e\n}\n\n/* -------------------------------------------------- */\n\nul li {\n list-style-type: square;\n margin: 10px 20px;\n}\n\n.allcaps {\n text-transform:uppercase;\n}\n\n/* -------------------------------------------------- */\n\n.tablewithimages .image {\n width: 45%;\n}\n@media only screen and (max-width: 768px) {\n .tablewithimages td, .tablewithimages .image {\n display:block;\n width:100%;\n padding: 10px 0 0 0;\n border:0;\n }\n .tablewithimages img {\n margin-top:30px;\n }\n}\n\n/* -------------------------------------------------- */\n/* ---------------- RECOMMENDED APPS ---------------- */\n\n.appslist a {\n border: 0 !important;\n}\n.appslist ul {\n vertical-align: top;\n margin:0;\n padding: 0;\n}\n.appslist li {\n width: 48.5%;\n display: inline-table;\n margin-bottom: 50px;\n vertical-align: top;\n padding-right: 1%;\n}\n.inner_left_side.equal .appslist .appitem {\n width: 100%;\n padding-right: 0;\n margin-bottom: 20px;\n}\nul .appitem {\n margin: 10px 0;\n}\n.appslist img {\n height: auto;\n max-height: 100%;\n max-width: 100%;\n width: 100%;\n box-shadow: 1px 1px 3px rgba(0,0,0,0.1);\n border: 1px solid #ccc;\n border-radius: 18px;\n overflow: hidden;\n}\n.appslist .appitem .image {\n width: 70px;\n height: 110px;\n float: left;\n margin-right: 10px;\n margin-top: 0;\n}\n.appslist p {\n padding-right: 10px;\n margin-bottom: 10px;\n text-align: initial;\n}\n.appslist .apptitle {\n font-size: 14px;\n margin-right: 10px;\n padding-top: 0;\n margin-top: 0;\n margin-bottom: 7px;\n text-transform: uppercase;\n font-weight: bold;\n}\n.appslist .apptext {\n font-size: 14px;\n line-height: 22px;\n margin-left: 90px;\n}\n.appslist .stores {\n margin-left: 90px;\n width: auto;\n display: block;\n}\n.inner_left_side.equal .appslist .stores {\n width: 100%;\n text-align: initial;\n}\n.story .text .appslist .stores {\n margin-left: 130px;\n}\n.appslist .appitem li {\n display: inline-block;\n min-height: 0;\n margin-bottom: 0px;\n width: 125px;\n background-repeat:no-repeat;\n margin: 0;\n}\n.appslist .appitem li a {\n display: block;\n padding-left: 33px;\n background-repeat: no-repeat;\n background-position: 5px center;\n color: rgba(51,51,51,1.00);\n background-color: rgba(255,255,255,0.00);\n border-radius: 3px;\n text-decoration: none;\n padding-right: 10px;\n line-height: 34px;\n font-size: 14px;\n background-size: auto 75%;\n white-space: nowrap;\n}\n.stores .apple {\n background-image:url('********.png');\n}\n.stores .android {\n background-image:url('********.png');\n}\n\n@media only screen and (max-width: 800px) {\n .appslist li {\n width: 100%;\n }\n .inner_left_side.equal .appslist .stores {\n width:auto;\n }\n}\n\n\nI searched a lot on how to present full CSS in UITextView, and I found answers like this one but all these answers defined how to add simple CSS. \n\nDoes anyone try to add complex CSS to UITExtView before? Are there any libraries support this features?"
] | [
"ios",
"css",
"swift",
"uitextview",
"nsattributedstring"
] |
[
"Displaying the correct price",
"I'm struggling with the problem on this website (http://duledo.co.uk/product-category/self-healing-mat-cutting-mat/). I used WooCommerce Currency Switcher. The prices are updated except English version of this site. What's the problem with this?\n\nThanks in advance for any help."
] | [
"php",
"wordpress",
"woocommerce"
] |
[
"html radio button are not clickable (The actual file is jade)",
"This would be more easier question but I am stuck on some small simple thing: \nMy angular object is like this: \n\n$scope.questions = [\n {\n questionText: \"1. This is a test question#1\",\n choices: [{\n id: 1,\n text: \"NO\",\n isUserAnswer: false\n }, {\n id: 2,\n text: \"YES\",\n isUserAnswer: true\n }]\n },\n {\n questionText: \"2. This is a test question#2\",\n choices: [{\n id: 1,\n text: \"NO\",\n isUserAnswer: false\n }, {\n id: 2,\n text: \"YES\",\n isUserAnswer: true\n }]\n }\n];\n\n\nNow I am trying to populate my frontend (jade/html) using this object so that I can have two radio buttons for each questions. My jade file is like this: \n\ndiv\n ul.unstyled\n li(ng-repeat='question in questions')\n strong.question {{question.questionText}}\n ul.unstyled(id='quest_{{$parent.$index}}')\n li(ng-repeat='choice in question.choices')\n label.(class='isCorrect_{{choice.selected}}', for='quest_{{$parent.$index}}_choice_{{$index}}')\n input(type='radio', id='quest_{{$parent.index}}_choice_{{$index}}', ng-model='choices[$parent.$index]', value='{{choice.text}}', name='quest_{{$parent.$index}}_choices', ng-click='showResult()')\n | {{choice.text}}\n\n\nNow I can see the questions and radio buttons on the html page but somehow I am unable to perform click on any of the button. \nAny obvious reason? Any help would be appreciated. It works perfect when I change to html file."
] | [
"javascript",
"html",
"angularjs",
"jade4j"
] |
[
"Package method having no effect in Buildr",
"I'm trying to package a scala project into a jar and write properties to the Manifest using Buildrs package() method.\n\nThe package seems to have no affect on the Manifest. Here's the build file:\n\nVERSION_NUMBER = \"1.0.0\"\nGROUP = \"Green\"\nCOPYRIGHT = \"Green CopyRight\"\n\nrequire 'buildr/scala'\n\nBuildr::Scala::Scalac::REQUIRES.library = '2.8.0-SNAPSHOT'\nBuildr::Scala::Scalac::REQUIRES.compiler = '2.8.0-SNAPSHOT'\nJava.classpath.reject! { |c| c.to_s.index('scala') }\nJava.classpath << Buildr::Scala::Scalac::REQUIRES\n\nENV['USE_FSC'] = 'yes'\n\nrepositories.remote << \"http://www.ibiblio.org/maven2/\"\n\ndesc \"The Green project\"\ndefine \"Green\" do\n project.version = VERSION_NUMBER\n project.group = GROUP\n package(:jar).with :manifest=>manifest.merge(\n 'Main-Class'=>'com.acme.Main',\n 'Implementation-Vendor'=>COPYRIGHT\n )\nend\n\n\nAnd here's the resulting Manifest:\n\nBuild-By: brianheylin\nBuild-Jdk: 1.6.0_17\nImplementation-Title: The Green project\nImplementation-Version: \nImplementation-Vendor: \nMain-Class: green.GreenMain\nManifest-Version: 1.0\nCreated-By: Buildr\n\n\nNotice that neither the Implementation-Vendor or Main-Class property has been overwritten. I run Buildr as follows:\n\njruby -S buildr clean package\n\n\nI'm using jRuby 1.4.0 and Buildr 1.3.5 (installed as a gem). Anyone any ideas on why this is the case?"
] | [
"scala",
"jar",
"manifest",
"buildr"
] |
[
"Allow global configuration of a SharePoint web part",
"I have created a SharePoint web part which has custom properties that the user can configure. However these apply only to that instance of the web part. How could I provide the user a place to allow the user to set properties that would apply to every instance of the web part?\n\n(I'm new to SharePoint development and am using WSPBuilder to create a web part with a feature and deploy it.)"
] | [
"sharepoint",
"web-parts"
] |
[
"Failed to mount component",
"What is the difference between:\n\nVue.component('cond',require('./components/myComponent.vue').default); \n\n\nand \n\nVue.component('cond',require('./components/myComponent.vue')); \n\n\nwhen I need to use the first or last one?"
] | [
"vue.js",
"components",
"vue-component"
] |
[
"Trying to get the index of an array of images when clicked on",
"function openGallery(){\r\n console.log($(this).index()); \r\n}\r\n\r\n$(\"body\").on( \"click\", \"#gallery img\", openGallery);\r\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>\r\n<section class=\"grid-x grid-padding-x section-content\" id=\"gallery\">\r\n<div class=\"cell small-12\">\r\n <h1>Gallery</h1>\r\n</div>\r\n\r\n<div class=\"cell small-12\">\r\n <section class=\"grid-x grid-padding-x small-up-2 medium-up-4 large-up-6\">\r\n<div class=\"cell\"><img src=\"img/gallery/gallery-1-sm.jpg\" alt=\"gallery 1\"></div>\r\n<div class=\"cell\"><img src=\"img/gallery/gallery-2-sm.jpg\" alt=\"gallery 2\"></div>\r\n<div class=\"cell\"><img src=\"img/gallery/gallery-3-sm.jpg\" alt=\"gallery 3\"></div>\r\n<div class=\"cell\"><img src=\"img/gallery/gallery-4-sm.jpg\" alt=\"gallery 4\"></div>\r\n<div class=\"cell\"><img src=\"img/gallery/gallery-5-sm.jpg\" alt=\"gallery 5\"></div>\r\n<div class=\"cell\"><img src=\"img/gallery/gallery-6-sm.jpg\" alt=\"gallery 6\"></div>\r\n</section> \r\n</div>\r\n</section>\r\n\r\n\r\n\n\n// I keep getting 0 as the index valley of what is clicked on. I think I'm missing something very simple."
] | [
"javascript",
"jquery",
"html",
"arrays"
] |
[
"wordpress website, using cloudflare as CDN, CSS on the live site keeps disappearing and sometime css classes does not work when i inspect the element",
"I am working on a wordpress website, using cloudflare CDN. I have dev, staging and live site, where dev and staging works perfectly fine but live site works very weird, CSS on the site keeps disappearing and sometimes css classes from product pages does not work or disappear."
] | [
"javascript",
"css",
"wordpress",
"cloudflare"
] |
[
"set selected start time as min time for end date in react date picker",
"Hello i am using React Datepicker for specific time range.\n\nhttps://reactdatepicker.com/#example-specific-time-range.\n\nHeres is my code:\n\nclass Location extends Component {\nconstructor() {\n super();\n this.state = {\n selectedStartDate: '',\n selectedEndDate: '',\n booking: {\n startDate: '',\n endDate: '',\n },\n };\n\n this.handleStartDateChange = this.handleStartDateChange.bind(this);\n this.handleEndDateChange = this.handleEndDateChange.bind(this);\n}\n\n\nhandleStartDateChange(date) {\n var bookingObj = this.state.booking;\n bookingObj.startDate = date;\n this.setState({ booking: bookingObj})\n}\n\nhandleEndDateChange(date) {\n var bookingObj = this.state.booking;\n bookingObj.endDate = date;\n this.setState({ booking: bookingObj})\n}\n\nrender() {\n return (\n <div className=\"row\">\n <div className=\"col-md-12 col-lg-12 start_boxx\">\n <div className=\"row\">\n <div className=\"col-sm-12\">\n <div className=\"form-group date_time\">\n <DatePicker\n className=\"form-control dtepickr\"\n placeholderText=\"Click to select start Date\"\n selected={this.state.booking.startDate}\n onChange={this.handleStartDateChange}\n minDate={this.state.selectedStartDate}\n maxDate={this.state.selectedEndDate}\n showTimeSelect\n dateFormat=\"dd-MM-yyyy HH:mm aa\" \n />\n </div>\n <div className=\"form-group date_time\">\n <DatePicker\n className=\"form-control dtepickr\"\n placeholderText=\"Click to select end Date\"\n selected={this.state.booking.endDate}\n onChange={this.handleEndDateChange}\n minDate={this.state.selectedStartDate}\n maxDate={this.state.selectedEndDate}\n showTimeSelect\n minTime={this.state.booking.startDate}\n maxTime={this.state.booking.??}\n dateFormat=\"dd-MM-yyyy HH:mm aa\"\n />\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n}\n}\n\n\nI want to set my start time as minimum time for end date.\ni use minTime and maxTime fumction but does not work.\nplease help me to get out of this.\nthanks"
] | [
"reactjs"
] |
[
"How are REST api \"expand features\" implemented in SQL (without ORM)",
"REST APIs often have the feature to expand nested objects in their responses. I have an API to maintain and I would like to implement this feature. I would like to hear about how the community approaches the problem when it comes to SQL.\n\nWith an ORM it is possible to expand dynamically, at runtime, but this causes extra roundtrips to the database, and with big objects, the ORM is gonna make dozens of database queries. Ideally, I would like to limit each endpoint to a single SQL query. Therefore what is the common approach?\n\n\nParse the URL and chose the query to execute based on the expand parameter?\nFetch all the data in a single query and filter out data according to the expand parameter?\n\n\nWhat's problematic is that if I want to avoid multiple roundtrips to the database, I need to know in advance which expand combinations are possible. It is very difficult to allow deeply nested expands for instance.\n\nThanks"
] | [
"sql",
"api",
"orm"
] |
[
"Scala monad with flatMap definition",
"I have a construct, let's call it Container. It, as you might guess, is a container for another object, with some headers (a simple map). There are two instances of the container, a success container, or a failed container. \n\nI have a function defined on container, called \n\nflatMap(f: Container[T]=> Container[U]): Container[U]\n\nPretty familiar right, except unlike a 'real' monad, it's from M[A]->M[B], rather than A->M[B]. This is because I want the mapping functions to have access to all the fields of the container.\n\nNow there's no real problem with this, except it doesn't follow the definitions for a monad and so it doesn't work with for comprehensions as a generator.\n\nAny suggestions, other than changing the flatMap definition, or am I just SoL :)"
] | [
"scala"
] |
[
"Get the right jquery datatable object on click event",
"I want to remove a row from a datatable table with an on click event. I got this based on the documentation and my code works. \nHowever I don't want to hard code the variable name for my datatable object in the remove function as there might be multiple or differently called datatables. How can I determine the correct object where the row should be removed?\n\nUpdated code in codepen https://codepen.io/bintux/pen/QWLKxQG based on @David Hedlund's answer.\n\nvar table = $('#example').DataTable();\n\n$('.deleterow').on('click', function () {\n //I want to avoid this hard coded name for the datatable object but instead get the right object when the user clicks in the table \n\n table\n .row($(this).parents('tr'))\n .remove()\n .draw();\n\n});\n\n\n\n\r\n\r\nvar table = $('#example').DataTable();\r\n$('.deleterow').on('click', function() {\r\n table\r\n .row($(this)\r\n .parents('tr'))\r\n .remove()\r\n .draw();\r\n //console.log(row);\r\n});\r\n<link href=\"https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css\">\r\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js\"></script>\r\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.19/js/jquery.dataTables.min.js\"></script>\r\n<script src=\"https://cdn.datatables.net/1.10.18/js/dataTables.bootstrap4.min.js\"></script>\r\n<div class=\"container\">\r\n <table id=\"example\" class=\"display nowrap\" width=\"100%\">\r\n <thead>\r\n <tr>\r\n <th>Remove</th>\r\n <th>Name</th>\r\n <th>Position</th>\r\n <th>Office</th>\r\n <th>Age</th>\r\n <th>Start date</th>\r\n <th>Salary</th>\r\n </tr>\r\n </thead>\r\n <tfoot>\r\n <tr>\r\n <th>Remove</th>\r\n <th>Name</th>\r\n <th>Position</th>\r\n <th>Office</th>\r\n <th>Age</th>\r\n <th>Start date</th>\r\n <th>Salary</th>\r\n </tr>\r\n </tfoot>\r\n\r\n <tbody>\r\n <tr>\r\n <td><span class=\"deleterow\">X</span></td>\r\n <td>Tiger Nixon</td>\r\n <td>System Architect</td>\r\n <td>Edinburgh</td>\r\n <td>61</td>\r\n <td>2011/04/25</td>\r\n <td>$3,120</td>\r\n </tr>\r\n <tr>\r\n <td><span class=\"deleterow\">X</span></td>\r\n <td>Garrett Winters</td>\r\n <td>Director</td>\r\n <td>Edinburgh</td>\r\n <td>63</td>\r\n <td>2011/07/25</td>\r\n <td>$5,300</td>\r\n </tr>\r\n <tr>\r\n <td><span class=\"deleterow\">X</span></td>\r\n <td>Donna Snider</td>\r\n <td>System Architect</td>\r\n <td>New York</td>\r\n <td>27</td>\r\n <td>2011/01/25</td>\r\n <td>$3,120</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>"
] | [
"javascript",
"jquery",
"datatables"
] |
[
"sp_executesql Parameters Values",
"I have a table that can be modified my the user, meaning the user can add columns, since i cant know how many columns does de table will have, I dont know how can i supply the sp_executesql values.\n\nMy code so far:\n\nSET @sSQL = (\n N'INSERT INTO dbo.MyTable\n VALUES('+@numParametros+')'\n)\n\n--For Explaining purposes since @stmtPar is SET dynamically \n--in a while-loop at de begining of the SP\nSET @ParmDefinition = @stmtPar \n\n\nHere is where i need help, due to the fact that i dont know how many columns does the table has I cant know how many @parameters i need to supply\n\nEXEC sp_executesql @sSql, @ParmDefinition, ????\n\n\nI have a @values variable that contains the values that need to be inserted but if i put the next statment sql only uses @values fo supply the first column\n\nEXEC sp_executesql @sSql, @ParmDefinition, @values\n\n\nHope you can help, thank you"
] | [
"sql",
"sql-server",
"tsql",
"dynamic-sql"
] |
[
"Ajax content submission",
"I have the following code, which takes a response from the Cardspring servers and attempts to send it to our site to be stored in our database. I'm having trouble getting the ajax to work correctly. As I watch the heroku server logs, it seems as it the ajax isn't sending a POST to our server -- there's no log entry for the ajax request. Here's what the ajax code looks like:\n\n <script type=\"text/javascript\">\n $(document).ready(function()\n {\n $('#contactform').submit(function(event) {\n $('.submit-button').attr('disabled', 'disabled');\n cardSpringResponseHandler = function(response){\n if((typeof response.error) != \"undefined\")\n {\n var error = response.error;\n var reason = response.reason;\n alert(error + ' ' + reason);\n }\n\n else\n {\n alert(response.token + ' ' + response.last4 + ' '+ response.brand + ' ' + response.brand_string + ' ' + response.expiration);\n alert('Thank you, your card is registered!');\n $.ajax({\n type: 'POST',\n url:'www.url.com/me',\n async: false,\n data: {\"token\": response.token,\"last4\": repsonse.last4,\"brand\": response.brand,\"brand_string\":response.brand_string,\"expiration\": response.expiration}.serialize(),\n\n error: function () {\n alert('Error');\n }\n });\n\n }\n\n alert('Hello 2');\n };\n alert('adding card');\n CardSpring.addCard(cardSpringResponseHandler\n , {\n publisher_id : '{{ CARDSPRING_APP_ID }}',\n security_token : '{{ securityToken }}',\n timestamp : '{{ timestamp }}',\n hmac : '{{ digestedHash }}'\n }, {\n card_number : $('.card-number').val(),\n exp_month : $('.expiration-month').val(),\n exp_year : $('.expiration-year').val(),\n user_id : '{{ csid }}'\n }, \"all\");\n alert('card added');\n return false;\n });\n });\n</script> \n\n\nHere's a snippet of urls.py, to show the url:\n\nurl(r'^me/$', accountInfo),\n\n\nHere's what the server side code looks like, as a django view:\n\ndef accountInfo(request):\n #after CS.addCard is sucessful, this adds the credit card Token to our DB...\n print request.method\n if request.method == \"POST\":\n print \"in account info\"\n print \"expiration = \" ,\n #print request.POST['expiration']\n print \"request =\"\n print request\n try:\n cardToAdd = Cards(csID = request.COOKIES.get('csID'),token = request.POST['token'], last4 = request.POST['last4'], cardType = request.POST[\"brand\"] ,typeString = request.POST['brand_string'],\n expDate = request.POST['expiration'])\n cardToAdd.save();\n json_data = json.dumps({\"HTTPRESPONSE\":\"sucess\"})\n return HttpResponse(json_data, mimetype=\"application/json\") \n\n except:\n json_data = json.dumps({\"HTTPRESPONSE\":\"fail\"})\n return HttpResponse(json_data, mimetype=\"application/json\")\n\n\nThe initial print request.method runs on the first load of the page, with method = GET. The server doesn't print out any other requests, which makes me think the ajax code isn't running\n\nThe alerts (at least some of them) do occur. They always occur in this order:\n\n\nadding card\ncard added\nresponse.token, response.last4, etc\nThank you, your card was added\n\n\nDoes anyone have any idea what's going on? Thank you for your help -- I'm very very rusty with ajax and javascript"
] | [
"javascript",
"ajax",
"django"
] |
[
"Are there ready-to-use libraries and frameworks to include JavaScript into Java widgets?",
"Are there ready-to-use libraries and frameworks to include JavaScript into Java widgets?\n\nsomething more than just raw WebView widget, the solution where interaction of UI element of Java and JavaScript widgets and logic is highly integrated.\n\nI need to create IDE for Node.js using Java and JavaScript code bases."
] | [
"java",
"javascript",
"frameworks",
"widget"
] |
[
"Menu elements active state",
"So i have been working on this problem all day, and i do not seem to becomming across a solution for this. I have googled the internet dry, however i have not been able to come a cross any help which i could use.\n\nI know that there are many similar questions out there, but again none of which have helped me, even though it seems to be a simple problem.\n\nMy problem is the active state of the menu element on this page: http://dev.ateo.dk/om-ateo/\n\nIts the \"Om Ateo\" and the \"Ofte stillede spørgsmål\" which will not become active elements in the menu, even though it is active.\n\nI have set the body class and the body id to match the id's of the li element, but none of this seems to work in any way."
] | [
"php",
"css",
"menu"
] |
[
"When rendering a view the model is not updated only the viewbag",
"So.... I have an action in my controller that basically copies the current model and returns a new view based on that copy. To inform the user that this is a copy I append a message via the viewbag stating that it's a copy. All seemed to be working until I noticed that it's not the copy that is being used when rendering the new view instead it's the original, but the viewbag on the other hand is updated so the message is shown. \n\nHmm, don't know if that's understandable so I'll try to show what i mean with some pseudo-code as well:\n\nModel\n\npublic class Model{\n [ScaffoldColumn(false)]\n [HiddenInput(DisplayValue = false)]\n public Guid Id { get; set; }\n\n public string Name { get; set; }\n}\n\n\nView\n\n<input type=\"submit\" name=\"Copy\" value=\"@_(\"Copy\")\"/>\n\n\nController\n\npublic ActionResult Copy(model) {\n ViewBag.Message = _(\"This is a copy.\");\n var clone = model.Clone();\n return View(\"Index\", clone);\n}\n\n\nI'm having a real hard time trying to wrap my head around this so any help/tips/pointers are really appreciated.\n\nOh, I've stepped through the code several times to ensure that the clone is really a clone. The only thing that differentiates them is the Id property and that is the new one in the controller but when the view renders it's back to the old one."
] | [
"asp.net-mvc-3"
] |
[
"Convert session variable list of GUIDs to list of strings",
"I have a session variable that's set to a list of GUIDs. I need to convert that list of GUIDs into strings. I know very very little about session variables and have limited experience with C#, hence the probably stupid solutions I've tried below:\n\nSession[\"OtherProgramIDs\"] is of type object{System.Collections.Generic.List<System.Guid?>}\n\nDoesn't work, gives me \"InvalidCastException\", \n\n\n Unable to cast object of type\n 'System.Collections.Generic.List1[System.Nullable1[System.Guid]]' to\n type 'System.Collections.Generic.List`1[System.String]'\":\n\n\nvar otherProgramList = (List<string>)Session[\"OtherProgramIDs\"];\n\n\nDoesn't work, this gives me a message that says \"object does not contain a definition for Select and no extension method Select accepting a first argument of type object could be found\":\n\nvar otherProgramList = Session[\"OtherProgramIDs\"].Select(x => (string)x).ToList();\n\n\nThis gives me the same message as above:\n\nvar otherProgramList = Session[\"OtherProgramIDs\"].Select(x => x.ToString()).ToList();\n\n\nDo I need to loop through it using .ToString() and then adding to the otherProgramList or something?\n\nEDIT\n\nI've added the error messages above. Have also tried this suggestion from the comments and receive the same highlighted error above about System.Collections.Generic.List yada yada yada.\n\nvar otherProgramList = ((IEnumerable<Guid>)Session[\"OtherProgramIDs\"]).Select(x => x.ToString()).ToList();\n\nFYI - it is ok that this GUID is nullable, there are other constraints at play that make this so."
] | [
"c#",
"list"
] |
[
"How to convert row into multiple rows based on combination of different sets of variables in that row?",
"I'm trying to build a python program using numpy arrays, which should accept no of variables, no of sets & dictionary containing mapping for no of variables per set like\ndict_set = {set1:[var1,var2,var3],set2:[var4,var5],set3:[var6,var7,var8,var9,var10,var11]}\n\nand create combination of sets to convert into different rows.\nhere is the input:\n\r\n\r\n<table><tbody><tr><th>V1</th><th>V2</th><th>V3</th><th>V4</th><th>V5</th><th>V6</th><th>V7</th><th>V8</th><th>V9</th><th>V10</th><th>V11</th><th>Class</th></tr><tr><td>-1.359807134</td><td>-0.072781173</td><td>2.536346738</td><td>1.378155224</td><td>-0.33832077</td><td>0.462387778</td><td>0.239598554</td><td>0.098697901</td><td>0.36378697</td><td>0.090794172</td><td>-0.551599533</td><td>0</td></tr></tbody></table>\r\n\r\n\r\n\nOutput:\n\r\n\r\n<table><tbody><tr><th>V1</th><th>V2</th><th>V3</th><th>V4</th><th>V5</th><th>V6</th><th>V7</th><th>V8</th><th>V9</th><th>V10</th><th>V11</th><th>Class</th></tr><tr><td>-1.359807134</td><td>-0.072781173</td><td>2.536346738</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>0</td></tr><tr><td> </td><td> </td><td> </td><td>1.378155224</td><td>-0.33832077</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>0</td></tr><tr><td> </td><td> </td><td> </td><td> </td><td> </td><td>0.462387778</td><td>0.239598554</td><td>0.098697901</td><td>0.36378697</td><td>0.090794172</td><td>-0.551599533</td><td>0</td></tr><tr><td>-1.359807134</td><td>-0.072781173</td><td>2.536346738</td><td>1.378155224</td><td>-0.33832077</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>0</td></tr><tr><td>-1.359807134</td><td>-0.072781173</td><td>2.536346738</td><td> </td><td> </td><td>0.462387778</td><td>0.239598554</td><td>0.098697901</td><td>0.36378697</td><td>0.090794172</td><td>-0.551599533</td><td>0</td></tr><tr><td> </td><td> </td><td> </td><td>1.378155224</td><td>-0.33832077</td><td>0.462387778</td><td>0.239598554</td><td>0.098697901</td><td>0.36378697</td><td>0.090794172</td><td>-0.551599533</td><td>0</td></tr><tr><td>-1.359807134</td><td>-0.072781173</td><td>2.536346738</td><td>1.378155224</td><td>-0.33832077</td><td>0.462387778</td><td>0.239598554</td><td>0.098697901</td><td>0.36378697</td><td>0.090794172</td><td>-0.551599533</td><td>0</td></tr></tbody></table>\r\n\r\n\r\n\nI would like to apply this program to dataset containing 50K rows.\nHelp is really appreciated.\nThanks,\nN"
] | [
"python",
"arrays",
"dataset",
"combinations"
] |
[
"Create png UIImage from OpenGL drawing",
"I'm exporting my OpenGL drawings to a UIImage using the following method:\n\n-(UIImage*)saveOpenGLDrawnToUIImage:(NSInteger)aWidth height:(NSInteger)aHeight {\n NSInteger myDataLength = aWidth * aHeight * 4;\n\n GLubyte *buffer = (GLubyte *) malloc(myDataLength);\n glReadPixels(0, 0, aWidth, aHeight, GL_RGBA, GL_UNSIGNED_BYTE, buffer);\n\n GLubyte *buffer2 = (GLubyte *) malloc(myDataLength);\n for(int y = 0; y < aHeight; y++)\n {\n for(int x = 0; x < aWidth * 4; x++)\n {\n buffer2[(aHeight-1 - y) * aWidth * 4 + x] = buffer[y * 4 * aWidth + x];\n }\n }\n\n CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, buffer2, myDataLength, NULL);\n\n int bitsPerComponent = 8;\n int bitsPerPixel = 32;\n int bytesPerRow = 4 * aWidth;\n CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();\n CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;\n CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;\n\n CGImageRef imageRef = CGImageCreate(aWidth, aHeight, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider, NULL, NO, renderingIntent);\n\n UIImage *myImage = [UIImage imageWithCGImage:imageRef];\n return myImage;\n}\n\n\nBut the background is always black instead of transparent.\n\nI tried using CGImageRef imageRef = CGImageCreateWithPNGDataProvider(provider, NULL, NO, kCGRenderingIntentDefault); but it always generates nil.\n\nHow can I get this to process with a transparent background?"
] | [
"ios",
"objective-c",
"opengl-es",
"uiimage"
] |
[
"How to stream stdout and stderr to file from fork in node.js?",
"I have a separate script runner.js that I'd like to run in the background of my main app. I am trying to fork it, and I'd like runner.js to stream its stdout and stderr to a separate log file. I am having issues getting this to work. Here is my app's code:\nconst startTask = async (logfile) => {\n const stream = fs.createWriteStream(logfile, { flag: 'w+' })\n const child = child_process.fork('./runner.js', [], { stdio: ['ignore', stream, stream] })\n child.send('START')\n}\n\nAnd here is a skeleton of what runner.js looks like:\nconst doStuff = async () => {\n ...\n}\n\nprocess.on('message', async (message) => {\n if (message === 'START') {\n try {\n await doStuff()\n } catch (e) {}\n }\n}\n\nI keep running into issues around node not being able to fork the child because I do not have an IPC channel attached to it. I am wondering how to best do this? Perhaps I should use spawn() instead?"
] | [
"node.js",
"child-process"
] |
[
"How to get resumeData at UIApplicationWillTerminateNotification in NSURLSessionDownloadTask",
"I want to save data unfinished downloads when the app is closed.\n\nTried so, but always empty resumeData:\n\n[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillTerminate) name:UIApplicationWillTerminateNotification object:nil];\n\n- (void)appWillTerminate\n{\n [self.downloadTask cancelByProducingResumeData:^(NSData *resumeData) {\n if (resumeData)\n [self saveData:resumeData];\n else\n NSLog(@\"Not exist\");\n }];\n}"
] | [
"ios",
"nsurlconnection",
"afnetworking",
"nsurlsession"
] |
[
"How do I add opacity to CSS sidebar (not all the elements)?",
"I have this site and I'm trying to add opacity to the sidebar, but only the white part and leve the other elements with a 100 percent opacity.\n\nhttp://eparquitectos.mx/\n\nhere is my CSS\n\nI tried adding \n\nopacity:0.4; in .sidebar but everything received the same opacity, including text and logo.\n\nSIDEBAR\n*************************************************************************/\n.sidebar {\nmargin: 0;\nposition: fixed;\npadding:50px 0 0 0;\nwidth:220px;\nheight:100%;\nleft:50px;\ntop:0;\n}\n\n.sidebar.sidebar_absolute{\nleft:0;\nposition: absolute;\n}\n\n.sidebar.sidebar_absolute .inner_sidebar{\npadding-bottom:67px;\n}\n\n.inner_sidebar{\nwidth:220px;\nfloat: left;\n}\n\n.fullwidth .sidebar{\ndisplay:none;\n}\n\n.border-transparent{\nposition: absolute;\nwidth: 1px;\nleft: 0;\ntop: 0;\nheight: 100%;\n}\n\n.border-transparent-right{\nleft:auto;\nright:0;\n}\n\ndiv .border-transparent-top{\nheight:1px;\nwidth:100%;\n}\n\n\n#top .logo, .logo a{\ndisplay:block;\nposition:relative;\nborder: none;\npadding: 0;\nmargin:0;\nfloat:left;\ntext-align: center;\n}\n\n#top .logo a, #top .logo a:hover{\ntop:0;\nleft:0;\noutline:none;\nborder: none;\n}\n\n#top .logo img{\nborder:none;\nmargin:0 auto;\nmax-width: 180px;\n}\n\n#top .bg-logo, #top .bg-logo a{\ntext-indent: -9999px;\nheight:85px;\nwidth:180px;\n}\n\n\n/*menu*/\n\n.main_menu, #top .main_menu .menu{\nline-height:30px;\nz-index:300;\nclear:both;\nwidth:100%;\nposition: relative;\n}\n\n.main_menu div{\nposition: relative;\nwidth: 100%;\nz-index:300;\n}\n\n.main_menu .menu, .main_menu .menu ul{\nmargin:0;\npadding:0;\nlist-style-type:none;\nlist-style-position:outside;\nposition:relative;\nline-height:50px; \nz-index:5;\n}\n\n#top .main_menu .menu a{\ndisplay:block;\nline-height:18px;\noutline:medium none;\npadding:9px 0;\ntext-decoration:none;\nz-index: 10;\nposition: relative;\nwidth:100%;\nz-index:5;\n}\n\n.main_menu .menu li a strong {\ndisplay:block;\nfont-size:14px;\nfont-weight:normal;\ncursor: pointer;\ntext-transform: uppercase;\n}\n\n.main_menu .menu li a span {\ndisplay:block;\nfont-size:11px;\nline-height:14px;\ncolor:#999;\ncursor: pointer;\nposition: relative;\n}\n\n\nThank you for your time."
] | [
"css",
"opacity"
] |
[
"module 'tensorflow' has no attribute 'gfile' even after adding io to the name",
"I was working on the coco dataset for the object detection tutorial and encountered this error:\n\n\nIn the same program earlier i had the line:\n\nwith detection_graph.as_default():\nod_graph_def = tf.compat.v1.GraphDef()\nwith tensorflow_core.io.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:\n serialized_graph = fid.read()\n od_graph_def.ParseFromString(serialized_graph)\n tf.import_graph_def(od_graph_def, name = '')\n\n\nThis part is working fine but when i run:\n\nlabel_map = label_map_util.load_labelmap(PATH_TO_LABELS)\n\n\nThis throws up the error. Now I have tried by changing it to \"tf.io\" and have also tried changing the code in the \"label_map_util\" program. I have also tried using tensorflow.compat.v1 and all of the permutation with and without adding \"tf.io\" but it still wouldnt work. Could it be that the label_map_util program is picking up tensorflow from some other directory? To ensure that i uninstalled tensorflow from the base anaconda environment and only have tensorflow in the virtual environment that I am working in.\nMy tensorflow version is 2.1.0 and python version is 3.7.6"
] | [
"python",
"tensorflow"
] |
[
"Upload different files through ckeditor",
"I have checked http://ckeditor.com/demo#full. \n\nBut I can not find any option to upload .exe file through ckeditor.\n\nCan I upload .exe file through this editor. If yes, how can I do this?\n\nPlease suggest."
] | [
"pdf",
"ckeditor",
"exe"
] |
[
"Insert a new record with autogenerated id",
"I am trying to insert a new record into a simple database table with MyBatis but I get a strange exception. Mybe it is related to that I am not using POJO.\n\nMyBatis version: 3.4.5\n\nMy table:\n\nCREATE TABLE IF NOT EXISTS image\n(\n id BIGINT PRIMARY KEY,\n content BYTEA\n) WITHOUT OIDS;\n\n\nMyBatis mapper:\n\n@Insert(\"INSERT INTO image (id, content) VALUES (#{id}, #{content})\")\n@SelectKey(statement = \"SELECT NEXTVAL('image_seq')\", keyProperty = \"id\", before = true, resultType = long.class)\nlong insertImage(byte[] content);\n\n\nThe way I am trying to use it:\n\nbyte[] fileContent = IOUtils.toByteArray(inputStream);\nlong id = imageDao.insertImage(fileContent);\n\n\nThe exception what I get:\n\njava.lang.ClassCastException: java.lang.Long cannot be cast to [B\n at org.apache.ibatis.type.ByteArrayTypeHandler.setNonNullParameter(ByteArrayTypeHandler.java:26)\n at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:53)\n at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:87)\n at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:93)\n at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:64)\n at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86)\n at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)\n at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)\n at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)\n at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)\n at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n...\n\n\nI do not want to create POJO class with getter/setter method for this one \"content\" param but I think this issue is related to missing POJO.\n\nWhat is the solution?\n\nEDIT\n\nI am trying to debug mybatis code and I have found \"[B\" in the parameterTypes:"
] | [
"java",
"mybatis",
"ibatis"
] |
[
"How do I reload a file in nano as root?",
"Motivation\n\nThe screen brightness setting in my DE (Cinnamon) does not allow for setting very low values. So I have a shortcut on my desktop to sudo nano /sys/class/backlight/intel_backlight/brightness. When I click the desktop icon, my terminal open, I need to enter my password and I can set the brightness value manually. I then save the file via Ctrl + o.\n\nHowever, if I (by mistake or otherwise) press the brightness key on my keyboard, the value will of course change. If I exit nano then the terminal will also close and I need to start over again.\n\nQuestion\n\nCan I reload the file (brightness) without exiting nano?"
] | [
"nano"
] |
[
"Best practice for nested packages/class on Android",
"Is there any best practice regarding whether or not nested packages and classes is a good idea?\n\nA) nested packages\ni.e. Is it a good idea to have \n\nutils\n XXX.java\n xxxx\n XXX.java\n XXX.java\nmodel\nview\n activity\n fragment\n dialog (dialogfragment)\n errors\n sth\n\n\nB) nested class\ni.e. Is it a good idea to have \n\nclass Const {\n class static HOST {\n public final static String STAGING = \"\";\n public final static String PRODUCTION = \"\";\n }\n class static Foo {\n }\n}"
] | [
"android",
"package"
] |
[
"Linq to entities. NullReferenceException",
"I use VS 2008 and ado.net EF. I have two tables:\n\nShifts(SH_Id, WorkshopId,TabNum)\nWorkshops(WH_ID, WH_Name)\n\n\nShifts linked to Workshops(WorkshopId -- WH_ID) I'm trying to write query:\n\nvar data = _Context.Shifts.Where(w => w.TabNum == 1).First();\nvar workshop = data.Workshops.WH_ID;\n\n\nIt returns NullReferenceException. \nBut following code returns WH_ID:\n\n var data2 = (from o in _Context.Shifts\n where o.TabNum == 1\n select new\n {\n wh_id = o.Workshops.WH_Id\n\n });\n\n var workshop = data2.First().Workshops.wh_id;\n\n\nWhy data.Workshops.WH_ID returns NullReferenceException?"
] | [
"c#",
"entity-framework",
"linq-to-entities"
] |
[
"LaTeX \\url{} in italics",
"Is there a simple way of getting a LaTeX url to display in italics, i.e. emph{\\url{http://www.stackoverflow.com}}? FYI I am also using \\urlstyle{same} right before, which keeps the style looking like the document default style, but I don't want to set my document default to italics."
] | [
"url",
"latex"
] |
[
"Why should we use character entities for symbols in HTML?",
"I accept some of the symbols, we have to use character entities. But what is the difference to use &#38; and & or &gt; and > and some of them which is available in keyboard.\n\nJust for knowledge purpose.\n\nThanks in Advance."
] | [
"html"
] |
[
"How to ignore sortDescriptor in NSFetchedResultsController",
"I'm using NSFetchedResultsController to retrieve data for a UITableView.\nbut problem is I have to use sortDescriptor with NSFetchedResultsController.\nI don't want to sort my data, I want to show data in the table as the order I have inserted them in the table.\n\nIs there any way to handle this task?"
] | [
"iphone",
"ios",
"nsfetchedresultscontroller",
"nssortdescriptor"
] |
[
"Upload PDF from Python as attachment to Salesforce Object",
"I am trying to upload a pdf generated in Python as an attachment to a salesforce object using the simple_salesforce Python package. I have tried several different ways to accomplish this, but have had no luck so far. Here is the code \n\nimport base64\nimport json\nfrom simple_salesforce import Salesforce\n\ninstance = ''\nsessionId = sf.session_id\n\ndef pdf_encode(pdf_filename):\n body = open(pdf_filename, 'rb') #open binary file in read mode \n body = body.read() \n body = base64.encodebytes(body)\n\nbody = pdf_encode('PDF_Report.pdf')\n\n\nresponse = requests.post('https://%s.salesforce.com/services/data/v29.0/sobjects/Attachment/' % instance,\n headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer %s' % sessionId },\n data = json.dumps({\n 'ParentId': parent_id,\n 'Name': 'test.txt',\n 'body': body\n })\n)\n\n\nI get this error. \n\nTypeError: Object of type bytes is not JSON serializable\n\nI have also tried to use \n\nbody = base64.encodebytes(body).decode('ascii') \n\nin my code, but I can't get that to work either. I get the error \n\nUnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)\n\nAny suggestions on how to upload a PDF in Python 3 into Salesforce as an attachment using simple_salesforce?"
] | [
"python",
"python-3.x",
"pdf",
"salesforce",
"simple-salesforce"
] |
[
"Ruby on Rails what does this hash output mean?",
"#<Hashie::Mash created_time=\"1366084479\" from=#<Hashie::Mash \nfull_name=\"alyssabri_\" id=\"24110592\" username=\"ally\"> id=\"4350706\" \ntext=\"Some Text\">\n\n\nWhat does this mean? I get it when I do this:\n\n <% (@arr).each do |media| %>\n <%= media.caption %>\n <% end %>\n\n\nI'm trying to get the text which is in caption?\n\nThanks"
] | [
"ruby-on-rails",
"ruby-on-rails-3",
"hash",
"hashmap"
] |
[
"SASS include variables in an @each loop",
"I have a SASS mixin set up to loop through a bank of colours and apply them to specific elements when the body has a specific data colour. This is all working fine but I'm curious to know if instead of using 'blue, green, red, purple, orange' if you can use variables as the colours too; '$blue, $green, $red' etc. which have varied hex values.\n\nAny suggestions?\n\nI have this currently...\n\n$blue: #003fb8;\n$green: #005f30;\n$red: #fe5053;\n$purple: #5f0d82;\n$orange: #ff6d00;\n\n@mixin coloured-elements($color) {\n a:hover, \n a.site-title,\n nav.main ul li.active a,\n .projects--layout .project h3 {\n color: $color;\n }\n}\n\n$colors_names: blue, green, red, purple, orange;\n$colors_variables: $blue, $green, $red, $purple, $orange;\n@each $color in $colors_variables {\n body[data-colour=\"#{$color}\"] {\n @include coloured-elements($color);\n }\n}\n\n\nWhich outputs the below... but how can I use the $colors_name as the data attribute and not the hex value?\n\nbody[data-colour=\"#003fb8\"] a:hover,\nbody[data-colour=\"#003fb8\"] a.site-title,\nbody[data-colour=\"#003fb8\"] nav.main ul li.active a,\nbody[data-colour=\"#003fb8\"] .projects--layout .project h3 {\n color: #003fb8;\n}\n\nbody[data-colour=\"#005f30\"] a:hover,\nbody[data-colour=\"#005f30\"] a.site-title,\nbody[data-colour=\"#005f30\"] nav.main ul li.active a,\nbody[data-colour=\"#005f30\"] .projects--layout .project h3 {\n color: #005f30;\n}\n\nbody[data-colour=\"#fe5053\"] a:hover,\nbody[data-colour=\"#fe5053\"] a.site-title,\nbody[data-colour=\"#fe5053\"] nav.main ul li.active a,\nbody[data-colour=\"#fe5053\"] .projects--layout .project h3 {\n color: #fe5053;\n}\n\nbody[data-colour=\"#5f0d82\"] a:hover,\nbody[data-colour=\"#5f0d82\"] a.site-title,\nbody[data-colour=\"#5f0d82\"] nav.main ul li.active a,\nbody[data-colour=\"#5f0d82\"] .projects--layout .project h3 {\n color: #5f0d82;\n}\n\nbody[data-colour=\"#ff6d00\"] a:hover,\nbody[data-colour=\"#ff6d00\"] a.site-title,\nbody[data-colour=\"#ff6d00\"] nav.main ul li.active a,\nbody[data-colour=\"#ff6d00\"] .projects--layout .project h3 {\n color: #ff6d00;\n}"
] | [
"css",
"sass"
] |
[
"Unable to see container logs from my C++ App when using client.containers.run of docker-py",
"In python with docker-py, I am running two docker containers:\n\neclipse-mosquitto\nan ubuntu:bionic based image where my C++ App is launched with ENTRYPOINT ["/directory/myApp"]\n\nI use the following docker-py API:\ncontainer = client.containers.run(imageName, detach=True, name=containerName, ports = ports, volumes = volumes)\n\n\nWhen it is the eclipse-mosquitto container, if I call container.logs() I got the following logs:\n\n1606303570: mosquitto version 1.6.12 starting\n1606303570: Config loaded from /mosquitto/config/mosquitto.conf.\n1606303570: Opening ipv4 listen socket on port 1883.\n1606303570: Opening ipv6 listen socket on port 1883.\n1606303570: mosquitto version 1.6.12 running\n\n\nWhen it is my custom container, if I call container.logs() I got nothing and furthermore logs from Docker Desktop Dashboard is empty too:\n\n\nThis seems to be kind of similar to this issue https://github.com/docker/docker-py/issues/2697\nAfter several tests this is my findings:\n\nIf I run my custom container from command line, logs from Docker Desktop Dashboard are there\nIf I run my custom container from '''subprocess.call(docker_cmd)''', logs from Docker Desktop Dashboard are there\nIf I run my custom container from '''client.containers.run''', logs from Docker Desktop Dashboard are empty\n\nThe same tests with eclipse-mosquitto gives me always a Docker Desktop Dashboard full of logs.\nDoes anybody have an idea how to get my logs from my custom container using client.containers.run ?"
] | [
"python",
"c++",
"docker",
"stdout",
"dockerpy"
] |
[
"How do I link a dockerized python script to a mysql docker container to load data on the same host?",
"I have two docker containers running in an Ubuntu 16.04 machine, one docker container has a mysql sever running, the other container holds a dockerized python script set to run a cron job every minute that loads data into mysql. How can I connect the two to load data through the python script into the mysql container? I have an error showing up:\nHere are my relevant commands:\n\nMYSQL container runs without issue:\n\ndocker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=yourPassword --name icarus -d mysql_docker_image\n\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\n927e50ca0c7d mysql_docker_image \"docker-entrypoint.s…\" About an hour ago Up About an hour 0.0.0.0:3306->3306/tcp, 33060/tcp icarus\n\n\nSecond container holds cron and python script:\n\n #build the container without issue \n sudo docker run -t -i -d docker-cron\n\n #exec into it to check logs\n sudo docker exec -i -t container_id /bin/bash\n\n #check logs\n root@b149b5e7306d:/# cat /var/log/cron.log\n\n\nError:\n\nhave the following error showing up, which I believe has to do with wrong host address:\n\nCaught this error: OperationalError('(pymysql.err.OperationalError) (2003, \"Can\\'t connect to MySQL server on \\'localhost\\' ([Errno 99] Cannot assign requested address)\")',)\n\n\nPython Script:\n\nfrom traffic.data import opensky\nfrom sqlalchemy import create_engine\n#from sqlalchemy_utils import database_exists, create_database\nimport sqlalchemy\nimport gc\n\n\n#connection and host information\nhost = 'localhost'\ndb='icarus'\nengine = create_engine('mysql+pymysql://root:password@'+ host+ ':3306/'+ db) #create engine connection\nversion= sys.version_info[0]\n\n#functions to upload data\ndef upload(df,table_name):\n df.to_sql(table_name,con=engine,index=False,if_exists='append')\n engine.dispose()\n print('SUCCESSFULLY LOADED DATA INTO STAGING...')\n\n#pull data drom api\nsv = opensky.api_states()\nfinal_df = sv.data\n#quick column clean up \nprint(final_df.head())\nfinal_df=final_df.rename(columns = {'timestamp':'time_stamp'})\n\n\n#insert data to staging\ntry:\n upload(final_df, 'flights_stg')\nexcept Exception as error:\n print('Caught this error: ' + repr(error))\ndel(final_df)\ngc.collect()\n\n\nI'm assuming the error is the use of 'localhost' as my address? How would i go about resolving something like this?\n\nMore information:\n\nMYSQL Dockerfile:\n\nFROM mysql\nCOPY init.sql /docker-entrypoint-initdb.d\n\n\nPython Dockerfile:\n\nFROM ubuntu:latest\n\nWORKDIR /usr/src/app\n\n#apt-get install -y build-essential -y python python-dev python-pip python-virtualenv libmysqlclient-dev curl&& \\\n\nRUN \\\n apt-get update && \\\n apt-get install -y build-essential -y git -y python3.6 python3-pip libproj-dev proj-data proj-bin libgeos++-dev libmysqlclient-dev python-mysqldb curl&& \\\n rm -rf /var/lib/apt/lists/*\n\nCOPY requirements.txt ./\nRUN pip3 install --upgrade pip && \\\n pip3 install --no-cache-dir -r requirements.txt\n\nRUN pip3 install --upgrade setuptools\nRUN pip3 install git+https://github.com/xoolive/traffic\n\nCOPY . .\n\n# Install cron\nRUN apt-get update\nRUN apt-get install cron\n\n# Add crontab file in the cron directory\nADD crontab /etc/cron.d/simple-cron\n\n# Add shell script and grant execution rights\nADD script.sh /script.sh\nRUN chmod +x /script.sh\n\n# Give execution rights on the cron job\nRUN chmod 0644 /etc/cron.d/simple-cron\n\n# Create the log file to be able to run tail\nRUN touch /var/log/cron.log\n\n# Run the command on container startup\nCMD cron && tail -f /var/log/cron.log"
] | [
"python",
"mysql",
"docker",
"docker-build"
] |
[
"Multiple IndexDBs in WinJS or filtering?",
"I am using WinJS and IndexDB to support a metro app I'm writing. I need to maintain 2 lists of information. I could use the same DB and store the same object for both lists if I could filter on a field but I can't find a method to support filtering from an IndexDB.\n\nAs that hasn't worked then I thought I'd just use 2 IndexDB's. My metro app is just throwing an exception with no other details that an error 2.\n\nCan I use multiple IndexDB in one page of a Metro app?\n\nIs filtering possible with IndexDBs?\n\nEven the results from the IndexDB seem to be hidden as I can't even manually filter after I've got all the results."
] | [
"indexeddb",
"winjs"
] |
[
"Working with date time objects in rails model",
"I have two columns in my model, start_time and end_time. \n\nThe view to generate this model has a cool calendar for the date and a nifty time selector for the time, but I cant figure out how to make this more elegant. I want to be able to store both the date and time from my form in the database without all this mess, Rails has to have a better way, right?\n\nI came up with this solution and every time I look at it I get nauseous. Any ideas on how to make this prettier?\n\nattr_accessor :start_time_time, :end_time_time, :start_time_date, :end_time_date\n\ndef start_time_date\n self.start_time.try(:strftime,DATE_FORMAT)\nend\n\ndef end_time_date\n self.end_time.try(:strftime, DATE_FORMAT)\nend\n\ndef start_time_time\n self.start_time.try(:strftime, TIME_FORMAT)\nend\n\ndef end_time_time\n self.end_time.try(:strftime, TIME_FORMAT)\nend\n\ndef start_time_date=(date)\n begin\n self.start_time = nil\n self.start_time = Time.zone.parse(\"#{Date.strptime(date, DATE_FORMAT).to_formatted_s(:db)} #{start_time_time}\") unless date.blank?\n rescue\n errors.add(:start_time_date)\n end\nend\n\ndef end_time_date=(date)\n begin\n self.end_time = nil\n self.end_time = Time.zone.parse(\"#{Date.strptime(date, DATE_FORMAT).to_formatted_s(:db)} #{end_time_time}\") unless date.blank?\n rescue\n errors.add(:end_time_date)\n end\nend\n\ndef start_time_time=(time)\n begin\n self.start_time = Time.zone.parse(\"#{Date.strptime(start_time_date, DATE_FORMAT).to_formatted_s(:db)} #{time}\") unless start_time_date.blank? or time.blank?\n rescue\n errors.add(:start_time_time)\n end\nend\n\ndef end_time_time=(time)\n begin \n self.end_time = Time.zone.parse(\"#{Date.strptime(end_time_date, DATE_FORMAT).to_formatted_s(:db)} #{time}\") unless end_time_date.blank? or time.blank?\n rescue\n errors.add(:end_time_time)\n end\nend"
] | [
"ruby-on-rails",
"datetime"
] |
[
"How is the string representation of a MongoDB ObjectID generated? (In the shell)",
"In the MongoDB shell, if I type someDoc._id, Mongo replies with something like ObjectId(4f6b83af44c75956279e7777). How is that string generated from the ObjectId bytes?\n\nLinks to the javascript source for this are welcome, as are links to the source for other drivers."
] | [
"string",
"mongodb"
] |
[
"Data appears when printed but doesn't show up in dataframe",
"#! /usr/lib/python3\n\nimport yfinance as yf\nimport pandas as pd\n\npd.set_option('display.max_rows', None, 'display.max_columns', None)\n\n# Request stock data from yfinance\nticker = yf.Ticker('AAPL')\n\n# Get all option expiration dates in the form of a list\nxdates = ticker.options\n\n# Go through the list of expiry dates one by one\nfor xdate in xdates:\n # Get option chain info for that xdate\n option = ticker.option_chain(xdate)\n # print out this value, get back 15 columns and 63 rows of information\n print(option)\n # Put that same data in dataframe\n df = pd.DataFrame(data = option)\n # Show dataframe\n print(df)\n \n\nExpected: df will show a DataFrame containing the same information that is shown when running print(option), i.e. 15 columns and 63 rows of data, or at least some part of them\nActual:\n\ndf shows only two columns with no information\ndf.shape results in (2,1)\nprint(df.columns.tolist()) results in [0]\n\nSince the desired info appears when you print it, I'm confused as to why it's not appearing in the dataframe."
] | [
"python",
"pandas",
"dataframe",
"yfinance"
] |
[
"R-Excel VBA: how to extract values returned by GetArrayToVBA?",
"I'm trying to write an R-Excel vba addin and am having trouble using GetArrayToVBA. \n\nExample:\n\nRInterface.StartRServer\nRInterface.RRun \"mytst<-4\"\nDim tstVar As Variant, tst As Double\ntstVar = RInterface.GetArrayToVBA(\"mytst\")\ntst = CDbl(testVar)\nMsgBox \"count = \" & CStr(tst)\nRInterface.StopRServer\n\n\nResults in messagebox showing count = 0. I was expecting count = 4."
] | [
"r",
"excel",
"vba"
] |
[
"XElement.Element failed to select the correct child node",
"I have the following XML:\n\n<inventory>\n <item>\n <stocktype>\n <type>Basket</type>\n <id>1</id>\n <parentId>0</parentId>\n </stocktype>\n <cost>10.00</cost>\n <quantity>1</quantity>\n <name>Golden Wick Basket</name>\n <note>\n <code>remark</code>\n <content>Be extra careful about the golden paint....</content> \n </note> \n <note>\n <code>usage</code>\n <content>DeluxFruitBasket</content> \n </note> \n </item>\n <item>\n <stocktype>\n <type>Fruit</type>\n <id>2</id>\n <parentId>1</parentId>\n </stocktype>\n <cost>6.00</cost>\n <quantity>10</quantity>\n <name>Apple</name>\n <note>\n <code>remark</code>\n <content>Please pick red apples only</content> \n </note>\n <note>\n <code>usage</code>\n <content>DeluxFruitBasket</content> \n </note>\n </item>\n <item>\n <stocktype>\n <type>Fruit</type>\n <id>3</id>\n <parentId>1</parentId>\n </stocktype>\n <cost>4.00</cost>\n <quantity>10</quantity>\n <name>Orange</name>\n <note>\n <code>remark</code>\n <content></content> \n </note>\n <note>\n <code>usage</code>\n <content>DeluxFruitBasket</content> \n </note>\n </item>\n <item>\n <stocktype>\n <type>Fruit</type>\n <id>4</id>\n <parentId>1</parentId>\n </stocktype>\n <cost>12.00</cost>\n <quantity>1</quantity>\n <name>Pineapple</name>\n </item>\n</inventory>\n\n\nI have tried this LINQ to XML query but it always evaluated to false:\n\nIf(_rootElement.Descendants(\"item\").Any(Function (x) x.Element(\"stocktype\").Element(\"type\").Value = \"Fruit\" And x.Element(\"note\").Element(\"content\").Value = \"DeluxFruitBasket\")) \n\n\nand I have used linqpad to check and replace Any() with Where() and the query returned null. \n\nQuestion:\n\n\nWhy is the query returned null?\nI also discovered that x.Element(\"note\").Element(\"content\") will always select the first \"note\" element from the two, why? \nI can not change the structure of the XML as it is a standard in my company, how can I rewrite the query to archive my intent?\n\n\nThank you very much."
] | [
"xml",
"vb.net",
"linq"
] |
[
"Sql to select count using dates",
"I am using SQL Sever database, I am writing a query to select count of each option's RecordDate is found in surveys start and end date. If same any option found more than one time between the start and date, even then should be considered once.\n\ntblOptions\n----------------------------------\nOption, RecardDate\n---------------------------------- \no1 , 2016-01-01 \no1 , 2016-01-03 \no1 , 2016-05-08 \no2 , 2016-01-04 \no2 , 2016-01-01 \no2 , 2016-01-23 \no2 , 2016-05-15 \no3 , 2016-05-01 \no3 , 2016-05-02 \no3 , 2016-05-03 \no3 , 2016-04-04 \no3 , 2016-08-04\n\n\ntblSurveys\n----------------------------------\nSurey, StartDate, EndDate\n----------------------------------\ns1 , 2016-01-01 , 2016-01-15\ns2 , 2016-01-16 , 2016-01-31\ns3 , 2016-05-01 , 2016-05-31\n\n\nOUTPUT\n\nOption, Count \n-------------------\no1, 2 (Exp.:o1's recorddates found between two surveys star and end dates) \no2, 3 (Exp.:o2's recorddates found between three surveys star and end dates) \no3, 1 (Exp.:o3's recorddates found between one surveys star and end dates)"
] | [
"sql",
"sql-server"
] |
[
"ASP.Net c#, Repeater Itemcommand. I don't delete data",
"If Click button in repeater control, delete data in database but not working. I use Visiual Studio 2013. My project ASP.Net Website and I am useing MasterPage and My Database connectionstring command in web.config.\n\nThis is default.aspx.cs file\n\nstatic string yol = ConfigurationManager.ConnectionStrings[\"cs\"].ConnectionString;\nSqlConnection baglanti = new SqlConnection();\nSqlCommand sorgu = new SqlCommand();\nSqlDataReader oku;\nprotected void Page_Load(object sender, EventArgs e)\n{\n baglanti = new SqlConnection(yol);\n sorgu.Connection = baglanti;\n baglanti.Open();\n if (!Page.IsPostBack)\n {\n sorgu.CommandText = \"select * from blog\";\n oku = sorgu.ExecuteReader();\n haber.DataSource = oku;\n haber.DataBind();\n oku.Close();\n }\n baglanti.Close(); \n}\n\nprotected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)\n{\n baglanti.Open();\n\n if (e.CommandName == \"sil\")\n {\n int id = Convert.ToInt32(e.CommandArgument);\n sorgu.CommandText = \"delete from blog where id=\" + id;\n sorgu.ExecuteNonQuery();\n haber.DataBind();\n }\n baglanti.Close();\n}\n\n\nDefault.aspx file\n\n<form runat=\"server\">\n <asp:Repeater ID=\"haber\" runat=\"server\" OnItemCommand=\"Repeater1_ItemCommand\">\n <ItemTemplate>\n <li class=\"mix nature\" data-name=\"Woodstump\">\n <a href=\"?<%# Eval(\"Id\") %>\"><img src=\"../img/work1.jpg\" alt=\"\" width=\"150px\" height=\"150px\"></a>\n <h4> <%# Eval(\"baslik\") %> <br />\n <asp:Button ID=\"Button1\" Text=\"Button\" runat=\"server\" CommandName=\"sil\" CommandArgument=\"<%# Eval(\"Id\") %>\" />\n </h4>\n </li>\n </ItemTemplate>\n </asp:Repeater>\n </form>\n\n\nEdit: If i use this command CommandArgument=\"<%# Eval(\"Id\") %>\", Exeption is \"The server tag is not well formed\"\n if i use this command CommandArgument='<%# Eval(\"Id\") %>', Not take exeption but not work(not delete data in database)."
] | [
"c#",
"asp.net",
"repeater"
] |
[
"WP8 - How to change MapCartographicMode by selected item",
"I have got this listbox:\n\n<ListBox x:Name=\"layerMenu\" SelectionChanged=\"layerMenu_SelectionChanged\" >\n <ListBoxItem Content=\"Road\" HorizontalAlignment=\"Center\"/>\n <ListBoxItem Content=\"Aerial\" HorizontalAlignment=\"Center\" />\n <ListBoxItem Content=\"Hybrid\" HorizontalAlignment=\"Center\" />\n <ListBoxItem Content=\"Terrain\" HorizontalAlignment=\"Center\" />\n</ListBox>\n\n\nand I would like to change the carthographic mode of my map. Following does not work.\n\nprivate void layerMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)\n{ \n MapCartographicMode selected = (MapCartographicMode)((sender as ListBox).SelectedItem);\n MyMap.CartographicMode = selected;\n}\n\n\nThis error occures:\n\nSystem.InvalidCastException: Specified cast is not valid.\n\n\nI can solve that by using switch(layerMenu.SelectedIndex) but I prefer this shorter way if it is possible.\nThank you for any help."
] | [
"c#",
"xaml",
"windows-phone-8"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.