out

Index out of bounds (Python)

点点圈 提交于 2020-01-05 07:31:29
问题 I have some data that I would like to aggregate, but I'm getting the index out of bounds error, and I can't seem to figure out why. Here's my code: if period == "hour": n=3 tvec_a=np.zeros([24,6]) tvec_a[:,3]=np.arange(0,24) data_a=np.zeros([24,4]) elif period == "day": n=2 tvec_a=np.zeros([31,6]) tvec_a[:,2]=np.arange(1,32) data_a=np.zeros([31,4]) elif period == "month": n=1 tvec_a=np.zeros([12,6]) tvec_a[:,1]=np.arange(1,13) data_a=np.zeros([12,4]) elif period == "hour of the day": tvec_a

Index out of bounds (Python)

╄→尐↘猪︶ㄣ 提交于 2020-01-05 07:31:07
问题 I have some data that I would like to aggregate, but I'm getting the index out of bounds error, and I can't seem to figure out why. Here's my code: if period == "hour": n=3 tvec_a=np.zeros([24,6]) tvec_a[:,3]=np.arange(0,24) data_a=np.zeros([24,4]) elif period == "day": n=2 tvec_a=np.zeros([31,6]) tvec_a[:,2]=np.arange(1,32) data_a=np.zeros([31,4]) elif period == "month": n=1 tvec_a=np.zeros([12,6]) tvec_a[:,1]=np.arange(1,13) data_a=np.zeros([12,4]) elif period == "hour of the day": tvec_a

Android relatively out wrap_content and match_parent

梦想与她 提交于 2020-01-05 03:56:06
问题 I have an issue with a RelativeLayout. It is a custom view for a List Item. I have a RelativeLayout, it's height is set to wrap_content. Inside of it are three Linear Layouts, one of which has it's height set to wrap_content. The other two are set to match_parent as I need them to fill the parent after it has grown to accommodate the wrap_content one. The two that are supposed to grow are behind the other one (it's used for swiping, The top view when swiped moves out of the way to reveal the

How to call a .net method with an output parameter?

て烟熏妆下的殇ゞ 提交于 2020-01-03 08:27:10
问题 I just want to call the GenerateScript method of Microsoft.Data.Schema.ScriptDom.Sql.Sql100ScriptGenerator from PowerShell. #C public void GenerateScript( IScriptFragment scriptFragment, out string script ) I found this, but I do not get it to work $sg = new-object Microsoft.Data.Schema.ScriptDom.Sql.Sql100ScriptGenerator $sql = 'select * from PowerShell' $out = '' $sg.GenerateScript($sql, [ref] $out) $out this gives Cannot find an overload for "GenerateScript" and the argument count: "2". At

Difference between pointer-to-pointer vs reference-to-pointer (C++)

大憨熊 提交于 2020-01-01 03:17:07
问题 I have a bit of COM code that uses interface pointers. The original author of the code implemented functions that return an interface pointer like this: HRESULT Query ( IN BSTR sQuery, OUT IEnumWbemClassObject* &pEnumerator ); // (1) instead of the traditional HRESULT Query ( IN BSTR sQuery, OUT IEnumWbemClassObject** ppEnumerator ); // (2) The function (1) is called like this: hRes = Query ( sQuery, pEnumerator ); // (3) which definitely looks wrong but it works fine. I'm not sure if I'm

Null-coalescing out parameter gives unexpected warning

南笙酒味 提交于 2019-12-30 18:39:33
问题 Using this construct: var dict = new Dictionary<int, string>(); var result = (dict?.TryGetValue(1, out var value) ?? false) ? value : "Default"; I get an error saying CS0165 use of unassigned local variable 'value' which is not what I expect. How could value possibly be undefined? If the dictionary is null the inner statement will return false which will make the outer statement evaluate to false, returning Default . What am I missing here? Is it just the compiler being unable to evaluate the

Console.ReadLine add 48 to int

家住魔仙堡 提交于 2019-12-29 09:08:13
问题 I get 48 when I input 0 to a ReadLine(). Is this a bug? class Program { static void Main(string[] args) { string name; int age; readPerson(out name, out age); } static void readPerson(out string name, out int age) { Console.Write("Enter name: "); name = Console.ReadLine(); Console.Write("Enter age: "); age = Console.Read(); Console.WriteLine("Name: {0}; Age: {1}", name, age.ToString()); } } 回答1: According to the MSDN documentation, the Console.Read method returns: The next character from the

Android WebView Out of memory allocation

孤街醉人 提交于 2019-12-25 04:06:30
问题 I have a WebView that shows a bitmap from uri. It works well the first 7 or 8 times it is loaded but then when loading it i get this error. Need help please. 01-27 18:44:27.155 30480-30480/? E/dalvikvm-heap﹕ Out of memory on a 631816-byte allocation. 01-27 18:44:30.579 15859-15859/? E/MtpService﹕ In MTPAPP onReceive:android.intent.action.BATTERY_CHANGED 01-27 18:44:30.579 15859-15859/? E/MtpService﹕ battPlugged Type : 2 01-27 18:44:34.362 1704-8058/? E/Dumper﹕ 3: 48387128549: User action:

jQuery fadein fadeout repeatedly

故事扮演 提交于 2019-12-23 21:34:45
问题 I have a image and in it wants to be fadein fadeout automatically when the document is loaded and it should be done till the document is closed .. help me plzz 回答1: this'll do it: $(function () { $('#fader').fadeIn('slow', function () { fadeItOut(); }); }); function fadeItIn() { $('#fader').fadeIn('slow', function () { fadeItOut(); }); } function fadeItOut() { $('#fader').fadeOut('slow', function () { fadeItIn(); }); } with fader being the id of your image 回答2: $( function() { var t = 500;

Convert a string in a List<int> using LINQ (cleaner way)

梦想的初衷 提交于 2019-12-23 02:39:26
问题 I have this string: string input = "1,2,3,4,s,6"; Pay attention to the s character. I just want to convert this string in a List<int> using LINQ. I initially tried in this way: var myList = new List<int>(); input.Split(',').ToList().ForEach(n => myList.Add(int.TryParse(n, out int num) ? num : -1) ); lista.RemoveAll(e => e == -1); But I prefer not have any -1 instead of a no-number characters. So now I try with this: var myList = new List<int>(); input.Split(',').ToList() .FindAll(n => int