Posts

Showing posts from June, 2012

GSA Search Result Logs -

i using gsa appliance 7.2 planning improve search experience want analyze search logs, in search logs getting user ip , search query link. other want link user clicked , in page got search result in 1st page or second page etc. please me detailed search logs. thank you there possibility generate search reports in gsa admin console under reports > search reports. these reports sort of summary in can see following details: number of search queries per day; number of search queries per hour; top keywords; top search queries; position of clicks; page of clicks; top clicked urls; top ips of clients used perform search queries. with reports > serving logs , can per-query track clients , search results returned gsa, can't analyze click-behaviour , user-journey through website. you'll need implement google analytics, omniture or other web analytics. gsa-ga integration, please consult this document .

Looping through JSON with PHP to get children -

i've been trying morning appear quite simple , i'm failing miserably. i have api request returns valid json data , need loop through various values in php several nodes application. here snippet of json { "results": [ { "date": "2015-06-01", "rates": [ { "id": 1592, "name": "weekend promotion", "room_rates": [ { "room_type_id": 66, "room_type_code": "dlk", "sold": 0, "sell_limit": null, "availability": 25, "out_of_order": 0, "single": 85, "double": 85, "extra_adult": null,

How do I avoid multiple apk install promps on an Android programmatic install? -

our android applications automatically check updates every 5 minutes in background , downloads latest .apk file our downloads server. it fires off install using below method: public static void installdownloadedapplication(context context) { intent intent = new intent(intent.action_view); intent.addflags(intent.flag_activity_new_task); file sdcard = environment.getexternalstoragedirectory(); file file = new file(sdcard, constants.application_code+".apk"); uri uri = uri.fromfile(file); intent.setdataandtype(uri, "application/vnd.android.package-archive"); context.startactivity(intent); } this prompts end-user (using standard android os application install prompt) install or cancel application apk. if 1 of our applications in need of update, android install prompt appears once no matter how many times above code in 1 application runs. the problem having if user leaves android device long while , multiple of applications need a

How to disconnect all sockets serve side using socket.io? -

how can disconnect/close sockets on server side ? maybe restarting socket.io module server side ? (using lateste socket.io) assuming io socket.io server object, can server-side disconnect connected clients: io.sockets.sockets.foreach(function(s) { s.disconnect(true); }); depending upon client configuration, clients may try reconnect. fyi, there lot of different answers similar problems in question: socket.io - how list of connected sockets/clients? , have pay attention answers apply socket.io versions greater 1.0 since changed v1.0.

Python static variable in function global name not defined -

i have written function calculate heading between 2 points if vehicle reports it's moving , vehicle has moved 20cm between points. the function uses static variables - or @ least if worked - keep track of previous positions , heading values. here code: def withcan(pos): eastdist = pos[0]-previous_pos[0] northdist = pos[1]-previous_pos[1] canflag = pos[2] if (canflag == 1 or canflag==2): if (previous_canflag == 1 , canflag == 2): previous_heading += 180.0 previous_canflag = canflag elif (previous_canflag == 2 , canflag == 1): previous_heading += 180.0 previous_canflag = canflag else: previous_canflag = canflag if ( (canflag == 1 or canflag == 2) , math.sqrt(northdist*northdist+eastdist*eastdist) > canstep ): previous_heading = math.degrees(math.atan2(eastdist, northdist)) previous_pos[0] = pos[0] previous_pos[1] = pos[1] return previo

sql - Executing anonymous block PlSQL fail -

i want execute pl/sql script via terminal can't manage work. first checks whether user exists , if copies data table of user. problem arises when there no user - script doesn't work because says table or view not exist, , means somehow precompiles it, while want execute line line. here is: declare v_count integer := 0; begin select count (1) v_count sys.dba_users username = upper ('b'); if v_count = 0 dbms_output.put_line ('fail'); else insert a.some_table (some_column) select some_column b.some_table some_column = "x"; end if; end; / it throws error table not exist @ line select some_column b.some_table because while indeed not exist (the user not) script wouldn't go there. you need use dynamic pl/sql insert, not validated @ compile time @ runtime: declare v_count integer := 0; begin select count (1) v_count sys.dba_users username = upper ('b')

php - How to get cookie value -

creating cookie session_start(); $params = session_get_cookie_params(); setcookie(session_name('username'),'hamza',1, isset($params['path']), isset($params['domain']), isset($params['secure']), isset($params['httponly'])); session_regenerate_id(true); echo "cookie created !"; now fetching cookie value session_start(); $name=$_cookie['username']; echo $_cookie["username"]; if(isset($name)) { if($name=='username') { echo "success"; } else { echo "error"; } } please me ! result why create auto random value like: u8omuum6c9pkngrg4843b3q9m3). want original cookie value "hamza" ????? this the format of cookie creation syntax setcookie(name, value, expire, path, domain, secure, httponly); so first variable cookie name you can read using $_cookie['y

powershell - New line space is lost with reading & setting the content -

i trying read file, put content & save same file using powershell. below script: $x=file.txt $old='hi' $new='hello' (get-content $x | foreach-object {$_ -replace "$old","$new"}) | set-content $x file content: hi world!!! after running script, new line space getting lost. file looks below: content after script execution: hello world!!! i don't want new line space lost & format should same. expecting output below: hello world!!! try using carriage return + new line `r`n , maybe this: $new='hello `r`n'

Convert java arrayList of Parent/child relation into tree? -

i have bunch of parent/child pairs, i'd turn hierarchical tree structures possible. example, these pairings: child : parent h : ga f : g g : d e : d : e b : c c : e d : null z : y y : x x: null which needs transformed (a) heirarchical tree(s): d ├── e │ ├── │ │ └── b │ └── c └── g | ├── f | └── h | x | └── y | └──z how, in java, go arraylist containing child=>parent pairs, tree one? i need output of operation arraylist contains 2 elements d , x in turn each 1 have list of children in turn contains list of children , on public class megamenudto { private string id; private string name; private string parentid; private list<megamenudto> childrenitems=new arraylist<megamenudto>(); public string getid() { return id; } public void setid(string id) { id = id; } public string getname()

multithreading - F# saveFileDialog -

i'm trying save file using savefiledialog in f#. far i've looked @ this post , tried rewrite , other code on net. i've read bit savefiledialogs on msdn. i think code should work reason crashes (if press continue in ide can glimpse of savefiledialog wrong type-filter). my crash message "an exception of type 'system.threading.threadstateexception' occurred in system.windows.forms.dll not handled in user code" and code is: let savefile = new savefiledialog() savefile.filename <- "my sudoku.txt" savefile.filter <- "text files (*.txt)|*.txt|all files (*.*)|*.*"; savefile.initialdirectory <- directory.getcurrentdirectory () savefile.filterindex <- 1 if savefile.showdialog(new form(text="save", topmost=true, width=360, height=390)) = system.windows.forms.dialogresult.ok savefile (savefile.initialdirectory) (savefile.filename) (stufftosave)

c# - Updating ado.net entity data model without effecting model classes already in EDMX -

i have done lot of attribute validation on models in edmx entity data model class .but time of updating adding new table ado.net entity data model automatically removed attributes given. is there way update newly added table model class without effecting other models customized.. the bad point have worked on auto-generated code. but lucky, if observe more attention model classes should see partial classes can extend classes in files , put attribute respectively on each 1 , won't affected generation of edmx. try , give result ;-)

java - Print Decoded Data after SSLEngine Handshake is FINISHED -

how decoded data after ssl handshake complete? at moment seems decrypt of data. steps reproduce save , run this code go https://localhost:1500 - should notice beginning , end of request has like: ?get ... #$?+{???u7y???

javascript - multiple dynamic drop down lists in form -

i have form drop down lists in each row. change in dropdown list on column must result in hiding field in column b in same row. here trimmed-down version of 1 row in table. <form class="form-horizontal"> <div class="form-group"> <div class="duration"> <select id="session_attributes_0_duration"> <option value="0">15 minute block</option> <option value="1">30 minute block</option> <option value="2">1 hour block</option> </select> </div> <div class="cost> <input id="session_attributes_0_cost"> </div> </div> and here coffeescript try hide cost in case of '15 minute block' set_duration_changes = () -> durations = find_all_duration_drop_downs() duration in durations if duration.firstchild.tagname == "select"

angularjs - navigate across history stacks ionic ion-tabs -

i have problem have application has 4 ion tabs of each have own history stack. having problem navigate tab => b, tab b moved inner page of tab b, there no way of navigating , resetting history on tab b when go tab can reset tab b's history root of tab b. if right, want clear navigation stack within tab when changing tabs? have @ following approach: <ion tab> has callback when deselecting. can use call function in controller clears history. html page looks example this: <ion-tab title="xyz" href="#/tab/whatever" on-deselect="clearhistory()"> ... </ion-tab> and in controller define following coresponding function: .controller('testctrl', function($scope, $ionichistory) { $scope.clearhistory = function() { $ionichistory.clearhistory(); } }) this clears navigation stack of current tab before leaving. tested ionic tabs starter templates , worked me. i hope issue. if not, leave me comment

Nested Updated MySQL Query -

table - galleries +----+----------+------------+----------+ | id | user_id | is_primary | photo | +----+----------+------------+----------+ | 1 | 1 | 1 | img1.jpg | | 2 | 2 | 1 | img2.jpg | | 3 | 1 | 0 | img3.jpg | | 4 | 1 | 0 | img4.jpg | | 5 | 1 | 0 | img5.jpg | | 6 | 3 | 1 | img6.jpg | | 7 | 2 | 0 | img7.jpg | +----+----------+------------+----------+ update galleries set is_primary=0 user_id=1 update galleries set is_primary=1 id=4 there have column name is_primary need set 1 rows is_primary=1 user id 1 there have 1 row is_primary = 1 , user_id=1 i want updated is_primary=1 id=4 before updated need set is_primary=0 user_id=1 . i don't want write 2 times query updated. how write nested query update record? you can use case-when as update galleries set is_primary = case when id=4 1 else 0 end user_id = 1 ;

lucene - Search for a numeric range inside string in elastic search -

i wanted search numeric expression in elastic search. example indent code 4.8663 spaces indent code 121.232 spaces indent code 12.3232 spaces example query get string "indent code between 1 , 100" it should 1st , 3rd not 2nd. { "span_near": { "in_order": 1, "clauses": [ { "span_term": { "request": "indent" } }, { "span_term": { "request": "code" } } , {

javascript - How to insert latitude and longitude in database from click event? -

using asp. trying store user's location (latitude, longitude) database. presents problem: i want values of longitude , latitude of google map clicking button got 0 values in database.. database ha 2 filed longitude , latitude has decimal datatype. and getting error an-unhandled-exception-of-type-system-data-sqlclient-sqlexception-occured-in-system-data-dll in cmd1.executenonquery(); line here's sample code of first attempt: <html xmlns="http://www.w3.org/1999/xhtml"> <head id="head1" runat="server"> <title></title> </head> <body> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var long = 0; var lat = 0; window.onload = function () { var mapoptions = { center: new google.maps.latlng(18.9300, 72.8200),

image - file_get_contents() expects parameter 1 to be a valid path -

my image uploading images/news successfully. want save image in database. keeps giving me above error. model query correct because use insert other data , works. how can save image database once user clicks submit? my controller: function news() { $config = array( 'upload_path' => "./images/news", 'allowed_types' => "gif|jpg|png|jpeg|jpg", 'overwrite' =>false, 'max_size' => "2048000", 'max_height' => "768", 'max_width' => "1024" ); $this->load->library('upload', $config); $this->load->helper(array('form', 'url')); if($this->upload->do_upload()) { $data = array('upload_data' => $this->upload->data()); $this->load->view('manage_news',$data); } else { $message2 = "please choose file type. gif,jpg,png,jpeg,pdf "; echo "<script type='text/javas

ios - How to get the order of each day in a week? -

Image
i wonder if there way know how each day of week ordered? know in gregorian calendar, property 'weekday' indicates 1-7, and sunday represented 1. when change region(setting->general->language &region->region) russia, apple's calendar app displays 'm'as first day of week, while united states displays 's' first day of week. how can work out programmatically? idea, advance. you can set programmatically start day of week following code. to first day of week after setting - (nsdate*)firstdayofweek { nscalendar* calender = [[nscalendar currentcalendar] copy]; [calender setfirstweekday:2]; //override locale make week start on monday nsdate* startoftheweek; nstimeinterval interval; [calender rangeofunit:nsweekcalendarunit startdate:&startoftheweek interval:&interval fordate:self]; return startoftheweek; } to set first day of week [[nscalendar currentcalendar] setfirstweekday:2]; //override local

php - How to display the nested foreach values in smarty -

i need display nested for-each loop values in smarty. i have array array ( [err] => 0 [code] => 0 [msg] => success [retval] => array ( [0] => array ( [id] => 8 [thread_id] => 8 [body] => hi test message [priority] => 1 [sender_id] => 11 [cdate] => 2015-06-01 12:26:55 [status] => 1 [subject] => hi [user_name] => soniya kaliappan ) ) ) how can retval['body'] value in smarty . please me . simply run foreach inside foreach - {foreach from=$yourarray item=loopval} {foreach from=$loopval.retval key=retval item=retval} {$retval.body} {/foreach} {/foreach} or there 1 array inside retval - {foreach from=$yourarray item=loopval} {$loopval.retval.0.body} {/foreach}

c# - Linq, date comparison -

i need npgsql query convert linq query. npgsql looks like: p.cmd = new npgsqlcommand("select distinct min(h_dt::date) w_h " + "inner join on h_us_id = us_id " + "where cat_id != '' , h_dt::date not in (select distinct period_date m_v " + "where mv_id = 1)", conn); i try convert: var q = (from t in context.w_h join t1 in context.us on t.h_us_id equals t1.us_id t1.cat_id != "" select t.h_dt) .min(); i need in adding part of comparison: and h_dt::date not in (select distinct period_date m_v) h_dt::date - return date in format yyyy-mm-dd have collection hold results: // pseudocode ! write selection here: var v = select distinct period_date m_v and compare contains: q.where(i=> ! v.contains(i) );

c++ - Event in Maya Api to capture currentTime / frame change -

developing maya plugin. how can set-up callback gets fired each time frame number / current time changed in scene ? had @ mscenemessage class, doesn't seem contain looking for. thanks. you can use meventmessage setup callback every time frame/current time changes. code speaks louder words, here's code comments interspersed illustrate how set up: (tldr impatient first, full code excerpt follow in next section) tldr: a code summary impatient: // ... // our callback id array // store ids of our callbacks // later removal mcallbackidarray mycallbackids; // actual adding callback happens // register our callback "timechanged" event mcallbackid callbackid = meventmessage::addeventcallback("timechanged", (mmessage::mbasicfunction) mysamplecmd::usercb); // ... if(mycallbackids.length() != 0) // make sure remove callbacks added stat = meventmessage::removecallbacks(mycallbackids)

android - Google Analytics shows false data -

i'm new google analytics. have app in google play built in native android programming - in eclipse. when check google analytics shows app had sessions in ios, , in countries don't see in google play developer console. there i'm missing?

html - PhP pulling string from line and separating by ":" -

i trying pull string .txt file using php, have done using code: $f_contents = file("accounts/00183.txt"); $line = $f_contents[array_rand($f_contents)]; $data = $line; after random string pulled separated. e.g strings in .txt in format "user:pass". im trying make "$first" = content before ":" e.g "user". , "$last" = content after ":" e.g "pass". i'v looked around on google 2 hours , found nothing works. hope can help! use list & explode - $str = "user:pass"; list($first, $last) = explode(':', $str);

java - Video Compression using Telegram's Code Android - Output surface wait timed out | MediaCodec -

the code i'm using repo : https://github.com/drklo/telegram/ in ~/src/main/java/org/telegram/android/video/mediacontroller class encoder , decoder instantiated, i'm getting "sufrace wait timed out exception" in outputsurface class no matter video i'm choosing. tried on devices : nexus 4 (lollipop), asus zenfone 5 (kitkat), moto g (kitkat). is there i'm missing? have not changed code @ all. -- code snippet mediacontroller.java -- if (!decoderdone) { int decoderstatus = decoder.dequeueoutputbuffer(info, timeout_usec); if (decoderstatus == mediacodec.info_try_again_later) { decoderoutputavailable = false; } else if (decoderstatus == mediacodec.info_output_buffers_changed) { } else if (decoderstatus == mediacodec.info_output_format_changed) {

windows - Why wont this registry data value update? -

i writing batch script add registry key default value wont write value. value needs be: "c:\program files (x86)\microsoft office\office14\excel.exe" /dde "%1" i think has quotation mark characters " " cant figure out how make batch script understand needs in data value. this using: reg add hkey_classes_root\excel.sheet.12\shell\open\command /ve /d "c:\program files (x86)\microsoft office\office14\excel.exe" /dde "%1" /f reg add "hkey_classes_root\excel.sheet.12\shell\open\command" /ve /d "\"c:\program files (x86)\microsoft office\office14\excel.exe\" /dde \"%%1\"" /f you need escape inner quotes , %1 replaced parser sees first argument batch file

symfony - Can't login with LDAP and FOSUserbundle in Symfony2 -

i first time using ldap , fosuserbundle , trying implement login using ldap , fosuserbundle , following .yml files security.yml security: # preserve plain text password in token refresh user. # analyze security considerations before turn off setting. erase_credentials: false firewalls: main: pattern: ^/ fr3d_ldap: ~ form_login: always_use_default_target_path: false default_target_path: /profile provider: chain_provider logout: true anonymous: true providers: chain_provider: chain: providers: [fos_userbundle, fr3d_ldapbundle] fr3d_ldapbundle: id: fr3d_ldap.security.user.provider fos_userbundle: id: fos_user.user_provider.username encoders: abc\abcbundle\entity\users: plaintext config.yml fos_user: db_driver: orm # other valid values 'mongodb', 'couchdb' , 'propel' firewall_name: main user_class: abc\abcbundle

load content with Jquery together with sending variable in to it -

i have variable - x in jquery, loading php part in div block , need sent variable it. so - $(document).on('click','#link',function () { var x=5; $("#block").load("file.php"); }); in result still in same page.i need have variable x in it. i think use method or xmlhttprequest don't want page, need load php part in block. one solution send data second argument: $(document).on('click', '#link', function() { $("#block").load("file.php", { x: 5 }, function(res) { //your callback }); }); references .load()

vb.net - Execution of request failed - Upload photo picasa Album API vbnet -

dim p_service google.gdata.client.service = new google.gdata.photos.picasaservice("auth_test_app") dim p_parameters new google.gdata.client.oauth2parameters() dim p_application_name string = "test_app" 'step 1 - configure how use oauth 2.0 dim client_id string = "xxxxxxx.apps.googleusercontent.com" dim client_secret string = "xxxxxx" dim scope string = "http://picasaweb.google.com/data/" dim redirect_uri string = "xxxxx:2.0:oob" 'step 2 - set oauth 2.0 object p_parameters.clientid = client_id p_parameters.clientsecret = client_secret p_parameters.redirecturi = redirect_uri p_parameters.scope = scope 'step 3 - authorization url dim authorizationurl string = google.gdata.client.oauthutil.createoauth2authorizationurl(p_parameters) 'i have access token :) process.start(authorizationurl) p_parameters.accesstoken = "xxx" dim requestfactory new google.gdata.client.goauth2requestfactory(nothing, p

unity3d - Unity XCode project GooglePlayService build issue -

i added uikit.framework, but build error in xcode below, anyone know how fix that? undefined symbols architecture armv7: "_objc_class_$_uipresentationcontroller", referenced from: objc-class-ref in gpg(gpgtoastview.o) "_objc_class_$_uiusernotificationsettings", referenced from: objc-class-ref in gpg(gpgmanager.o) "_objc_class_$_uimutableusernotificationcategory", referenced from: objc-class-ref in gpg(gpgmanager.o) "_objc_class_$_uimutableusernotificationaction", referenced from: objc-class-ref in gpg(gpgmanager.o) ld: symbol(s) not found architecture armv7 clang: error: linker command failed exit code 1 (use -v see invocation) xcode version:5.1.1 you want check other linker flags , make sure added -objc. when build xcode project out unity, google play games plugin shows dialog instructions on how build project in xcode. these instructions noted in documentation @ https://github.com/playgames

java - why methods return a value (except void()) -

this statement oracledoc can't able understand statement please explain example. " can use interface names return types. in case, object returned must implement specified interface " here's method return type interface ( java.util.list ). since can't instantiate interface, method must return instance (object) of class implements list interface ( java.util.arraylist in example). public list foo () { return new arraylist (); }

how to pass an external property into a hive udf -

i writing hive udf in have call rest api , return array of string. have written function hardcoded rest api url. make endpoint configurable want take host property out , put in config. possible? if yes, how can pass this? can change udf take host part of input, , use variable substitution in hive: set host=todayshosturl select transform ${hiveconf:host}, line using 'python myudf.py' (line) yourtable;

apache - Apache2, Crowd OpenID SSO Authentication with Directory based LDAP issue with Git/Gerrit -

this question involves apache2, crowd openid sso authentication delegated directory based ldap issue git/gerrit. my environment details: operating system: ubuntu 12.4 lts – 64 bit. apache2 version: server version: apache/2.2.22 (ubuntu) server built: mar 5 2015 18:10:14 crowd version - atlassian crowd version: 2.8.2 problem description: i have configured crowd openid sso authentication delegated directory type microsoft active directory our ldap settings , provided necessary permissions crowd-openid-server settings , our git/gerrit server. currently (gerrit.config) file has below settings access our git/gerrit portal. [auth] type = openid_sso openidssourl = http://100.101.102.103:8095/openidserver/ logouturl = http:// 100.101.102.103:8095/gerrit_logout.html but when tried access gerrit portal, front end shows sign in button. once clicked authentication not forwarding crowd page enter login-id , password. remains on local host (meaning remains on gerrit por

filesystems - What exactly is mounting a file system? -

what happens when 'mount file system' ? @ level of stack happen? why necessary? you can think of linux system tree. add tree hence making accessible, filesystem can mounted, if particular system not needed anymore can removed tree, unmounted. more details check mount command documentation: http://www.tutorialspoint.com/unix_commands/mount.htm

How to load google translate page window in iframe -

how load google translate page window in iframe. i cant load google translate below coding, your browser not support iframes. my page empty please tell me solution how load window? i want show google translation window in site, is there anyother way show google translation page? google translate has limitation cannot rewrite iframe content, can translate listed in below link google translate iframe workaround additional info is possible auto-translate iframe google translation?

Legend label errors with glmnet plot in R -

Image
i modified function post ( adding labels on curves in glmnet plot in r ) add legend plot follows: library(glmnet) fit = glmnet(as.matrix(mtcars[-1]), mtcars[,1]) lbs_fun <- function(fit, ...) { l <- length(fit$lambda) x <- log(fit$lambda[l]) y <- fit$beta[, l] labs <- names(y) text(x, y, labels=labs, ...) legend('topright', legend=labs, col=1:length(labs), lty=1) # <<< added me } plot(fit, xvar="lambda") lbs_fun(fit) however, getting mismatch between text labels on plot , in legend. variable 'am' incorrectly colored. error? help. plot(fit, xvar="lambda") utilizes function matplot . default, matplot uses 6 colors , recycles them. have create legend accordingly: lbs_fun <- function(fit, ...) { l <- length(fit$lambda) x <- log(fit$lambda[l]) y <- fit$beta[, l] labs <- names(y) text(x, y, labels=labs, ...

javascript - angularjs on asp.net error failed to load resources on single page app -

good day; i new angular , work on asp.net morning tried playing spa using angular testing sample app when linked actual page loaded div ng-view directive controller has 2 function 1 show value text input after page loaded , other wired button clicked here code: app.controller("personalcontroller", function ($scope, $location) { get(); function () { $scope.email = "angelogasa1022@gmail.com"; } $scope.save = function () { $scope.email = "eloelo22@gmail.com"; }; }); the page showing , email value correct when tried click button nothing happens @ chrome developer tools , error pops failed load resource: server responded status of 404 (not found) is there settings avoid error? thank you

javascript - How can I add reminders into mobile device calendar using Java script? -

how can add reminders mobile device calendar using java script? want use script in phonegap application. you can use phonegap calendar plugin add events: https://github.com/eddyverbruggen/calendar-phonegap-plugin e.g. window.plugins.calendar.createevent(title,eventlocation,notes,startdate,enddate,success,error); you can add reminders events: // or add reminder, make recurring, change calendar, or url, use one: var filteroptions = window.plugins.calendar.getcalendaroptions(); // or {} or null defaults filteroptions.calendarname = "bla"; // ios filteroptions.id = "d9b1d85e-1182-458d-b110-4425f17819f1"; // ios only, createeventwithoptions (if not found, try matching against title, etc) var newoptions = window.plugins.calendar.getcalendaroptions(); newoptions.calendaname = "new bla"; // make sure calendar exists before moving event // not passing in reminders wipe them event. wipe default first reminder (60), set null. newoptions.firstre

php - Can Google drive file.insert check before insert, to prevent creating a duplicate folder? -

is there way stop creating duplicate folders in google drive rest api without looping items , compare title folder name. also how can list folders of root folder. i have tried pass folder id "root" argument in list files , list children method not getting expected response. thanks in advance. files: insert 's job create new file. check if file or directory exists before trying create new one. you might want check out files: list using q option can have api search you. if returns directory exists shouldn't insert it. thing return file id allowing use in later requests. mimetype = 'application/vnd.google-apps.folder' title contains 'hello' , title contains 'goodbye'

ios - Unable to convert NSString to NSURL -

i'm using following code nsurl nsstring nsurl null : nsstring *cfurl = (nsstring *)cfbridgingrelease(cfurlcreatestringbyaddingpercentescapes(kcfallocatordefault,(cfstringref)[asseturl absolutestring], null, cfstr("!$&'()*+,-./:;=?@_~"), kcfstringencodingutf8)); nsstring *instagramstring = [nsstring stringwithformat:@"instagram://library?assetpath=%@&instagramcaption=%@", (nsurl *)cfurl, strinstagramcaption]; nsurl *instagramurl = [nsurl urlwithstring:instagramstring]; nsurl not natively support instagram protocol. here supported protocols. the url loading system provides support accessing resources using following protocols: file transfer protocol (ftp://) hypertext transfer protocol (http://) hypertext transfer protocol encryption (https://) local file urls (file:///) data urls (data://) as stated in documentation, have create custom protocol .

Environment specific Chef databags -

i'm trying determine best method databags, hold-up being don't see why can't include single databag containing per environment. i'm finding having individual databags cookbooks seems norm. my initial understanding this: dev.json - mysql_password: 234983 - mysql_user: heyhey - mysql_host: somewhere.com - newrelic_api: uat.json - mysql_password: 111113 - mysql_user: root - mysql_host: somewhere-else.com - newrelic_api: something-else attributes/default.rb - load <chef-env> databag - mysql_password = databag.item.mysql_password is bad method or caveats doing way?

javascript - PageMethods is not defined Exception: Does not call the WebMethod in ASP.NET -

my webmethod not called pagemethod call in javascript function. here's code: edit console says: uncaught referenceerror: pagemethods not defined js: function profilefollowbuttonchange(cn) { if (cn.classname == "profile-page-owner-follow-button") { cn.classname = "profile-page-owner-follow-button-active"; alert("camefollow"); pagemethods.togglefollow("follow", onsuccess, onfailure); //does not trigger alert("camefollow"); //doesn't printed } else { cn.classname = "profile-page-owner-follow-button"; alert("cameunfollow"); pagemethods.togglefollow("unfollow", onsuccess, onfailure); //does not trigger alert("cameunfollow"); //doesn't printed } } function onsuccess() { } function onfailure() { }

javascript - What detail am I missing trying to make a ajax page crawlable? -

i think i'm missing detail trying google index ajax (gwt) website. i've followed approach: https://developers.google.com/webmasters/ajax-crawling/docs/learn-more if try address _escaped_fragment= in browser (e.g. http//foo/?_escaped_fragment=bar corresponding http//foo/#!bar) see html/indexing friendly snapshot. however, when try fetching http//foo/#!bar in google webmaster tools, still original js page, not snapshot, i'm assuming means google bot isn't understanding should _escaped_fragment_= version not #! version. i have included on original html. what doing wrong? tips on helpful! thanks

php - How to write the code for upload the image and save the image in database and the selected folder in Yii 2 -

please explain briefly code placed. , give 1 sample code save image in database , selected folder i use code in models public function aftersave($insert, $changedattributes) { if (isset($this->varimage)) { $this->varimage=uploadedfile::getinstance($this,'varimage'); if (is_object($this->varimage)) { $path = yii::$app->basepath . '/uploads/'; //set directory path save image $this->varimage->saveas($path.$this->intusertypeid."_".$this->varimage); //saving img in folder $this->varimage = $this->intusertypeid."_".$this->varimage; //appending id image name //\yii::$app->db->createcommand() //->update('organization', ['logo' => $this->logo], 'id = "'.$this- >id.'"') //->execute(); //manually update image name db

java - jpa native query control entity(part 3) -

retrieve company table getentity.java string table = "company"; string q = "select * " +table; query query = em.createnativequery(q, company.class); list<company> list = query.getresultlist(); ... retrieve staff table getentity.java string table = "staff"; string q = "select * " +table; query query = em.createnativequery(q, staff.class); list<staff> list = query.getresultlist(); ... my questions how control ? following: em.createnativequery(q, ?); list<?> list = q.getresultlist(); any ideas or suggestion? another option pass class entityclass argument find method , can try , derive table name entityclass using reflection , use entityclass type argument createnativequery method. hope helps!

Python Hashtable linear probing -

i trying find index in given list give largest number of probes needed before index assigned in hashtable. have list looks this: [4, 9, 12, 3, 7, 26, 16, 20, 11] and need figure out values in list creates longest probe sequence. i've been stuck on quite while , appreciated.

sql - How to select previous month in mysql with variable? -

this question has answer here: mysql: query rows previous month 9 answers $m=01 $y=2016 given month, how find value of previous month? (in example: december 2015) select convert(varchar,dateadd(d,-(day(getdate())),getdate()),106)

amazon web services - Ansible -- ec2_group and ec2_tag in the same role? -

i trying ansible role ec2_group definition , ec_tag on same file need have pretty compact. for ec2_tag need sg_id.. there way of getting value dynamically? any way of doing this? roles/region-environment/tasks/env_sg_test.yml - name: example ec2 group local_action: module: ec2_group name: my-security-group description: access my-security-group vpc_id: "{{ vpc }}" region: "{{ region }}" rules: - proto: tcp from_port: 22 to_port: 22 cidr_ip: 0.0.0.0/0 - proto: tcp from_port: 443 to_port: 443 cidr_ip: 0.0.0.0/0 - name: tag security group name local_action: module: ec2_tag resource: <----- resource. sg_id? region: "{{ region }}" state: present tags: name: "my security group name" env: "production" service: "web" thanks!!

regex - Fail to filtering Spam Referal in Google Analytics -

i see lot of spam referal in google analytics... i'm creating new custom filter , exclude 'hostname' field, regex pattern: .*best\-seo\-(offer|solution)\.com|buttons\-for\-your\-website\.com but somehow referal still coming up! wrong regex pattern eventhough validate through regexpal.com any insight ? filtering hostname exclude sessions occur on domains have same ga tracking code on domain yours. see hostname custom report example . instead exclude referral traffic adding spam domains referral exclusion list (admin > property > tracking info > referral exclusion list.) unfortunately, can't add regex: have enter each domain separately. more info on referral exclusion list . this custom report give list of spam domains exclude. update: i've changed answer previous answer inflate direct traffic. you should filter out referrals instead of hostname exclude spam referral traffic. when creating filter, make sure have view has no filter

Connecting the neo4j web client to a local database -

help! i've created boatload of nodes in neo4j database , i've been happily querying them. everything's working great, don't see how web interfaced attached local database -- terminology doesn't seem super consistent in neo4j documentation, i'm using in context of: ~$ /opt/neo4j/bin/neo4j-shell -? | grep -e '^ \-path' -path points neo4j db path local server can started there the web server seems interested in database in data/graph.db. feel :server connect should have option connect different local database, it's not evident. on linux/macos, edit neo4j-server.properties conf directory of neo4j installation , change value of org.neo4j.server.database.location point local database. the neo4j-shell refer above not affect web browser, , can use connect existing running database, or remote database or start local database if not running , connect it, see http://neo4j.com/docs/2.2.2/re02.html#shell-manpage

javascript - If code is placed within an anonymous function, why can I access it from the console? -

i've noticed meteor's production ready code concatenated, minified, , wrapped in anonymous function. in theory, should make meteor object , methods inaccessible through dom / window object / console. why can still access objects placed within anonymous function through console? javascript function scoped, means outer function variables accessible (and editable!) inner functions. goes way global (window) variables. example: (function() { window.t ='foo'; })(); if run code in console, see t is, you'll see created/changed within function. meteor globally scopes few variables ( meteor , check , etc.) can access them, in addition variables scope when create package. because each .js file anonymous function & if didn't export variables, you'd have write in 1 big file. exporting variables need, project stays modular. hope helps!

arduino - Change input to a smaller range -

first time poster here please go easy on me? :) i'm playing around teensy 3.1 arduino compatible board, see can thing. have code found emulates keyboard , types in 0000 enter, 0001 enter, way 9999. i want adjust code can change ranges ever like, example starting 2000-3000 or 2500-2600, etc. if tell me lines need adjusted achieve that, i'll thankful. #include <usb_keyboard.h> // code licensed under apache 2.0 license // http://www.apache.org/licenses/license-2.0.txt // limitation of liability. in no event , under no legal theory, // whether in tort (including negligence), contract, or otherwise, // unless required applicable law (such deliberate , grossly // negligent acts) or agreed in writing, shall contributor // liable damages, including direct, indirect, special, // incidental, or consequential damages of character arising // result of license or out of use or inability use // work (including not limited damages loss of goodwill, // work stoppage, compu

c++ - struct constructor will take space within the struct space? -

most of time use struct hold parameters socket communication data structure , can copy, pass or put entire structure on socket passing start address , size. if add constructor struct variable short array, constructor occupy space within struct? or can treat struct constructor same struct without constructor, , copy entire struct on socket start address , size, , space still continuously allocated? no, non-virtual member functions not contribute sizeof of object. existence of @ least 1 virtual function contribute (however constructors cannot virtual) since compiler implementing them via pointer (vpointer) array of pointer functions (vtable), must store pointer (4 or 8 bytes usually).

ruby - Nested Hashes and method reuse -

i have hashes want iterate, , have nested hashes can go 3-4 levels deep, using if statement @ moment check see if value hash , iterate through again i'm repeating code here. is there dry way using method? also want final output end in table, what's best way this? that's why had multiple if statements add separate tags. example method: <% def hashtest(key, value) %> <% if value.is_a?(hash) %> <%= key %> <% value.each |key, value| %> <%= key %> <%= value %> <% end %> <% else %> <%= key %> <%= value %> <% end %> <% end %> and mess of if statements have... <% parsed.each |key, value| %> <% if value.is_a?(hash) %> <%= key %> <br/> <% value.each |key, value| %> <% if value.is_a?(hash) %> <%= key %>

Java - How to accomplish partial updating of an entity from a map or JsonObject? -

i'm using jax-rs in project, use @post partial update consumes json. my code this: @path("{id}") @post @consumes(mediatype.application_json) public response edit(@pathparam("id") long id, map map /*or jsonobject*/) { product product = productservice.getbyid(id); if (map.containskey("name")) { product.setname(string.valueof(map.get("name"))); } if (map.containskey("description")) { product.setdescription(string.valueof(map.get("description"))); } // .... product = productservice.save(product); return response.ok(product, mediatype.application_json).build(); } but not elegant, , gets cumbersome number of attributes increases. so, tried automate mapping using apache beanutils: beanutils.populate(product, map); but if want filter attributes should not changed, example request might try change id sending { id: 666 }. or if want values before setting attributes, ex

Python prime number function returning error in tutorial -

python newbie here, bear me... unfortunately there's no "support" these tutorials, except posting questions in q&a forum , maybe student can help. know there ton of python prime functions out there, think i've come 1 works. however, codeacademy interpreter doesn't solution. here challenge: define function called is_prime takes number x input. for each number n 2 x - 1, test if x evenly divisible n. if is, return false. if none of them are, return true. here's solution (yes, know non-pythonic , super inelegant, i'm learning): def is_prime(x): x = int(x) if x > 0: return false if x == 0: return false if x == 1: print "1 not prime number" return false if x == 2: print "2 prime" return true in range(2, x): #print if x % == 0: print "this not p