Posts

Showing posts from March, 2011

Cannot connect native facebook via proxy in iOS -

i using proxy when using facebook, turns out cannot connect facebook server when using native app, works fine when use browser in mobile. can see native facebook connect fb server directly without proxy, other apps connect proxy server first. btw, think login ok fetch content not, can see graph.facebook.com visit proxy others not. is there way can use native fb proxy?

cassandra query for list the data using timestamp -

i new cassandra. have 1 table following columns customerid, timestamp, action,productid. need select customerid , date - date using time stamp.i dont know how in cassandra appreciated. first of should remember should plan queries executed in future , make table keys according it. if have keys (customerid, date) query can example: select * products customerid= '1' , date < 1453726670241 , date > 1453723370048; please, see http://docs.datastax.com/en/latest-cql/cql/cql_using/useaboutcql.html

Operator priority evaluation order in Prolog -

if define operator: op(700, yfx, sum). 700: rappresent priority respect other operators. yfx: rappresent precedence of arguments respect operator itself. configuration operator infix , argument y have precedence <= operatore priority , argument x have precedence < of operator priority. the highest precedence principal functor of therms, means isthe last operation executed.. so, means if have following evalutation: 9 sum 5 sum 7 so means have 3 in first evvaluate value of 5 sum 7 , evaluate: 9 sum (5 sum 7) is right reasoning operator priority? i think wording different you're using: 700: precedence. lower binds more strictly. yfx: associativity left. ?- write_canonical(1 sum 2 sum 3). yields sum(sum(1,2),3) . this operator associate left, arithmetic binary operators: ?- setof(x-o,current_op(x,yfx,o),l),pairs_keys_values(l,_,os). l = [250- (?), 400- (*), 400- (/), 400- (//), 400- (<<), 400- (>>), 400- (div), 400- (mod), ..

python - cherrypy didn't work correctly whith daemonize -

i'm new in cherrypy, , try develop small application using framework. problem is, application can serves , browser can access when cherrypy works in undaemonizer mode. when write code using cherrypy.process.plugins.daemonizer(), cherrypy started in background, , listen on specific port, browser connection refused( iptables or ufw shutted down still inaccessible ). incredible thing is, when start daemoned mode, can still start undaemoned process , , listen on same port. wonder why happend, , how solve it? simply saids: daemonizer starts, cherrypy listened on specified port, browser connection refused; without daemonizer, cherrypy works well. thanks alot with code from optparse import optionparser cherrypy.process.plugins import daemonizer cherrypy.process.plugins import pidfile import cherrypy import json import urllib import datetime try: import cpickle pickle except: import pickle import time import base64 import os import sys ''

visual studio - Broken references in solution -

i have large solution many project. have 6 developers working on solution using vs2013 , source controlled tfs 2013 . periodically project references , file references dlls broken. little yellow sign black exclamation point shows next reference in project references , when @ properties of broken references, noticed path empty elements broken. remove , re-add references, have done few times before , keeps breaking again. i googled around , found several people talking similar issues, in cases see, after removing , adding references, ok. case, keeps happening on , over. is there known cause this? can keep re-fixing this, it's workaround , not solution. assuming projectfirst generates dlls projectsecond, narrow down issue, can first build projectfirst , build projectsecond see whether behavior correct. if works, need check build order. in solution explorer , select project or select solution. on project menu, choose project build order check build order. on

android - how to disable button in listview -

i new android development , having hard time wrapping head around android listviews . pretty went through entire google search , tried every "possible" solution, without getting listview , having hard time solving problem. i want disable particular button when click complete_btn in listview item. right now, complete_btn.setonclicklistener in else {} part giving me null pointer exception (it's fine in if(converview == null) part). if remove code, works fine, commenting out in listener not work. i want disable button if yes clicked in alert dialog pops when button pressed! please me this?? public view getview(final int position, view convertview, final viewgroup parent) { view itemview; if (convertview == null) { itemview = layoutinflater.inflate(r.layout.activity_selected_delivery_item, parent, false); final deliveryltem deliveryltemposition = epiceriedelivery.selecteddeliveryitem.get(position); icon = (imageview)

jquery - KendoAutoComplete issue in chrome only -

enter image description here enter image description here when type user name showing above error.but when open in firefox , internet explorer works fine. below code function getactiveemployeenames() { //debugger; $.ajax({ type: "post", url: "vervewall.aspx/getactiveemployeenames", contenttype: "application/json; charset=utf-8", datatype: "json", success: function (response) { onsucceeded(response.d, null, null); }, failure: function (response) { //alert(response); } }); } it invoke below function var source = []; function onsucceeded(result, usercontext, methodname) { //debugger; //source = ""; if (result.length > 0) { if (source.length < 1) { (var = 0; <= result.length - 1; i++) { s

c - Serial port programming in Linux -

i want use rs232 port on board communicate pc. understand can use "dev/ttys0" purpose. i can open , write data pc using write() function. problem i can't read "dev/ttys0". every time use read function, "resource temporarily unavailable". can u guys tell me how solve problem? here code: #include <stdio.h> #include <string.h> #include <fcntl.h> #include <termios.h> #include <unistd.h> int main() { int n = 0, fd = 0, bytes = 0; char ch = 0; char buffer[10], *bufptr; int nbytes = 0, tries = 0, x = 0; struct termios term; fd = open("/dev/ttys0", o_rdwr | o_noctty | o_ndelay); if (fd == -1) { perror("open"); return; } else { fcntl(fd, f_setfl, 0); perror("port"); } if (n = tcgetattr(fd, &term) == -1) { perror("tcgetattr"); return; } if (n = cfsetispeed(&a

PHP read lock file created by a different Linux user? -

on linux server, have 2 linux users: jim - maintains central framework repository other users use, including 3rd party open source libraries such jobby . rob - uses framework maintained jim specific work. jobby php cron management script creates lock file @ /tmp/xxxxx.lck each job / process that's been started. before rob came in, jim used stuff including both central framework , specific work. therefore cron script run jim , lock file created , owned jim script reads lock file no problem. however, when rob came in , took on specific work, cron script rob run rob calls jobby library owned jim . lock file created , owned jim . cron script rob can't read lock file created jim , keeps giving jobby error: error: unable open file (file: /tmp/xxxx.lck). basically, script ( rob ) calls script b ( jim ) creates /tmp/xxxx.lck (-rw-r--r-- 1 jim jim), there secure way make script ( rob ) able read /tmp/xxxx.lck? but ain't permissions (-rw-r--r--) ri

Python Dictionary in Dictionary -

>>> docsite = {'text1':1, 'text2':1} >>> doc = { 'field1': docsite, 'field2': docsite } >>> doc['field2']['text1'] += 2 after when print doc variable, get >>> doc {'field2': {'text2': 1, 'text1': 3}, 'field1': {'text2': 1, 'text1': 3}} i change value in field2 only. somehow, values in field1 getting updated. question: why? how resolve it? your docsite variable reference dictionnary, therefore, storing @ different locations (e.g. associated different keys in dictionary) make them share same dictionary in memory. to resolve this, may want copy of dictionary: doc = {'field1': docsite, 'field2': docsite.copy()} note that, if in docsite have references other objects ( list , other dict , etc) may have use deepcopy : import copy d2 = copy.deepcopy(docsite)

javascript - Angular forEach not working -

Image
i have problem read data in angularjs. this example fixed obj work fine: var obj = { "done": "1"}; angular.foreach(st, function (value, key) { alert(key + ': ' + value); var returnval = value; //get number 1 ok }); my example: my function data return string ({ "done": "1"}); after replace var obj2 = data.repl ace("(", "").replace(")", ""); get format obj in above example. obj = { "done": "1"}; obj2 = { "done": "1"}; when put obj2 in angular.foreach not working. i'm trying use stringify, angular.fromjson nothing! any solution? in screenshot, obj2 json string , need parse object before sending foreach. here working example. var data = '({ "done": "1"});'; var obj2 = data.replace(/[();]/g, ''); angular.foreach(json.parse(obj2), function (value, key) { alert(key + 

c - Comparing defined raw data using preprocessor -

i have defined raw data in header file (which generated automatically), this: #defined raw_data 0x11, 0x20, 0x55, 0x00, x044 the aim check specific parameter of raw_data in compilation time , if wrong throw #error. for instance, during compilation, preprocessor should check if 2nd parameter of raw_data (in case 0x20) 0x20, if not throw #error. the main problem, how access specific parameter in defined raw_data, somehow possible? p.s. using keil compiler in c. #define raw_data 0x11, 0x20, 0x55, 0x00, x044 #define x_get_second_par(par) get_second_par(par) #define get_second_par(p1,p2,p3,p4,p5) p2 #if x_get_second_par(raw_data) != 0x20 #error "2nd parameter shall 0x20" #endif for specific parameter checking. it's not elegant.

awesome wm - Start client fullscreen doesn't cover wibox -

when client started, should started fullscreen. tried configure using rules no matter do, client doesn't cover wibox. what have far: function set_fullscreen(c) mywibox[c.screen].ontop = false c.fullscreen = false c.fullscreen = true c.x = 0 c.y = 0 mywibox[c.screen].ontop = false c.fullscreen = false c.fullscreen = true c.x = 0 c.y = 0 end awful.rules.rules = { { rule = { }, properties = { border_width = beautiful.border_width, border_color = beautiful.border_normal, focus = awful.client.focus.filter, keys = clientkeys, buttons = clientbuttons } }, { rule = { class = "<name>" }, properties = { fullscreen = true, size_hints_honor = false, focus = true }, callback = set_fullscreen } } i have wibox on bottom , application gets painted above wibox. gets painted off-scre

jquery - XPages fullCalendar is not a function -

hello need use fullcalendar scheduler example scheduler code (if open source code of example page simple undestard) so in xpages have created xpages code : <?xml version="1.0" encoding="utf-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core"> <xp:div styleclass="calendarcss " id="calendar"> </xp:div> <xp:scriptblock id="scriptblock1"> <xp:this.value><![cdata[$(function() { // document ready var x=x$("#{id:calendar}"); x.fullcalendar({ defaultview: 'agendaday', defaultdate: '2016-01-07', editable: true, selectable: true, eventlimit: true, // allow "more" link when many events header: { left: 'prev,next today', center: 'title', right: 'agendaday,agendatwoday,agen

typescript - How to add an external library inside microsoft's power bi developer tools and export in pbiviz -

i trying create custom visualization inside powerbi using pykcharts.js . unable import file pykcharts.js dev tool's console. have tried passing cdn path this /// <reference path="https://cdn.rawgit.com/akshayda04/powerbi-cdn/master/pykcharts/pykcharts.1.1.0.min.ts"/> as using typescript, not accepting it. there way include file , suggest me ways export file in pbiviz? you achieve using jquery.getscript() method. i tested , it's works fine withe power bi developer tools , custom visualisation. tried jquery.browser plugin this: $.getscript("https://cdnjs.cloudflare.com/ajax/libs/jquery-browser/0.1.0/jquery.browser.js", function( data, textstatus, jqxhr ) { //now external scripts loaded. on use }); and, after it's correctly loaded (so when jquery.getscript success callback invoked) use it, in example it's $.browser . need remember available after it's loaded. need adjust code wait before pro

automation - Automatic export from SAP GUI (no direct access to Database) -

i'm looking making automatic exports (extractions) sap. but there restraints : it's impossible work sap support team on subject i don't have direct access sap database (just login/password sap gui) i want computerize action of simple sap user : -> login sap gui -> access right menu (by name or transaction code) -> put informations relating user (site code, department code, material code, etc...) -> put dynamic range date (which change every day) -> extract data csv file the final objective build job schedule (every days @ 00:00 example) create export file (with sap data) on file server. every ideas welcome (official or not). take @ these automation , personalization techniques you: sap variants . variants presets different transactions , business functions allow launching them predefinde parameters. such sophisticated options dynamic dates (e.g. every day tomorrow's date passed transaction) possible. sap background

select image except for ROIs in imagej -

i have question regarding image processing in imagej. there way how select background except multiple rois have created in picture? thanks in advance it sounds made several rois , want select in image outside them. if so, can follows. of using roi manager recommended jan. make rois, adding each 1 roi manager pressing t. in roi manager, select rois, click more >> , choose or. combines rois one. add combined roi roi manager (press t) , select in manager. in main imagej menu, go edit > selection > make inverse. have roi except original rois. --theresa

r - How to get number and names of columns that have at least one null value -

i filter out columns have @ least 1 missing value after getting number of columns , thier names. use function names , number of columns contain missing values, filter them out of data frame: checkcolallnulls <- if (ncol(filter(function(x) all(is.na(x)), df)) > 0) { cat("columns have nulls:",ncol(filter( function(x) all(is.na(x)), df))) cat("columns names have nulls:",colnames(filter( function(x) all(is.na(x)), df))) df <- filter(function(x) ! all(is.na(x)), df) print("columns having nulls removed ") } else { print("no columns having nulls found") } i tried same operation columns have @ least 1 missing value using colsums out success. checkcolnulls <- if ( colsums(is.na(df)) > 0) { cat("columns have more 1 null:",ncol(colsums(is.na(df)) > 0 )) cat("columns names have more 1 null:",colnames(colsums(is.na(df)) > 0 )) df <- filter(function(x) colsums(is.na(x)) > 0), df) prin

r - Reducing data frame by linear regression -

i reduce following data frame: subject, run, condition, dv 1, 1, 1, 123 1, 1, 2, 456 1, 1, 3, 789 1, 2, 1, 123 1, 2, 2, 456 1, 2, 3, 789 2, 1, 1, 123 2, 1, 2, 456 2, 1, 3, 789 2, 2, 1, 123 2, 2, 2, 456 2, 2, 3, 789 to data frame: subject, run, coeff(lm(dv ~ condition)) 1, 1, ??? 1, 2, ??? 2, 1, ??? 2, 2, ??? any ideas on how approach this? you should use do rather summarize : df %>% group_by(subject, run) %>% do(lm = lm(dv ~ condition,data=.)) %>% summarize(subject=subject, run=run, coef=coef(lm)[[2]])

c# - How can I tick or untick a checkbox in a datagridview using White -

i have winforms app, displays datagridview. automatically populated bindingsource, , contains several rows of data. columns include standard things strings. of these columns checkboxes. name | user | admin ---- ---- ----- john | x | fred | | x i writing automated tests using teststack.white. can read existing state of checkboxes without issue. how set or clear checkboxes? i've tried: table.rows[0].cells[1].value = true; fails because underlying row/cell deleted before white can read current value. and also: table.rows[0].cells[1].setvalue(true); fails set new value. my helpful way set values? datagridview checkbox column - value , functionality : foreach (datagridviewrow row in datagridview1.rows) { row.cells[checkboxcolumn1.name].value = true; } or table object?

android - ButterKnife Bind in Fragment using different layouts -

i trying develop android application using fragments , stumbled on problem while trying use butterknife binds views , use @onclick annotation. in fragment inflate different layouts depending on user's selection in menu. lets user selects settings inflate settings layout holds button logout. if user selects sync in menu inflate sync view holds button start sync. my oncreateview looks following code: public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = null; if(settings) { rootview = inflater.inflate(r.layout.settings_view, container, false); } else { rootview = inflater.inflate(r.layout.sync_view, container, false); } return rootview; } so created @onclick method logout button @onclick(r.id.btnsettingslogout) public void logout() { toast.maketext(getactivity(), "button pressed!", toast.length_short).show(); } , added butterknife.bind(this, rootview); end of oncreateview

My docker was stuck by down whalesay, what should I do? -

i new docker, , learn start docker, went wrong docker pull whalesay : it's big, , download stuck. my operating system os x ei capitan. here docker version: jocelyndemacbook-pro:~ jocelyn$ docker version client: version: 1.9.1 api version: 1.21 go version: go1.4.3 git commit: a34a1d5 built: fri nov 20 17:56:04 utc 2015 os/arch: darwin/amd64 server: version: 1.9.1 api version: 1.21 go version: go1.4.3 git commit: a34a1d5 built: fri nov 20 17:56:04 utc 2015 os/arch: linux/amd64 from mac, shutdown current vm (i suspect named default: docker-machine ls make sure of name) docker-machine stop default then restart: docker-machine start default docker-machine ssh default and try pull image. note issue 12823 "docker can hang indefinitely waiting nonexistant process pull image" being addressed pr 19743 "set idle timeouts http reads , writes in communications registry" : commit e23ea05

javascript - jQuery post via HTML Form -

site searched on different sites don't find solution form/html file. i'm new in , don't know why code wont work, please review code , can tell me wrong ? (this me easiest way learn it) <!doctype html> <html> <head> <script src="jquery-1.9.1.js"></script> </head> <body> <form id="formoid" action="site" title="" method="post"> <div> <label class="title">first name</label> <input type="text" id="name" name="name" value="" > </div> <div> <label class="title">name</label> <input type="text" id="name2" name="name2" value=""> <input name="authenticity_token" type="hidden" value="token_value"> <

c# - Keep Clipboard Info after closing Program -

i have expanded datagridview user control , other numericupdown controls user can copy/paste information within software , other software excel. my problem when user closes software information in clipboard lost. clipboard information kept, in case information not big (maybe asking user, microsoft office software does). how can leave information in clipboard, user can use afterwards? use overload of clipboard.setdataobject allows pass in value indicating should happen data when app exits: true if want data remain on clipboard after application exits; otherwise, false.

php - moodle quiz not completing when criteria is met -

good morning, i have course 12 quizzes require participants take in sequential order. @ end of each video "video code" user has provide answer quiz. have done following: toggled completion criteria true under administration > edit settings checked require grade activity completion under current course > quiz # > edit settings (administration navigation) gave quiz mark of five, answer, , grade @ 100% under administration > quiz admin > question bank > questions set grade pass 5.00 via administration > course admin > grades > click cog under necessary quiz (must on grader report , edit turned on) now, cannot figure out why grade in gradebook not green, if have correct should mean grade passing. currently, not able move second quiz though grade passing , test user has completed activity.

node.js - How to show error message on same page in node js? -

i using post method submit form in node js. when submit form, want show error message node server if login fails. setting message res.send("") showing message on window. please me solve this? you can use module persisted flash messages between page redirects - https://www.npmjs.com/package/connect-flash

PHP MongoDB Nested Document Search -

i have nested document have language dependent content , want search if content have data specific language , query should return me content else false. i tried query option $data = $collection->findone(array('original'=>'what this', 'translation.language'=>'english') ); i expecting result: { "language": "english", "quote": "what this" } but above query return both language content. can please share code regarding saving , updating data using php my collection: { "_id": objectid("56a8844bc56760810e483815"), "language": "english", "original_key": "what this", "translation": [ { "language": "english", "quote": "what this" }, { "language": "spanish", "quote": "what spanish"

php - xampp or apache not work in some page WordPress -

i install xampp on windows server 2003. at first move wp on server hosting . but when open index page know every thing work 3 image source same : <img class="cover" src="<? bloginfo('template_url'); ?>/images/s1.jpg" alt="[html & css]"/> or data : <li class="<? if(is_home()) echo 'current_page_item'; ?>"><a href="#"> first page</a></li> and in page include @ first : <? /** * @package wordpress * @subpackage magazine_obsession */ require_once('fn-admin.php'); require_once('thman-settings.php'); require_once('thman-settings-pages.php'); add_action('admin_menu', 'thman_add_menu'); ?> and wp-admin not show me when try go wp-admin show top message . what problem? why same php file execute of them no? problem form apache or wp or xammp ? how can solve it? thanks help. all examples ha

ios - Capture movie with AVAssetWriter skipping frames in iphone 4 -

i'm trying capture movie using avassetwriter, in iphone 5 right, capture , save movie charm. but when try capture movie in iphone 4, samplebuffer skip frames , movie not good. so, code: - (void) initcapturesession{ // opensession , set quality 1280x720 session = [[avcapturesession alloc] init]; if([session cansetsessionpreset:avcapturesessionpreset640x480]) session.sessionpreset = avcapturesessionpresethigh; // devices audio , video devicevideo = [avcapturedevice defaultdevicewithmediatype:avmediatypevideo]; deviceaudio = [avcapturedevice defaultdevicewithmediatype:avmediatypeaudio]; nserror *error = nil; // create input of audio , video inputvideo = [avcapturedeviceinput deviceinputwithdevice:devicevideo error:&error]; if (!inputvideo) nslog(@"error: trying open camera: %@", error); inputaudio

ruby on rails - Model index.html page displaying duplicated data -

i'm getting strange behavior on model index page. when create 1 model object, displays correctly on index page. when create second model object, shows duplicates of both objects on index page, so object object b object object b i've confirmed duplicate objects not being created in database. also, when destroy object b, displays object correctly once. index.html.erb <table class="table"> <thead> <tr> <th>image</th> <th>name</th> <th>description</th> <th>url</th> <th></th> <th></th> <th></th> </tr> </thead> <tbody> <%= render @companies %> </tbody> </table> _company.html.erb <% @companies.each |company| %> <tr> <td><%= image_tag company.image(:medium) %></td> <td><%= company.name %></td> <td&g

How to publish test result files (.trx) to TFS 2013 -

status: i have tfs 2013 installation on dedicated machine , modified build template runs batch file (no visual studio project required), commit on our repository. while batch file runs, builds our code , runs custom test suites, test output multiple junit xml files. i found way on how can convert junit xml .trx files via batch, i'm stuck when comes publishing results tfs. i found out there multiple ways that, unfortunately no way possible on our build agent right now. i tried: use tfspublisher , described here - can't because don't have visual studio on our build agent machine installed use mstest.exe described here , can't either because -again- don't have visual studio on our build agent machine installed question: so there alternative way haven't found yet publish .trx files tfs? there must solution. can't first person tries accomplish that. instead of installing of visual studio, install test agents visual studio smal

symfony - Login in symfony2 -

i'm trying implement basic authentication in symfony2. here main parts of code don't see problem edit complete security.yml jms_security_extra: secure_all_services: false expressions: true security: encoders: symfony\component\security\core\user\user: plaintext role_hierarchy: role_admin: role_user role_super_admin: [role_user, role_admin, role_allowed_to_switch] providers: in_memory: memory: users: user: { password: userpass, roles: [ 'role_user' ] } admin: { password: adminpass, roles: [ 'role_admin' ] } firewalls: login: pattern: ^/login anonymous: ~ secured_area: pattern: ^/ stateless: true form_login: login_path: /login check_path: /login_check access_control: - { path: ^/login, roles: i