compare_oracle / oraclechunk52.json
xPXXX's picture
Upload 10 files
02d084c
Raw
History Blame Contribute Delete
56.8 kB
Invalid JSON:Unexpected non-whitespace character after JSONat line 2, column 1
{"QuestionId": 38155065, "AnswerCount": 5, "Tags": "<mysql><sql>", "CreationDate": "2016-07-01T23:38:37.807", "AcceptedAnswerId": null, "Title": "Get last item in each group MySql", "Body": "<p>In the first table I have orders. In the second - messages which send to these orders. I need to get date and status from the last message (or NULL if messages didn`t send yet) for each orders where has active=1. The tables connected by composite key - \"order_id + offer\".</p>\n\n<p>\"orders\" table:</p>\n\n<pre><code>+----------+----------+--------+----------+\n| order_id | offer | active | timezone |\n+----------+----------+--------+----------+\n| 6 | kopiya | 1 | 0 |\n| 6 | kopiya-3 | 1 | 0 |\n| 10 | kopiya | 1 | 180 |\n| 23 | kopiya-2 | 1 | 0 |\n| 27 | kopiya-2 | 0 | 0 |\n+----------+----------+--------+----------+\n</code></pre>\n\n<p>\"sms\" table:</p>\n\n<pre><code>+------+----------+----------+------+--------+---------------------+\n| key_ | order_id | offer | type | status | date |\n+------+----------+----------+------+--------+---------------------+\n| 1 | 6 | kopiya | text | 1 | 2016-06-20 00:00:00 |\n| 2 | 6 | kopiya-3 | text | 0 | 2016-06-21 00:00:00 |\n| 3 | 10 | kopiya | text | 0 | 2016-06-27 00:00:00 |\n| 4 | 27 | kopiya-2 | text | 1 | 2016-06-21 00:00:00 |\n| 6 | 6 | kopiya-3 | text | 1 | 2016-06-23 00:00:00 |\n+------+----------+----------+------+--------+---------------------+\n</code></pre>\n\n<p>The result will be:</p>\n\n<pre><code>+----------+----------+---------------------+--------+\n| order_id | offer | last_date | status |\n+----------+----------+---------------------+--------+\n| 6 | kopiya | 2016-06-20 00:00:00 | 1 |\n| 6 | kopiya-3 | 2016-06-23 00:00:00 | 1 |\n| 10 | kopiya | 2016-06-27 00:00:00 | 0 |\n| 23 | kopiya-2 | NULL | NULL |\n+----------+----------+---------------------+--------+\n</code></pre>\n\n<p>This query works not correctly:</p>\n\n<pre><code>SELECT o.order_id, o.offer, max(date) as last_date, status\nFROM orders AS o\nLEFT JOIN sms AS s\nON o.order_id=s.order_id AND o.offer=s.offer\nWHERE `active` = 1\nGROUP BY o.order_id, o.offer;\n</code></pre>\n\n<p>It show:</p>\n\n<pre><code>+----------+----------+---------------------+--------+\n| order_id | offer | last_date | status |\n+----------+----------+---------------------+--------+\n| 6 | kopiya | 2016-06-20 00:00:00 | 1 |\n| 6 | kopiya-3 | 2016-06-23 00:00:00 | 0 |\n| 10 | kopiya | 2016-06-27 00:00:00 | 0 |\n| 23 | kopiya-2 | NULL | NULL |\n+----------+----------+---------------------+--------+\n</code></pre>\n\n<p>For key \"6 kopiya-3\" it return status=0 but expected 1, because it get this value from the first row instead row with max date. How can I fix this?</p>\n", "Lable": "No"}
{"QuestionId": 38189400, "AnswerCount": 3, "Tags": "<git>", "CreationDate": "2016-07-04T16:57:30.570", "AcceptedAnswerId": "38189631", "Title": "Git - What's the branch I'm merging from?", "Body": "<p>How to get name of the branch I'm merging from? <strong>git status</strong> tells me only that I'm merging, but I forgot what branch exactly I'm merging... </p>\n\n<pre><code>On branch master\nYour branch is up-to-date with 'origin/master'.\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n</code></pre>\n", "Lable": "No"}
{"QuestionId": 38211862, "AnswerCount": 1, "Tags": "<python><machine-learning><neural-network><tensorflow><deep-learning>", "CreationDate": "2016-07-05T20:08:04.813", "AcceptedAnswerId": null, "Title": "Udacity Deep Learning Convolutional Neural Networks- TensorFlow", "Body": "<p>I have been working on Udacity's course on deep learning- which I must add is great! I am very happy with the assignments so far. But there are two lines of code, that I am not quite understanding.</p>\n\n<pre><code>batch_size = 20\npatch_size = 5\ndepth = 16\nnum_hidden = 64\n\ngraph = tf.Graph()\n\nwith graph.as_default():\n\n # Input data.\n tf_train_dataset = tf.placeholder(\n tf.float32, shape=(batch_size, image_size, image_size, num_channels))\n tf_train_labels = tf.placeholder(tf.float32, shape=(batch_size, num_labels))\n tf_valid_dataset = tf.constant(valid_dataset)\n tf_test_dataset = tf.constant(test_dataset)\n\n # Variables.\n layer1_weights = tf.Variable(tf.truncated_normal(\n [patch_size, patch_size, num_channels, depth], stddev=0.1))\n layer1_biases = tf.Variable(tf.zeros([depth]))\n layer2_weights = tf.Variable(tf.truncated_normal(\n [patch_size, patch_size, depth, depth], stddev=0.1))\n ***********************************************************\n layer2_biases = tf.Variable(tf.constant(1.0, shape=[depth]))\n ***********************************************************\n layer3_weights = tf.Variable(tf.truncated_normal(\n [image_size // 4 * image_size // 4 * depth, num_hidden], stddev=0.1))\n ***********************************************************\n layer3_biases = tf.Variable(tf.constant(1.0, shape=[num_hidden]))\n layer4_weights = tf.Variable(tf.truncated_normal(\n [num_hidden, num_labels], stddev=0.1))\n layer4_biases = tf.Variable(tf.constant(1.0, shape=[num_labels]))\n\n # Model.\n def model(data):\n conv = tf.nn.conv2d(data, layer1_weights, [1, 2, 2, 1], padding='SAME')\n hidden = tf.nn.relu(conv + layer1_biases)\n conv = tf.nn.conv2d(hidden, layer2_weights, [1, 2, 2, 1], padding='SAME')\n hidden = tf.nn.relu(conv + layer2_biases)\n shape = hidden.get_shape().as_list()\n reshape = tf.reshape(hidden, [shape[0], shape[1] * shape[2] * shape[3]])\n hidden = tf.nn.relu(tf.matmul(reshape, layer3_weights) + layer3_biases)\n return tf.matmul(hidden, layer4_weights) + layer4_biases\n\n # Training computation.\n logits = model(tf_train_dataset)\n loss = tf.reduce_mean(\n tf.nn.softmax_cross_entropy_with_logits(logits, tf_train_labels))\n\n # Optimizer.\n optimizer = tf.train.GradientDescentOptimizer(0.05).minimize(loss)\n\n # Predictions for the training, validation, and test data.\n train_prediction = tf.nn.softmax(logits)\n valid_prediction = tf.nn.softmax(model(tf_valid_dataset))\n test_prediction = tf.nn.softmax(model(tf_test_dataset))\n</code></pre>\n\n<p>I have put asterisks around the parts of the code that I do not quite understand. First, I am not quite sure why the first set of biases between the input and convolutional layer are zeros, and then in the second layer they are then all ones.</p>\n\n<p>Next, I do not understand the following line of code:</p>\n\n<pre><code>layer3_weights = tf.Variable(tf.truncated_normal(\n [image_size // 4 * image_size // 4 * depth, num_hidden], stddev=0.1))\n</code></pre>\n\n<p>Specifically, I don't get why we have used <code>image_size // 4 * image_size // 4 * depth</code>, and I especially don't understand why we have used 4.</p>\n\n<p>If you need more information then please let me know. This is taken from Udacity's deep learning course, where the notebooks are able to be cloned from GitHub.</p>\n\n<p>Many thanks :)</p>\n", "Lable": "D"}
{"QuestionId": 38225770, "AnswerCount": 3, "Tags": "<python><tensorflow><deep-learning>", "CreationDate": "2016-07-06T13:52:03.410", "AcceptedAnswerId": "38226653", "Title": "how to read batches in one hdf5 data file for training?", "Body": "<p>I have a hdf5 training dataset with size <code>(21760, 1, 33, 33)</code>. <code>21760</code> is the whole number of training samples. I want to use the mini-batch training data with the size <code>128</code> to train the network. </p>\n\n<p>I want to ask:</p>\n\n<p>How to feed <code>128</code> mini-batch training data from the whole dataset with tensorflow each time?</p>\n", "Lable": "D"}
{"QuestionId": 38238540, "AnswerCount": 1, "Tags": "<java><csv><hashmap>", "CreationDate": "2016-07-07T06:09:12.110", "AcceptedAnswerId": "38239653", "Title": "Comparing Keys in a Hashmap", "Body": "<p>I have a test.csv file that is formatted as:</p>\n\n<pre><code>Home,Owner,Lat,Long\n5th Street,John,5.6765,-6.56464564\n7th Street,Bob,7.75,-4.4534564\n9th Street,Kyle,4.64,-9.566467364\n10th Street,Jim,14.234,-2.5667564\n</code></pre>\n\n<p>I have a hashmap that reads a file that contains the same header contents such as the CSV, just a different format, with no accompanying data.</p>\n\n<p>In example:</p>\n\n<pre><code>Map&lt;Integer, String&gt; container = new HashMap&lt;&gt;();\n</code></pre>\n\n<p>where, </p>\n\n<p>Key, Value</p>\n\n<pre><code>[0][NULL]\n[1][Owner]\n[2][Lat]\n[3][NULL]\n</code></pre>\n\n<p>I have also created a second hash map that:</p>\n\n<pre><code>BufferedReader reader = new BufferedReader (new FileReader(\"test.csv\"));\nCSVParser parser = new CSVParser(reader, CSVFormat.DEFAULT);\nBoolean headerParsed = false;\nCSVRecord headerRecord = null;\nint i;\nMap&lt;String,String&gt; value = new HashMap&lt;&gt;();\nfor (final CSVRecord record : parser) {\n if (!headerParsed = false) {\n headerRecord = record;\n headerParsed = true;\n }\n for (i =0; i&lt; record.size(); i++) {\n value.put (headerRecord.get(0), record.get(0));\n }\n}\n</code></pre>\n\n<p>I want to read and compare the hashmap, if the container map has a value that is in the value map, then I put that value in to a corresponding object. </p>\n\n<p>example object</p>\n\n<pre><code>public DataSet (//args) {\n this.home\n this.owner\n this.lat\n this.longitude\n}\n</code></pre>\n\n<p>I want to create a function where the data is set inside the object when the hashmaps are compared and when a value map key is equal to a contain map key, and the value is placed is set into the object. Something really simply that is efficient at handling the setting as well.</p>\n\n<p>Please note: I made the CSV header and the rows finite, in real life, the CSV could have x number of fields(Home,Owner,Lat,Long,houseType,houseColor, ect..), and a n number of values associated to those fields</p>\n", "Lable": "No"}
{"QuestionId": 38278409, "AnswerCount": 1, "Tags": "<python-2.7><tensorflow><deep-learning><raspberry-pi3>", "CreationDate": "2016-07-09T04:41:46.520", "AcceptedAnswerId": "38287148", "Title": "How to classify image in real time using tensorflow?", "Body": "<p>I'm trying to use raspberry pi camera to capture image and classify the image in real time into three classes. What I did is using the code below. It can predict in the first iteration. The problem is that it shows me ran out of memory after the second iteration. Is there anyway to fix this?</p>\n\n<pre><code>import numpy as np\nimport tensorflow as tf\nimport argparse\nimport os\nimport sys\n\ndef create_graph(model_file):\n \"\"\"Creates a graph from saved GraphDef file and returns a saver.\"\"\"\n # Creates graph from saved graph_def.pb.\n with tf.gfile.FastGFile(model_file, 'rb') as f:\n graph_def = tf.GraphDef()\n graph_def.ParseFromString(f.read())\n _ = tf.import_graph_def(graph_def, name='')\n\n\ndef run_inference(images, out_file, labels, model_file, k=5):\n\n # Creates graph from saved GraphDef.\n create_graph(model_file)\n\n if out_file:\n out_file = open(out_file, 'wb', 1)\n\n with tf.Session() as sess:\n softmax_tensor = sess.graph.get_tensor_by_name('final_result:0')\n for img in images:\n if not tf.gfile.Exists(img):\n tf.logging.fatal('File does not exist %s', img)\n continue\n image_data = tf.gfile.FastGFile(img, 'rb').read()\n\n\n predictions = sess.run(softmax_tensor,\n {'DecodeJpeg/contents:0': image_data})\n predictions = np.squeeze(predictions)\n top_k = predictions.argsort()[-k:][::-1] # Getting top k predictions\n\n vals = []\n for node_id in top_k:\n human_string = labels[node_id]\n score = predictions[node_id]\n vals.append('%s=%.5f' % (human_string, score))\n rec = \"%s\\t %s\" % (img, \", \".join(vals))\n if out_file:\n out_file.write(rec)\n out_file.write(\"\\n\")\n else:\n print(rec) \n if out_file:\n print(\"Output stored to a file\")\n out_file.close()\n\nif __name__ == '__main__':\n parser = argparse.ArgumentParser(description='Classify Image(s)')\n parser.add_argument('-i','--in', help='Input Image file ')\n parser.add_argument('-li','--list', help='List File having input image paths')\n parser.add_argument('-o','--out', help='Output file for storing the content')\n parser.add_argument('-m','--model', help='model file path (protobuf)', required=True)\n parser.add_argument('-l','--labels', help='labels text file', required=True)\n parser.add_argument('-r','--root', help='path to root directory of input data')\n args = vars(parser.parse_args())\n # Read input\n if not args['in'] and not args['list']:\n print(\"Either -in or -list option is required.\")\n sys.exit(1)\n if args['in']:\n images = [args['in']]\n else: # list must be given\n with open(args['list']) as ff:\n images = filter(lambda x: x, map(lambda y: y.strip(), ff.readlines()))\n\n # if a separate root directory given then make a new path\n if args['root']:\n print(\"Input data from : %s\" % args['root'])\n images = map(lambda p: os.path.join(args['root'], p), images)\n\n with open(args['labels'], 'rb') as f:\n labels = [str(w).replace(\"\\n\", \"\") for w in f.readlines()]\n\n while True:\n imagename='/home/pi/Desktop/camerasnap.jpg'\n images=raspi.capture(imagename)\n run_inference(images=images, out_file=args['out'], labels=labels, model_file=args['model'])\n</code></pre>\n", "Lable": "D"}
{"QuestionId": 38303348, "AnswerCount": 2, "Tags": "<machine-learning><neural-network><artificial-intelligence><tensorflow><conv-neural-network>", "CreationDate": "2016-07-11T09:21:34.780", "AcceptedAnswerId": null, "Title": "What is the difference between the train loss and train error?", "Body": "<p>A professor of mine gave me a small script that he uses to visualize the evolution of his neural net after every epoch of learning. This is a plot of 3 values: train loss, train error and test error.</p>\n\n<p>What is the difference between the first two?</p>\n", "Lable": "D"}
{"QuestionId": 38351456, "AnswerCount": 4, "Tags": "<c#><wpf><unity3d>", "CreationDate": "2016-07-13T12:14:19.380", "AcceptedAnswerId": "38351635", "Title": "Simple game development with WPF or Unity", "Body": "<p>WPF provides some amazing features to work with animations. I was wondering if it would be fit for the development of simple games like <a href=\"http://www.istrolid.com/\" rel=\"nofollow\">Istrolid</a>. I believe WPF can replicate almost (if not all) of the animation in Istrolid. I am good with WPF, but I am yet to start with Unity.</p>\n\n<p>Is WPF better in my case or is it worth investing time in learning Unity for the development of such simple games.</p>\n", "Lable": "No"}
{"QuestionId": 38352398, "AnswerCount": 1, "Tags": "<python><django>", "CreationDate": "2016-07-13T12:55:37.607", "AcceptedAnswerId": "38352480", "Title": "Checking user type using hasattr()", "Body": "<p>Some of my users are students. When a user creates a student profile the StudentProfile class is instantiated:</p>\n\n<pre><code>class StudentProfile(models.Model):\n user = models.OneToOneField(settings.AUTH_USER_MODEL, primary_key=True)\n \u2026\n</code></pre>\n\n<p>How can I check if a user is a student?</p>\n\n<pre><code>hasattr(request.user, 'StudentProfile')\n</code></pre>\n\n<p>returns False even when the logged-in user has an associated StudentProfile.</p>\n", "Lable": "No"}
{"QuestionId": 38377096, "AnswerCount": 1, "Tags": "<ios><uicollectionview><uicollectionviewlayout>", "CreationDate": "2016-07-14T14:35:56.553", "AcceptedAnswerId": "38380754", "Title": "iOS Swift UICollectionViewCustomLayout scrollDirection", "Body": "<p>i'm trying to change UIColloectionViewCustomLayout scrollDicretion to Horizontal. I have tried to :</p>\n\n<pre><code>let layout = CollectionViewLayout()\n layout.scrollDirection = .Horizontal\n self.collectionView.collectionViewLayout = layout\n</code></pre>\n\n<p>I need get this results</p>\n\n<pre><code>[1][4][7]\n[2][5][8]\n[3][6][9]\n</code></pre>\n\n<p>Now i have this </p>\n\n<pre><code>[1][2][3]\n[4][5][6]\n[7][6][9]\n</code></pre>\n", "Lable": "No"}
{"QuestionId": 38416785, "AnswerCount": 1, "Tags": "<android><memory-management><out-of-memory>", "CreationDate": "2016-07-17T00:15:36.483", "AcceptedAnswerId": null, "Title": "Load drawables efficiently not using much memory", "Body": "<p>In my application I have a scrolling menu and I use this function to full menu items. But most of the time I am getting out of memory error. I don't get error in my emulator. But my device fails all the time.\nI tried </p>\n\n<pre><code> android:hardwareAccelerated=\"false\"\n android:largeHeap=\"true\"\n</code></pre>\n\n<p>and reduced the images size too. But device says that it takes too much of memory. I want my app to be faster loading and memory efficient. I am still a starter in android. I saw some articles about loading images efficiently. But I didn't understand. Can anyone help me with some sample code?</p>\n\n<pre><code>public void RefreshMenuItems(int category) {\n //Create menu scroller\n LinearLayout.LayoutParams card_lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT);\n card_lp.setMargins(dp(5), 0, dp(5), 0);\n\n LinearLayout.LayoutParams image_lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, 0);\n image_lp.setMargins(dp(40), dp(5), dp(40), dp(5));\n image_lp.weight = 0.5f;\n\n LinearLayout.LayoutParams desc_lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0);\n desc_lp.weight = 0.32f;\n\n LinearLayout.LayoutParams title_lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0);\n title_lp.weight = 0.08f;\n\n RelativeLayout.LayoutParams price_rp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);\n price_rp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);\n\n RelativeLayout.LayoutParams buy_rp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);\n buy_rp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);\n\n LinearLayout.LayoutParams bottom_lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0);\n bottom_lp.weight = 0.1f;\n\n //fill menu\n for (int i = 0; i &lt; item_title.length; i++) {\n final int currenti = i;\n\n if ((item_category[i] == category) || category == 0) {\n TextView title = new TextView(this);\n title.setText(item_title[currenti]);\n title.setGravity(Gravity.CENTER);\n title.setTextColor(0xff212121);\n title.setPadding(dp(10), dp(0), dp(10), dp(0));\n title.setTypeface(null, Typeface.BOLD);\n title.setLayoutParams(title_lp);\n title.setBackgroundResource(R.drawable.borderradius2);\n title.setTextSize(fontpercent_screenheight(2.5));\n\n ImageView item = new ImageView(this);\n item.setImageResource(getResources().getIdentifier(item_image[i], \"drawable\", getPackageName()));\n item.setScaleType(ScaleType.FIT_CENTER);\n item.setAdjustViewBounds(true);\n item.setLayoutParams(image_lp);\n\n TextView desc = new TextView(this);\n desc.setText(item_shortdesc[currenti]);\n desc.setPadding(dp(10), dp(5), dp(10), dp(5));\n desc.setLayoutParams(desc_lp);\n desc.setTextSize(fontpercent_screenheight(2.5));\n\n TextView price = new TextView(this);\n price.setText(String.format(sign + \"%.2f\", Double.parseDouble(item_price[currenti])));\n price.setPadding(0, dp(5), dp(10), dp(5));\n price.setLayoutParams(price_rp);\n price.setTextSize(fontpercent_screenheight(2.5));\n\n buy = new TextView(this);\n buy.setText(R.string.MenuAddToOrderButton);\n buy.setPadding(dp(10), dp(5), 0, dp(5));\n buy.setTextColor(0xffff0000);\n buy.setLayoutParams(buy_rp);\n buy.setTextSize(fontpercent_screenheight(2.5));\n buy.setClickable(true);\n buy.setOnClickListener(new OnClickListener() {\n @Override\n public void onClick(View v) {\n addItemToOrder(currenti);\n }\n });\n buy.setOnTouchListener(new OnTouchListener() {\n @Override\n public boolean onTouch(View v, MotionEvent event) {\n if (event.getAction() == MotionEvent.ACTION_DOWN) {\n ((TextView) v).setTextColor(0xff212121);\n } else if (event.getAction() == MotionEvent.ACTION_UP) {\n ((TextView) v).setTextColor(0xffff0000);\n }\n return false;\n }\n });\n\n RelativeLayout bottom = new RelativeLayout(this);\n bottom.setLayoutParams(bottom_lp);\n bottom.addView(buy);\n bottom.addView(price);\n\n LinearLayout card = new LinearLayout(this);\n card.setOrientation(LinearLayout.VERTICAL);\n card.setLayoutParams(card_lp);\n card.setBackgroundResource(R.drawable.borderradius1);\n card.setWeightSum(1f);\n card.setOnClickListener(new OnClickListener() {\n @Override\n public void onClick(View v) {\n Intent intent = new Intent(context, ItemProfile.class).putExtra(\"item_image\", getResources().getIdentifier(item_image[currenti], \"drawable\", getPackageName())).putExtra(\"item_title\", item_title[currenti]).putExtra(\"item_desc\", item_desc[currenti]).putExtra(\"item_price\", Double.parseDouble(item_price[currenti]));\n startActivity(intent);\n }\n });\n\n card.addView(title);\n card.addView(item);\n card.addView(desc);\n card.addView(bottom);\n\n menu.addView(card);\n }\n }\n}\n</code></pre>\n", "Lable": "No"}
{"QuestionId": 38448868, "AnswerCount": 1, "Tags": "<javascript><jquery><html><css>", "CreationDate": "2016-07-19T02:57:43.307", "AcceptedAnswerId": "38448941", "Title": "Nav icon is not fixed throughout the page", "Body": "<p>I have a hamburger nav that does not stay fixed on the page. I know many said that if you set the <code>position:fixed</code> should work. But I am still having issues. Here are some snippets. And you can also find the the code here - <a href=\"http://codepen.io/lafrish/pen/kXZvgB\" rel=\"nofollow\">Codepen</a>.</p>\n\n<p><div class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\">\r\n<div class=\"snippet-code\">\r\n<pre class=\"snippet-code-js lang-js prettyprint-override\"><code>$('.menu-burger, .menu-items').on('click', function() {\r\n $('.menu-bg, .menu-items, .menu-burger').toggleClass('fs');\r\n $('.menu-burger').text() == \"\u2630\" ? $('.menu-burger').text('\u2715') : $('.menu-burger').text('\u2630');\r\n});</code></pre>\r\n<pre class=\"snippet-code-css lang-css prettyprint-override\"><code>.menu,\r\n.menu-bg,\r\n.menu-burger {\r\n position: fixed;\r\n width: 50px;\r\n height: 50px;\r\n font-size: 30px;\r\n text-align: center;\r\n border-radius: 100%;\r\n right: 25px;\r\n top: 25px;\r\n border-width: 0 0 1px;\r\n}\r\n.menu-bg {\r\n position: fixed;\r\n background: #f91791;\r\n pointer-events: none;\r\n transition: .3s;\r\n right: 50px;\r\n top: 50px;\r\n transform: translate3d(50%, -50%, 0);\r\n transform-origin: center center;\r\n}\r\n.menu-bg.fs {\r\n transform: translate3d(50%, -50%, 0);\r\n width: 2000vw;\r\n height: 2000vw;\r\n}\r\n.menu-burger {\r\n position: fixed;\r\n color: #fff;\r\n padding-top: 11px;\r\n -webkit-user-select: none;\r\n cursor: pointer;\r\n transition: .4s;\r\n transform-origin: center;\r\n}\r\n.menu-burger.fs {\r\n transform: rotate(-180deg) translateY(10px);\r\n}\r\n.menu-items {\r\n font-family: 'Abril Fatface', serif;\r\n font-size: 125px;\r\n line-height: 120px;\r\n position: absolute;\r\n color: #fff;\r\n width: 100%;\r\n text-align: left;\r\n opacity: 0;\r\n transition: .4s;\r\n margin-top: 25px;\r\n transform: translateY(-200%);\r\n pointer-events: none;\r\n -webkit-font-smoothing: antialiased;\r\n}\r\n.menu-items div {\r\n color: #fff;\r\n transition: 1s;\r\n opacity: 0;\r\n margin-top: 0px;\r\n}\r\n.menu-items div a {\r\n color: #fff;\r\n text-decoration: none;\r\n}\r\n.menu-items.fs {\r\n transform: translateY(0);\r\n pointer-events: auto;\r\n opacity: 1;\r\n}\r\n.menu-items.fs div {\r\n color: #fff;\r\n opacity: 1;\r\n}\r\n.menu-items.fs div a {\r\n color: #fff;\r\n text-decoration: none;\r\n}\r\n.menu-items.fs div a:hover {\r\n color: #000;\r\n text-decoration: none;\r\n transition: .4s;\r\n}</code></pre>\r\n<pre class=\"snippet-code-html lang-html prettyprint-override\"><code>&lt;script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"&gt;&lt;/script&gt;\r\n&lt;header class=\"close\"&gt;\r\n &lt;nav class=\"nav\"&gt;\r\n &lt;div class=\"container\"&gt;\r\n &lt;div class=\"menu-bg\"&gt;&lt;/div&gt;\r\n &lt;div class=\"menu-burger\"&gt;\u2630&lt;/div&gt;\r\n &lt;div class=\"menu-items\"&gt;\r\n &lt;div&gt;&lt;a href=\"#welcome\"&gt;Home&lt;/a&gt;&lt;/div&gt;\r\n &lt;div&gt;&lt;a href=\"#about\"&gt;About Me&lt;/a&gt;&lt;/div&gt;\r\n &lt;div&gt;&lt;a href=\"#portfolio\"&gt;Skills&lt;/a&gt;&lt;/div&gt;\r\n &lt;div&gt;&lt;a href=\"#resume\"&gt;Portfolio&lt;/a&gt;&lt;/div&gt;\r\n &lt;div&gt;&lt;a href=\"#contactMe\"&gt;Contact Me&lt;/a&gt;&lt;/div&gt;\r\n &lt;/div&gt;\r\n &lt;/div&gt;\r\n &lt;/nav&gt;\r\n&lt;/header&gt;</code></pre>\r\n</div>\r\n</div>\r\n</p>\n", "Lable": "No"}
{"QuestionId": 38462666, "AnswerCount": 1, "Tags": "<python><python-3.x><tensorflow>", "CreationDate": "2016-07-19T15:24:30.097", "AcceptedAnswerId": null, "Title": "Error when reading TFRecords with tensorflow: tensorflow.python.framework.errors.NotFoundError: FetchOutputs node ParseSingleExample/Squeeze", "Body": "<p>I'm really new with tensorflow and I'm sure that I'm doing something wrong here. My problem is that when I'm reading records from file, code works some times, but most of the time it fails:</p>\n\n\n\n<pre><code>import tensorflow as tf\nimport numpy as np\nimport time\n\ndef readFrame(inQueue, reader):\n frameWidth = int(1920/16)+1\n frameHeight = int(1080/16)+1\n frameItemsCount = frameWidth*frameHeight\n\n _, serialized_frame = reader.read(inQueue)\n features = tf.parse_single_example(\n serialized_frame,\n features= {\n 'x' : tf.FixedLenFeature([frameItemsCount], tf.float32)\n , 'y' : tf.FixedLenFeature([frameItemsCount], tf.float32)\n , 'direction': tf.FixedLenFeature([frameItemsCount], tf.float32)\n # , 'force' : tf.FixedLenFeature([frameItemsCount], tf.float32)\n # , 'sad' : tf.FixedLenFeature([frameItemsCount], tf.float32)\n })\n\n return features\n\n# pretty much copy paste from fully_connected_reader.py\ndef main(_):\n with tf.Graph().as_default():\n inputFramesQueue = tf.train.string_input_producer([\"tfrecords.out\"], num_epochs=100)\n reader = tf.TFRecordReader()\n\n init_op = tf.initialize_all_variables()\n sess = tf.Session()\n sess.run(init_op)\n coord = tf.train.Coordinator()\n threads = tf.train.start_queue_runners(sess=sess, coord=coord)\n\n try:\n step = 0\n while not coord.should_stop() and step &lt; 3:\n start_time = time.time()\n frameDict = readFrame(inputFramesQueue, reader)\n print(frameDict)\n frame = sess.run([\n frameDict['x']\n , frameDict['y']\n , frameDict['direction'] \n # , frameDict['force'] \n # , frameDict['sad']\n ])\n print(frame[2])\n\n duration = time.time() - start_time\n if step % 100 == 0: print('Step %d: (%.3f sec)' % (step, duration))\n step += 1\n except tf.errors.OutOfRangeError:\n print('Done training for %d epochs, %d steps.' % (FLAGS.num_epochs, step))\n finally:\n coord.request_stop()\n\n coord.join(threads)\n sess.close()\n\nif __name__ == '__main__':\n tf.app.run()\n</code></pre>\n\n<p>For example when I run it these are two different outputs I'm getting:</p>\n\n<pre><code>(venv) bash-3.2$ python src/readframes.py\n{'x': &lt;tf.Tensor 'ParseSingleExample/Squeeze_x:0' shape=(8228,) dtype=float32&gt;, 'direction': &lt;tf.Tensor 'ParseSingleExample/Squeeze_direction:0' shape=(\n8228,) dtype=float32&gt;, 'y': &lt;tf.Tensor 'ParseSingleExample/Squeeze_y:0' shape=(8228,) dtype=float32&gt;}\nTraceback (most recent call last):\n File \"/Users/mikaelle/Projects/Omat/tensorflow-grouping/venv/lib/python3.5/site-packages/tensorflow/python/client/session.py\", line 715, in _do_call\n return fn(*args)\n File \"/Users/mikaelle/Projects/Omat/tensorflow-grouping/venv/lib/python3.5/site-packages/tensorflow/python/client/session.py\", line 697, in _run_fn\n status, run_metadata)\n File \"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/contextlib.py\", line 66, in __exit__\n next(self.gen)\n File \"/Users/mikaelle/Projects/Omat/tensorflow-grouping/venv/lib/python3.5/site-packages/tensorflow/python/framework/errors.py\", line 450, in raise_ex\nception_on_not_ok_status\n pywrap_tensorflow.TF_GetCode(status))\ntensorflow.python.framework.errors.NotFoundError: FetchOutputs node ParseSingleExample/Squeeze_y:0: not found\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"src/readframes.py\", line 62, in &lt;module&gt;\n tf.app.run()\n File \"/Users/mikaelle/Projects/Omat/tensorflow-grouping/venv/lib/python3.5/site-packages/tensorflow/python/platform/app.py\", line 30, in run\n sys.exit(main(sys.argv))\n File \"src/readframes.py\", line 44, in main\n , frameDict['direction']\n File \"/Users/mikaelle/Projects/Omat/tensorflow-grouping/venv/lib/python3.5/site-packages/tensorflow/python/client/session.py\", line 372, in run\n run_metadata_ptr)\n File \"/Users/mikaelle/Projects/Omat/tensorflow-grouping/venv/lib/python3.5/site-packages/tensorflow/python/client/session.py\", line 636, in _run\n feed_dict_string, options, run_metadata)\n File \"/Users/mikaelle/Projects/Omat/tensorflow-grouping/venv/lib/python3.5/site-packages/tensorflow/python/client/session.py\", line 708, in _do_run\n target_list, options, run_metadata)\n File \"/Users/mikaelle/Projects/Omat/tensorflow-grouping/venv/lib/python3.5/site-packages/tensorflow/python/client/session.py\", line 728, in _do_call\n raise type(e)(node_def, op, message)\ntensorflow.python.framework.errors.NotFoundError: FetchOutputs node ParseSingleExample/Squeeze_y:0: not found\n(venv) bash-3.2$\n\n(venv) bash-3.2$ python src/readframes.py\n{'y': &lt;tf.Tensor 'ParseSingleExample/Squeeze_y:0' shape=(8228,) dtype=float32&gt;, 'direction': &lt;tf.Tensor 'ParseSingleExample/Squeeze_direction:0' shape=(\n8228,) dtype=float32&gt;, 'x': &lt;tf.Tensor 'ParseSingleExample/Squeeze_x:0' shape=(8228,) dtype=float32&gt;}\n[ 0. 0. 0. ..., 0. 0. 0.]\nStep 0: (0.014 sec)\n{'y': &lt;tf.Tensor 'ParseSingleExample_1/Squeeze_y:0' shape=(8228,) dtype=float32&gt;, 'direction': &lt;tf.Tensor 'ParseSingleExample_1/Squeeze_direction:0' sha\npe=(8228,) dtype=float32&gt;, 'x': &lt;tf.Tensor 'ParseSingleExample_1/Squeeze_x:0' shape=(8228,) dtype=float32&gt;}\n[ 0. 0. 0. ..., 0. 0. 0.]\n{'y': &lt;tf.Tensor 'ParseSingleExample_2/Squeeze_y:0' shape=(8228,) dtype=float32&gt;, 'direction': &lt;tf.Tensor 'ParseSingleExample_2/Squeeze_direction:0' sha\npe=(8228,) dtype=float32&gt;, 'x': &lt;tf.Tensor 'ParseSingleExample_2/Squeeze_x:0' shape=(8228,) dtype=float32&gt;}\n[ 0. 2.24240255 2.24240255 ..., 0. 0. 0. ]\n(venv) bash-3.2$\n</code></pre>\n\n<p>Somehow it seems that file cannot be accessed when items are tried to be fetched from there...</p>\n", "Lable": "D"}
{"QuestionId": 38483157, "AnswerCount": 2, "Tags": "<linux><batch-file><cmd><call><prompt>", "CreationDate": "2016-07-20T13:48:28.177", "AcceptedAnswerId": null, "Title": "Is there a Linux command or a script that I could write and run on linux to call a Windows DOS command prompt? If so, how?", "Body": "<p>I would like to automate an existing process that involves executing programs on a Linux server which would then send output file(s) to be edited by excel. The resulting .csv files must be run on a Windows DOS command prompt. If I would like to automate this process, one of the things that I would like to know is if it's possible for me to write and run a script on a Linux server to call a Windows DOS command prompt. Any suggestions?</p>\n", "Lable": "No"}
{"QuestionId": 38500570, "AnswerCount": 2, "Tags": "<python-2.7><tensorflow><deep-learning><skflow>", "CreationDate": "2016-07-21T09:41:15.983", "AcceptedAnswerId": "38589914", "Title": "How to input data in a tensorflow learn validation monitor?", "Body": "<p>I'm trying to use a validation monitor in skflow by passing my validation set as numpy array.</p>\n\n<p>Here is some simple code to reproduce the problem (I installed tensorflow from the provided binaries for Ubuntu/Linux 64-bit, GPU enabled, Python 2.7):</p>\n\n<pre><code>import numpy as np\nfrom sklearn.cross_validation import train_test_split\nfrom tensorflow.contrib import learn\nimport tensorflow as tf\nimport logging\nlogging.getLogger().setLevel(logging.INFO)\n\n#Some fake data \nN=200\nX=np.array(range(N),dtype=np.float32)/(N/10)\nX=X[:,np.newaxis]\nY=np.sin(X.squeeze())+np.random.normal(0, 0.5, N)\n\nX_train, X_test, Y_train, Y_test = train_test_split(X, Y, \n train_size=0.8, \n test_size=0.2)\n\nval_monitor = learn.monitors.ValidationMonitor(X_test, Y_test,early_stopping_rounds=200)\nreg=learn.DNNRegressor(hidden_units=[10,10],activation_fn=tf.tanh,model_dir=\"tmp/\")\nreg.fit(X_train,Y_train,steps=5000,monitors=[val_monitor])\nprint \"train error:\", reg.evaluate(X_train, Y_train)\nprint \"test error:\", reg.evaluate(X_test, Y_test)\n</code></pre>\n\n<p>The code runs but only the first validation step is done properly, then validation always returns the same value even if training is actually going fine which can be checked by running an evaluation on the test set at the end. The following message also appears for each validation step.</p>\n\n<pre><code>INFO:tensorflow:Input iterator is exhausted. \n</code></pre>\n\n<p>Any help is welcome!\nThanks,\nDavid</p>\n", "Lable": "D"}
{"QuestionId": 38503423, "AnswerCount": 1, "Tags": "<reactjs><webpack>", "CreationDate": "2016-07-21T11:46:28.363", "AcceptedAnswerId": "38503466", "Title": "Getting Webpack CSS and React working together", "Body": "<p>I have my webpack config loaders as like this:</p>\n\n<pre><code>//config for css\n{ test: /\\.css$/, loader: \"style-loader!css-loader\" },\n{ test: /\\.png$/, loader: \"url-loader?limit=100000\" },\n{ test: /\\.jpg$/, loader: \"file-loader\" }\n</code></pre>\n\n<p>and in my React component I have:</p>\n\n<pre><code>import styles from \"../../../css/style.css\"\n</code></pre>\n\n<p>and my <code>style.css</code> looks like:</p>\n\n<pre><code>#box {\n}\n</code></pre>\n\n<p>but in my react component if I refer to <code>styles</code> its just returning <code>{}</code>, I expect it should have <code>box</code> key. But it doesn't, where I'm making mistake?</p>\n", "Lable": "No"}
{"QuestionId": 38651609, "AnswerCount": 1, "Tags": "<neural-network><tensorflow><recurrent-neural-network>", "CreationDate": "2016-07-29T06:07:58.400", "AcceptedAnswerId": "38659803", "Title": "In tensorflow, how do I reset a row of a tensor to zeros?", "Body": "<p>I am working on recurrent neural network in Tensorflow.\nI have a tensor <code>H</code> which stores hidden states for a batch of inputs.</p>\n\n<p>Assume that <code>H</code> is of size <code>a*b</code>. How do I reset rows of <code>H</code>, given in a list, to <code>zeros</code>?</p>\n\n<p>e.g. if a list is <code>[1, 2]</code> I want to reset only those rows of <code>H</code> to <code>zeros</code>, leaving others intact.</p>\n", "Lable": "D"}
{"QuestionId": 38689506, "AnswerCount": 1, "Tags": "<asp.net><vb.net><webforms><asp.net-identity>", "CreationDate": "2016-08-01T00:19:44.310", "AcceptedAnswerId": "38691029", "Title": "Securing ASP.NET Web Forms page with ASP.NET Identity", "Body": "<p>I am developing small department-size application using Web Forms. Technology choice comes form the past, as application is based on an old one already existing + Web Forms seem to be extremely fast and efficient for our case.</p>\n\n<p>Default template in VS 2015 creates all login pages, etc. I assign roles to users. And the question comes how to protect specific folder or page to be available only for users with specific role?</p>\n\n<p>The only idea I have is:</p>\n\n<pre><code>If Not Page.User.Identity.IsAuthenticated or Not Page.User.Identity.IsInRole(\"MyRole\") Then\n Response.Redirect(\"~/Account/Login?ReturnUrl=\" &amp; Server.UrlEncode(Request.Url.ToString())\nEnd If\n</code></pre>\n\n<p>This is not convenient having many pages in application. I saw MVC solves this with attribute</p>\n\n<pre><code>[Authorize( Roles = Constants.ADMIN )]\n</code></pre>\n\n<p>What is the best way to achieve this? Please advise.</p>\n", "Lable": "No"}
{"QuestionId": 38714935, "AnswerCount": 2, "Tags": "<kotlin>", "CreationDate": "2016-08-02T08:03:13.147", "AcceptedAnswerId": "38721917", "Title": "Two functions with different number of type parameters in Kotlin", "Body": "<p>This two functions conflicts with each other. \nIs there a workaround for this issue?</p>\n\n<pre><code>inline fun &lt;reified T: Any&gt; foo() = ...\ninline fun &lt;reified T: Any, reified I: Any&gt; foo() = ...\n</code></pre>\n\n<p>Thanks!</p>\n\n<p>Edit:</p>\n\n<p>I found convenient(at least for me) solution for this issue:</p>\n\n<pre><code>inline fun &lt;reified T: Any&gt; foo() = foo&lt;T, MyDefaultType&gt;()\ninline fun &lt;reified T: Any, reified I: Any&gt; foo(type1: KClass&lt;T&gt; = T::class, type2: KClass&lt;I&gt; = I::class) = ...\n</code></pre>\n\n<p>It can be even concise if you choose to add only one parameter.</p>\n\n<p>Later you can use it like this:</p>\n\n<pre><code>val x = foo&lt;A, B&gt;()\nval y = foo&lt;C&gt;()\n</code></pre>\n\n<p>That's what I need.</p>\n", "Lable": "No"}
{"QuestionId": 38722799, "AnswerCount": 0, "Tags": "<python><tensorflow>", "CreationDate": "2016-08-02T14:08:58.527", "AcceptedAnswerId": null, "Title": "Does Tensorflow reuse computation for every sess.run() node?", "Body": "<p>In the documentation of Tensorflow's <code>Session.run()</code> function (<a href=\"https://www.tensorflow.org/versions/r0.10/api_docs/python/client.html#Session.run\" rel=\"nofollow\">link here</a>) it is said that the <code>fetches</code> argument can be a list of nodes, to get the output of multiple graph nodes at the same time, instead of just one.</p>\n\n<p>My question is, if such nodes are related and have dependencies between them, will the computation be shared or each node will have it's own computation? </p>\n\n<p>Let my explain better with an example. Suppose we have the following computation graph:</p>\n\n<pre><code>import tensorflow as tf\na = tf.placeholder(\"float\")\nb = tf.mul(a,3)\nc = tf.mul(b,-2)\n\nsess = tf.Session()\nprint(sess.run([b, c], feed_dict={a:2}))\n</code></pre>\n\n<p>The output will be</p>\n\n<pre><code>[6.0, -12.0]\n</code></pre>\n\n<p>But will the computation to get <code>b</code> be reused to get <code>c</code>? Or will <code>b</code> and <code>c</code> be computed independently even though they share some operations?</p>\n\n<p>My guess is that the computation will be reused, but I can't find the answer in the documentation.</p>\n\n<p>Thanks!</p>\n", "Lable": "D"}
{"QuestionId": 38725224, "AnswerCount": 2, "Tags": "<python><machine-learning><nlp><tensorflow><deep-learning>", "CreationDate": "2016-08-02T15:53:42.937", "AcceptedAnswerId": "38963313", "Title": "Tensorflow DNNClassifier return wrong prediction", "Body": "<p>I try to make a sentence classifier using tensorflow as in the example of the official site <a href=\"https://www.tensorflow.org/versions/r0.9/tutorials/tflearn/index.html\" rel=\"nofollow\">tf.contrib.learn Quickstart</a> but using my own data, first I convert all my data (which are strings of varying lengths) to ids through the use of dictionaries and so transform each sentence in an array of integers.</p>\n\n<p>Each record for training has its own assigned label.</p>\n\n<p>The problem is that predictions are not exact, only some, but others even when the input is equal to a record of the training base the result is wrong.<br>\nMy code looks something like this:</p>\n\n<pre><code>def launchModelData(values, labels, sample, actionClasses):\n\n #Tensor for trainig data\n v = tf.Variable(values)\n l = tf.Variable(labels)\n\n #Data Sample\n s = tf.Variable(sample)\n\n # Build 3 layer DNN with 10, 20, 10 units respectively.\n classifier = tf.contrib.learn.DNNClassifier(hidden_units=[10, 20, 10], n_classes=actionClasses)\n\n # Add an op to initialize the variables.\n init_op = tf.initialize_all_variables()\n\n # Later, when launching the model\n with tf.Session() as sess:\n # Run the init operation.\n sess.run(init_op)\n\n # Fit model.\n classifier.fit(x=v.eval(), y=l.eval(), steps=200)\n\n # Classify one new sample.\n new_sample = np.array(s.eval(), dtype=int)\n y = classifier.predict(new_sample)\n print ('Predictions: {}'.format(str(y)))\n\n return y\n</code></pre>\n\n<p>Values and classes axample: </p>\n\n<pre><code>[0 1] 0 \n[0 2] 0 \n[0 4] 0 \n[7 8] 1 \n[7 9] 1 \n[ 7 13] 1 \n[14 15] 2 \n[14 16] 2 \n[14 18] 2 \n[20 21] 3 \n[26 27] 5 \n[29 27] 5 \n[31 32] 5 \n... \n</code></pre>\n\n<p>I'm new to tensorflow so I try to make it less complex possible, any help will be welcome.</p>\n\n<p><strong>EDIT</strong><br>\nMy actual training data is <a href=\"https://drive.google.com/open?id=0B3uEZ76zDg_wNXJnT3g5c0lWWjQ\" rel=\"nofollow\">this.</a></p>\n\n<p>I try it with 8 classes and the predictions were fine, so maybe i need a bigger corpus, i will try and show my outputs in a new edit. </p>\n\n<p><strong>EDIT2</strong> </p>\n\n<p>Now i use a composition of five layer [n,2n,4n,8n,16n] where n = Classes and steps = 20000, this reduce the loss and increase the accuracy really well but again it just work with a few targets (10 aprox) with a bigger amount the predictions become wrong.</p>\n", "Lable": "D"}
{"QuestionId": 38751185, "AnswerCount": 1, "Tags": "<tensorflow>", "CreationDate": "2016-08-03T18:32:20.317", "AcceptedAnswerId": null, "Title": "Running LinearClassifier.fit with SparseTensor", "Body": "<p>I'm trying to create a LinearClassifer with a sparse binary numpy coo matrix (reports) using a SparseTensor. This is with TensorFlow 0.9.0</p>\n\n<p>I do this as follows:</p>\n\n<pre><code>reports_indices = list()\nrows,cols = reports.nonzero()\nfor row,col in zip(rows,cols):\n reports_indices.append([row,col])\n\nx_sparsetensor = tf.SparseTensor(\n indices=reports_indices,\n values=[1] * len(reports_indices),\n shape=[reports.shape[0],reports.shape[1]])\n</code></pre>\n\n<p>The dimensions of reports is 10K by 1.5K.</p>\n\n<p>I then setup the LinearClassifier as follows:</p>\n\n<pre><code>m = tf.contrib.learn.LinearClassifier()\n\nm.fit(x=x_sparsetensor,y=response_vector.todense(),input_fn=None)\n</code></pre>\n\n<p>Response vector is binary and has a length of 10K. This results in the following error:</p>\n\n<pre><code>Traceback (most recent call last):\n File \"ddi_prr.py\", line 38, in &lt;module&gt;\n m.fit(x=x_sparsetensor,y=response_vector.todense(),input_fn=None)\n File \"/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py\", line 173, in fit\n input_fn, feed_fn = _get_input_fn(x, y, batch_size)\n File \"/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py\", line 67, in _get_input_fn\n x, y, n_classes=None, batch_size=batch_size)\n File \"/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/io/data_feeder.py\", line 117, in setup_train_data_feeder\n X, y, n_classes, batch_size, shuffle=shuffle, epochs=epochs)\n File \"/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/io/data_feeder.py\", line 240, in __init__\n batch_size)\n File \"/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/io/data_feeder.py\", line 44, in _get_in_out_shape\n x_shape = list(x_shape[1:]) if len(x_shape) &gt; 1 else [1]\nTypeError: object of type 'Tensor' has no len()\n</code></pre>\n\n<p>Is my construction incorrect for some reason? It seems that LinearClassifier.fit can't be instantiated with a SparseTensor for x, is that true? Thanks in advance for any help.</p>\n", "Lable": "D"}
{"QuestionId": 38751736, "AnswerCount": 2, "Tags": "<memory-management><gpu><tensorflow>", "CreationDate": "2016-08-03T19:04:43.847", "AcceptedAnswerId": "38755584", "Title": "Understanding tensorflow queues and cpu <-> gpu transfer", "Body": "<p>After reading this github issue I feel like I'm missing something in my understanding on queues:</p>\n\n<p><a href=\"https://github.com/tensorflow/tensorflow/issues/3009\" rel=\"nofollow\">https://github.com/tensorflow/tensorflow/issues/3009</a></p>\n\n<p>I thought that when loading data into a queue, it will get pre-transferred to the GPU while the last batch is getting computed, so that there is virtually no bandwidth bottleneck, assuming computation takes longer than the time to load the next batch. </p>\n\n<p>But the above link suggests that there is an expensive copy from queue into the graph (numpy &lt;-> TF) and that it would be faster to load the files into the graph and do preprocessing there instead. But that doesn't make sense to me. Why does it matter if I load a 256x256 image from file vs a raw numpy array? If anything, I would think that the numpy version is faster. What am I missing?</p>\n", "Lable": "D"}
{"QuestionId": 38812231, "AnswerCount": 0, "Tags": "<java><hibernate>", "CreationDate": "2016-08-07T08:14:26.307", "AcceptedAnswerId": null, "Title": "Hibernate embed only some fields of the class (not an entire class)", "Body": "<p>In my database, I have a table <code>Article</code> with 10 columns. I also have a table <code>Item</code> that has an <code>Article</code> as a foreign key - one of the fields in <code>Item</code> is the <code>Article_ID</code> field. However, the <code>Item</code> also has another field from the <code>Article</code>, and that is the <code>Article_Price</code>. </p>\n\n<p>So the situation is that I have the field <code>Article_Price</code> both in my <code>Article</code> and <code>Item</code> table, even though the <code>Item</code> already has the <code>Article</code> as a FK.</p>\n\n<p>The question is - how to embed <strong>only</strong> the <code>Article_Price</code> field in my <code>Item</code> class, and not the entire <code>Article</code> (since it already exists as a separate table)?</p>\n\n<p>I understand that for embedding the whole <code>Article</code>, the code would look something like the following.</p>\n\n<pre><code>@Entity\n@Embeddable\npublic class Article {\n //...\n\n\n@Entity\npublic class Item {\n\n @Embedded\n Article article;\n</code></pre>\n\n<p>But I need only the <code>Article_Price</code> to be embedded, and the <code>Article</code> to remain as the FK. Something like this:</p>\n\n<p><strong><em>Item.java</em></strong></p>\n\n<pre><code>@Entity\n@Table(name = \"Item\")\npublic class Item {\n\n @Id \n @Column(name = \"Item_ID\", nullable = false)\n private int id;\n\n @ManyToOne\n @JoinColumn(name = \"Article_ID\")\n private Article article;\n\n @Embedded // I want only this attribute from Article to embedded here\n @Column(name = \"Article_Price\")\n private float articlePrice;\n</code></pre>\n\n<p><strong><em>Article.java</em></strong></p>\n\n<pre><code>@Entity\n@Table (name = \"Article\")\npublic class Article {\n\n @Id\n private int id;\n\n @Embeddable // I want only this attribute to be embeddable\n @Column(name = \"Article_Price\", nullable = false)\n private float price;\n</code></pre>\n\n<p>How can I achieve this?</p>\n\n<h2>UPDATE</h2>\n\n<p>I did the attribute override in my <code>Item.java</code> like this:</p>\n\n<pre><code> @ManyToOne\n @JoinColumn(name = \"Article_ID\", nullable = false)\n @Embedded // embedding only the price field\n @AttributeOverride(name = \"price\", column = @Column(name = \"Article_Price\", nullable = false))\n private Article article;\n</code></pre>\n\n<p>I am now able to store such <code>Item</code> object to the DB, and it maps to the correct <code>Article_ID</code> but the <code>Article_Price</code> field is always 0. So it doesn't copy the actual <code>Article_Price</code> from the <code>Article</code> table, but just defaults it. Any idea how to solve this?</p>\n\n<p>I am saving like this:</p>\n\n<pre><code> Session s = sf.openSession();\n// \n// // saving to the DB\n s.beginTransaction();\n\n Article article = s.get(Article.class, 5391); // 5391 is the ID\n Item item = new Item(6.00f, article, 18.00f);\n\n s.save(item);\n</code></pre>\n\n<p>The problem is that the <code>Article</code> with the ID 5391 has the <code>Article_Price</code> property value of 150, and when I save the <code>Item</code> with referenced this <code>Article</code>, in the <code>Item</code>'s property <code>Article_Price</code> it has the value of 0. It should also be 150.</p>\n", "Lable": "No"}
{"QuestionId": 38864994, "AnswerCount": 1, "Tags": "<c#><asp.net><file-upload>", "CreationDate": "2016-08-10T05:35:03.390", "AcceptedAnswerId": null, "Title": "How to do if/else statement for fileUpload", "Body": "<p>Heyy all. I am trying to do an if/else statement for my fileupload function on my Edit Profile page in my ASP.net webpage.</p>\n\n<p>Here is my code:</p>\n\n<pre><code>protected void btnContinue_Click(object sender, EventArgs e)\n{\n //Declaration of variable to update Profile Image\n string imageName, newContact;\n imageName = FileUpload1.FileName.ToString();\n newContact = tbMobile.Text.ToString();\n\n username = (String)Session[\"NonAdmin\"];\n MySqlConnection mcon = new MySqlConnection(\"server=182.50.133.91;user id=Jonathan;password=jon123;persistsecurityinfo=True;database=ajactrac_;allowuservariables=True\");\n MySqlDataAdapter sda = new MySqlDataAdapter(\"select * from pointofcontact where Username = '\" + username.ToString() + \"'\", mcon);\n DataTable dt = new DataTable();\n sda.Fill(dt);\n if (dt.Rows.Count.ToString() == \"1\")\n {\n\n MySqlCommand command = mcon.CreateCommand();\n MySqlCommand command1 = mcon.CreateCommand();\n MySqlCommand command2 = mcon.CreateCommand();\n MySqlCommand command3 = mcon.CreateCommand();\n MySqlCommand command4 = mcon.CreateCommand();\n MySqlCommand command5 = mcon.CreateCommand();\n MySqlCommand command6 = mcon.CreateCommand();\n MySqlCommand command7 = mcon.CreateCommand();\n\n command.CommandText = \"update pointofcontact set Password = ?pwd where Username = '\" + username.ToString() + \"'\";\n command1.CommandText = \"update pointofcontact set FirstName = ?firstname where Username = '\" + username.ToString() + \"'\";\n command2.CommandText = \"update pointofcontact set LastName = ?lastname where Username = '\" + username.ToString() + \"'\";\n command3.CommandText = \"update pointofcontact set ContactNumber = ?contact where Username = '\" + username.ToString() + \"'\";\n command4.CommandText = \"update pointofcontact set EmailAddress = ?email where Username = '\" + username.ToString() + \"'\";\n command5.CommandText = \"update pointofcontact set Address = ?address where Username = '\" + username.ToString() + \"'\";\n command6.CommandText = \"update pointofcontact set BackupContactNumber = ?backupnumber where Username = '\" + username.ToString() + \"'\";\n command7.CommandText = \"update pointofcontact set ProfilePic = ?newimage where Username = '\" + username.ToString() + \"'\";\n\n mcon.Open();\n if (tbNewPassword.Text == \"\")\n {\n command.Parameters.AddWithValue(\"?pwd\", tbOldPassword.Text.Trim());\n }\n else\n {\n command.Parameters.AddWithValue(\"?pwd\", tbNewPassword.Text.Trim());\n }\n\n if(tbNewFirstName.Text == \"\")\n {\n command1.Parameters.AddWithValue(\"?firstname\", tbFirstName.Text.Trim());\n }\n else\n {\n command1.Parameters.AddWithValue(\"?firstname\", tbNewFirstName.Text.Trim());\n }\n\n if(tbNewLastName.Text == \"\")\n {\n command2.Parameters.AddWithValue(\"?lastname\", tbLastName.Text.Trim());\n }\n else\n {\n command2.Parameters.AddWithValue(\"?lastname\", tbNewLastName.Text.Trim());\n }\n\n if(tbNewContact.Text == \"\")\n {\n command3.Parameters.AddWithValue(\"?contact\", tbMobile.Text.Trim());\n }\n else\n {\n command3.Parameters.AddWithValue(\"?contact\", tbNewContact.Text.Trim());\n }\n\n if(tbNewEmail.Text == \"\")\n {\n command4.Parameters.AddWithValue(\"?email\", tbEmail.Text.Trim());\n }\n else\n {\n command4.Parameters.AddWithValue(\"?email\", tbNewEmail.Text.Trim());\n }\n\n if(tbNewAddress.Text == \"\")\n {\n command5.Parameters.AddWithValue(\"?address\", tbAddress.Text.Trim());\n }\n else\n {\n command5.Parameters.AddWithValue(\"?address\", tbNewAddress.Text.Trim());\n }\n\n if(tbNewBackupContact.Text == \"\")\n {\n command6.Parameters.AddWithValue(\"?backupnumber\", tbBackupContact.Text.Trim());\n }\n else\n {\n command6.Parameters.AddWithValue(\"?backupnumber\", tbNewBackupContact.Text.Trim());\n }\n\n\n FileUpload1.PostedFile.SaveAs(Server.MapPath(\"~/Images/\") + imageName);\n command7.Parameters.AddWithValue(\"?newimage\", imageName);\n\n command.ExecuteNonQuery();\n command1.ExecuteNonQuery();\n command2.ExecuteNonQuery();\n command3.ExecuteNonQuery();\n command4.ExecuteNonQuery();\n command5.ExecuteNonQuery();\n command6.ExecuteNonQuery();\n command7.ExecuteNonQuery();\n\n mcon.Close();\n string javaScript = \"&lt;script language=JavaScript&gt;\\n\" + \"alert('Profile Updated!');\\n\" + \"&lt;/script&gt;\";\n RegisterStartupScript(\"xyz\", javaScript);\n }\n else\n {\n string javaScript = \"&lt;script language=JavaScript&gt;\\n\" + \"alert('Some Error Occured! Profile Not Updated!');\\n\" + \"&lt;/script&gt;\";\n RegisterStartupScript(\"xyz\", javaScript);\n }\n tbNewPassword.Text = \"\";\n\n\n\n\n}\n</code></pre>\n\n<p>I had planned to use the if else statement for my fileupload function such that if the user has not uploaded a new picture, he/she would be still able to update their profile.</p>\n\n<p>Currently when I try to edit a user's profile, this error message comes out.</p>\n", "Lable": "No"}