[Solved] Chef Apache2 recipe failing during server build

With OHAI 7, you don’t need (and can’t) reload plugins on the basis of the filename where the specific function is provided. Instead, you reload it based on the specific attribute you want to reload. Thus, while the attributes in node[‘etc’][‘passwd’] still are provided by a plugin named passwd.rb, you can’t reload it that way. … Read more

[Solved] PHP issue with checkbox value [closed]

First of all you are going to want to change your $datesAvailableArray so that it contains an actual dates. ISO 8601 strings are an excellent format. $datesAvailableArray = array( ‘Saturday’ => array( ‘2014-11-14T11:00:00Z’, ‘2014-11-14T12:00:00Z’, ‘2014-11-14T13:00:00Z’, ‘2014-11-14T14:00:00Z’ ), ‘Sunday’ => array( ‘2014-11-15T11:00:00Z’, ‘2014-11-15T12:00:00Z’, ‘2014-11-15T13:00:00Z’, ‘2014-11-15T14:00:00Z’ ) ); Now that we have date strings we can create … Read more

[Solved] How to change datetime format in javascript?

There are, of course, vanilla solutions but working with date/time in JS is generally a pain. If you’re going to be working with date/time in any serious capacity I would highly recommend using Moment.js‘s format method for its robustness and flexibility, and it should be able to do what you want. Examples from the docs: … Read more

[Solved] RegEx in Java for multiple hits [closed]

Try with JSON library sample code: JSONObject jsonObject = new JSONObject(jsonString); JSONObject innJsonObject = jsonObject.getJSONArray(“entries”).getJSONObject(0); System.out.println(innJsonObject.get(“pageref”)); // page_0 System.out.println(innJsonObject.get(“time”)); // 515 You can try with GSON library as well. sample code: Gson gson = new Gson(); Type type = new TypeToken<Map<String, ArrayList<Map<String, Object>>>>() {}.getType(); Map<String, ArrayList<Map<String, Object>>> data = gson.fromJson(reader, type); Map<String, Object> map = … Read more

[Solved] Iterate over a list in python

A simple way is to simply print each string in the returned whois: host=”stackoverflow.com” whois = pythonwhois.net.get_whois_raw(host) for item in whois: print item This would output something like this: Domain Name: STACKOVERFLOW.COM Registrar WHOIS Server: whois.name.com Registrar URL: http://www.name.com Updated Date: 2014-05-09T17:51:17-06:00 Creation Date: 2003-12-26T19:18:07-07:00 Registrar Registration Expiration Date: 2015-12-26T19:18:07-07:00 Registrar: Name.com, Inc. Registrar IANA … Read more

[Solved] Iterate over a list in python

Introduction Python is a powerful programming language that allows you to iterate over a list in a variety of ways. Iterating over a list is a common task in programming, and Python provides several methods for doing so. In this article, we will discuss how to iterate over a list in Python using various methods … Read more

[Solved] To convert a particular format to NSDate [closed]

Use this code to get the Current Date NSDateFormatter *dateFor=[[NSDateFormatter alloc]init]; NSString *currentDateString = @”2014-01-08T21:21:22.737+05:30″; [dateFor setDateFormat:@”yyyy-MM-dd’T’HH:mm:ss.SSSZZZZ”]; NSDate *currentDate = [dateFor dateFromString:currentDateString]; NSLog(@”CurrentDate:%@”, currentDate); 5 solved To convert a particular format to NSDate [closed]