Posts

Showing posts from August, 2011

onPostExecute is getting null result on Android 4.2.2 -

my code working on upper version of android. whenever trying run program on jelly bean 4.2.2 not working. minimum sdk version is: 14 , target sdk version is: 22 my code is: private class authasync extends asynctask<string, integer, string> { @override protected void onpreexecute() { } @override protected string doinbackground(string... params) { httpget request = new httpget(params[0] + params[1]); responsehandler<string> responsehandler = new basicresponsehandler(); string responsetxt = null; httpclient client = paywellservices.gettrustedhttpclient(); try { responsetxt = client.execute(request, responsehandler); } catch (clientprotocolexception ex) { ex.printstacktrace(); } catch (ioexception ex) { ex.printstacktrace(); } return responsetxt; } @override protected void onpostexecute(string result) { super.onpostex

html - Display tab contents - Javascript -

Image
i working js function have tabbed panel , each tab opens division within same html file. i've set first tab's displayed default(these contents active page loads). when try clicking second tab specified tab's contents don't displayed. html forms displayed under each tab first tab's contents under division addrequest division <div id="addrequest" class="tabcontent"> <div id="form_container"> <!--<h1><a>acquisition</a></h1>--> <form id="form_1147240" class="appnitro" method="post" action=""> <div class="form_description"> <h2>acquisition</h2> <p>enter details of material required</p> </div> <ul > <div id="leftdiv" style="float: left; width: 50%;" > <!--material type--> <li id="li_7&q

php - Symfony Voter : Access denied, the user is neither anonymous, nor remember-me -

i'm pretty new symfony. i'm trying tu use voter on admin area. i want admin (role_admin) able delete (remove) user if he's superadmin (role_super_admin). my firewall seems work fine can login on admin area , want till i'm not using voter. here's dump of curent user object : user {#300 ▼ -id: 1 -password: "$2y$13$e3ll2n/pygrgn.7efikqsuamsklolcnggtf1hsbgnmzdxnal1aiua" -username: "justme" -email: "me@me.fr" -isactive: true -roles: array:1 [▼ 0 => "role_admin" ] } as use denyunlessgranted() in controller exception : debug - access denied, user neither anonymous, nor remember-me. error - uncaught php exception symfony\component\httpkernel\exception\accessdeniedhttpexception: "access denied." @ /volumes/work/mamp htdocs/a-symfony-re/vendor/symfony/symfony/src/symfony/component/security/http/firewall/exceptionlistener.php line 119 this security config : role_hierarchy: role_author

c# - Localization of data annotations in separate class library -

we trying implement localization our domain models existing in separate class library project within our solution. however, not able working our models data annotation attributes doesn't translated @ all. project structure solution web project resource folder (contains .resx files. ex. app.en.resx ) works fine class library domain models resource folder (contains .resx files. ex. app.en.resx ) doesn't work startup.cs services.addmvc() .addviewlocalization(languageviewlocationexpanderformat.suffix) .adddataannotationslocalization(); note localization works within web project, e.g translates views, controllers. however, doesn't work when try translate models exists in separate project. // regards there no support translate data annotations, views, controller etc exists in separate project without implementing yourself. the solution write own custom implementation using istringlocalizer, istringlocalizerfactory , register in

Xcode annoying delete breakpoint sound -

is there way turn off annoying sound plays when delete breakpoint dragging off? know, there osx utilities, enable turning off sound of particular application, skip option (i'm using soundflower , causes problems audio output time time). you can mute sound effects on mac under system preferences ==> sound ==> sound effects.

python - Send one file at a time? -

my python script: #!/usr/bin/python import cameraid import time import os image="/tmp/image/frame.png" count = 1 while (count==1): # make sure file file exists, else show error if ( not os.path.isfile(image)): print("error: %s file not found" %image) else: print("sending file %s ..." % image) print cameraid.run() print os.remove("/tmp/image/frame.png") does know how allow file send 1 @ time different filename. once file send, removed instantly. just make list of files want transfer, iterate on list send files 1 one. here simple function list of files: def list_of_files(folder, extension): ''' return list of file-paths each file folder target extension. ''' import glob return glob.glob(str(folder + '*.' + extension)) in case be: files = list_of_files('/tmp/image/','png') image in files: if ( not os.path.isfile(image)): p

Regex: pattern repeated capture – delimit the matching at the end of the pattern - non capture group and lookaheads negative exemple -

Image
i wish match end of text , have match characters , line breaks. but must exclude beginning of next capture! what want delimit end of pattern next pattern begins. i tried replace [^-] by like (?!-{2}\\*{3}) it doesn't work ! so want capture number , want capture whole paragraph (some text) between (--*** x ***) thanks using regex seems work: --\*{3}([\d]*)\*{3}(((?!-).*\n)*) 1st capturing group: digit inside stars. 2nd capturing group: text between "headers" 3rd capturing group: last line of paragraph. a link regex tested: https://regex101.com/r/xj0gc6/1

java - Download link to CSV file in the mail using spring boot -

i generating csv in code, takes time generate. so, sending email link once csv file generated. when click that, getting 404 not found error. when have same link in html, able download it. insight or sample refer sample link -http://localhost:9090/api/report/file?filename=filename.csv java code download report @requestmapping(value = "api/report/file") public void downloadcsv(httpservletresponse response, @requestparam("filename") string filename) throws ioexception { file file = new file(filename); inputstream = new fileinputstream(file); response.setcontenttype("application/octet-stream"); // response header response.setheader("content-disposition", "attachment; filename=\"" + file.getname() + "\""); // read file , write response outputstream os = response.getoutputstream(); byte[] buffer = new byte[1024]; int len; while ((len = is.read(buffer)) != -1) {

makefile - Issue with Redis install - geohash-int/geohash.o -

i have problem below when try install redis 3.2.1: [root@clj-lc-test01 redis-3.2.1]# make cd src && make make[1]: entering directory `/tmp/redis-3.2.1/src' link redis-server cc: ../deps/geohash-int/geohash.o: no such file or directory cc: ../deps/geohash-int/geohash_helper.o: no such file or directory make[1]: *** [redis-server] error 1 make[1]: leaving directory `/tmp/redis-3.2.1/src' make: *** [all] error 2 could point me right direction? i've seen errors , solution have been cd deps , run make ... problem. what should run here? thank you, gabriel i have solved going deps folder , run make geohash-int thank you! gabriel

laravel - Laravel5:Redirect::to() outside link NotFoundHttpException in RouteCollection.php -

i'm developing laravel 5 app, have route route::get('/go','urlcontroller@index'); and in urlcontroller.php,i have index method public function index(){ return redirect::to('www.google.com',302); } when test url http://localhost:8000/go change http://localhost:8000/www.google.com , have error notfoundhttpexception in routecollection.php line 161 problem , thanks you should add protocol before www.google.com public function index(){ return redirect::to('https://www.google.com',302); }

ios - UITableviewcell show delete button from using dictionary keys instead of NSMutableArray array data -

this code delete row in tableviewcell. - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { if (editingstyle == uitableviewcelleditingstyledelete) { [keys removeobjectatindex:indexpath.row]; // line error [_tableview deleterowsatindexpaths:[nsmutablearray arraywithobject:indexpath] withrowanimation:uitableviewrowanimationfade]; } } the error line `[keys removeobjectatindex:indexpath.row];' . i know code should use in nsmutablearray, want use same method dictionary keys plist delete cell. the editable: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ static nsstring *cellidentifier = @"cell"; customecell *customecell = [self.tableview dequeuereusablecellwithidentifier:cellidentifier]; if (customecell == nil){ customecell =[[customecell alloc] ini

ruby - Search functionality rails 4 -

i have current implementation allows me filter search results category name class category < activerecord::base has_many :bike_categories has_many :bikes, through: :bike_categories end class bikecategory < activerecord::base # holds bike_id , category_id allow multiple categories saved per image, opposed storing array of objects in 1 db column belongs_to :bike belongs_to :category end class bike < activerecord::base has_many :bike_categories, dependent: :destroy has_many :categories, through: :bike_categories end model def self.search(params) includes_categories(params[:name]) end def self.includes_categories(category_names) joins(:categories) .where(categories: { name: category_names }) .group('bikes.id') .having("count(*) = ?", category_names.size) end so if have following data bike id: 1 title: 'bike 1' id: 2 title: 'bike 2' category id: 1 name: 'mens' id: 2 name: 'womens' id: 3 name:

javascript - Not able to plot line in d3 chart -

i trying make d3 chart interactive, before have chart , div chart id. on click of id filtering data , trying plot no luck i new d3 due not able understand issue also data4.json { "data_high":[ { "line_id": "i6_line", "line_name": "6 line", "mean": 73.400000000000006 }, { "line_id": "i5_line", "line_name": "5 line", "mean": 73.400000000000006 }, { "line_id": "i4_line", "line_name": "4 line", "mean": 73.400000000000006 }, { "line_id": "i3_line", "line_name": "3 line", "mean": 73.400000000000006 } ] } data5.json { "data_low":[ { "line_id": "i6_line", "line_name": "6 l

oracle11g - Replication advice Oracle 11g -

we have requirement implement replication (of transactions) production database test database (across db link). we're using 11g enterprise edition. this because it's not production data that's needed, intention code releases in test database tested against real-world transactions prod system, without need transactions done manually. if transaction fails in test system worked in prod system, wrong release. it doesn't have in real-time however, delay acceptable. there must 0 risk though on production transactions failing, due issue replication. what options here? believe streams deprecated in 12c, should of concern? goldengate additional ££, i'm afraid rules out in case. kind of custom trigger-based solution... risk on prod system far can see. any advice appreciated! as of oracle release 12c (12.1.x), oracle advanced replication , oracle streams being discontinued. oracle golden gate going replace features of oracle advanced replication , oracle

java - get 2 characters from a string -

i have string filename holds file names in foreach loop. string like: myfile_test_india_20160728 myfile_test_america_20160728 myfile_test_germany_20160728 i need first 2 characters of country name. tried below: string rmtdir = filename.substring(filename.length() - 12, filename.length() - 12); system.out.println(rmtdir); but using required data india. other countries, manually need update 2nd part of substring, keeping extended length of countries in mind. like america , germany: string rmtdir = filename.substring(filename.length() - 12, filename.length() - 14); is there way go starting index , select number of positions selected? assuming format 2 examples, i'd use split() , substring() string test = "myfile_test_india_20160728"; string countrycode = test.split("_")[2].substring(0,2); system.out.println(countrycode); // print in

javascript - VS2015 Excel Web AddIn crashes Excel 2016 -

Image
i have created new excel web addin in visual studio 2015. ran default project without changes in excel 2016. when clicked on "show taskpane" in excel's ribbon, excel crashes. i've tried repairing office , visual studio, followed reinstalling them completely, problem still persists. is known issue? else can try, shy of resetting or reformatting windows? my environment: visual studio 2015 enterprise update 3 office developer tools 14.0.23928 64-bit windows 10 pro, no new window updates 32-bit excel 2016 (pro plus), updated/reinstalled today, all com addins/addins disabled this see when click on show taskpane ribbon button: the task pane appears, after split second, excel crashes here's event log: faulting application name: excel.exe, version: 16.0.7070.2033, time stamp: 0x57964b42 faulting module name: excel.exe, version: 16.0.7070.2033, time stamp: 0x57964b42 exception code: 0xc0000005 fault offset: 0x00550741 faulting process id:

cq5 - how to filter asset and meta-data property values using query builder in aem -

type:nt:unstructured path=/content/dam/en_us node=jcr:content group.1_property=cmg_name group.1_property.operation=exists group.1_property.value=web standard i have assets pdf , images inside \content\dam\en-us , have meta data respective assets .i want pdf or image asset metadata property values .but notable exact output.i have asset c012666.png inside jcr:cotent inside metadata.now, if give property value have pdf file.so, pls can 1 help??? if want list properties of hit have use p.hits = full. , if want list it's children have use p.nodedepth = amount_of_sublevels. for example query http://localhost:4502/bin/querybuilder.json?p.hits=full&property=jcr%3atitle&property.value=default%20design&p.nodedepth=2 will list properties of the node called "default design" , list children of it hope suits needs here's documentations https://hashimkhan.in/2015/12/02/query-builder/

backbone.js - Exporting a function with RequireJS in Node returns an empty object -

how export function requirejs module in node? code have, empty object rather backbone model i'm expecting. first.js contains: 'use strict'; var define=require('amd-define'); define(function (require) { var backbone = require('backbone'); // our basic **todo** model has `title`, `order`, , `completed` attributes. var todo = backbone.model.extend({ // customizations of model... }); return todo; }) my test file test.js contains: 'use strict'; var chai =require("chai"); var assert=chai.assert; var expect=chai.expect; var todo=require("first"); describe('tests todo model', function () { it('should create global variables todo', function () { expect(todo).to.be.exist; console.log(typeof (todo)) }); it('should created default values attributes', function() { var todo = new todo(); expect(todo.get('title')).to.equal('')

html - how to add inline css to rails link_to helper -

am on rails 5 , categories have images. want use images backround images when set in styling url not change <div class="grid-category"> <% @servicescategories.each |category| %> <%= link_to servicecategories_path(slug: category.slug ), :style=>'background-image: asset-data-url("category.category_image");', class: "category-item" %> <h3> <%= category.name %></h3> <% end %> <% end %> </div> what doing wrong here you need interpolate value of category.category_image <%= link_to servicecategories_path(slug: category.slug ), class: "category-item" %> <div style="background-image: url(<%= asset_path('category.category_image') %>)"> <h3> <%= category.name %></h3> </div> <% end %>

jquery - Javascript - Add users ip address to form textbox -

the script below collects users external ip , writes page, want able put in form textbox , write value database. have tried results in null value. <!-- start: here's ip stuff --> <script type="application/javascript"> function getip(json) { document.write(json.ip) } </script> <script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getip"></script> <!-- end: ip stuff --> <form> <input type="text" id="ipadderss"> </form> isn't you're trying do? using pure javascript can change input value document.getelementbyid("ipaddress").value = json.ip; . moved form top. <form> <input type="text" id="ipaddress"> </form> <!-- start: here's ip stuff --> <script type="application/javascript"> function getip(json) { document.getelementbyi

JSON2HTML: Not a valid JSON list python -

i have piece of json in file convert html. seen online there tool called json2html python takes care of me. [{ "name": "steve", "timestampe": "2016-07-28 10:04:15", "age": 22 }, { "name": "dave", "timestamp": "2016-07-28 10:04:15", "age": 34 }] above json, when using online converter tool - http://json2html.varunmalhotra.xyz/ works great , produces nice table me. however when install library using pip , run following: _json = [{ "name": "steve", "timestampe": "2016-07-28 10:04:15", "age": 22 }, { "name": "dave", "timestamp": "2016-07-28 10:04:15", "age": 34 }] print json2html.convert(json=_json) i error file "/root/.pyenv/versions/venv/lib/python2.7/site-packages/json2html/jsonconv.py", line 162, in iterjson rai

apache zookeeper - Consume and produce message in particular Kafka partition? -

for reading partitions in topic: ~bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic mytopic --from-beginning how can consume particular partition of topic? (for instance partition key 13) and how produce message in partition particular partition key? possible? you can't using console consumer , producer. can using higher level clients (in language works you). you may use example assign method manually assign specific topic-partition consume ( https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/kafkaconsumer.java#l906 ) you may use custom partitioner override partitioning logic decide manually how partition messages ( https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/producer/producerconfig.java#l206-l208 )

osx - How do I change the RAM setting in VirtualBox? -

Image
i work on macbook air 4gb of ram. projects, use ubuntu in virtualbox (by way of vagrant). vms have insufficient ram. virtualbox takes of ram (2gb). can not change limits, slider not work (it frozen?). you can following in vagrantfile vagrant.configure("2") |config| # ... other configuration config.vm.provider "virtualbox" |v| v.memory = 1024 end end this allow 1gb on vm.

twitter bootstrap - Why text and input on same line? -

i have example . here html , bootstrap3: <form class="form-horizontal"> <div class="form-group"> <label for="inputemail3" class="col-sm-2 control-label">email</label> <div class="col-sm-10"> <input type="email" class="form-control" id="inputemail3" placeholder="email"> </div> </div> <div class="form-group"> <label for="inputpassword3" class="col-sm-2 control-label">password</label> <div class="col-sm-10"> <input type="password" class="form-control" id="inputpassword3" placeholder="password"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <div class="checkbox"> <label>

jupyter notebook - Manage google dataproc preemptible-workers persistent disk size -

i'm using jupyter on cluster created using google dataproc , working well. i tried change cluster " size " (machine type, boot disk size, number of workers, ...) fit needs, , working pretty well. the main issue don't how change persistent disk size preemptible-workers. i'm using command: gcloud dataproc clusters create jupyter --project <my_project> --initialization-actions gs://dataproc-initialization-actions/jupyter/jupyter.sh --num-preemptible-workers 0 --master-boot-disk-size 25 --worker-boot-disk-size 10 --worker-machine-type n1-standard-1 --worker-boot-disk-size 10 i hoped " --worker-boot-disk-size 10 " option have been applied preemptible ones, did not. so, there way change preemptible-workers boot disk size? furthermore, google charge me preemtible worker persistent disk usage? the beta dataproc gcloud channel offers --preemptible-worker-boot-disk-size sounds thing want. for example: gcloud beta dataproc cl

hadoop - Run pig in oozie shell action -

i have created simple pigscript loads 10 records , stores in table. when invoke pig(stored in hdfs) file using oozie shell action,i , error follows: >>> invoking shell command line >> exit code of shell command 5 <<< invocation of shell command completed <<< <<< invocation of main class completed <<< failing oozie launcher, main class [org.apache.oozie.action.hadoop.shellmain], exit code [1] oozie launcher failed, finishing hadoop job gracefully i have put shell file in lib folder in workspace , added required jar files in same lib folder. please me solve issue. i solved this issue following steps: 1)created workflow in hue placing pig action invoke pigscript. 2)generated workflow.xml file clicking run button. 3)ran workflow.xml through commandline adding shell wrapper class iterates , gives dates input parameters. job.properties file: oozie.use.system.libpath=true security_enabled=false dryrun=false jobtracker

c# - Errors when I split a string -

this question has answer here: confusing error when splitting string 4 answers when try split strings, got 2 type of errors: error 1 best overloaded method match 'string.split(params char[])' has invalid arguments error 2 argument 1: cannot convert 'string' 'char[]' this part of code that: if (string.isnullorempty(data_odd)) { if (node.getattributevalue("class", "").contains(("first-cell"))) rowbet.match = node.innertext.trim(); var matchteam = rowbet.match.split("-", stringsplitoptions.removeemptyentries); rowbet.home = matchteam[0]; rowbet.host = matchteam[1]; if (node.getattributevalue("class", "").contains(("result"))) rowbet.result = node.innertext.trim(); var matchpoints = rowbet.result.split(":", strings

twilio - Dynamic destination phone assign, at incoming call start -

i looking possibility implement call tracking twilio. what need right @ start of incoming call able change destination number call. how achievable twilio via api? reading api docs found there real-time call , message routing feature ( here ) , followed example ( here ) it's not achieve. thanks ahead suggestion , help! --steve twilio developer evangelist here. you absolutely can dynamically change destination number calls on twilio. when forwarding calls use <dial> noun in twiml so: <response> <dial>your_number_here</dial> </response> however, if serve twiml dynamically can return whatever number in <dial> tag want, based on whatever conditions want. example in ruby using sinatra: post "/voice" if params["from"] === some_special_number number = forwarding_number_1 else number = forwarding_number_2 end "<response> <dial>#{number}</dial> </response&g

python - pandas pivot_table apply aggfunc last instance -

i have made pivot table various columns , have applied aggfunc np.sum , first , count. want last instance of corresponding value of column dataframe. there function serve purpose? i think can use aggfunc='last' sample: df = pd.dataframe({ 'age':[35, 37, 40, 29, 31, 26, 28], 'city':['b', 'ch', 'la', 'ch', 'b', 'b', 'ch'], 'position':['m','m','m','p', 'p','m','m']}) print (df) age city position 0 35 b m 1 37 ch m 2 40 la m 3 29 ch p 4 31 b p 5 26 b m 6 28 ch m print (df.pivot_table(index='position', columns='city', values='age', aggfunc='last')) city b ch la position m 26.0 28.0 40.0 p 31.0 29.0 nan

c# - Save an exception on an Outlook add-in -

i trying programmatically change items of recurrence (and make exceptions). the project outlook 2010 addin. i tried following code after couple of saves code exited @ calitm.save() command extracted ="somelocation" //that's fancy way iterate on list of appointment items (int = 0; < filterappointmentstochangelocation.recordcount; i++) { int selrow = 1 var calitm = filterappointmentstochangelocation.data[selrow].getolappointment(); //this returns appointmentitem associated form //that contains location property calitm.userproperties["location"].value = extracted; calitm.save(); marshal.releasecomobject(calitm); } do have suggestions? thnx time... if code exists means crashing during call save method. you need try/catch faulting code can save/rethrow exception for (int = 0; < filterappointmentstochangelocation.recordcount; i++) { int selrow = 1 var calitm = filterappointmentstochangelocation.

python - Django unit test on custom model manager method -

i pretty new in python , django. i have model custom model manager method ,where raising validationerror on exceptions.now want test custom manager method.but don't know how catch validationerror or anyother error in terms of testing django model's customs manager method. my scenario depicted below, class custommodelmanager(model.manager): def custom_method(self): #for exception raise validationerror('a sample validation error') class samplemodel(models.model): ###fields objects = custommodelmanager() i have tried following unit test,but not working , def test_samle_model(self): issues = issues.objects.custom_method(field1='wrong field')###this raise validationerror self.assertequalvalidationerror, 'a sample validation error') is possible catch 'any error' test? or missing something? you want `assertraises' : def test_sample_model(self): self.assertraises(validationerror

css - Make p:fileUpload advanced mode appear like simple mode -

Image
i'm trying display fileupload advanced mode , ajax feature, wold make appear simple mode, display button label name, facelet <p:fileupload fileuploadlistener="#{scriptmanagerform.uploadsourcefile}" auto="true" skinsimple="true"> <f:attribute name="name" value="#{sourcefile.name}" /> </p:fileupload> with css .fileupload-content{ display: none; } .ui-fileupload .fileinput-button { background-color: rgba(142, 103, 64, 0.98); } thank you, not sure why want this, css perspective code below: /*hide advanced buttons , progress*/ .ui-fileupload-upload, .ui-fileupload-cancel, .ui-fileupload-progress{ display: none; } /*move file name , size of file onto same line*/ .ui-fileupload-buttonbar, .ui-fileupload-content{ float: left; } /*remove of margin file name

android - Unable to setup IBM Worklight on my mac -

Image
i using mac os 10.11.4, eclipse mars jee 64 bit & adt i'm trying run ibm mobilefirst plugin in eclipse mars, not showing me in create new project image shown below.i have added necessary plug ins successfully. after installation of plug in showing success image shown below. i'm loading ibm mobilefirst eclipse marketplace. as new hybrid application development please guide me setup eclipse, ibm mobile first or worklight , adt bundle plug in step-by-step. thanks in advance. i think first need read product before installing it... in mobilefirst foundation 8.0 things different . create standard cordova application using cordova cli , add mobilefirst sdk using cordova cli, because sdk made of set of cordova plug-ins . the studio plug-in tool exposes mobilefirst cli functionality in ui, such as: loading console, registering applications, previewing applications... read more mobilefirst foundation 8.0 here: https://mobilefirstplatform.ibmclo

Firebase authentication: linking multiple accounts in Swift -

i've set firebase authentication ios app using facebook, google & email/password sign in , it's working fine. authentication happens when user wants access high-priority parts of app (i.e. don't require users sign in start using app). on app start up, sign users in anonymously in background , that's working fine too. i've read documentation i'm struggling understand code required enable me link anonymous account facebook/email signed in account in following flow: new user opens app user signed in anonymously in background (new user.uid "a" created) low priority data stored against anonymous user in firebase realtime db user hits high-priority area needs authenticate user signs in using facebook (new user.uid "b" created) previous user.uid "a" needs linked user.uid "b" my method looks this: func signupwithfacebook(){ // track anonymous user link later let prevuser = firauth.auth()?.currentu

swift - Compiler error when comparing values of enum type with associated values? -

class myclass { enum myenum { case firstcase case secondcase(int) case thirdcase } var state:myenum! func mymethod () { if state! == myenum.firstcase { // } } } i compiler error pointing @ if statement:: binary operator '==' cannot applied 2 'myclass.myenum' operands if instead, use switch statement, there no problem: switch state! { // also, why need `!` if state // implicitly unwrapped optional? because optionals // internally enums, , compiler gets confused? case .firstcase: // something... default: // (do nothing) break } however, switch statement feels verbose: want do something .firstcase , , nothing otherwise. if statement makes more sense. what's going on enums , == ? edit: ultra-weird. after settling switch version , moving on other (totally unrelated) parts of code, , coming back, if -statement version (comnparing force

xcode - Module 'GoogleMobileAds' not found in iOS -

came across topic similar problem, unable solve it. integrated admob ads in unity app ios , loaded project in xcode. added framework googlemobileads dragging project window. unfortunately when build project error displayed. i tryed replace googlemobileads.h on #import <googlemobileads/googlemobileads.h> in gadunativecustomtemplatead.h not me. used google mobile ads unity plugin v3.0.4 xcode v. 7.3.1 error: umbrella header googlemobileads h not found 1 img 2 img i found solution in video https://www.youtube.com/watch?v=rxo_rcmxgu4 , here summary: download googlemobileadssdkios.zip https://firebase.google.com/docs/admob/ios/download unzip file. go project navigator view. move unzip file inside framework folder. build code, if doesn't work substitute string gives error with (void)loadrequest:(gadrequest *)request withadunitid:(nsstring *)adunitid userid:(nsstring *)userid { [self.rewardbasedvideo loadrequest:request withadunitid:adunitid]; }

javascript - Lankit Datatables Bundle in Symfony2 -

i have little problem backoffice implementation symfony, want print info in different tables , want filter them datatables system. code when go view info printed doens't print , give me 500 error, thead , tfoot prints tbody doens't. here code: routing: backoffice_view: path: /backoffice/table defaults: { _controller: apibundle:api:view } backoffice_table_info: path: /backoffice/table/info defaults: { _controller: apibundle:api:table } requirements: _method: controller: public function tableaction() { $datatable = $this->get('lankit_datatables')->getdatatable('apibundle:entity'); return $datatable->getsearchresults(); } public function viewaction() { return $this->render('apibundle:api:table.html.twig', array( )); } javascript table (i code filter in each column): $('#table tfoot th').each( function () { var title = $(this).text(); $(this).html( '<i

Leave Approval By Various Number of Managers odoo -

i need approve leaves of employees,by 3 level in odoo have 2 level approve but need 1.direct manager 2.hr 3.by ceo final approve how can in odoo? you can configure manager in employee abc employee having manager bcd. bcd having manger cde , cde having manager def. here bcd direct manager, cde hr , def ceo. should go searching manager @ top. not sure exact requirements otherwise can suggest go configuring departments each department having parent department.

c# - How to create a panel with support for Drag and Drop? -

Image
suppose have listbox custom elements , blank panel . when drag these items panel , must build on logic. example, if there's nothing panel , element located in middle. if there , new element stay near element closest . such possible implement? for example: i modified this answer of working drag , drop implementation adding sorting logic. placing item in middle visually can done css styling. assumption: "closest it" means closest alphabetically. public object lb_item = null; private void listbox1_dragleave(object sender, eventargs e) { listbox lb = sender listbox; lb_item = lb.selecteditem; lb.items.remove(lb.selecteditem); } private void listbox1_dragenter(object sender, drageventargs e) { if (lb_item != null) { listbox1.items.add(lb_item); lb_item = null; // here added logic: // sort items added // (thereby placing item in middle). listbox1.sorted = true; } } privat

java - How to resolve, JSONException: No value for "1" -

been looking around on site while, , i'm not getting anywhere. i creating android app getting list of values mysql db via php, , returning result encoded in json object: {"error":false,"values":{"1":{"name":"this string"}, "2":{...}}} i retrieving json object in java so: jsonobject jobj = new jsonobject(response); boolean error = jobj.getboolean("error"); if (!error) { jsonobject values = jobj.getjsonobject("values"); iterator<?> keys = values.keys(); while(keys.hasnext()) { string key = (string)keys.next(); jsonobject value = jobj.getjsonobject(key); ... } its @ point before ellipses exception: org.json.jsonexception: no value "1" am doing stupid, or what, looks ok me. have tried multiple different things keep getting same issue. name obj , add list of strings. can't seem beyond point. any or push in right direction grate

Is it possible to open multiple instances or split view of chrome developer tools tabs? -

Image
i want debug code @ same time see being sent on network tab without having go , forth between network tab , sources tab . there way of chrome version 52.0.2743.82 or version 54.0.2810.2 canary? i know possible log http request in console can visible other tabs open want actuall networks tab if possible.. thank in advance you can view 'quick source' while viewing network panel (or other main panels) @ same. allow view source , add breakpoints. however, it's not possible step through code using debugging in split view . chrome automatically switch sources tab if use shortcuts. it's not possible have extension running separate instance of debugger chrome debugging protocol doesn't allow simultaneous clients connected. i open discussion other chromium contributors feasibility of sharing debugging controls in split view. don't know whether or can done easily. suspect it's fair amount of work. if set split view, it's useful anyway, g

android - How to set each view own position in RecyclerView? -

Image
trying make recyclerview this: there lot of views in recyclerview, , each view has it's own position parameters. example, view1's position in 1 row, view2's , view3's position 1 after (like in linearlayout). etc... think realization related layoutmanager (maybe gridlayout). how set various position of each view? if use recyclerview, should define several rows/items recycler view, means define different layouts , inflate + fill them content runtime. in case should define 3 layouts. 1) layout 1 view 2) layout 2 views 3) layout 3 views implement baseadapter class fill recycler view view rows (the layouts have defined) further information @ sample developpers, how use 1 layout. procedure multiple layout rows (in case 3) same

android - fetching all the call details like number,call type etc after call disconnect and automatically post it with web services -

i have fetched call details through code. private void getcalldetails() { stringbuffer sb = new stringbuffer(); if (activitycompat.checkselfpermission(getactivity(), manifest.permission.read_call_log) != packagemanager.permission_granted) { return; } cursor managedcursor = getactivity().getcontentresolver().query(calllog.calls.content_uri, null, null, null, calllog.calls.date + " desc limit 40"); int number = managedcursor.getcolumnindex(calllog.calls.number); int type = managedcursor.getcolumnindex(calllog.calls.type); int date = managedcursor.getcolumnindex(calllog.calls.date); int duration = managedcursor.getcolumnindex(calllog.calls.duration); // sb.append("call details :"); string finaldate[]; while (managedcursor.movetonext()) { string phnumber = managedcursor.getstring(number); string calltype = managedcursor.getstring(type); string calldate = managed

bots - How to use the ThumbnailCard in IDialog Context -

Image
hi developing 1 bot using microsoft botframework project in using idialog interface. in using thumbnailcard displaying cards. here when attaching data cards , data attaching within postasync method it’s not providing reply. public virtual async task messagereceivedasync(idialogcontext context, iawaitable<imessageactivity> argument) { thumbnailcard plcard = null; imessageactivity replytoconversation =await argument; replytoconversation.type = "message"; replytoconversation.attachments = new list<attachment>(); replytoconversation.text = "welcome book show"; dictionary<string, string> cardcontentlist = new dictionary<string, string>(); cardcontentlist.add("jason bourne", "url"); cardcontentlist.add("the land", "url"); cardcontentlist.add("yoga hosers", "url"); foreach (keyvaluepair<string,