Posts

Showing posts from May, 2010

objective c - Uploading a file to Google drive using iOS sdk -

in current application, trying upload .text file google drive using google sdk ios . issue every time got error message in log insufficient permission , if have faced or have idea on type of error kindly me. here code, gtldrivefile *file = [gtldrivefile object]; file.descriptionproperty = @"uploaded ios app."; file.mimetype = @"text/*"; file.name=@"mytextfile"; nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"mytestfile" oftype:@"txt"]; gtluploadparameters *uploadparameters = [gtluploadparameters uploadparameterswithfileurl:[nsurl urlwithstring:filepath] mimetype:file.mimetype]; gtlquerydrive *query = [gtlquerydrive queryforfilescreatewithobject:file uploadparameters:uploadparameters]; [self.service executequery:query completionhandler:^(gtlserviceticket *ticket, id object, nserror *error) { if (error) { nslog(@"er

Spring SAML configuration is breaking other http connections -

i using spring saml implement single sign on in application. evreything integrated , works sso perspective. service of application uses http client post via axis started failing following error { http://xml.apache.org/axis/ }stacktrace:javax.net.ssl.sslpeerunverifiedexception: ssl peer failed hostname validation name: null i have looked answer provided link spring security saml + https page , follow same no avail. below configuration tlsprotocolsocketfactory <bean class="org.springframework.beans.factory.config.methodinvokingfactorybean"> <property name="targetclass" value="org.apache.commons.httpclient.protocol.protocol"/> <property name="targetmethod" value="registerprotocol"/> <property name="arguments"> <list> <value>https</value> <bean class="org.apache.commons.httpclient.protocol.protocol">

c# - Entity Framework v6.1 query compilation performance -

Image
i confused how ef linq queries compiled , executed. when run piece of program in linqpad couple of times, varied performance results (each time same query takes different amount of time). please find below test execution environment. tools used: ef v6.1 & linqpad v5.08. ref db : contosouniversity db downloaded msdn. for queries, using persons, courses & departments tables above db; see below. now, have below data: query goal: second person , associated departments. query: var test = ( p in persons join d in departments on p.id equals d.instructorid select new { person = p, dept = d } ); var result = (from pd in test group pd pd.person.id grp orderby grp.key select new { id = grp.key, firstname = grp.first().person.firstname, deps = grp.where(x => x.dept != null).select(x => x.dept).distinct().tolist() }).skip(1).take(1).tolist(); foreach(var r in result) {

php - Laravel 5 .htaccess url public remove not working -

i using laravel 5 default directory structure. removing public folder url using following code in .htaccess <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^(.*)$ public/$1 [l] </ifmodule> i using xampp , path http://localhost/pro/laravel5/public so project in htdocs/pro/laravel5/ here have kept above .htaccess else default when try access project following error. notfoundhttpexception in routecollection.php line 145: in routecollection.php line 145 @ routecollection->match(object(request)) in router.php line 719 @ router->findroute(object(request)) in router.php line 642 @ router->dispatchtoroute(object(request)) in router.php line 618 @ router->dispatch(object(request)) in kernel.php line 210 @ kernel->illuminate\foundation\http\{closure}(object(request)) @ call_user_func(object(closure), object(request)) in pipeline.php line 141 @ pipeline->illuminate\pipeline\{closure}(object(request)) in verifycsrftoken.php line 43 @ verifyc

Typescript: define type of an object -

i want define type of object literal, key valye pairs, below. in way can't manage this. please help. export const endpoints: {name: string: {method: string; url: string;}} = { allfeed: { method: 'get', url: 'https://www.yammer.com/api/v1/messages.json' }, topfeed: { method: 'get', url: 'https://www.yammer.com/api/v1/messages/algo.json' }, followingfeed: { method: 'get', url: 'https://www.yammer.com/api/v1/messages/following.json' }, defaultfeed: { method: 'get', url: 'https://www.yammer.com/api/v1/messages.json/my_feed.json' } }; you're close, should be: const endpoints: { [name: string]: { method: string; url: string; } } = { allfeed: { method: 'get', url: 'https://www.yammer.com/api/v1/messages.json' }, ... }; you can use interfaces: interface endpoint { method: string; url: string; } interfac

openerp - How to bring products from opportunity to quotation -

hello new odoo , want help. i have created tab products(many2many) in opportunity (your pipeline) contains product comes mass mailing has been customized. when opportunity won , converted quotation want products present in opportunity transferred in order_line(one2many) tab of quotation. need know there possible way complete functionality. i see 2 ways, how that: lead (opportunity) scope try override functionality of odoo creating sale.order crm.lead . here have create sale.order.line via one2many triplets ( look write method ) or after sale.order creation, create sale.order.line (with values , create()) order scope (only useful when have lead id on sale.order creation) get crm.lead (when provided) , create sale.order.line 1 of approaches "lead (opportunity) scope".

html - How to delete the row in a div without using table in javascript -

hi guys source code need delete row in div when press delete button using javascript please give me solution me.the important thing don't use table instead of div .so please give me solution me. function add() { var x = document.queryselectorall(".div1"); var i; (i = 0; < x.length; i++) { x[i].innerhtml += "<br><br> <input type='text' name='mytext'>"; } } function del() { var y = document.queryselectorall(".div2"); var i; (var = 0; < y.length; i++) { y[i].innerhtml += "<br><br><br> <input type='button' value='delete' onclick='removerow(this)'>"; } } function removerow(input) { input.parentnode.removechild(input.previoussibling); input.parentnode.removechild(input); } #add_btn { float: left; margin: 0% 0% 0% 72%; border-radius: 25px; cursor: pointer; padding: 10px; } body { b

typescript - How to resolve error "Cannot find name '_' " using lodash in angular2 app with webpack -

Image
here's how import lodash in typescript/angular2 app using webpack: $ npm install lodash --save $ typings install dt~lodash --save in webpack.config.js: module.exports = { plugins: [ new provideplugin({ '_' : 'lodash' and works. but there's still error in editor (sublime) , in terminal on runtime : cannot find name '_' so, i'm missing? in .ts file use lodash tried declare so: declare var _ : lodashstatic with no luck. i not sure how old issue these kind of issues still happening. have added lodash type definition angular-cli project , made work. part of experiment wanted third party libraries used inside angular2. had struggle bit figure out how works here goes. the current type definition lodash seems having issue. getting error while compiling. replaced content of type definition file older version of lodash type definition file , worked. working version path, https://github.com/borisyankov/

Save Outlook attachment VBA does not work properly -

i try run code, not save xml file given folder. wrong it? public sub saveattachtodisk(itm outlook.mailitem) dim objatt outlook.attachment dim savefolder string dim dateformat string dateformat = format(now, "yyyy-mm-dd h-mm") savefolder = "c:\users\gabor\documents\cafm\xml\" each objatt in itm.attachments if instr(objatt.displayname, ".xml") objatt.saveasfile savefolder & "\" & objatt.displayname end if set objatt = nothing next end sub from comment "changing security settings solved problem. had set macro settings enable macro." – vergab jul 28 @ 20:09

database - How to display data in AbstractTableModel using java? -

Image
i have created jframe , want create abstracttablemodel display data database using dbquery in grey box. this first time doing , have been struggling long, hope receive help! thank you. jbutton btnsubmit = new jbutton("submit"); btnsubmit.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { boolean conditionok = false; if(chckbxr.isselected()==false && chckbxr_1.isselected()==false && chckbxr_2.isselected()==false && chckbxr_3.isselected()==false){ joptionpane.showmessagedialog(frame,"please select client account"); } else if(fromdate.gettext().equals("")){ joptionpane.showmessagedialog(frame, "please enter starting date"); } else if(todate.gettext().equals("")){ joptionpane.showmessagedialog(frame, "please enter end date");

java - Is there a point to use method level security in spring if we secured the REST API from the configuration -

i ask if there point secure methods call in rest controller pre , post annotations. have configured security through java configuration this: @override protected void configure(httpsecurity http) throws exception { http .and() .formlogin() (...) .and() .authorizerequests() .antmatchers("/api/**").hasauthority("role_user"); } so every request under /api should authorized role_user. tried find information in internet thing find this: https://coderanch.com/t/549265/spring/method-security-spring-security however can't think of use case hacker access somehow methods in service layer. url security , method security in service layer aims @ different use cases. if need control users role can call url given prefix (here api) url security need full stop. if have complex application service methods can called different controllers , want make sure did not fail restrict access, method security can come ensuring va

How can I get a connection URL from an SQLAlchemy Engine instance? -

i begin program generating url object , passing create_engine . in section of code far, far away find out engine connected to, i.e. connection url. is there easy way this? using inspect can see how driver type. can understand if password component of connection string no longer available, i'm hoping else still available. any ideas?

sql - How to do sum of column in mssql -

i have written following query name , amount : select fm.familyname,qt.amount registrations rs left join family fm on fm.id = rs.family_id left join quote qt on qt.id = rs.quote_id group fm.familyname,qt.amount so above query getting below answer: name amount abc 1200 abc 1300 abc 1400 but want output like: name amount abc 3900 how can this? have used sum(isnull(cast(qt.amount float),0)) total doing total of individual column. how can total ? simply group fm.familyname alone: select fm.familyname, sum(qt.amount) registrations rs left join family fm on fm.id = rs.family_id left join quote qt on qt.id = rs.quote_id group fm.familyname if "operand data type varchar(max) invalid sum operator.", need cast column, like: select fm.familyname, sum(cast(qt.amount float)) ...

How to create java web service to write data to Firebase? -

we creating android app , web app using firebase 3.0.0. right both these clients writing data directly firebase database. we wish avoid introducing web services component in between. component write data firebase, , consumed android , web (or ios in future) apps. we have decided develop web services using java, found firebase jar jvm . there no firebase tutorials implement such component. can use jar creating web services in java? how? thanks for new firebase, can use server sdk documentation page: https://firebase.google.com/docs/server/setup . start accessing database following instructions here: https://firebase.google.com/docs/database/server/start

<?php echo base_url();?> and <?php base_url();?> -

<script src='<?php base_url();?>assets/js/jquery.min.js'></script> the script above code friend use, works him, if change <?php echo base_url();?> , it's work me, not him. it's become problem when transfer files each other, supposed ? thank you. i've solution script case, change config.php : $http = 'http' . ((isset($_server['https']) && $_server['https'] == 'on') ? 's' : '') . '://'; $urlbaru = str_replace("index.php","", $_server['script_name']); $config['base_url'] = "$http" . $_server['server_name'] . "" . $urlbaru; please show more problem detail paste error code in here use information you. btw, base_url() isn't php embedded function, 1 of potential problem friend custom function named base_url() supposed return it's root path. so, have either include or build same function sam

c# - Method "TakePhotoAsync" of Xam.Plugin.Media return null on platform WinPhone in Xamarin.Forms -

Image
i'm new xamarin , xamarin forms. not understand how come method "takephotoasync" of plugin xam.plugin.media return null lifting system.nullreferenceexception. variable media correctly initialized. part of code: var file = await media.takephotoasync(new storecameramediaoptions { defaultcamera = cameradevice.rear, directory = "testphoto", name = "photo.jpg", savetoalbum = true }); exactly variable file null, why?! due link have next thing: updated components

ios - Special Emoji doesn't present correctly in device -

Image
i use unicode("\ue43b") in uilabel , weird thing works in simulator not works in real device. code below: uilabel *label = [[uilabel alloc] initwithframe:cgrectmake(0, 0, size.width, size.height)]; [self.view addsubview:label]; label.text = @"the emoji is:\ue43b"; label.textalignment = nstextalignmentcenter; the result runs in simulator: when run in device(iphone6 9.3.2), shows rectangle character. i have search google \ue43b , this site says: this private use codepoint. is, deliberately not assigned character. added unicode in version 1.1 , belongs block private use area. but still don't understand how simulator works, apps wechat can show emoji. you using custom font on mac not using on iphone. note, not proper unicode code point. it's private-use character. code points can added fonts if desire. the ios simulator mac application includes mac-compatible version of uikit. things available on mac available simulator, if n

javascript - In wallpaper app i am getting Gap beside the image in fullScreenView -

plz @ below image getting gap beside image in full screen view plz please have on code , tell me what's wrong it. if there solution plz explain me step-by-step (i new android) gap beside image package com.saveitornot.wallit; fullscreenviewactivity.java import android.annotation.suppresslint; import android.content.activitynotfoundexception; import android.content.intent; import android.content.pm.packagemanager; import android.graphics.bitmap; import android.graphics.point; import android.graphics.drawable.bitmapdrawable; import android.net.uri; import android.os.build; import android.os.bundle; import android.os.handler; import android.support.design.widget.coordinatorlayout; import android.support.v4.app.activitycompat; import android.support.v7.app.appcompatactivity; import android.util.log; import android.view.display; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.window; import android.view.windowmanager; im

javascript - What's an elegant way to export objects in CoffeeScript module? -

i have several functions in coffeescript module: func1 = () -> ... func2 = () -> ... func3 = () -> ... func4 = () -> ... if want make clear come (without searching definition), i'd avoid making them global ( @func1 = ... , @func2 = ... ) , , stick more explicit syntax: helpers = require('/lib/helpers.coffee') but requires like meteor.exports.func1 = func1 repeated every time. or meteor.exports.func1 = () -> ... but way it's harder make calls between them here inside. i know es6 has elegant syntax {var1, var2, ...} , there similar in coffeescript? func1 = () -> func2 = () -> module.exports = {func1, func2} compiled to: var func1, func2; func1 = function() {}; func2 = function() {}; module.exports = { func1: func1, func2: func2 };

javascript - Requesting data from storage in Chrome extension -

i using chrome storage api, has method chrome.storage.local.get('key'); my program going store list of data in each day. what type of data i'm storing (not important) if user browse facebook.com n minutes , google.com m minutes in 2016/7/28, i'll store "facebook.com||n::google.com||m" in key "2016/7/28". '::' seperates each data '||' seperate domain , time. what's problem the set of data may grow large number, , 1 of program feature request uncertainly many (any natural number) date data storage. considering: 1. number of days requested uncertain, data shouldn't store in single key. or, i'll need pull huge amount of data storage if request single day, seems absolutely idiot. 2. but! if program request 100+ or more data storage, i'll need call chrome.storage.local.get('date'); method each date. i'm not sure how method implemented , whether can complete such crazy task. if could, i'm not

Android Blood pressure graph implementation? -

Image
thanks reading question, need implement blood pressure graph in android sample application, attached sample image below, can use third party libraries achart engine , mpchart android making graph,any ideas , suggestions kindly share details, thanks , naren.s i suggest http://www.android-graphview.org/ library. it's super easy use. i'm not sure how implement vertical lines among points since you'd have introduce 2 linegraphseries. but if don't need vertical lines, graphview library wise , easy solution :)

php - make an url password protected from direct accessing htaccess -

i new .htaccess . have 2 files named page1.php , page2.php ,while page2.php in folder , page1.php has link it.i want make page2.php password protected when wants open page2.php directly hitting url. should open when wants go page page1.php page. can me out done? note:i have added following thing .htaccess . here page password protected in both ways no matter open directly or go page page1.php . want make password protected when directly want go page. authuserfile c:/wamp/www/htaccess_pwd/main/.htpasswd.txt authtype basic authname "you need authorized!!" require valid-user <files "page2.php"> require valid-user </files> solution1: if dealing .php files, think easiest code in php. page1.php: <?php session_start(); $_session["log"]="ok"; ?> page2.php: <?php session_start(); if(isset($_session["log"])){ ?> //your site <?php }else{ ?> not allowed enter!!! <?php } ?>

postgresql - postgres create trigger after insert but before delete? -

i want call stored procedure in 3 different cases: after insert , after update , before delete . possible combine these cases 1 create trigger statement? (i know, won't work): create trigger update_pntzzz3 after insert or update or before delete on onedee each row execute procedure update_pntzzz3(); right create new trigger delete case. create trigger update_pntzzz3 after insert or update on onedee each row execute procedure update_pntzzz3(); create trigger del_pntzzz3 before delete on onedee each row execute procedure update_pntzzz3();

javascript - Laravel Patch AJAX -

i have modal updates information on countries. // partial code of modal <div id="editmodal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button> <h4 class="modal-title" id="mymodallabel">edit <label id="entitytype"></label></h4> </div> <div class="modal-body"> <div class="row"> @yield('editmodalbody') </div> </div> <div class=&

objective c - Exc bad access in table view - iOS -

Image
i have array fill when user click search button. if there no data response, server return empty response , therefore here empty array. wonder, why when fire fake request return me exc_bad_access (code=1, address = 0xa) . it point to: - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { if (_arrvalues.count > 0) return self.arrvalues.count; return 0; } to line: if (_arrvalues.count > 0) in viewdidload did allocate array that: _arrvalues = @[]; so, cant understand why occurs. suggestions? in debugger prints array memory , isa pointer, there no data if user search fake request return nothing. from debug panel: when update server part (remove response , create empty array) problem disappeared. there issue in request/mapping part: // _arrvalues = [eventsmgr geteventsfromresponse:x]; _arrvalues = @[]; use code - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsectio

css - Center Float with ::before and ::after elements -

Image
i want center h3 elements after , before, moment have : html <h2>nos réalisations dans la région</h2> css h2 { font-size: 35px; font-weight: 300; margin-top: 0; color: #fff; position: relative; text-transform: uppercase; float: left; } h2::before { content: ''; width: 60px; height: 5px; background: #248290; position: absolute; bottom: -9px; left: 0; } h2::after { content: ''; width: 100%; height: 1px; background: #248290; position: absolute; bottom: -7px; left: 0; } i want center element photo. one solution. there more simple. positioning left 50% , subtract half of element width using negative margin. h2 { font-size: 35px; font-weight: 300; margin-top: 0; color: #fff; position: relative; text-transform: uppercase; float: left; background: #333; } h2::before { content: ''; width: 60px

javascript - How to pass Array of Js functions to another Js function? -

i newbie java script. writing asynchronous functions let's func1, func2, func3 . have execute 1 after another. decided use async lib execute 1 after another. script file: function func1(param1,param2){ //dosomething .. } function func2(param3,param4){ //dosomething .. } function func3(param5,param6){ //dosomething .. } function myfunction(arr){ console.log(arr); async.series(arr,function(){ //do .. }); } html file: <a onclick="myfunction([func1('p1','p2'),func2('p3','p4'),func('p5','p6')])"></a> but when try console.log , giving null,null,null kindly provide me solution regarding. you're not passing array of function references, you're passing array of result of calling functions. array contain whatever functions returned (or undefined if don't return anything). if want create function reference arguments "baked in", can function#bin

asp.net mvc - Kendo Panelbar MVC - Trying to Open Popup by clicking on a menu item -

in program have kendo panel bar shows menu, want open dialog box/ popup window when user clicks on menu child item. <div> @(html.kendo().panelbar() .name("panelbar") .expandmode(panelbarexpandmode.single) .events(events => events .select(@<text> reportcontroller.onselect </text>)) .items(panelbar => { panelbar.add().text("test1") .expanded(true) .items(test1=> { workers.add().text("sample1"); workers.add().text("sample2"); workers.add().text("sample3"); }); panelbar.add().text("test2") .items(test2 => { clients.add().text("book1") .items(costings => { costings.add().text("page1"); costings.add

python - ZeroMQ: How to prioritise sockets in a .poll() method? -

Image
imagine following code: import threading, zmq, time context = zmq.context() receivers = [] poller = zmq.poller() def thread_fn(number: int): sender = context.socket(zmq.push) sender.connect("tcp://localhost:%d" % (6666 + number)) in range(10): sender.send_string("message thread %d" % number) in range(3): new_receiver = context.socket(zmq.pull) new_receiver.bind("tcp://*:%d" % (6666 + i)) poller.register(new_receiver, zmq.pollin) receivers.append(new_receiver) threading.thread(target=lambda: thread_fn(i), daemon=true).start() while true: try: socks = dict(poller.poll()) except keyboardinterrupt: break in range(3): if receivers[i] in socks: print("%d: process message %s" % (i, receivers[i].recv_string())) time.sleep(0.2) # 'process' data the threads send messages without interruption arrive in random order @ corresponding pull -

java - Android: MapView not showing up empty -

i want show google maps in tabbed layout so created viewpager in main activity , added below fragment map showing empty. every overridden function getting called expected. not able understand causing map not show up. below code fragment_map.xml <?xml version="1.0" encoding="utf-8"?> <com.google.android.gms.maps.mapview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" android:name="com.google.android.gms.maps.supportmapfragment" android:layout_width="match_parent" android:layout_height="match_parent" android:apikey="@string/google_maps_key" android:id="@+id/mapview" > </com.google.android.gms.maps.mapview> mapfragment.java import android.os.bundle; import android.support.v4.app.fragment; import android.view.layoutinflater; import android.view.view; imp