[Solved] How to convert the Varchar of sum to time using sql server 2008 [closed]

Try this: DECLARE @SUM VARCHAR(50)=’33.90′; SELECT CAST(CAST(LEFT(@SUM,CHARINDEX(‘.’,@SUM,0)-1) AS INT)+ CAST(SUBSTRING(@SUM,CHARINDEX(‘.’,@SUM,0)+1,LEN(@SUM)) AS INT)/60 AS VARCHAR(10))+’.’+ CAST(CAST(SUBSTRING(@SUM,CHARINDEX(‘.’,@SUM,0)+1,LEN(@SUM)) AS INT)%60 AS VARCHAR(10)) result: 34.30 1 solved How to convert the Varchar of sum to time using sql server 2008 [closed]

[Solved] how to write regex for this expression in java

The short answer: #a.+#((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?) This will match any character except line breaks in the content section, and should match any url. NOTE: You will have to escape all backslashes in the given regex to represent it as a java String literal. Sources for the url regex: What is the best regular expression to check if … Read more

[Solved] Swift 2 get the number of images in main bundle [closed]

Try this EDITED let myArray = NSMutableArray() var image:UIImage! var nimages = 0 for(;;nimages++){ let nameOfImg_ = entity.attribute let imageName = String(format: “name%@number%lu.jpg”, arguments: [nameOfImg_,(nimages + 1)]) if((NSBundle.mainBundle().pathForResource(imageName, ofType: nil)) != nil){ image = UIImage(contentsOfFile: NSBundle.mainBundle().pathForResource(imageName, ofType: nil)!) myArray.addObject(image!) }else{ break } } entity.attribute must be a String 12 solved Swift 2 get the number … Read more

[Solved] How to count elements in a list and return a dict? [duplicate]

Using no external modules and only the count, although there would be some redundancy using dict comprehension: d = {itm:L.count(itm) for itm in set(L)} If you are allowed to use external modules and do not need to implement everything on your own, you could use Python’s defaultdict which is delivered through the collections module: #!/usr/bin/env … Read more

[Solved] how to add search functionality in edittext in Android

Load all the contacts in array list or string array and then use AutoCompleteTextView for adding search functionallity Gett all contacts like this as expalined here public ArrayList<PhoneContactInfo> getAllPhoneContacts() { Log.d(“START”,”Getting all Contacts”); ArrayList<PhoneContactInfo> arrContacts = new ArrayList<PhoneContactInfo>(); PhoneContactInfo phoneContactInfo=null; Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI; Cursor cursor = context.getContentResolver().query(uri, new String[] {ContactsContract.CommonDataKinds.Phone.NUMBER,ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,ContactsContract.CommonDataKinds.Phone._ID}, null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + … Read more

[Solved] Why does this method cause infinite recursion? [closed]

func is always calling itself. There is no stopping condition. Each call creates a new stack frame, until the call stack is full and StackOverflowError is thrown. Recursive methods should always have a stopping condition. For example – n < 0 : public static int func(int n){ int result; if (n >= 0) result = … Read more

[Solved] Filter list with complex expression

I believe this does what you want… arr = [[2,6,8],[1,4,7],[3,3,4],[2,4,9],[3,3,7]] foo = lambda arr, evenOdd, noDoubles: [ i for i in arr if not (evenOdd and (all(k % 2 == 1 for k in i) or all(k%2 == 0 for k in i))) and not (noDoubles and (len(i) != len(set(i))))] print(foo(arr, False, False)) print(foo(arr, True, … Read more