Posts

Showing posts from June, 2012

python - ImportError: /home/pi/cv2.so: undefined symbol: _PyUnicode_AsString -

hi have raspberry pi 2 model b raspbain installed on it, want machine vision applications installed opencv 3.0.0 version python 3+ following tutorial: http://www.pyimagesearch.com/2015/07/27/installing-opencv-3-0-for-both-python-2-7-and-python-3-on-your-raspberry-pi-2/#comment-364261 i wanted compile first program (which took here https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_image_display/py_image_display.html#display-image ): import numpy np import cv2 img = cv2.imread('messi5.jpg',0) cv2.imshow('image',img) k = cv2.waitkey(0) if k == 27: cv2.destroyallwindows() and error: importerror: no module named cv2.cv so searching found this: opencv - cannot find module cv2 , added: import sys sys.path.append('/usr/local/lib/python2.7/site-packages') to code (changing python2.7 python3.2 because that's 1 have) , error this: importerror: /home/pi/cv2.so: undefined symbol: _pyunicode_asstring i verified...

c# - Structuremap 3+ (3.1.6.186) how to specify a default instance? -

i'm convering old structure map new one.. 2. 3.1.6.186... i'm trying define default instance iwebaccess winformaccess...when run error: setup : structuremap.structuremapconfigurationexception : no default instance registered , cannot automatically determined type 'jcdctools.core.utilities.interfaces.iwebaccess' there no configuration specified jcdctools.core.utilities.interfaces.iwebaccess 1.) container.getinstance(jcdctools.core.utilities.interfaces.iwebaccess) at structuremap.sessioncache.getdefault(type plugintype, ipipelinegraph pipelinegraph) in c:\buildagent\work\a395dbde6b793293\src\structuremap\sessioncache.cs: line 63 @ structuremap.container.getinstance(type plugintype) in c:\buildagent\work\a395dbde6b793293\src\structuremap\container.cs: line 339 @ structuremap.container.getinstance() in c:\buildagent\work\a395dbde6b793293\src\structuremap\container.cs: line 202 @ _test_dal.basetest.testfixture...

javascript - How can I use JointJS with Meteor? -

i trying run sample app jointjs tutorial, i've got far. 1) sampleapp.html <head> <title>sampleapp</title> </head> <body> <h1>welcome meteor!</h1> {{> hello}} </body> <template name="hello"> <div></div> </template> 2) sampleapp.js if (meteor.isclient) { template.hello.onrendered(function () { var graph = new joint.dia.graph; var paper = new joint.dia.paper({ el: this.$('div'), width: 600, height: 200, model: graph, gridsize: 1 }); var rect = new joint.shapes.basic.rect({ position: { x: 100, y: 30 }, size: { width: 100, height: 30 }, attrs: { rect: { fill: 'blue' }, text: { text: 'my box', fill: 'white' } } }); var rect2 = rect.clone(); rect2.translate(300); var link = new joint.dia.link({ source: { id: rect.id }, target: { id: ...

node.js - Jquery i18next translation issue -

Image
i developing nodejs app. here how initialize i18next in app.js: var i18n = require('i18next'); i18n.init({ savemissing: true, debug: true }); here js code: ... // display strength based on score switch (strength.score) { case 0: $('#strength-meter').removeclass() $('#strength-meter').addclass('progress-bar progress-bar-danger') $('.progress .progress-bar').css('width', '25%') return 'very weak' break; ... i have tried using "return i18n.t('app.phlastname');" . "uncaught referenceerror: i18n not defined." error what doing wrong? in advance. update i changed code works on clientside. included i18n lib in page. , updated javascript/jquery code this: $.i18n.init({ debug: true }, function(t) { return t("app.lblname"); }); so don't seem above mentioned error, not getting text. when not using translati...

java - Refresh Session in spring security SAML -

we using spring saml extension provide support sso our customers. working fine our dev environment idp(okta). however, 1 of our client using tivoli idp , running problem after amount of time, user start getting unable authenticate error. based on research found out that, tivoli setting sessionnotonorafter attribute <saml:authnstatement authninstant="2015-09-14t20:14:14z" sessionindex="xxxx" sessionnotonorafter="2015-09-14t21:14:14z"> in our saml assertion response. i know options have sp handle scenario. should prompting user re-authenticate whenever run issue or there way can set our application in way can refresh session automatically. thanks sahil this sessionnotonorafter attribute expiry payload. sp should not receive same payload ever if there lot of chance middle man attack. the sp should implement keepalive functionality ping idp saying extend session of same payload.so idp can update attribute current data , ti...

Can facebook verify IDs for me? -

i see facebook has identity verification tools own users, possible poll api , determine whether or not user has had id verified? i'm assuming we'll have permissions access information access names. thank you! one quick @ docs tells there "is_verified" field, no need permissions: /me?fields=is_verified,name source: https://developers.facebook.com/docs/graph-api/reference/v2.4/user

ios - How to receive a touch ended event if a finger is already touching the screen when the app loads -

i need track if user touching screen across multiple views , separate screens throughout app. have created window delegate method receive every type of touch event. problem if keep 1 finger on first screen , tap button separate finger takes me second screen, when release original finger no event fired. this problem same if hold finger on screen before app loads , release once it's started, no event fired touch ending. i presume there in built system in ios states have start new touch once app has started or screen/view has changed, if release finger touching nothing happens. is there way detect this? need keep constant accurate number of touches on screen throughout different screens/views within app, if user takes finger(s) off screen.

java - Android development - variable inside inner class -

my second question android development (using android studio) of app i'm suffering through. elaborate: the aim : 2 arrows, 1 up, 1 down. above , below box contains information each time different. the problem : here try set conditionals based off variable set first 0. if arrow pressed , variable 0, nothing, otherwise decrement number. likewise, if down arrow press , variable 9 nothing, otherwise increment number. so happens. code: package com.example.savag.myapplication; import android.hardware.sensorevent; import android.hardware.sensoreventlistener; import android.media.image; import android.provider.settings; import android.support.v4.content.res.resourcescompat; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.imagebutton; import android.widget.imageview; import android.widget.linearlayout; import android.hardware.sensor; import android...

Vanilla Javascript: counter variable of for loop undefined when used in function -

this sudoko generator i'm programming in vanilla javascript: jsfiddle nicer looking full screen jsfiddle if click on 1 of fields, popup shown 3x3 fields 1 9. if click on 1 of fields of popup f. ex. 5 , should change parent field 5 . problem changes parent field undefined . here relevant code generate popup: // create popup function createpopup(position) { var popup = document.createelement('dialog'); popup.classname = 'popup'; popup.id = 'window_' + position; var dialogblock = popup.appendchild(document.createelement('div')); dialogblock.classname = 'popupblock'; (var z = 1; z <= 9; z++) { var div = dialogblock.appendchild(document.createelement('div')); div.classname = 'popupcell'; div.id = position + 'z' + z; div.appendchild(document.createtextnode(z)); div.onclick = function (e, z)...

Add regex to password complexity in Sitecore 8 -

the requirement require users have complex passwords requiring minimum length of 8 characters. 1+ non alpha numeric character. 1+ lowercase alpha character. 1+ uppercase alpha character. 1+ number. i can accomplish adding following web.config <add name="sql" type="system.web.security.sqlmembershipprovider" connectionstringname="core" applicationname="sitecore" minrequiredpasswordlength="8" minrequirednonalphanumericcharacters="1" requiresquestionandanswer="false" requiresuniqueemail="false" maxinvalidpasswordattempts="5" passwordstrengthregularexpression="(?=.{8,})(?=.*[\d])(?=.*[a-z])(?=.*[a-z]).*" /> passwordstrengthregularexpression validation seems not handled sitecore following unhandled exception when invalid password entered: 376 15:59:41 error application error. exception: system.web.httpunhandledexception message: exception of type 'system.web.httpunhandle...

ios - UISplitViewController pan to primary view from anywhere -

sorry long-winded explination, question - or similar - has been asked few times , havent found satisfactory answer. writing ipad app in ios 8 implements uisplitviewcontroller . have been attempting work on iphone. transferred on pretty well, collapses automatically , button included in left side of nav. bar. my problem want keep button functionality pop 1 view off stack, able pan primary view if there several detail views on top of it. ideally, want able overwrite or redirect interactivepopgesturerecognizer gesture smoothly pans primary view (in cases can have anywhere 1 4 detail views stacked on top of it). but, cannot figure out how this. my current solution (code below) disable interactivepopgesturerecognizer in detail viewcontroller , implement own screenedgepangesturerecognizer that, when triggered, executes poptorootviewcontroller . i've subclassed screenedgepangesturerecognizer treats screen edge pan discrete "swipe" (i.e. once large enough screen edge ...

c++ - How can I use a dialog (resource file) on a new VS 2013 project from a different VS 2013 project? -

let me first not want copy of resource file on 2 projects (i have seen question that). using windows 7, ms vs 2013, c++, mfc. these 2 projects referencing part of same solution. i have dialog has been created rc/h/cpp files works in 1 project (project a). want able open dialog routine in separate project (project b). project b has gui button when clicked wish dialog project brought up. i have included reference project in properties of project b. i have included (#include) rc file path project in rc file project b (which takes care of resource file, , definition numbers resource file not overlap). i have included path (from project a) class controls dialog in project b (in file contains event handler bring dialog). there no errors setup have, doesn't anything. create dialog , try domodal on anywhere in project (where works) , nothing happens, can click button many times , never brings up. i cannot provide of code on this, hope enough information give me kind of...

How to deal with removal of a permission for a broadcast receiver in Android M? -

i've got legacy code making permission safe marshmallow. there broadcast using phone_state permission follows: <receiver android:name="redacted.thebroadcastreceiver"> <intent-filter> <action android:name="android.intent.action.phone_state"></action> <action android:name="android.net.conn.connectivity_change" /> </intent-filter> </receiver> if phone_state permission granted later user denied when there phone call there permissions related crash. crash occurs before broadcast receiver's onreceive() called (the crash in android.app.activitythread.handlereceiver). means broadcast receiver not chance check if permission granted or not , deal situation. so question is, if there broadcast receiver such how can code deal situation user has disabled permission because afaik there no api monitor changes in permissions occur, therefore code cannot know on fly permission has been r...

Math programming with python -

so i'm pretty new programming , don't understand how problem. egg cartons each hold 12 eggs. write program reads integer number of eggs input(), prints out 2 numbers: how many cartons can filled these eggs, , how many eggs left over. appreciate help! at first, looking modulo operator , function math.floor() modulo from wikipedia: in computing, modulo operation finds remainder after division of 1 number (sometimes called modulus). for example: 12%12=0 24%12=0 25%12=1 this fit needs eggs leftover. math.floor() returns largest following integer. eg.: math.floor(13/2) would same as math.floor(6.5) and result in 6. this function should solve problem filled egg cartons. hint remember import floor() properly. from math import floor first, try figure rest out on own. you shouldn't @ until code done. either way i'm not mom, if wanna die dumb tried prevent it. https://github.com/aiyionprime/eggcartons one last thing....

gulp - TypeError: module is not a function AngularJS & Jasmine and protractor -

i have following in app.js require('angular'); var http = require('http'); var filldropdownscontroller = require('./js/controllers'); var getdropdownsservice = require('./js/services'); angular.module('app', ['filldropdownscontroller', 'getdropdownsservice']); my ng-app on html tag. using gulp-protractor write unit tests. in test file, have mentioned following: beforeeach(function(){ module('app'); }); but keeps on giving error follow when run gulp command: message: failed: module not function stack: typeerror: module not function any idea wrong here? thanks!

python - I need a fresh pair of eyes for this Game -

i've been trying create rock-paper-scissor game [ sort of ;-) ], reason when computer wins doesn't display it, gives me error. read through code , tell me problem. (i new coding, , there million mistakes please explain them ) import random class game: def __init__(self, human): # these possible hands , corresponding numbers self.hand = { 1: "rock", 2: "paper", 3: "scissors", 4: "lizard", 5: "spock", 6: "spider-man", 7: "batman", 8: "wizard", 9: "gun" } # here write "hand" , "what beats + wining message" self.message = { "rock": {"scissors": "rock crushes scissors", "lizard": "rock crushes lizard.", "spider-man": "rock knocks out spider-man.", ...

javascript - Please help me understand this recursion function -

i'm trying understand recursion function , better educate myself on recursion in general. can't seem follow how code it's thing. i'm hoping can walk me through can understand what's going on. function takes largest value of array , checks see if combination of numbers add value. function arrayadditioni(arr) { arr.sort(function(a,b){ //sort array; return - b; }); console.log('sorted array: ['+arr+']'); var largest = arr.pop(); //grab last value aka largest function recursion(target, array){ if(array.length === 0) { //if array empty return boolean return target === 0; } var n = array[0]; //first value of array array = array.slice(1); console.log('array: [' +array+']'); console.log('target: '+target); return recursion(target,array) || recursion(target - n, array); //not sure ??? } return recursion(largest,arr); //call recursion function } console.log(arraya...

xamarin - How to export Android Signing Keys -

i have 2 machines, 1 pc, 1 mac. both have xamarin studio. on pc, i've configured android signing key, , have published app google play using key. made app changes code - on mac - , attempted sign using different key , upload, , of course, got "you must sign same key" error. i can't find way export android signing key xamarin studio installation on pc. can see import new key, not how export existing key. checked certificate manager both local system , user account on windows, no luck. any idea how export? in installation every release keystore stored @ x:\users\username\appdata\local\xamarin\mono android\keystore\appname check here

c++ - Error: Compiling Boost with MPI Support in Windows -

i trying compile 64 bit version of boost 1.57 (www.boost.org) source mpi support using microsoft visual studio 2015, having errors. following directions on following website ( https://gist.github.com/unanancyowen/d879a41710e9c05025f8#file-boost1-56-0-md ). have followed instructions letter, (instead) running following command build: c:\boost_1_57_0>b2.exe toolset = msvc-14.0 address-model = 64 --build-dir = build \ x64 install --prefix = "c: \ program files \ boost" -j4 with following error: c:/boost_1_57_0/tools/build/src/tools\mpi.jam:251: syntax error @ argument $(cluster_pack_path_native) c:/boost_1_57_0/tools/build/src/tools\mpi.jam:252: syntax error @ keyword { libs\graph_parallel\build\jamfile.v2:17: in modules.load error: rule "mpi.configured" unknown in module "jamfile<c:\boost_1_57_0\libs\graph_parallel\build>". c:/boost_1_57_0/tools/build/src/build\project.jam:311: in load-jamfile c:/boost_1_57_0/tools/build/src/build\projec...

java - getActionBar().setSelectedNavigationItem(position); -

i had nullpointerexception when used method above, instead of getsupportactionbar().setselectednavigationitem(position); for future reference, how can android studio or intellijidea give me better tip on mistake. havent tried analyze -> inspect code i received common mistake commonsguy sample demos. it available in google's own effectivenavigation code sample as: // set action bar. final actionbar actionbar = getactionbar(); here, actionbar stayed null , set if(actionbar != null) statements , code managed run, until changed android support library method: getsupportactionbar() this example google had managed run without showing me 3 "sections tabs" your activity should extending appcompatactivity make possible use getsupportactionbar() method. please check if activity 's theme not extending noactionbar .

python - Regarding multiline/docstring comment -

i going through part of multi line comment shown below: def __init__(self): """ connect nexus 7 rfcomm port: 4 nexus 7 mac address: 08:60:6e:a5:82:c8 """ if not mistaken multi line comment reason python uses multi-line comment establish connection. makes me curious why happens? you're right, it's comment. it's docstring noted @nightshadequeen. docstrings functions/etc. used provide contextual hints in ides, in visual studio intellisense. comments not provide functionality or anything, helpful programmers using or reading code @ later date.

three.js - Multiple Textures on a Single Face/Plane -

Image
if have geometry, say three.planegeometry(400,400); or three.meshbasicmaterial({map:new three.meshfacematerial(materials)}); //multiple textures on 1 face how make have multiple textures on same side of plane? furthermore, how go setting coordinates of texture , position of texture on plane (or face)? it should this: you can use shader material textures uniforms or other approaches there , there , there .

ruby on rails - bash_profile syntax error -

i getting syntax error in .bash_profile when start terminal on yosemite. have found online suggests there nothing wrong syntax, although getting error in line 4. here error, followed .bash_profile code. can see wrong? affecting ability install rails (i seem having difficulty write permissions): the error: -bash: /users/admin/.bash_profile: line 4: syntax error near unexpected token `fi' -bash: /users/admin/.bash_profile: line 4: `eval "$(rbenv init -)"; fi' the .bash_profile code: export path=/usr/loca/bin:$path eval "$(rbenv init -)" if rbenv > /dev/null eval "$(rbenv init -)"; fi if rbenv > /dev/null; eval "$(rbenv init -)"; fi [[ -s "$home/.rvm/scripts/rvm" ]] && source "$home/.rvm/scripts/rvm" # load rvm shell session *as function* thanks! the if statement on line 3 not have matching then . until bash sees then , doesn't let use fi .

hardware - Is a Mac Air with Core 2 duo enough to start developing for ios? -

i'm planning buy second hand macbook air, target iphone , ipad development. developed extensive focus on .net technologies , i'm planning start developing app iphone 6. my question is: macbook air core 2 duo enough build application? have limited budget :( update: mean question, clarify if computer ok start small native applications, learning purposes. close "hello world" iphone app. well not enough development. need check latest mac os can install on ios development tool xcode requires specific os version xcode version . latest xcode 7 can installed on os x 10.10.4 or later.

javascript - Reference the text field that I'm in when I press enter -

javascript/jquery (doesn't work how want to): function chkkey(event) { if (event.keycode == 13) { $(this).val("value", "wow such code"); }; }; i not want reference text field name because have multiple text fields on page different names use same chkkey function. need reference text field i'm in regardless of name. possible? i'm thinking it's parent/bubbling issue, don't have experience things @ all. edit: complete html/js: <!doctype html> <html> <head> <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0" /> <title>boxes , lines</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> </head> <body> <div id="outerdiv"> <input type="button" name="btnnewfield" value="add new fiel...

php - htaccess issue - not rewriting url -

i know question has been asked lot of times before need help. have spent hours on , cant figure out heck wrong in following htaccess code. options +followsymlinks rewriteengine on rewriterule services/z/(.*)/ services.php?z=$1 rewritecond %{server_port} 80 rewriterule ^(.*)$ https://rcunlocks.com/$1 [r,l] i trying re-write url https://rcunlocks.com/services.php?z=spus3 to https://rcunlocks.com/services/spus3 if wrong htaccess file please tell me. your appreciated. thank you. try one options +followsymlinks rewriteengine on # check request url neither file nor directory rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^services/(.*) services.php?z=$1 [nc]

docker - Dockerizing an existing Project -

i have web based application using play framework , scala dockerize. essentially, following: create docker file docker container play application be able pass in configuration docker file can build docker image either local code base or pull master branch any suggestions on how started? hm, no real need create new dockerfile when thankfully many existing ones exist purpose. by searching on dockerhub these [ 1 , 2 ] images play framework exist. can use these "as is" or base new image on them if reason want more additional functionality. docker pull <image name> , docker run <image name> suffice them , running, plenty of parameters according needs whatever choice may be, it's idea first familiarize concepts of docker reading docs (which written nicely). additionally, address configuration requirements, focus on volumes in docker , allow share folder host container.

c# - Changing console color, gives me a Stackoverflow Exception -

i use following methods printing text in different color on console. private static void writeupdatedbookingdetails(string text) { console.foregroundcolor = consolecolor.darkgreen; writeupdatedbookingdetails(text); } when execute writeupdatedbookingdetails() method following code, gives me exception an unhandled exception of type 'system.stackoverflowexception' occurred in mscorlib.dll) static void main(string[] args) { ... // exception occurred when call method. writeupdatedbookingdetails("\n- - reconciling updated bookings - -"); ... } } your problem used recursion . when call method, foreground first set dark green. can see here, call same method again! forms infinite loop! when loop loops lot of times, stack overflows. that's why stackoverflowexception occurs. guess want call console.writeline (te...

security - preventing false positices in fortify scan -

we consistently see lot of false positives in our fortify results. there way can make fortify ignore sections of code? example can add comment in block of code overlooked fortify. you did not specify language scanning can change answer little bit. you can exclude files , directories either @ command line "-exclude" switch. once figure out syntax can include in build configuration, such pom.xml. look @ url examples: http://h30499.www3.hp.com/t5/fortify-software-security-center/how-to-exclude-source-files-from-scan/td-p/6574900

asp.net - Get version number of my website -

the website old aspx website. running under c# 4.5 using visual studio 2013 if helps. my assemblyinfo.cs file has following in it. [assembly: assemblyversion("1.0.*")] i have taken out assemblyfileversion attribute. on default.aspx file have following; site version: <%= system.reflection.assembly.getexecutingassembly().getname().version.tostring() %> however version displayed 0.0.0.0. i have followed sample on , http://abundantcode.com/how-to-get-auto-incrementing-version-number-in-visual-studio-2013/ still 0.0.0.0 any idea on doing wrong? edit: try this: typeof(yourmainclass).assembly.getname().version you can try this: var str = httpcontext.current.applicationinstance; assembly assem = str.gettype().basetype.assembly; system.version assemblyversion = assem.getname().version; or this: var ver = assembly.getassembly(page.gettype().basetype).getname().version;

xcode - Type variable in protocol - Swift 2 -

so have protocol, , in want variable class type. way can init class variable. keep in mind there many different classes. made quick example. i error "type 'cashregister' not conform protocol 'registerprotocol'" this example isn't i'm doing, gets point across. help. protocol registerprotocol { var currentbill: dollarbillprotocol {get set} func makenewbill()->dollarbillprotocol } extension registerprotocol { func printcurrentbill() { swift.print(currentbill) } } class cashregister: registerprotocol { var currentbill = onedollarbill.self func makenewbill() -> dollarbillprotocol { return currentbill.init() } } protocol dollarbillprotocol { // protocol bills have in common } class onedollarbill: dollarbillprotocol { required init(){ } } class fivedollarbill: dollarbillprotocol { required init(){ } } the way declare currentbill in cashregister makes var of...

converting a list to string and printing it out python -

i trying convert first letter of each word of string uppercase in python. keep getting generator object @ 0x10315b8> no post before seems answer question. def capitalize(str): newstr = str.split(' ') newlist = [] word in newstr: if word[0][0] == word[0][0].upper(): newlist.append(word[0][0].upper()) newlist.append(word[0][1:]) newlist.append(" ") convert_first = (str(w) w in newlist) print(convert_first) capitalize(input("enter string"))#calling function your problem lies in how trying make string out of list of strings. opposite of "splitting" string list "joining" list string. def capitalize(str): newstr = str.split(' ') newlist = [] word in newstr: newlist.append(word[0].upper() + word[1:]) convert_first = ' '.join(newlist) print(convert_first) capitalize(input("enter string"))#calling function note: made attempt have code clos...

java - Aparapi GPU execution slower than CPU -

i trying test performance of aparapi. have seen blogs results show aparapi improve performance while doing data parallel operations. but not able see in tests. here did, wrote 2 programs, 1 using aparapi, other 1 using normal loops. program 1: in aparapi import com.amd.aparapi.kernel; import com.amd.aparapi.range; public class app { public static void main( string[] args ) { final int size = 50000000; final float[] = new float[size]; final float[] b = new float[size]; (int = 0; < size; i++) { a[i] = (float) (math.random() * 100); b[i] = (float) (math.random() * 100); } final float[] sum = new float[size]; kernel kernel = new kernel(){ @override public void run() { int gid = getglobalid(); sum[gid] = a[gid] + b[gid]; } }; long t1 = system.currenttimemillis(); kernel.execute(range.create(size)); long t2...

autodoc - How to stop Sphinx automethod prefixing method name with class name -

when use sphinx automethod document specific method so: .. automethod:: my_module.myclass.my_method the resulting docs append class name method name this: myclass.my_method(kwarg1=none, kwarg2=none) docstring my_method... is there way tell automethod not prefix method name class name, such resulting docs this: my_method(kwarg1=none, kwarg2=none) docstring my_method... ? add line in conf.py file add_module_names = false

objective c - ios Xcode images.xcassets issue (deleted image keeps showing) -

i had image in images.xcassets using launch screen. deleted image, image keeps showing when use same file name. instance, actual file "logo.png" doesn't exist anywhere, , when type in "logo" image view, interface builder shows question mark, when app launched, image shows fine. the new image i'm trying use doesn't show when it's loaded images.xcassets. new image file not corrupt because when embed in project, not xcassets file, loads fine. this stupidest , frustrating issue ever had. have clue? *update: reason works now. didn't thing...

c# - Extract text between ~ tags -

i have have following string: ~header1 content1 content2 content3 content4 ~header2 content5 content6 content7 content8 ~header3 content9 content10 content11 content12 ~header4 i need extract content between each header ( ~header ) using regular expression in c# language. how accomplish that? i tried following code: string pattern = "\\~.*\\~"; matchcollection matches = regex.matches(data , pattern, regexoptions.multiline ) ; but not getting output. so there array output, suppose name m content: m[0] = "~header1|content1|content2|content3|content4"; m[1] = "~header2|content5|content6|content7|content8"; etc this trick string[] m = regex.split(value1, @"(?=~header)").where(x => !string.isnullorempty(x)).toarray();

sorting - spark rank - scala based one second and third elemnts of tuple of RDD -

hi assign rank each row based on second element , third element of tuple ,here have sample data . add " 1 " if third element of tuple has max value against id . if tuple's third element has same values values , based 1 second element of tuple i.e-maximum of second element tuple should have " 1 " fourth element . other fourth elements of tuple values 0 . hope understand requirement : (id,second,third)->tuple (32609,878,199) (32609,832,199) (45470,231,199) (42482,1001,299) (42482,16,291) code: *val rank=matching.map{{case (x1,x2,x3)=> (x1,x2,x3,((x3.toint*100000)+x2.toint).toint)}.sortby(-_. 4).groupby( ._1)* result: rank.take(10).foreach(println) (32609,compactbuffer((32609,878,199,19900878), (32609,832,199,19900832))) (45470,compactbuffer((45470,231,199,19900231))) (42482,compactbuffer((42482,1001,299,29901001), (42482,16,291,29100016))) desired output : (32609,878,199,1) (32609,832,199,0) (45470,231,199,1) (42...

Omniauth Facebook not returning email and gender rails 4 -

i need fetch name, email, image , gender facebook. getting name , image, email , gender not fetched facebook. struggling past 2 days, can me out here. user model: def self.from_omniauth(auth) where(provider: auth.provider, uid: auth.uid).first_or_initialize.tap |user| user.provider = auth.provider user.uid = auth.uid user.name = auth.info.name user.email = auth.info.email user.gender = auth.extra.raw_info.gender #if user.gender.blank? user.image = auth.info.image user.save! end end omniauth.rb omniauth.config.logger = rails.logger rails.application.config.middleware.use omniauth::builder if rails.env.production? provider :facebook, 'app_id', 'app_sec' elsif rails.env.development? provider :facebook, 'app_id', 'app_sec', {:scope => 'publish_actions,email', :client_options => { :ssl => { :ca_file => "#{rails.root}/config/ca-bundle.crt" }}} else provider :f...

graph - barplot of variables by factors in R -

Image
i wish plot barplots different categories (v, c , s in dummy data) values of different variables (v1-v5) see how ranges of different categories vary across variable. there way in r ? factor v1 v2 v3 v4 v5 v 12.0 8.4 5.3 3.0 3.5 v 11.8 7.5 4.7 2.8 3.7 c 13.2 9.5 5.7 3.0 4.1 c 13.4 9.3 6.3 3.3 3.8 c 10.5 7.7 5.0 2.5 3.2 s 13.1 9.6 5.4 3.1 3.9 s 15.0 9.0 5.1 4.5 9.0 its should simple code using package, have not been able figure out. you do: library(data.table) df2 <- melt(setdt(df), measure.vars = patterns("^v")) library(ggplot2) ggplot(df2, aes(x=factor, y=value1)) + stat_summary(aes(fill=variable), fun.y="sum", geom = "bar", position="dodge") + theme_bw() this gives: used data: df <- read.table(text="factor v1 v2 v3 v4 v5 v 12.0 8.4 5.3 3.0 3.5 v 11.8 7.5 4.7 2.8 3.7 c 13.2 9.5 5.7 3.0 4.1 c 13.4 9.3 6.3 3.3 3.8 c 10.5 7.7 5.0 2.5 3.2 s 13.1 9.6 5.4 ...

java - Is it possible to put methods in arrays to be randomized? -

i'm using java, , wondering if it's possible put methods directly arrays elements. like: ...[] arrayname = {herp(), derp(), jinkies()}; when looked prior, people mentioned "reflection," don't know (i'm new programming). there simple way put methods arrays (my goal spit them out randomly random, , terminate string parameter in each method named "quit" or something)? if not, how reflection work circumstance (if @ all)? i not asking reflection is. exact (main) question "is possible put methods arrays," , if is, how done? what syntax it? thank time it not possible in java assign function object. still can use use lambda expression or similar structure this. not assign functions can use one. create functional interface @functionalinterface interface myfunction { public void fun(); } use lambda expressions initialize array of functional interfaces myfunction[] functions = new myfunction[]{ () -> system.out...

python - When I request from instagram user info it's return only user name -

i use python library : from instagram.client import instagramapi access_token = "access token" api = instagramapi(access_token=access_token) user_info = api.user(user_id) print user_info i couldn't receive answer: { "data": { "id": "1574083", "username": "snoopdogg", "full_name": "snoop dogg", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1574083_75sq_1295469061.jpg", "bio": "this bio", "website": "http://snoopdogg.com", "counts": { "media": 1320, "follows": 420, "followed_by": 3410 } } how retrive bio, followers count etc. info? thankyou you receiving entire response, python version of instagram api client returning instances of user class (inherits apimo...

java - Can't retrieve method annotation into Jar file -

i try retrieve cucumber annotations make content assist plugin. don't know why code not work. reflexion api return me null method.getdeclaredannotations(). public list<string> getstepdefinition() throws classnotfoundexception, ioexception { string location = platform.getpreferencesservice(). getstring("mypref", "jarlocation", null, null); if(location != null) { file f = new file(location); url url = f.touri().tourl(); url[] urls = new url[]{url}; urlclassloader cl = new urlclassloader(urls); class<?> clazz = cl.loadclass("mystepdefinitionfile"); method[] methods = clazz.getdeclaredmethods(); (method method : methods) { if(method.isannotationpresent(soit.class)) { soit annotation = method.getannotation(soit.class); annotation.value(); } ...

CS50 helpers.c, Code not finding value (needle)? Any ideas? -

not sure why cant find value in array. whenever run code returns "didn't find needle in haystack." /** * helpers.c * * computer science 50 * problem set 3 * * helper functions problem set 3. */ #include <cs50.h> #include "helpers.h" /** * returns true if value in array of n values, else false. */ bool search(int value, int values[], int n) { //makes sure input value positive while (n > 0) { //searches until value found (int = 0; < n; i++) { if (value == values[i]) { printf("found it!\n"); return true; } } } return false; } haven't started sort /** * sorts array of n values. */ /*void sort(int values[], int n) { // todo: implement o(n^2) sorting algorithm return; }*/ i have changed , used if statement way was, still gives same. #include <cs50.h> #include "helpers.h" /** * returns true if value in ...