last

Strip last two characters of a column in MySQL

匿名 (未验证) 提交于 2019-12-03 01:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an SQL column where the entries are strings. I need to spit out those entries after trimming the last two characters, e.g. if the entry is 199902345 it should output 1999023 . I tried looking into TRIM but looks like it offers trimming only if we know what are the last two characters. But in my case, I don't know what those last two numbers are and they just needs to be discarded. So, in short, what MySQL string operation enables to trim the last two characters of a string? I must add that the length of the string is not fixed. It

How to pause form submit, for 1 last validation, at the very end and after that release/trigger/continue the submission?

匿名 (未验证) 提交于 2019-12-03 01:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a page1.php and i have a fly.php. page1.php is a simple (regular) form page, where people put info, when user submit the form. via ajax it loads the captcha template and ask to verify on the fly (till here is fine). After onFly validation, i want to allow this .submit() continue Question: How can i after .submit() pause for validatio n of this captcha and after validation successfull, resume the form submission (which is on hold)? Example: Part 1: page1.php $(document).ready(function() { $('.callmeback').submit(function() { $.ajax({

How to prevent open last projects when intellij idea start

匿名 (未验证) 提交于 2019-12-03 01:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: By default intellij idea open last project when starting. How to open intellij idea without openning last projects? 回答1: IntelliJ 14, 15, 16: Settings -> Appearance & Behaviour -> System Settings -> Reopen last project on startup Previously: Settings -> General -> Startup/shutdown -> Reopen last project on startup. 回答2: If for any reason you need to change this setting without using the UI (for example if IDEA is hanging when it opens your project), you can find the setting in eg /.IntelliJIdea10/config/options/ide.general.xml The location

Finding last element of a binary heap

匿名 (未验证) 提交于 2019-12-03 01:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: quoting Wikipedia : It is perfectly acceptable to use a traditional binary tree data structure to implement a binary heap. There is an issue with finding the adjacent element on the last level on the binary heap when adding an element which can be resolved algorithmically ... Any ideas on how such an algorithm might work? I was not able to find any information about this issue, for most binary heaps are implemented using arrays. Any help appreciated. Recently, I have registered an OpenID account and am not able to edit my initial post nor

Identify which iteration you are on in a loop in python

匿名 (未验证) 提交于 2019-12-03 01:27:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Basically I would like to be able to tell when I'm on the Nth item in a loop iteration. Any thoughts? d = {1:2, 3:4, 5:6, 7:8, 9:0} for x in d: if last item: # 回答1: Use enumerate : #!/usr/bin/env python d = {1:2, 3:4, 5:6, 7:8, 9:0} # If you want an ordered dictionary (and have python 2.7/3.2), # uncomment the next lines: # from collections import OrderedDict # d = OrderedDict(sorted(d.items(), key=lambda t: t[0])) last = len(d) - 1 for i, x in enumerate(d): if i == last: print i, x, 'last' else: print i, x # Output: # 0 1 # 1 3 # 2 9 # 3 5

Get the last output of a dynamic_rnn in TensorFlow

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a 3-D tensor of shape [batch, None, dim] where the second dimension, i.e. the timesteps, is unknown. I use dynamic_rnn to process such input, like in the following snippet: import numpy as np import tensorflow as tf batch = 2 dim = 3 hidden = 4 lengths = tf.placeholder(dtype=tf.int32, shape=[batch]) inputs = tf.placeholder(dtype=tf.float32, shape=[batch, None, dim]) cell = tf.nn.rnn_cell.GRUCell(hidden) cell_state = cell.zero_state(batch, tf.float32) output, _ = tf.nn.dynamic_rnn(cell, inputs, lengths, initial_state=cell_state)

Most efficient way to search the last x lines of a file in python

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a file and I don't know how big it's going to be (it could be quite large, but the size will vary greatly). I want to search the last 10 lines or so to see if any of them match a string. I need to do this as quickly and efficiently as possible and was wondering if there's anything better than: s = "foo" last_bit = fileObj.readlines()[-10:] for line in last_bit: if line == s: print "FOUND" 回答1: # Tail from __future__ import with_statement find_str = "FIREFOX" # String to find fname = "g:/autoIt/ActiveWin.log_2" # File to check with

cleartool list activities since last 7 days

匿名 (未验证) 提交于 2019-12-03 01:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: We use ClearCase UCM which has multiple Vobs (10). How to find the activities for past one week? Or list activities between two date ranges? 回答1: It is a bit trickey, because all cleartool lsactivity commands are limited to one pvob ("project vob" or "special vob with UCM metadata in it"): cleartool lsact -invob \my\pvob -stream ... And an activity can be reused (meaning an old activity can have in its changeset very recent versions) If you have two baselines, you can easily diff them (by activity): See .. diffbl **. ct diffbl -act baseline

How to delete last character in a string in C#?

匿名 (未验证) 提交于 2019-12-03 01:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Building a string for post request in the following way, var itemsToAdd = sl.SelProds.ToList(); if (sl.SelProds.Count() != 0) { foreach (var item in itemsToAdd) { paramstr = paramstr + string.Format("productID={0}&", item.prodID.ToString()); } } after I get resulting paramstr , I need to delete last character & in it How to delete last character in a string using C#? 回答1: build it with string.Join instead: var parameters = sl.SelProds.Select(x=>"productID="+x.prodID).ToArray(); paramstr = string.Join("&", parameters); string.Join takes a

AttributeError: 'numpy.int64' object has no attribute 'timestamp' in python 3.5 in Anaconda

匿名 (未验证) 提交于 2019-12-03 01:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am a newbie in learning Machine Learning, so following a great tutorial in YouTube. But the following code is giving me an error. I read a similar question in here, but timetuple() does not solve my case, nor any solutions from the video. Here is my code : import pandas as pd import quandl, math from datetime import datetime, date, time, timedelta import time import numpy as np from sklearn import preprocessing, cross_validation, svm from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt #plot stuff, how to plot