Posts

antlr4 - ANTLR - how to skip missing tokens in a 'for' loop -

Image
i'm developing 'toy' language learn antlr. my construct for loop this. for(4,10){ //program expressions }; i have grammar think works, it's little ugly. i'm not sure i've handled semantically unimportant tokens well. for example, comma in middle there appears token, it's unimportant parser, needs 2 , 3 loop bounds. means when see child() elements parts of loop token, have skip unimportant ones. you can see best if examine antlr viewer , @ parse tree this. red arrows point tokens think redundant. feel should making more use of skip() feature am, can't see how insert grammar tokens @ level. loop: 'for(' foridxitem ',' foridxitem '){' (programexpression)+ '}'; foridxitem: num #forindexnumÌ | var #forindexvar; the short answer antlr produces parse-tree, there cruft step on or otherwise ignore when walking tree. the longer answer there tension between skip...

Cannot import com.google.android.maps.MapView -

i wanna import com.google.android.maps.mapview to project in android studio, prompt error "cannot resolve symbol 'maps'". class mapoverlay extends com.google.android.maps.overlay { .... } how solve it? thanks change compile 'com.google.android.gms:play-services:5.+' in build.gradle compile 'com.google.android.gms:play-services:6.1.11' or use: supportmapfragment here example: http://www.truiton.com/2013/05/android-supportmapfragment-example/

android - How to save app data on Google Drive? -

i want use google drive as server store app data. so, have written data file , upload file drive. code: try { // outputstream.write(bitmapstream.tobytearray()); outputstream.write(text.getbytes()); } catch (ioexception e1) { log.i(tag, "unable write file contents."); } metadatachangeset metadatachangeset = new metadatachangeset.builder() .setmimetype("text/txt").settitle("testfile.txt").build(); intentsender intentsender = drive.driveapi .newcreatefileactivitybuilder() .setinitialmetadata(metadatachangeset) .setinitialdrivecontents(result.getdrivecontents()) .build(mgoogleapiclient); try { startintentsenderforresult(intentsender, request_code_creator, null, 0, 0, 0); } catch (sendintentexception e) { log.i(tag, "failed launch file chooser."); ...

How to assign textfield or any delegate in Swift Language? -

i new born developer swift language. want assign textfield delegate view controller. tried assign this class loginviewcontroller: uiviewcontroller <uitextfielddelegate> it's returning following error "cannot specialize non-generic type 'uiviewcontroller'" you need add protocols want conform using comma: class loginviewcontroller: uiviewcontroller, uitextfielddelegate you can extend only 1 class, conform many protocols want: class loginviewcontroller: uiviewcontroller, uitextfielddelegate, uialertviewdelegate from apple doc : class someclass: somesuperclass, firstprotocol, anotherprotocol { // class definition goes here }

email - gitlab] how the disable the user confirmation e-mail -

currently, using gitlab, , love using great one. however, users cannot receive confirmation email , cannot loggin. 1) confirm them through admin privilege or 2) configure system not send email confirmation. any ideas? thank in advance. like @shin-haeng-kang said, new user, setting signup_enabled: false in site settings , creating users admin menu , editing password after creating user work. if users exists, found following issue request shows how edit postgres database manually. from gitlab server: sudo -u git -h psql -d gitlabhq_production gitlabhq_production=> update users set confirmation_token=null, confirmed_at=now() confirmed_at null;

Splitting objects inside Java stream -

i wondering possible split object inside stream. example employee : public class employee { string name; int age; double salary; public employee(string name, int age, double salary) { this.name = name; this.age = age; this.salary = salary; } public string getname() { return name; } public int getage() { return age; } public double getsalary() { return salary; } } i perform operation in stream. simplicity, let (assume code architecture not allow put inside employee class - otherwise easy): public void someoperationwithemployee(string name, int age, double salary) { system.out.format("%s %d %.0f\n", name, age, salary); } now looks this: stream.of(new employee("adam", 38, 3000), new employee("john", 19, 2000)) // conversations go here ... .foreach(e -> someoperationwithemployee(e.getname, e.getage(), e.getsalary)); the question - possible put code inside stream...

c# - WinRT decimal to string formatting -

i have decimal value need display in xaml. the problem win rt not support stringformat in xaml. i trying use converter then: public class decimaltocurrencyconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, string language) { if (value decimal) { return value.tostring("c2", system.globalization.cultureinfo.currentculture); } } public object convertback(object value, type targettype, object parameter, string language) { throw new notimplementedexception(); } } the problem above approach not work. what need convert numbers like: 1234.78 1.234,78 or 1 234.78 or 1 234,78 depending on parameters how can in winrt? thank you! try understand here. numberformatting supporting in winrt/ https://msdn.microsoft.com/en-us/library/windows/apps/windows.globalization.numberformatting.aspx