Posts

Showing posts from June, 2012

python - Getting a none type error while iterating a dictionary? -

this question has answer here: python function prints none 1 answer code:- def displayhand(hand): letter in hand.keys(): j in range(hand[letter]): print letter, # print on same line print # print empty line hand = {'a':1, 'q':1, 'l':2, 'm':1, 'u':1, 'i':1} print displayhand(hand) output:- a m l l q u none req output:- a m l l q u kindly give logical solution. your function not return when print result of function prints none displayhand(hand) # execute function without printing result, in case none

c# - Not to execute any further code until the async method is completed its execution -

not execute further code until async method completed execution. please let me know how achieve it. following sample code : // parent form code private void btnopenform1_click(object sender, eventargs e) { form1 form1 = new form1(); var result = form1.showdialog(); if (result == system.windows.forms.dialogresult.ok) { // } } // child form code private void form1_formclosing(object sender, formclosingeventargs e) { dialogresult result = messagebox.show(string.format("do want save changes?", "confirmation", messageboxbuttons.yesnocancel, messageboxicon.question); if (result == system.windows.forms.dialogresult.cancel) { e.cancel = true; } else { if (result == dialogresult.yes) { e.cancel = true; this.dialogresult = system.windows.forms.dialogresult.ok; // here need wait compulsarily till operation completed, no next statement should executed (ne

ruby on rails - Email Field returns blank string -

i using devise in rails3 application.the problem facing email field being returned blank string after save. resource.save rails.logger.info p resource this returns me #<user id: 1850, email: "", encrypted_password: "$2a$10$eznvztkpgyyn2k8i20vxbuk6oz.xq6gfocbouyfkdkx/...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, confirmation_token: "6e6c41315002a24cf63e4512ab94f693ef9d419218e1cbb9a2d...", confirmed_at: nil, confirmation_sent_at: "2015-07-02 04:49:23", unconfirmed_email: "anildiasdavis@gmail.com", company_code: "wnzqifhn", partner_id: nil, partner_type: nil, super_admin_id: nil, super_admin_type: nil, device_token: nil, is_active: nil, is_disabled: false, total_session_time: "0:0:0", status: "pending", created_at: "2015-07-02 04:49:

html - ReturnURL messed up when a page links to itself -

i have home.aspx , about.aspx in root directory, account folder included login.aspx , register.aspx , manage.aspx . i have navbar includes links relevant pages depending on whether user logged in or not. suppose if @ login.aspx page , clicks again on link /login.aspx , return url becomes returnurl="localhost:xxxx/account/account/login.aspx" if click on register.aspx now, becomes account/account/account/register.aspx what called , how rectify it? think need make virtual root directory relative addresses resolved. hrefs this, <li id="registerlink" runat="server"><a href="account/register.aspx"><span class="glyphicon glyphicon-user"></span> register</a></li> <li id="loginlink" runat="server"><a href="account/login.aspx"><span class="glyphicon glyphicon-log-in"></span> login</a></li> you use relative ancho

Block users using their ip addresses in php -

actually have no practical experience using php other in locally hosted server. following video tutorial learn php , , there code block specific ip web site. thing want know here if works users have dynamic ip addresses or not? and, proper way block user? i'm glad if can explain more practical side of blocking users. thank you! <?php $http_client_ip = $_server['http_client_ip']; $http_x_forwarded_for = $server['http_x_forwarded_for']; $remote_address = $server['remote_addr']; if (!empty($http_client_ip)){ $ip_address = $http_client_ip; } elseif (!empty($http_x_forwarded_for)) { $ip_address = $http_x_forwarded_for; } else { $ip_address = $remote_address; } //block list contains ips should blocked. foreach ($block_list $block) { if ($block == $ip_address){ die(); } } ?> visitors can restricted accessing site using ip deny manager in cpanel or adding allow or deny code in .htaccess file. syntax follows: allows ip 1

symfony - How to specify Symfony2 Bootstrap checkbox inline style? -

the symfony2 boostrap template has conditional switch on 'checkbox-inline'. how triggered? {% if 'checkbox-inline' in parent_label_class %} {{- form_label(form, null, { widget: parent() }) -}} since conditional check looking in parent_label_class , can add form builder option called label_attr , , there can append class. example: $builder->add('checkbox', 'checkbox', array( 'label_attr' => array( 'class' => 'checkbox-inline' ) ) ); which give following output: <div class="checkbox"> <label class="checkbox-inline required"> <input type="checkbox" id="form_checkbox" name="form[checkbox]" required="required" value="1" />checkbox </label> </div>

jquery - How to most efficiently check for certain "breakpoints" upon browser re-size? -

i'm playing responsive design have 2 breakpoints defined: mobile > max-width 320px tablet portrait > max-width 767px on desktop have lot of animation + advanced functionality going on javascript. on mobile , tablet im looking simplify , disable both js + "re-building" dom elements. im wondering efficient way determine breakpoints (in terms of width) be? im thinking lot performance here. i know can check window width upon re-size like: $( window ).resize(function() { if ($(window).width() > 320 && $(window).width() < 400) { //mobile } if ($(window).width() > 401 && $(window).width() < 768) { //tablet } if ($(window).width() > 769) { //desktop } }); but seems "expensive" operation? any suggestions lightweight libraries can used welcome! i ran problem , have not found perfect solution. however, there workaround seems less resource hungry. using timeout inside resize() function

Java best practice: Class with only static methods -

i have application have class called plausibilitychecker . class has static methods, checkzipcodeformat or checkmailformat . use them in gui classes check input before sending lower layer. is practice? thought i'd go static methods don't have care passing instance gui classes or having instance field in each gui class doesn't reference gui object. i noticed files class of java nio has static methods assume can't horribly wrong. i you're doing right. apart of that, advices utility class: make sure doesn't have state. is, there's no field in class unless it's declared static final . also, make sure field immutable e.g. string s. make sure cannot super class of other classes. make class final other programmers cannot extend it. this 1 debatable, may declare no-arg constructor private , no other class create instance of utility class (using reflection or similar do, there's no need go protective class). why may not this? well, s

sungridengine - Purging Dead Nodes from SGE -

my qstat -g c indicates have dead nodes (formally ' cdsue '): cluster queue cqload used res avail total aoacds cdsue -------------------------------------------------------------------------------- all.q 0.11 18 0 9 37 0 10 is there easy way purge or remove these nodes queue? sge smart enough not allocate work them clutter various displays. i hardway. kill jobs "running" or stuck on dead nodes. run qconf remove node pipeline - qconf -dattr hostgroup hostlist <nodealias> @allhosts' qconf -purge queue slots all.q@<nodealias> qconf -dconf <nodealias> qconf -de <nodealias>

ifndef - Conditional exclusion of code in Swift -

i trying exclude parts of swift file specific target. yet did not find replacement of #ifndef objective-c directive , if use form of kind: #if taxi_coops func pippo(){ println("pippo"); } #else func triggeractivelocationupdate(entering:bool){} #endif the preprocessor totally ignores directive , tries compile triggeractivelocationupdate. please note #if taxi_coops directive respected in other parts of same file. is there way exclude pieces of code in swift and/or why fix not work? in swift, use #if ! replacement #ifndef , e.g.: #if !os(osx) // compiled when not on os x #endif

App Indexing in android -

i have implemented app indexing in application not working , showing below messages. deep link page : http://m.cardekho.com/carmodels/hyundai/hyundai_eon google not resources page: https://graph.facebook.com/v2.0/244697749072142/activities?access_token=&format=json&sdk=android https://graph.facebook.com/v2.0/244697749072142?format=json&sdk=android&fields=supports_attribution%2csupports_implicit_sdk_logging%2cgdpv4_nux_content%2cgdpv4_nux_enabled https://graph.facebook.com/v2.0/244697749072142?format=json&sdk=android&fields=supports_attribution%2csupports_implicit_sdk_logging%2cgdpv4_nux_content%2cgdpv4_nux_enabled https://track.appsflyer.com/api/v2.3/androidevent?buildnumber=1.15&app_id=com.girnarsoft.cardekho the error message refers resources either disallowed crawling, or can't accessed, deemed important page structure. in case it's former. at https://graph.facebook.com/robots.txt it's showing: user-agent: * disallow

javascript - Two functions on Keypress won't work (textarea) -

i have created 2 function on enter key press to hide show dive on enter key press to auto resize textarea height on enter when reached end. here fiddle : http://jsfiddle.net/rz3f3gng/2/ $('.one').hide(); $(function() { //hide show dive on enter press , on other keys hide div $('#maincontent').on('keypress', function(e) { if (e.which == 13) { e.preventdefault(); $('.one').show(); } else { $('.one').hide(); } }); function textareaauto(o) { o.style.height = "200px"; o.style.height = (2 + o.scrollheight) + "px"; } }); .one { width: 100px; height: 30px; background: red; } textarea { overflow: hidden; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <div class="one"> </div> <textarea id="maincontent" onkeydown="textareaauto(

xml - Load a table from wikipedia into R -

i'm trying load table of supreme court justices r following url. https://en.wikipedia.org/wiki/list_of_justices_of_the_supreme_court_of_the_united_states i'm using following code: scotusurl <- "https://en.wikipedia.org/wiki/list_of_justices_of_the_supreme_court_of_the_united_states" scotusdata <- geturl(scotusurl, ssl.verifypeer = false) scotusdoc <- htmlparse(scotusdata) scotusdata <- scotusdoc['//table[@class="wikitable"]'] scotustable <- readhtmltable(scotusdata[[1]], stringsasfactors = false) r returns scotustable null. goal here data.frame in r can use make ggplot of scotus justice tenure on court. had script working make awesome plot, after recent decisions changed on page , script not function. went through html on wikipedia try find changes, i'm not webdev break script isn't apparent. additionally, there method in r allow me cache data page i'm not referencing url? seem ideal way avoid issue in future. a

parse.com - In cloud code seems impossible to use Parse.Config.get() with express is it correct? -

is there way use parse.config.get() inside expressjs app hosted in cloud code? looks easy use parse.object , parse.user parse.config.get() code not deployed using "parse deploy" we manage use adding jssdk in html , using "frontend js" haven't find way use in directly in express controllers. thanks it seem related kind of permissions issues... var parse = require('parse-cloud-express').parse; var util = require('util') parse.cloud.define("currentconfig", function(request, response) { console.log('ran currentconfig cloud function.'); // why have this? parse.initialize(xxx, yyy); parse.config.get().then(function(config) { // never called // ... console.log(config.get('xxx')) }, function(error) { console.log(util.inspect(error)) }); }); output ran currentconfig cloud function. { code: undefined, message: 'unauthorized' } edited code work me: var parse = requi

access vba - How to run function in vba using data macro? -

i new data macro in ms access 2013 , need it. lets assume have simple database 1 table of users. when change "age" field in table, want run external exe file (the reason why dosent matter). learn subject during last few days , end this: 1. build module in ms access called runminifix (minifix name of exe file want run). module uses shellexecute function , whole module looks that: option compare database const sw_show = 1 const sw_showmaximized = 3 public declare function shellexecute lib "shell32.dll" alias "shellexecutea" (byval hwnd long, _ byval lpoperation string, _ byval lpfile string, _ byval lpparameters string, _ byval lpdirectory string, _ optional byval nshowcmd long) long public function runminifix() dim retval long on error resume next retval = shellexecute(0, "open", "c:\program files\minifix\minifix.exe", "<arguments>", _ "<run in folde

How to understand git remote message? -

i have create new local repository (using git init, followed adding , committing files). later added remote repository: $git remote add br /home/user/work/git/bare/ i can see through command git remote -v git fetch br successful when switch repo, gives following message: $ git checkout br/master note: checking out 'br/master'. in 'detached head' state. can around, make experimental changes , commit them, , can discard commits make in state without impacting branches performing checkout. if want create new branch retain commits create, may (now or later) using -b checkout command again. example: git checkout -b new_branch_name head @ a155c68... added makefile.in` i did not understand above text? 'detached head' state? just add: $ git branch * (no branch) master $ i @ no branch, how/why? you checked out commit pointed remote branch (you can list them using git branch -r ). if it’s not pointed local branch, results in deta

multithreading - C# Form closing all threads join -

i have simple piece of code: private volaile bool working; private volatile list<thread> threads = new list<thread>(); private volatile form face; public void start(int n) { working = true; (int = 0; <= n; i++) { thread worker = new thread(() => { while(working) { // work } }); threads.add(worker); worker.start(); } } public void stop() { if(working) { working = false; logger.info("waiting threads join"); foreach (thread worker in threads) { worker.join(); } logger.info("threads joined"); } } private void face_closing(object sender, system.componentmodel.canceleventargs e) { face.invoke(new action(() => {stop();})); system.environment.exit(0); } face form creates on programm start , have controls, when use start() , stop() methods, works fi

javascript - Remove html element from a page loaded as ajax response into div -

i trying remove link(i want make button please in too) id=regbutton index.jsp page loaded response on clicking login button on regdata.jsp page regdata.jsp <script> $(document).ready(function(){ $("button").click(function(){ $("#maindiv").load("index.jsp"); $('#regbutton').remove(); }); }); </script> </head> <body> <div id="maindiv" class="units-row"> <h2>thanks registering!</h2> <button id="reglogin">login now</button> </div> index.jsp <body> <center> <s:actionerror /> <h1 id="login_title"></h1> <form action="checklogin.action" method="post"> <p> <input type="text" id="username" name="username" placeholder=&qu

c# - How to add relationship attributes in entity framework model first? -

how can add relationship attribute in many many relationship when using model first approach entity framework? suppose have 2 entities entity_1 , entity_2 has many many association. let's assume association has attribute attr1 . how model in entity designer in visual studio 2013? is there option or isn't there option? you can find on subject. http://www.entityframeworktutorial.net/code-first/configure-many-to-many-relationship-in-code-first.aspx

c++ - Barnes-Hut and recursion limit -

i have implemented "barnes-hut" algorithm n-body simulator, , have run problem. my program crash, memory related exceptions, stack overflow exception. the thing makes strange error receive not occur @ fixed times, seems come out of blue. using task manager can see there no memory leak, , have been careful avoid this. though, use recursion, , objects in objects. is possible need include maximum depth of oct-tree , causing error? the maximal recursion depth indeed limited stack size. stack size not same full ram memory size. eg. on windows, default stack size (per thread) 1mb, nothing more. it´s possible reconfigure program, and/or "catch" stack overflow error without whole program crashing (latter rather dirty, @ least possible). nonetheless best solution modified code rid of recursion. recursions can replaced iterative solutions, bit more complicated. , data of each function call can moved vector etc. 1 entry per call, dynamic allocated

Install4j created .app file for MAC is not showing any running instance warning message while uninstalling that application or deleting .app file. -

i uninstalling/deleting .app file on mac install4j created.but not giving running instance of file message while doing so. same scenario happens while installing, have running instance of application , when trying install application again on same location, should prompt me message application running , 1 can't install @ same location. not giving such message. suggest me if configuration or changes need set while building installer on install4j?? checking running processes on mac os x requires @ least install4j 6. in install4j 5.x , earlier feature not supported. update 2015-07-10: in addition there bug running process checking "single bundle installer" media file types broken. fixed in 6.0.4.

c# - cannot send email through button asp.net -

im planning send email image attached receiver. when click on button, nothing happens. error or success note not visible. can me out on this? thank you. here codes: aspx <%@ page title="" language="c#" masterpagefile="~/admin/site1.master" autoeventwireup="true" codebehind="submitpurchaseorder.aspx.cs" inherits="islandgas.admin.submitpurchaseorder" %> <asp:content id="content1" contentplaceholderid="title" runat="server"> </asp:content> <asp:content id="content2" contentplaceholderid="content" runat="server"> <form id="form1" runat="server"> <div> <table style=" border:1px solid" align="center"> <tr> <td colspan="2" align="center"> <b>purchase order supplier</b> </td> </tr> <tr> <td> gmail username: </td> &

html - font-size with display:inline-block fails -

i have problem css font-size cannot figure out. problem: simple website footer. footer consists of 2 columns, each column links. columns based on display:inline-block. the font-size set in rem , works fine on desktop. on mobile, ie android chrome, font-size not scale: text gets unreadable tiny, other text ie in p-tags readable expected. if remove display:inline-block footer-nav-column text scales expected loss of column-layout. i tried float columns too, text scales tiny hieroglyphs. what's wrong here? plz ;-) html: <footer class="footer-nav"> <div class="layout-center"> <ul class="footer-nav-column"> <li><a href="/contact">contact</a></li> </ul> <ul class="footer-nav-column"> <li><a href="/legal">legal</a></li> <li><a href="/privacy">privacy</a></li>

mysql - need absent and present count with month name -

i need month name absent , present count. database query: select sid,count(case when status ='a' 1 end) absent_count,count(case when status ='p' 1 end) present_count, monthname(attendance_date) `month_name` attendance sid = '2' , campus_id = 2 group sid; there's no point in group sid - '2' , per where clause. instead, since want count per month name, should appear in group by clause: select monthname(attendance_date) `month_name`, count(case when status ='a' 1 end) absent_count, count(case when status ='p' 1 end) present_count, attendance sid = '2' , campus_id = 2 group monthname(attendance_date);

use a different sidebar on the single.php of wordpress -

i want use different sidebar specific post category in wordpress i using plugin called simple page sidebars can register new sidebars , assign them pages.. need use such sidebar (which can configure in widget area) in single.php template if specific category selected. any hint? :) try open single.php and/or page.php , find following code: <?php get_sidebar(); ?> replace above code this: <?php $sidebar = get_post_meta($post->id, "sidebar", true); get_sidebar($sidebar); ?>

azure webjobssdk - Get BrokeredMessage from within custom IJobActivator -

is possible @ underlying brokeredmessage in web job service bus trigger within ijobactivator? useful in multi-tenant scenario. i'm using custom ijobactivator unity instantiate jobs. within unityjobactivator class, i'd able @ underlying brokeredmessage , pull custom properties off of it, such "tenant", of messages have. allow me inject appropriate database connection, or configuration objects job class before executed. below example want inject itenantconfiguration job, have based on brokeredmessage custom property. if access brokeredmessage within unityjobactivator. public class customjob { private const string subscription = "subscription"; private const string topic = "topic"; private itenantconfiguration config; public customjob(itenantconfiguration config) { // configuration depends on tenant property of brokeredmessage this.config = config; } public void handle([servicebustrigger(topic,

oracle - To insert a value in a String -

i have requirement manipulate string required value. i need change actualstring99 actualstring_99 . passing actualstring99 function , returning actualstring_99 in following way. select 'value' actual, regexp_replace('value', '[[:digit:]]') string, regexp_replace('value', '[[:alpha:]]') digit, concat(concat(regexp_replace('value', '[[:digit:]]'),'_'),regexp_replace('value', '[[:alpha:]]')) required dual; passing value as actualstring99 . have other simple way (using or without using regular expression) out calling function? to prepend underscore before numerical part of string, can use regexp_replace backreference. select regexp_replace('actualstri

android - Keep an activity/activities alive while the app is open in the background -

hey guys i'm brand new site, know people put down lot asking duplicated questions hope isn't 1 of them. as site, new android programming , have created simple app calculating price based on time. this app has 3 activities use switch layouts 1. firstactivity - shows title page , button launch second activity 2. secondactivity - starts timer , calculates price based on seconds. 3. lastactivity - shows end results of time , price , allows user share other apps (email, sms) everything working fine, when phone orientates current activity killed , restarted i've fixed forcing layout portrait - i've run problem again when move app background so actual question: need secondactivity keep time, , lastactivity keep saved info if user switches apps. i'm not talking when app closed im talking when app switcher or home button activated , app still open in background. thank in advance! so in end needed more information on how implement data save featu

javascript - Variation dropdowns into radio buttons -

i trying convert dropdown radio buttons on fly using jquery, here code jquery(document).ready(function($) { $('select#pa_size option[value=' + $choice + ']').attr('selected', true).parent().trigger('change'); }); this code me radio button. cant work add-to-cart option. please click add-to-cart link see direct page. jquery(document).ready(function($){ //get exising select options $('select#pa_size').each(function(i, select){ var $select = $(select); $select.find('option').each(function(j, option){ var $option = $(option); // create radio: var $radio = $('<input type="radio" />'); // set name , value: $radio.attr('name', $select.attr('name')).attr('value', $option.val()); // set checked if option selected if ($option.attr('selected')) $radio.attr('checked', 'checked'); //

angularjs - $http.get(url) not returning data -

i building service in angular , injecting service in controller. trying fetch data json file , using $http. data not getting returned , undefined. i updating code per suggestion @phil service.js ;(function(app) { app.factory('authservice', ['$log', '$http','$location', function($log, $http,$location) { var url = 'js/user.json'; var authservice= {}; var userexist=null; authservice.authenticate = function(userid) { var userobj = $http.get(url).success(function (data) { userexist = data console.log(data); return userexist; $log.info("loaded users"); }) .error(function (error) { $log.info(error); $log.info("no user exists"); return error; }) return userobj; } return authservice; }]); })(angul

sql server - How to run sql query for each row value using set based approach -

i have following code placed inside cursor , have remove cursor due performance issue. trying use set based approach, have replace @originalvalue , @per_month variable sql query per set based approach @ same time need perform below calculation each row (with value of @originalvalue , @per_month ) if replacing @originalvalue , @per_month sql query select originalvalue , per_month tblreport reportdate = getdate() ", in case below mention code not yielding result in row manner. eg. cursor declared below records: originalvalue per_month ------------------------ 100 1 200 3 600 4 500 7 code: set @total = (@total * power(1 + (@value1 / 100.0), @originalvalue) + (@per_month / 100.0) * ( case when @originalvalue = 0 1 else case when (@value1 / 100.0)<> 0 (power(1 + (@value1 / 100.0), @originalvalue) - 1) / (@value1 / 100.0) * (1 + (@value1 / 100.0) * @method) else @origin

Method to send multiple paperclip attachments through actionmailer in rails -

so need mailer send attachments user uploads in form upon creation. used cocoon , paperclip attach multiple files in form. here object_controller: class rfqscontroller < applicationcontroller ... def create @object= rfq.new(rfq_params) respond_to |format| if @object.save object_mailer.object_message(current_user, @object).deliver format.html { redirect_to @object, notice: 'object created.' } format.html { render :new } end end end ... this send email multiple attachments class objectmailer < applicationmailer default from: "test@test.com" def placeholder_message(user, rfq) @user = user object.object_attachments.each |attachment| attachments[attachment.attachment_file_file_name] = file.read(attachment.attachment_file.path) end mail to: user.email, subject: "test" end end

objective c - NSSet containing objects with overwritten isEqual -

in class overwrite isequal @interface myclass : nsobject @property (nonatomic, strong) nsstring * customid; @end i overwrite isequal checks equality of customid - (bool)isequal:(id)object { if ([object iskindofclass:[myclass class]]) { if (self.customid == nil) { return no; } return [self.customid isequal:[object customid]]; } return [super isequal:object]; } now nsset practically hash table, making fast check, if contains hash value... thats know but, let imagine code nsarray * instancestocheck = ...; nsarray * allinstances = ...; (myclass * instance in allinstances) { if ([instancestocheck containsobject:instance]) { // smth } } i "optimize" 1 (use nsset membership testing) nsarray * instancestocheck = ...; nsarray * allinstances = ...; nsset * instancestocheckasset = [nsset setwitharray:instancestocheck]; (myclass * instance in allinstances) { if ([instancestocheckasset contai

cmd - FORFILES file not found -

a file specified in /c parameter of forfiles command in batch file not being located. forfiles /p "%csv_path%" /m "*.csv" /c "cmd /c sqlcmd -s %db_server% -d %db% -e -i scripts\loadstationcsv.sql -o loadstationcsv.log -v temptable = ##dayparts csvpath = @path" sql cmd shows following error: sqlcmd: error: error occurred while opening or operating on file scripts\loadstationcsv.sql (reason: system cannot find path specified). executed command line, sqlcmd runs parameters above. scripts/loadstationcsv.sql file exists.

javascript - Change HTML Page in Crossrider Popup -

i have popup called picker.html contains 2 options - either going options page (that crossrider doesnt natively support) or opening webpage. there more options. now, when "go options" button pressed want change popup go file options.html . i tried using appapi.browseraction.setpopup work after click on browser action making useless. window.location doesnt work crossrider uses background.html , there's no api path of resource file. you can use document.open , appapi.resources.get change whole html. need run crossridermain make sure used resources being loaded. see working example below. experience it's not possible change height of new popup / page, please edit answer if finds tested possibility (css doesn't appear working here). <!doctype html> <html> <head> <script type="text/javascript"> function crossridermain($) { appapi.resources.includecss('html/bootstra

php - Cross Domain Sign In -

i have few domains on same server, same ip , same databases - can accessed 5 of domains. i have remade login system, on main domain, cookie works not main domain sub domains well. means if user logs 1 area, signed in everywhere. great! write cookie hash (taken db) , check when loading each page, , automatically securely signed in. this lovely, problem comes when switching domains, cookies seem locked down domains. other domain (lets call domain2.com) cannot read cookie domain1.com. are there clever ways around this? write database, such ip, wouldnt secure company work on same ip , therefore wouldnt specific. or thought maybe including hidden iframe on page, links page on main server, , pulls information way somehow. i not sure, sure can done. ideas? browsers, reasons, not allow cookies read other domain. what can have domain2.com redirect page on domain1.com checks if user logged in , if redirects domain2.com user's id can log them in.

jquery - Dropdown required field -

i have contact form has range of optional , required fields. 1 of required fields drop-down. looks this: <div> <select name="favfruit[]" size="1" required> <option value="apple">apple</option> <option value="banana">banana</option> <option value="plum">plum</option> <option value="pomegranate">pomegranate</option> <option value="strawberry">strawberry</option> <option value="watermelon">watermelon</option> </select> </div> jfiddle i using jquery validate required fields , works fine. except field shows having been completed user because drop-down displays first option default. user can leave dropdown untouched , jquery assumes form has been filled first choice , validates. so made simple change form leave first field blank adding <option val

android - Facebook SDK 4.0 get additional permissions -

in app want ask permissions log-in user , publish_actions . want publish picture on user wall after action when ask publish permissions request cancelled. using loginwithpublishpermissions needed permissions. tried mauthbtn.cancelpermission() but nothing changed. looking way obtain both permissions, if not together. loginbutton = (loginbutton) view.findviewbyid(r.id.login_button); loginbutton.setreadpermissions(arrays.aslist("public_profile,user_birthday,email")); as can see in above example asking birthday email , public profile. can same permission need. since want post app must reviewed facebook allow post

Laravel 5 Events and Queue -

as mentioned in laravel docs ( http://laravel.com/docs/5.1/events#defining-listeners ), can make listener queued. makes possible run events in asynchronous manner. i went more deep this, , found out can have event fired in separate laravel installation, long use same queue instance(beanstalkd in case) , share same listener (the listener class should defined in both installations). now need more information regarding this. is ok? mean, works now, considered "hack"? there library or way this? how can have distributed events using this? mean, when fire event somewhere, there listeners fired somewhere else. not on same installation, , of them has fired. not achievable current setup. i think i'm looking distributed event system laravel, i'm not sure... you don´t need queue achieve this. had similar problem , solve @ way: if want send events frontend on machine recommend use broadcasting events . can use redis or pusher. if want send events b

html - How do i combine these media query in to one? -

ok dumb question , i'm blacking out or how take media , make know screen size automatically? @media (max-width: 600px) { .wm-booking-enduser-logo-bg { max-width:600px; } } @media (max-width: 500px) { .wm-booking-enduser-logo-bg { max-width:500px; } } @media (max-width: 400px) { .wm-booking-enduser-logo-bg { max-width:400px; } } @media (max-width: 300px) { .wm-booking-enduser-logo-bg { max-width:300px; } } @media (max-width: 200px) { .wm-booking-enduser-logo-bg { max-width:200px; } } from looks like, want have .wm-booking-enduser-logo-bg expand full width of viewport, automatically. if element not child of parent element restricting size, use following (without media queries): .wm-booking-enduser-logo-bg { max-width: 100% } add comment if doesn't work you. edit: note max-width different width . latter sets width explicitly ( ie .wm-booking-enduser-logo-bg full width). former means "don't stretch elemen

ios - How to display image from a google json response using photo_reference? -

i getting json response google api. there tag in json called photo_reference. how display image using tag. nsdictionary *photodict = [[place objectforkey:@"photos"] objectatindex:0]; nsstring *photoref = [photodict objectforkey:@"photo_reference"]; nsstring *url = [nsstring stringwithformat:@"https://maps.googleapis.com/maps/api/place/photo?photoreference=%@&key=%@&sensor=false&maxwidth=320", photoref, kgoogle_api_key];

c++ - How do I cast a void pointer to a int[3]? -

i need call 3rd party library , pass in int[3] void * [works]: int pattern[3] = {2,4,10}; if ( ostaskcreate( blinkled, ( void * ) pattern, ( void * ) &blinktaskstack[user_task_stk_size], ( void * ) blinktaskstack, main_prio - 1 ) != os_no_err ) { iprintf( "*** error creating blink task\r\n" ); } but need parse string pattern array , can't seem right. first pass string parser , array: int (&parseblinkoncommand(char rxbuffer[3]))[3] { // code parses rxbuffer , creates 3 ints needed int pattern[3] = {repeats, onticks, offticks}; return pattern; } then try pass ostaskcreate did before: int pattern2[3] = parseblinkoncommand(rxbuffer); if ( ostaskcreate( blinkled, ( void * ) pattern2, ( void * ) &blinktaskstack[user_task_stk_size], ( void * ) blinktaskstack, main_prio - 1 ) != os_no_err ) { iprintf( "*** error creating remote blink task\r\n&qu

java - JSONObject["user_birthday"] not a string -

sorry repeated problem didn't found answer on google. trying parse json object of setter/getter class. public arraylist<user> getarraylist(stringbuffer jsonreceived){ arraylist<user> userarraylist = new arraylist<user>(); jsonobject json = new jsonobject(jsonreceived.tostring()); jsonarray usertable = json.getjsonarray("user"); (int = 0; < usertable.length(); i++) { user user = new user(); user.setid(usertable.getjsonobject(i).getint("user_id")); user.setlastname(usertable.getjsonobject(i).getstring("user_last_name")); user.setfirstname(usertable.getjsonobject(i).getstring("user_first_name")); user.setemail(usertable.getjsonobject(i).getstring("user_email")); system.out.println(usertable.getjsonobject(i).getstring("user_birthday")); string datestr = usertable.getjsonobject(i).getstring("user_birthday"); simp

python - qt stylesheet not working -

so writing small program,here code: import sys pyqt5.qt import qapplication pyqt5 import qtwidgets class cmywidget(qtwidgets.qwidget): def __init__(self,p = none): super(cmywidget,self).__init__(p) if __name__ == "__main__": app = qapplication(sys.argv) #w = qtwidgets.qwidget() #this ok #1 w = cmywidget() #2 label = qtwidgets.qlabel(w) label.settext("12345") btn = qtwidgets.qpushbutton(w) btn.settext("x") hlayout = qtwidgets.qhboxlayout(w) hlayout.addwidget(label) hlayout.addwidget(btn) w.setstylesheet("border:none;"\ "border-bottom:5px solid rgb(255,0,0)") w.show() sys.exit(app.exec_()) the problem if use #1 ,then ok,all widgets's bottom border drawed;but if change #2 ,only child widget draw bottom border,the cmywidget won't draw bottom border,am doing wrong here? there problems stylesheets when t

powershell - Adding objects to array to create multiple columns -

i'm trying displayname of software listed in addremoveprograms each computer, add array under name of computer, export. here's have: $computers = gc "c:\get software.txt" $csv = "c:\get software.csv" $results = @() if (test-path $csv) { remove-item $csv } foreach($computer in $computers){ #get displayname of software installed on asset $software = get-wmiobject win32reg_addremoveprograms -computername $computer | select-object -expandproperty displayname $counter = 0 while ($counter -lt $software.count){ #create psobject. loops through software , adds $results. $obj = new-object psobject add-member –inputobject $obj –membertype noteproperty -name $computer -value $software[$counter] $counter++ $results+=$obj } } $results | export-csv $csv -notypeinformation unfortunately, output lists first computer in csv. i've tried stepping through understand it, don't understand why can't add

ios - Facebook - Mobile app installs not tracked -

i having troubles when trying track number of mobile installs of ios application through facebook. i using facebook-ios-sdk 4.0.1 , , calling: - (void)applicationdidbecomeactive:(uiapplication *)application { [fbsdkappevents activateapp]; } however, when go bottom of facebook application dashboard, have this: last mobile app installs: we have not seen install pings app yet moreover, if go app ads helper app, get: no installs recorded in last 7 days ios. see app analytics more data. if expect see installs reported, make sure have set measurement indicated here. specifically, make sure to call 'activateapp' function app on foreground. include correct facebook app id in info plist. i'm doing both things. in fact, use other features facebook ios sdk , working fine. what weird that, if go app analytics , head mobile installs report, there actual installs being tracked. so question is, why installs being shown in ap

java - sendMultipartTextMessage sending as multiple SMS messages? -

i sending long sms messages in android using following code: smsmanager sms = smsmanager.getdefault(); arraylist<string> parts = sms.dividemessage(message); sms.sendmultiparttextmessage(phonenumber, null, parts, null, null); the problem on phones pre lollipop 5.0 (mainly noticed on kitkat 4.4) sms being sent 2 separate sms rather joined (multipart) message. on phones running lollipop 5.0+ message correctly sent long sms? i have tested on 2 exact same model phones 1 running 4.4 kitkat , other updated 5.0 lollipop , same behaviour described above occurs? has else noticed or found resolution? when message long enough, typically more 160 characters, it's sent separate sms messages, , on gsm networks bit of meta data added called user data header (udh) tells receiver separate messages should combined. what want happen receiver combine them single message. note it's receiver combines them, that's need looking. far know, behaviour of sendmultiparttext

javascript - jQuery can't access input field in table -

i'm trying change input field value dynamically loaded html. however, can't seem find right code. here code using: $.get('/js/dynamic/locations', function(newrow) { var existing_elem = $('.edit-table tr:last').after(newrow); var appendedrow = $('table tr:last-of-type'); appendedrow.find('td[data-th="name"] > span').text(v.location_name); appendedrow.find('td[data-th="name"] > input').val(v.location_name); }); the span text updating correctly, input value not updating @ all. here value of newrow: <tr> <td data-th="name"> <span class="edit-input-text"></span> <input class="inp input-edit" type="text" name="location_name" value=""> </td> <td data-th="address"><span class="edit-input-text"></span> <input class="inp input-edit&q

asp.net - Property Rows.Count of HtmlTable reduced to 1 -

on asp.net page have declared htmltable follows. <table> <tr> <td> <table id="nodestable" runat="server" cellpadding="0" cellspacing="0" rules=none frame=box> </td> </tr> </table> i fill table follows: for integer = 0 15 step 1 dim tblrow new htmltablerow tblinnercell = new htmltablecell() dim htmlcb new htmlcontrols.htmlinputcheckbox tblinnercell.style.add("text-align", "center") tblinnercell.controls.add(htmlcb) tblrow.cells.add(tblinnercell) nodestable.rows.add(tblrow) 'debugging here show rowcount increase sa far 15 next so see 15 checkboxes , html code shows 15 rows. check 1 of checkboxes 'checked' , press button. the code behind of button each row htmltablerow in nodestable.rows if(cbool(ctype(row.cells(0)

javascript - JSXGraph drag entire circle from center point -

i'm new jsxgraph. trying construct circle using 2 points center point , b sits on circle itself. need b resize circle (no problem, this) when dragged move entire circle around without resizing it. the examples give on link below have both , b resizing circle: http://jsxgraph.uni-bayreuth.de/wiki/index.php/circle can point me in right direction? thanks. this indeed tricky question. solution use groups. pack 2 (free) points group this: var board, a, b, circ, grp; board = jxg.jsxgraph.initboard('box6', {boundingbox:[-5,5,5,-5], keepaspectratio:true}); = board.create('point',[-1, -1], {size: 5, name: 'a', color: 'blue'}); b = board.create('point',[2, -1], {size: 5, name: 'b', color: 'red'}); circ = board.create('circle', [a, b]); grp = board.create('group', [a, b]); grp.removetranslationpoint(b); in case, dragging 2 points results moves circle while ke

vba - Code Interruption Error -

so code have below attempts find wip in column h. if find wip: copy 3 cells , make 10 replicas of them in next column either in same row or next available row. for reason code runs loop first "wip" value , gives code interruption error. can see why keeps happening? thank you, ori sub step1_update() dim dblsku double dim strdesc string dim strtype string dim browfin integer dim browfin1 integer dim counter integer dim trowfin integer counter = 0 worksheets("final").activate trowfin = 5 browfin = activesheet.range("a" & rows.count).end(xlup).row 'loop 1 while trowfin < browfin 'if 1 (set 3 values) if range("h" & trowfin).value = range("h3").value dblsku = range("f" & trowfin).value strdesc = range("g" & trowfin).value strtype = range("h" & trowfin).value 'find last used row in col j browfin1 = (activeshee