Posts

Showing posts from April, 2010

c# - win10 UWP OnScreen Keyboard is not hiding -

i have created win 10 uwp application . in have popup light dismissal enabled. <popup x:name="addwebpagepopup" islightdismissenabled="true" isopen="{binding ispopupopen}" opened="addwebpagepopup_opened"> <textbox x:name="webpagenametextbox" text="{binding webpageurl, mode=twoway, updatesourcetrigger=propertychanged}" style="{staticresource texboxstyle}" keydown="webpagenametextbox_keydown" />` <button content="cancel" command="{binding cancelcommand}" horizontalcontentalignment="center"/> </popup> in addwebpagepopup_opened setting focus webpagenametextbox . in cancelcommand i setting ispopupopen false issue onscreenkeyboard in tablet mode. keyboard showing when popup opened , closing when cancel button clicked. issue there when touch outside popup. popup dismissed keyboard still visible. have idea why happen? when presses ...

c# - A generic error occurred in GDI+, Getting this exception in my code when i try to save optimized image on server -

here code below using redraw , save image. bitmap bitmap = new bitmap(httpcontext.current.server.mappath( filepath + path.getfilename(filename))); int newwidth = 100; int newheight = 100; int iwidth = bitmap.width; int iheight = bitmap.height; if (iwidth <= 100) newwidth = iwidth; if (iheight <= 100) newheight = iheight; bitmap.dispose(); // once got information, we'll process it. // create image object using original width , height. // define pixel format (for rich rgb color). system.drawing.image objoptimage = new system.drawing.bitmap(newwidth, newheight, system.drawing.imaging.pixelformat.format16bpprgb555); // original image. using (system.drawing.image objimg = system.drawing.image.fromfile(httpcontext.current.server.mappath(filepath + filename))) { // re-draw image using newly obtained pixel format. using (system.drawing.graphics ographic = system.drawing.graphics.fromimage(objoptimage)) { var _1 = ographic; ...

angularjs - How to scrape text from span with ng-if attribute using python? -

i trying scrape data paytm web page using python beautifulsoup https://paytm.com/shop/p/masha-mauve-satin-nighty-wnighw000nt14_45bbppfr?src=search-grid&tracker=autosuggest%7cundefined%7cmasha%20nighty%7cgrid%7csearch%7c1 . able scrap fields using direct class names fields using angularjs attributes , don't have idea how that. i know how scrape data of span defined class:- mrp = link_soup.find_all("span" , class_="price")[0].string.strip() but don't know how same mentioned code. code want scrape data:- <span ng-if="!product.product.isonlycarcategory">buy rs 329</span> i want scrape number 329 span. whole code:- <div itemprop="offers" itemscope="itemscope" itemtype="https://schema.org/offer" class="buy-bar"> <button class="md-raised fl md-button md-default-theme" ng-transclude="" type="button" ng-show="!product.produc...

c - Android AOSP linux service standard output -

im developing own watchdog linux service (init.rc) android image im cooking. these linux services use log libraries log.h show output of such services. have tried track these libraries in order find log output dumped. i havent found neither in android logcat nor /proc/kmsg or dmesg this log.h library linux services started in init.rc: #ifndef _init_log_h_ #define _init_log_h_ #include <cutils/klog.h> #define error(x...) klog_error("init", x) #define notice(x...) klog_notice("init", x) #define info(x...) klog_info("init", x) #define log_uevents 0 /* log uevent messages if 1. verbose */ #endif and example of using such library info("starting watchdogd\n"); to display log service in init.rc can start service /system/bin/logwrapper example service xupnpdx /system/bin/logwrapper /system/bin/xupnpdservice

kohana - How do I pass parameters after setting the content of a template? -

my problem lose parameters (i.e. can't use id variable) when inside if condition because occurs after press submit button in view (i.e. after set post array) public function action_resetpassword() { $this->template->content = view::factory('user/password/reset') ->bind('message', $message) ->bind('errors', $errors); if (http_request::post == $this->request->method()) { $id = $this->request->param('id'); if understand correctly wish pass parameters view set in if. can done 'binding' these variables view (i.e. pass reference) public function action_resetpassword() { $this->template->content = view::factory('user/password/reset') ->bind('message', $message) ->bind('errors', $errors) ->bind('id', $id); // empty variable defined here ... if (http_request::post == $this->request->m...

javascript - Error with require node.js SyntaxError: Unexpected identifier -

i new node.js. created file named events_scraper.js , put code in file: var request = require('request'); var cheerio = require('cheerio'); var fs = require('fs'); var regions = ['campania','molise','puglia','basilicata','sicilia','sardegna']; var domain = 'http://www.eventiesagre.it'; var basepath = 'http://www.eventiesagre.it/cerca/eventi/sagre/maggio/{{region}}/prov/cit/intit/rilib'; var result = 'path_to_folder{{region}}.json'; //start of scraper function getdata(path, region) { request(path, function (error, response, html) { if (!error && response.statuscode == 200) { var $ = cheerio.load(html); // research information each events var evt = { categoria: $('.category').text().trim().replace( /\s\s+/g, ' '), titolo: $('.summary').text(), sottotitolo: $('.titolo...

implementation of custom validation on click of Save & Submit Button in angularjs -

i new angularjs , need develop single page application. have requirement of implementation of angular validation. i have 10 fields(input, select , listbox) on page , 2 buttons(save , submit). when click on save 6 fields(just example) should have valid values , when click on submit button- 8 fields should checked. but problem is. if used form tag on page how implement these validation. your appreciated. write code in controller obj.haserrorwithsubmit = function (form, field, validation) { if (validation) { return ($scope.submitted && form[field].$error[validation]); } return (form[field].$dirty && form[field].$invalid) || ($scope.submitted && form[field].$invalid); }; obj.haserrorwithsave = function (form, field, validation) { if (validation) { return ($scope.save && form[field].$error[validation]); } return (form[field].$dirty && form[field].$invalid) || ($scope.submitted ``&...

asp.net - How to replace special characters using regex -

using asp.net regex. i've written extension method want use replace whole words - word might single special character '&'. in case want replace '&' 'and', , i'll need use same technique reverse 'and' '&', must work whole words , not extended words 'hand'. i've tried few variations regex pattern - started '\bword\b' didn't work @ ampersand, , have '\sword\s' works except removes spaces around word, meaning phrase "health & beauty" ends "healthandbeauty". any appreciated. here's extension method: public static string replaceword(this string @this, string wordtofind, string replacement, regexoptions regexoptions = regexoptions.none) { guard.string.notempty(() => @this); guard.string.notempty(() => wordtofind); guard.string.notempty(() => replacement); var pattern = string.format(@...

c# - Copy a text field data into a look field type -

i new in coding world :) helpful if can me below query. have created 2 custom entity called sector , sub sector having 1:n relationship account. since relation fields hence lookup type , populated on account form. on part, have insideview( 3rd party tool) integrated our contact , account form. have mapped fields inside view crm fields update data inside view when being synced inside view not support lookup type field hence cannot map lookup field type data. we discovered barrier when tried map our custom entity (sector , subsector) inside view. since cannot map lookup field type thought have 2 text field instead , map inside view. once data synced these 2 text fields filled out sector , subsector name. now, want copy information text fields lookup field (custom fields sector , sub sector) in advance :) bhavesh i not understanding requirement can fill lookup field text. use following code: function setlookupfield() { var context = xrm.page.context; var user...

linux - Separate SSH and SFTP -

is possible separate ssh , sftp? for example, have sftp listening on port 22 , ssh on port 2222? i have separated list of sftp , ssh users, goal allow sftp users connect on port 22, , make ssh listening on higher port such 2222. as both part of ssh not find way achieve this. thanks in advance! the other questions correct, can set single instance of openssh listen on both ports , handle sftp connection on 1 , ssh connections on other: port 22 port 2222 match localport 22 subsystem sftp internal-sftp chrootdirectory /sftp/root/dir allowtcpforwarding no x11forwarding no forcecommand internal-sftp

php - saving hasMany always add record instead of updating -

i have hasmany relationship (let's post hasmany comments ) i want edit both post , existing comment @ same time my code in comment edit.ctp file did <?= $this->form->create($post); ?> <?= $this->form->input('title'); ?> <?= $this->form->input('title'); ?> <?= $this->form->input('text'); ?> <?= $this->form->input('comments.0.id'); ?> <?= $this->form->input('comments.0.text'); ?> and in postscontroller $post= $this->posts->get($id); $post= $this->posts->patchentity($post, $this->request->data, ['associated' => ['comments']]); my problem now expect comment updated, instead cake adds new comment every time. what did do i tried debug $this->request->data , got [ 'text' => 'this test', 'comments' => [ (int) 0 => [ 'id' => '168...

javascript - HTML communication issue: jQuery .load function doesn't seem working -

i'm working on group project in highschool (so i'm not real developper) , have create website that'll display datas off of web server arduino card created (just html page). looked 8 weeks solution through internet , definetely didn't find anything, have 1 week finish this, i'm desperate.. i have learned html , css, little bit of javascript , jquery. , operations made in local environnement. first, tried value opening web server in new window -> taking wanted value -> closing window using : <script> function myfunction() { var mywindow = window.open("http://192.168.137.201/", "", "width=1","height=1"); var x = mywindow.document.getelementbyid("temp").innerhtml; document.getelementbyid("content").innerhtml = x; mywindow.close(); } so i'm trying output value "temp" id webserver in paragraph "content" value. here how server looks like: <!doctype htm...

javascript - Show directive one at a time AngularJS -

i trying use multiple directive in 1 page such 1 datepicker should enable @ 1 time, tried adding dynamic class somehow need double click in input box hide another. let me know doing wrong here. working plnkr - http://plnkr.co/edit/zcjr9zg9peuerx4krhbw?p=preview html code - <body ng-controller="mainctrl"> <div class="" ng-repeat="row in fakedataset" style="height: 150px; float: left;"> <my-datepicker dateid="dateid" first-week-day-sunday="true" placeholder="choose date" view-format="do mmmm yyyy" checkval="$index"> </my-datepicker> </div> </body> js code - var myapp = angular.module('myapp', []); myapp.controller('mainctrl', function($scope){ $scope.fakedataset = [34,787,56,78]; }) myapp.directive('mydatepicker', ['$document'...

tomcat - Maven permission denied -

i'm getting strange exception while trying create exploded war directory maven. , it's strange because changed files permissions 777 everyone. should check? ican't find useful info in stacktrace :( goals execute: install war:exploded tomcat:redeploy here's stacktrace: failed execute goal org.apache.maven.plugins:maven-war-plugin:2.3:exploded (default-cli) on project app-web: failed copy file artifact [com.kk:app-core2:jar:app-snapshot:compile]: d:\kk\app-2013\app-core2\target\classes (odmowa dostępu) -> [help 1] org.apache.maven.lifecycle.lifecycleexecutionexception: failed execute goal org.apache.maven.plugins:maven-war-plugin:2.3:exploded (default-cli) on project app-web: failed copy file artifact [com.kk:app-core2:jar:app-snapshot:compile] @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:217) @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:153) @ org.apache.maven.lifecycle.internal.m...

Liquid - switch statement with a variable -

i have following situation: <label for="swatch-{{ option_index }}-{{ value | handle }}" style="background-color: {% capture color %} {{ value | handle }} {% endcapture %} {% assign handle = color %} {% case handle %} {% when 'red' %} red; {% when 'navy' %} navy; {% else %} #f00; {% endcase %} background-image: url({{ value | handle | append: '.' | append: file_extension | file_url }})"> when {{color}} prints right color, when try use in comparison statement fails, returns blank (or rather default #f00 . same if statement. if define {% assign handle = 'red' %} then works fine. have tried using {{ value | handleize }} ? far i'm aware "handle" not right operator.

spring - springockito xsd link is broken -

the location of springockito's mockito.xsd seems broken. we used xsi:schemalocation="http://www.mockito.org/spring/mockito https://bitbucket.org/kubek2k/springockito/raw/tip/springockito/src/main/resources/spring/mockito.xsd but not work longer. know of current uri? looks kubek2k's bitbucket repo no longer accessible. luckily made github mirror here . given repo no longer accessible, better / more permanent solution might create local copy of mockito.xsd in src/main/resources directory, , reference instead. for example, create src/main/resources/meta-inf/spring/mockito.xsd , change xsd reference from: .... http://www.mockito.org/spring/mockito https://bitbucket.org/kubek2k/springockito/raw/tip/springockito/src/main/resources/spring/mockito.xsd"> to ... http://www.mockito.org/spring/mockito meta-inf/spring/mockito.xsd"> update 10-05-2016: there's fork here -- it's based off version 1.0.7 can see (which more recen...

Twitter Api : Rate limit - know remaining Tweets I can do -

i'm using twitter api , there don't undestand. i can ask how many remaining calls can on lot of things " rate_limit_status " call. ( https://dev.twitter.com/rest/reference/get/application/rate_limit_status ) but doesn't tell me how many tweets can or how many favorites can do. is there way ask ? don't find rate limits on theses actions. made test, , twitter stopped me after 300 tweets have no way know when able tweet again api. why these actions separate others ? can find how rate limit work on tweets , favorites ? there other "api call" i'm missing ? the rate limits on tweets has no rate limits can access twitter rest api. solution update instead should follow following rule : 2,400 tweets per day. daily update limit further broken down smaller limits semi-hourly intervals. retweets counted tweets. source : https://support.twitter.com/articles/15364 or 50 tweets every 30 minutes. in addition please note twitter...

Export only Gridview Data to Excel format in Asp.net C# -

in page have 2 textbox controls, gating date calendar extender & in export excel button going export gridview data excel sheet. when gating excel sheet show the textbox & button export excel sheet. i have written export code in export button. like:- protected void export_to_excel_click(object sender, eventargs e) { try { response.clearcontent(); response.buffer = true; response.addheader("content-disposition", string.format("attachment; filename={0}", "customers.xls")); response.contenttype = "application/ms-excel"; stringwriter sw = new stringwriter(); htmltextwriter htw = new htmltextwriter(sw); grd_middata.allowpaging = false; bindgriddata(); //change header row white color grd_middata.headerrow.style.add("background-color", "#ffffff"); //applying stlye ...

c# - Set contents of page according to browser resolution -

Image
here default browser size.and qr code @ right place. when re-size browser .i got one.but here qr code disappearing if reduce more. i want qr code under captcha . have searched ,got answers not working in case.please help. here code.thanks in advance. <div style="border: 1px solid lightgrey; border-radius: 10px 10px 10px 10 </table>px; width: 75%"> <table width= "75%" style="margin-left:1%"> <tr> <td> @html.captcha("refresh", "enter captcha", 5, "is required field.", true)<div style="color: red;">@tempdata["errormessage"]</div> </td> <td> <div id="qrcode" style="width: 200px; display: none"> <img src="@url.action("qrcode", "qr...

gml - How to pour liquid in game maker? -

Image
i want put water sprite inside flask , when drag on top of container pour water container. know how in game maker? , here picture of flask , container you use rectangle visible through sprites of recipients , change it's scale when pour it. example, link it's image_yscale variable quantity of poured liquid. if motivated, shaders solution. otherwise, design flat-bottomed recipients, make them transparent, , use draw event draw liquid-colored rectangle inside of them before drawing them. result won't astonishing, far easier. your draw event ; 1 - draw rectangle @ x & y coordinates (you may have use offset), correct scale using image_xscale & image_yscale, , correct angle flask's image_angle variable. 2 - draw recipient after that.

mongodb - Mongoose versioning: when is it safe to disable it? -

from docs : the versionkey property set on each document when first created mongoose. keys value contains internal revision of document. name of document property configurable. default __v. if conflicts application can configure such: [...] document versioning can disabled setting versionkey false. not disable versioning unless know doing. but i'm curious, in cases should safe disable feature? the version key purpose optimistic locking. when enabled, version value atomically incremented whenever document updated. this allow application code test if changes have been made between fetch (bringing in version key 42 example) , consequent update (ensuring version value still 42). if version key has different value (eg. 43 because update has been made document), application code can handle concurrent modification. the same concept used in relational databases instead of pessimistic locking can bring horrible performance. descent orms provi...

java - Use new created plugin on another machine -

i new gate-nlp . have created own plugin.it working fine . want use in machine . dont want copy folder machine anothers plugin folder . how can ? for application distribution between machines create folder contains necessary plugins application. resources loaded folder. approach application has no dependencies gate framework installation.

ios - Swift - UIImagePickerController - didFinishPickingMediaWithInfo return nil -

i have take captured image url. didfinishpickingmediawithinfo returns nil. problem didfinishpickingmediawithinfo nil , request need url of captured image. this code. func capturenewimage() { if uiimagepickercontroller.issourcetypeavailable(.camera) { let imagepickercontroller = uiimagepickercontroller() imagepickercontroller.sourcetype = .camera imagepickercontroller.cameracapturemode = .photo imagepickercontroller.mediatypes = [kuttypeimage string] imagepickercontroller.delegate = self presentviewcontroller(imagepickercontroller, animated: true, completion: nil) } else { print("camera not available") } } func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [string : anyobject]) { print(info); // return values see below print(info[uiimagepickercontrollerreferenceurl]) //return nill - problem here if (picker.cameracapturemode == .ph...

routes - routing in codeigniter not working -

the page displaying correctly when click second page in pagination showing page not found.when had given route problem take place..this route had given.. $route['mens']='hardpolo_control/men_image'; $route['mens/(:any)']='hardpolo_control/men_image/$1'; this pagination url public function men_image($category_name=null) { $category_id =$this->hardpolo_model->get_category_id($category_name); $data['active_mn']=$category_id; $data['mendropdown']=$this->hardpolo_model->get_category_by_parent($p_id=8); $data['kidsdropdown']=$this->hardpolo_model->get_category_by_parent($p_id=9); $data['accessoriesdropdown']=$this->hardpolo_model->get_category_by_parent($p_id=21); $config['base_url'] = base_url().'mens/'.$category_name; $config['per_page'] = 3; $config['uri_segment'] = 3; $config['total_rows'] = $this->har...

java - I need to mock a RabbitMQ in my unit Test -

i using rabbitmq in project. i have in consumer code of client part of rabbitmq , connection need tls1.1 connect real mq. i want test code in junit test , mock message delivery consumer. i see in google several examples different tools how camel rabbit or activemq tools works amqp 1.0 , rabbitmq works in amqp 0.9 . someone had problem? thanks! update this code testing receive json queue. package com.foo.foo.queue; import java.io.file; import java.io.fileinputstream; import java.io.ioexception; import java.net.url; import java.security.*; import java.security.cert.certificateexception; import javax.net.ssl.*; import org.apache.commons.lang3.stringutils; import org.apache.log4j.logmanager; import org.apache.log4j.logger; import org.json.jsonobject; import com.foo.foo.constants.constants; import com.foo.foo.core.configurationcontainer; import com.foo.foo.policyfinders.policyfinder; import com.rabbitmq.client.channel; import com.rabbitmq.client.connection; import com...

sql server - How can i choose an Authentication Mode If i do not have permits? -

Image
i can start sql server windows authentication mode. want change mixed mode. tried following: in sql server management studio object explorer, right-click the server, , click properties. on security page, under server authentication, select new server authentication mode, , click ok. in sql server management studio dialog box, click ok to acknowledge requirement restart sql server. in object explorer, right-click server, , click restart. if sql server agent running, must restarted. in second step error: i not have permissions make changes. account not have right carry out change. tried assign login sysadmin failed. tells me: what should do? should reinstall , configure authentication on mixed mode? you donot need reinstall sql server instance. instead follow below given steps 1]change registry follows "software\microsoft\microsoft sql server\sqlexpress\loginmode" = 2 2]once change value in registry,follow below given url http://...

rule engine - Drools : Template for Multiple patterns of same format -

i have drools rule rule file as: package com.test import com.test.fact.feature; global com.test.course subjects; rule "cs" when feature( subjectname=="math", rating >= 6) feature( subjectname=="computers", rating >= 9) feature( subjectname=="electronics", rating >= 3) subjects.addsubjectname("computers"); end rule "physics" when feature( subjectname=="math", rating >= 9) feature( subjectname=="physics", rating >= 9) subjects.addsubjectname("physics"); end the patterns in when clause can changed pattern definitions defining subject placed in database table as: patterndefinition (patternname,featurename, featurevalue) patterndefinition table name patternname, featurename , featurevalue columns. e.g. rule "cs", definitions pattern name "cs" follows: row 1 -> cs, math, >=9 row 2 -> cs, computers, >=9 row 3 -...

Creating a variable via the form rails -

value variables written in variables @first_city, @last_city, @date_trip of controller. without creating object in database. pass values of these variables page. possible or not? <%= form_for(@orders) |f| %> <p>Выберите маршрут</p> <%= f.select(:first_city, @city_select, :value => :first_city, prompt: "Откуда") %> <%= f.select(:last_city, @city_select, prompt: "Куда") %> <%= f.text_field :date_trip %><br> <%= f.submit "Дальше", class: "btn" %> <% end %> yes. however if state form_for(@orders) it automatically assume creating order. however can form_for @order, :url => {:action => "action"} create own action , access values trough order_params[] and can whatever want data hope helped

c# - How can I read the same line twice from a text file? -

i need check each line in file. if equals "eoo" break loop. if not need process line. the problem line being skipped while (r2.readline() != "eoo")//check { string temp = r2.readline(); if (temp == "customer name: " + name + "") } what doing wrong? save value in variable , use value saved in variable in following code: var text = r2.readline(); // read line , save in `text` while (text != "eoo" && !r2.endofstream) // check `eoo` or end of file { // code, use `text` variable instead of reading next line if (text == $"customer name: {name}") { ... } text = r2.readline(); // read next line }

Android studio rebuilds project after changing device (plugging new one) -

scenario looks this: i build project , launch on device i change device (unplug old 1 , plug new 1 usb) i run project , pick new device deployment target. android studio rebuilds project again is there way fix this? mean use built .apk file , install on newly plugged device? this because of instant run feature introduced in android 2.0. because instant run has convert complete project small , numerous dex files transferred on device/emulator , build in place, every time unplug , replug device, android studio has go through whole process again. way around if change devices turn off instant run.

arp - How to use webspy? -

i tried spoof local network arpspoof dsniff package. good, can see sniffed packets "victim" in wireshark. now, how use webspy? i've tried running firefox: #webspy -i wlan0 192.168.1.xxx webspy: listening on wlan0 openurl(http://178.33.xxx.xxx/) the "victim's" computer (192.168.1.xxx) tried connect 178.33.xxx.xxx couldn't see in firefox. requiring more?

ios - When to use NSURLProtocol? -

i communicating on 'http://' , 'https://'. when , why use nsurlprotocol? i read used new/custom schemes , above schemes not need use nsurlprotocol. you use nsurlprotocol if want data doesn't come internet appear in browser.

reactjs - React Native: How to disable navigator sceneconfig gestures on the fly? -

i know it's possible disable scene gesture when pushing scene sceneconfig gestures null so: return { ...customnavigatorsceneconfigs.floatfrombottom, gestures: {} }; but i'd temporarily disable gesture when view pushed. i have lightbox/image modal zoom support. when image zoomed-in need disable swipe gesture otherwise activate when user panning image. default , zoomed-out want gesture work. is possible disable sceneconfig gesture on fly - in response current state? my workaround right handle gesture logic inside view instead (with panresponder/scrollview events) since navigator routes aren't transparent ( #4494 ) it's not possible replicate default animation/gesture way.

image src is not displaying the page in php -

**i'm trying upload img path in database , show them in slider, problem img src not showing page assigned. can body tell me why image src not loading page. my code below slider.php slider has image code : <img src='<?php echo "imagetest.php?id=$id" ?> width="200"> image path couldn't display page imagetest.php has following code: page not showing in img src of slider if (empty($_get['id']) || !is_numeric($_get['id'])) { echo 'a valid image file id required display image file.'; exit; } $imageid = $_get['id']; //connect mysql database if ($conn = mysqli_connect('localhost', 'root', 'root', 'test')) { $content = mysqli_real_escape_string($conn, $content); $sql = "select type, content images id = {$imageid}"; if ($rs = mysqli_query($conn, $sql)) { $imagedata = mysqli_fetch_array($rs, mysqli_assoc); mysqli_free...

Rails Associated Table Does not update -

i have 2 models influencers(id, first_name, ....) influencer_authorizations(id, provider, provider_uid, oauth_token, ....) influencers has_many influencer_authorizations i trying login or sign influencer # 1. check if token valid # 2. check if influencer has authorization facebook_uid # 3. if no - create new influencer # 4. if yes - loging in. update token , log him in but when old user tries login oauth token not getting updated facebook controller def create @facebook_login = facebookclient.new(facebook_user_token) if @facebook_login.create render :show else render :error end end facebook client class facebookclient def initialize(token) @token = token @client = koala::facebook::api.new(token) end attr_reader :influencer def create @influencer = new_or_existing_influencer save_influencer end def errors { facebook_error: @facebook_errors } end private attr_reader :c...

android - ViewPager is not showing up on bottomSheetDialog -

viewpager not showing on bottomsheetdialog. here implementation. public void show(final boxitem boxitem) { bottomsheet = (mcontext).getlayoutinflater().inflate(r.layout.layout_change_size_and_frequency, null); bottomsheetdialog.setcontentview(bottomsheet); bottomsheetdialog.show(); hashmap = boxitem.getfrequencyitemconfighashmap(); initviews(); setupviewpagerandtabs(); } private void setupviewpagerandtabs() { set<string> keyset = hashmap.keyset(); viewpageradapter adapter = new viewpageradapter(((appcompatactivity) mcontext).getsupportfragmentmanager()); (string key : keyset) { adapter.addfragment(searchdetailitemsfragment.getinstance(hash.get(key)), key); } viewpager.setadapter(adapter); tablayout.setupwithviewpager(viewpager); } private void initviews() { tablayout = (tablayout) bottomsheet.findviewbyid(r.id.tabs); viewpager = (vie...

php - Woocommerce custom downloadable product type -

i have create custom wc product type, defined follow: class wc_product_my_product extends wc_product_simple { public function __construct( $product ) { $this->product_type = 'my_product'; $this->virtual = 'yes'; $this->downloadable = 'yes'; $this->manage_stock = 'no'; } } as can see product is, how intended, virtual product consisting in downloadable files. using jquery define settings displayed when product selected. showing fields displayed simple product virtual , downloadable selected. /* * apply same settings virtual / downloadable files */ jquery( '.options_group.show_if_downloadable' ).addclass( 'show_if_my_product' ); jquery( '.hide_if_virtual' ).addclass( 'hide_if_my_product' ); jquery( 'body' ).on( 'woocommerce-product-type-change', function( event, select_val, select ) { if ( select_val == 'my_product' ) { jquery( '.show_if_my_...

doctrine2 - PreUpdate entity symfony LifecycleCallbacks -

i have little problem preupdate lifecyclecallbacks in symfony. i have entity user onetomany relation entity product. class user{ /** * @orm\onetomany(targetentity="product", mappedby="formulario", cascade={"persist", "remove"}) */ private $products; } class product{ /** * @orm\manytoone(targetentity="user", inversedby="products") * @orm\joincolumn(name="user", referencedcolumnname="id") */ private $user; } my problem when add or remove product user. when hapends want launch preupdate function make changes in user entity. preupdate not fire when changing entity product user. thanks lot!!! changing related entities not allowed using preupdate listener. changes associations of updated entity never allowed in event, since doctrine cannot guarantee correctly handle referential integrity @ point of flush operation. ... documentation . ...

jQuery: How to paint text in different colors? -

i'd append text items div element , paint them in different colors. here's code: for (var = 0; < data.length; i++) { if (data[i].id <= 2) $("#div3").append('<p>' + data[i].firstname + '</p>').css('color', 'red'); else if (data[i].id > 2 && data[i].id <= 4) $("#div3").append('<p>' + data[i].firstname + '</p>').css('color', 'green'); else $("#div3").append('<p>' + data[i].firstname + '</p>').css('color', 'blue'); } but, blue. what's wrong , how fix it? use appendto() instead: $('<p>' + data[i].firstname + '</p>').appendto("#div3").css('color', 'red');

opensaml - SAML 2.0 IsPassive option -

when working on apache tomcat saml 2.0 based single-sign-on (sso), came across property named 'ispassive' under saml 2.0 authentication requests. saml 2.0 spec introduces follows: ispassive [optional] boolean value. if "true", identity provider , user agent must not visibly take control of user interface requester , interact presenter in noticeable fashion. if value not provided, default "false". what accurate meaning or example of definition in terms of single-sign-on scenario? property have connection active , passive profiles in single-sign-on? first, has nothing active or passive sso. typically "active" refers web services based sso (i think desktop client apps this) while "passive" more typically refers browser-based sso. second, sending ispassive=true, sp telling idp, "authenticate user if can without have user involved." think common methods web sso might kerberos (integrate windows auth) or...

php - Querying lat , long from db and show all records with in range -

i working on program stores latitude , longitude of users (using mysql , php). i need make query , show list of users within 100 km range. i stuck below issues db design faster result. db structure fine? if want faster output index on both lat , long work? should use innodb or myisam engines in below case. querying result in above said case take time if have hundreds of thousands of records my sql table structure: id(int 11 primary key auto increment) | lat(varchar) | long(varchar) is there direct sql function or code in can users in specified range? googled , found of them using cos this. way? query gives output, slow: select id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) distance markers having distance < 25 order distance limit 0, 20; if use mysql >= 5.6.1, use function st_distance , see http://dev.mysql.com/doc/refman/5.6/en/spatial-relat...

php - Formula to get payment dates of direct debit bills -

having billing payment method bills set direct debit, , installment periods may vary: 30/60/90 days, 30/45/60, 15/30/45 , on, how can accurately installment dates? this have far, doesn't work instance 30/45/60, or 15/45/75: $dates = []; $invoicedate = explode('-', $invoicedate); // yyyy-mm-dd generation date foreach ($installments $i => $installment) { // e.g.: $installment = [30, 45, 60] if ($installment % 30 == 0) { $month = round($installment / 30); $date = mktime(0, 0, 0, $invoicedate[1] + $month, $invoicedate[2], $invoicedate[0]); } else { $month = 0; if ($installment > 30 && count($installments) > 1) { $month = floor($installment / 30); $installment = abs($installment - ($month * 30)); } $monthoffset = 30 - date('t', mktime(0, 0, 0, $invoicedate[1] + $month, 1, date('y'))); $date = mktime(0, 0, 0, $inv...

Inserting datetime as string C# SQL-server -

i have sql-server , column called citizenshipdate . column of type datetime in sql. however, problem can have value '0' not datetime value rather string value. so i'm trying handle string in c# when inserting values error: conversion failed when converting datetime character string. i error because i'm trying insert string datetime in sql-server. here code: class person { public string personalidentitynumber { get; set; } public string specialidentitynumber { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string citizenshipdate { get; set; } } list<folkbokforingsposttype> deserializedlist = new list<folkbokforingsposttype>(); deserializedlist = deserialize<list<folkbokforingsposttype>>(); var mypersons = deserialize<list<folkbokforingsposttype>>() .select(x => new person ...