Posts

Showing posts from August, 2015

ios - Core Data Concurrency with parent/child relationship and NSInvocationOperation done right? -

i've been using core data store ios app data in sqlite db. data synchronized central server during login or after n minutes have passed , app grew, synchronization got slower , needed background process prevent freezing of main thread. for rewrote synchronization class use nsinvocationoperation class each process in synchronization method. i'm using dependencies data being imported/synchronized has several dependent relationships. then add operations nsoperationqueue , let run. there 2 additional important elements: when generate operations execute create new uuid nsstring, represents synchronization id. used track entities in core data have been synchronized, therefore, every entity has attribute stores synchronization id. used during synchronization process , accesses each method passed nsinvocationoperation . the import , synchronization methods actual methods access core data. inside each of methods create new instance of nsmanagedobjectcontext follows:

python - How can I put 2 buttons with images Vertically in a frame -

im using tkinter , trying create toolbar located on left side going vertically, have toolbar on top of frame filled in going horizontaly can't figure out how make second 1 on left, buttons. this code have: infobar = frame(master, bg="#ecf0f1", bd=1, relief=groove) infobar.pack(side=left, fill=both, expand=none) infobarr = label(toolbar, bg="#ecf0f1", text=' ') infobarr.pack(side=left, fill=y) poundtokgbutton = button(infobar, highlightbackground="#ecf0f1", image=eimg20, relief=flat, command=self.scale) poundtokgbutton.image = eimg20 createtooltip(poundtokgbutton, "conversion - pound kg") poundtokgbutton.pack(side=left) calculatorbutton = button(infobar, highlightbackground="#ecf0f1", image=eimg19, bd=1, relief=flat, command=self.calc) calculatorbutton.image = eimg19 createtooltip(calculatorbutton, "calculator") calculatorbutton.pack(side=

ios - What is the labels order in ABMultiValueCopyLabelAtIndex() -

i testing ios addressbook framework , trying figure what, what's best way extract value @ specific label , wondering @ same time if order of these labels change, random reason. this doing when adding new contact or adding existing one: let phone:abmutablemultivalue = abmultivaluecreatemutable( abpropertytype(kabstringpropertytype)).takeretainedvalue() abmultivalueaddvalueandlabel(phone, phonenumber, kabpersonphonemainlabel, nil) and later on in delegate call unknownpersonviewcontroller() doing this: let phone: abmultivalueref = abrecordcopyvalue(person, kabpersonphoneproperty).takeretainedvalue() firstphone = abmultivaluecopyvalueatindex(phone, 0).takeretainedvalue() as! string notice assuming main label @ index 0 . know comparison cfstring label possible, these labels funny, giving me weird gut feeling when comparing agains them. so, not sure how go this. you should not assume order. have read value of label. "look funny"

css - Font Face issues in Internet Explorer 8 -

i created test page ie 8 see if use google fonts. can find code @ end of question. i including every google font need using element list of them. now, depending on href attribute length in element, google fonts might not work in ie 8. here cases: if have: <link rel=stylesheet type="text/css" href="//fonts.googleapis.com/css?family=tangerine|open+sans|droid+sans|pt+sans|josefin+slab|arvo|lato" /> google fonts not work in ie 8. now, if remove "lato", last font specified: <link rel=stylesheet type="text/css" href="//fonts.googleapis.com/css?family=tangerine|open+sans|droid+sans|pt+sans|josefin+slab|arvo" /> google fonts work in ie 8. they work in chrome in both cases, ie 8 related only. html code test page: <html> <head> <link rel=stylesheet type="text/css" href="//fonts.googleapis.com/css?family=tangerine|open+sans|droid+sans|pt+sans|josefin+slab|arvo|lato&q

php - Authorization required oauth2 google picasa web album -

i have problem authorization in oauth2 google picasa api php. i have created following code: $fields_param_string="code=".$_get["code"]."& client_id=xxxxxxxxxx.apps.googleusercontent.com& client_secret=ry5syxxxxxxxxxx& redirect_uri=".urlencode("http://www.example.pl/upload.php"). "&grant_type=authorization_code"; $ch = curl_init( $url ); curl_setopt( $ch, curlopt_post, 1); curl_setopt( $ch, curlopt_postfields, $fields_param_string); curl_setopt ($ch, curlopt_httpheader, array("content-type: application/x-www-form-urlencoded")); curl_setopt( $ch, curlopt_returntransfer, 1); $response = curl_exec( $ch ); then right response (i have replaced data not hack it): "access_token": "ya29.ixxxxxxxxxxxxxx", "token_type": "bearer", "expires_in": 3600, "id_token": "eyjhbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" then run f

c# - Taking a file and splitting it into 2 groups -

so below have piece of code take data file , split 2 groups, , b. string path = @"c:\users\povermyer\documents\visual studio 2013\projects\danproject\pnrs\pnrs.log"; string[] lines = system.io.file.readalllines(path); var count = file.readlines(path).count(); list<string> groupa = lines.take(7678).tolist(); list<string> groupb = lines.skip(7678).take(5292).tolist(); for clarification, first group takes first 7678 lines of code , places group while second group skips first 7678 lines , places rest of lines, 5292 lines, in group. problem this, if use future files, might not contain 7678 fist , 5292. know beginning of first group starts , ends a, , second group starts b , ends b. question is, how code above place file 2 groups depending on how start , end? also, lines start , end not alone. example, beginning of ***********begin processing pnrs*********** , end ************end processing pnrs************` and same group b. please help! in ca

objective c - How to change MIDI TEMPO on the fly? [CoreMIDI] iOS -

i've got musictrack midi notes set musicsequence, ¡s being played musicplayer. problem comes when tried adjust tempo using; musictracknewextendedtempoevent(musictrack, 0.0, newbpm); apparently should change tempoevent in musictrack being played, doesn't. idea why happening? you first have remove tempo events tempo track. static void removetempoevents(musictrack tempotrack){ musiceventiterator tempiter; newmusiceventiterator(tempotrack, &tempiter); boolean hasevent; musiceventiteratorhascurrentevent(tempiter, &hasevent); while (hasevent) { musictimestamp stamp; musiceventtype type; const void *data = null; uint32 sizedata; musiceventiteratorgeteventinfo(tempiter, &stamp, &type, &data, &sizedata); if (type == kmusiceventtype_extendedtempo){ musiceventiteratordeleteevent(tempiter); musiceventiteratorhascurrentevent(tempiter, &hasevent);

c++ - How to return a pointer char from v8 to javascript -

i return char pointer v8 javascript, not work. in js length of result not good. example outlength 43529bytes in v8, in js have 4 bytes. correct in using return string::new((char *)img); javascript: var result = module.encode(); console.log(result.length); v8 handle<value> encode(const arguments& args) { file *pinputfile = fopen ( "images/file.rgb" , "rb" ); if (!pinputfile ) { fprintf(stderr, "could not open %s\n", "vr.rgb"); exit(1); } fseek (pinputfile , 0 , seek_end); long lsizeinput = ftell (pinputfile ); rewind (pinputfile ); char *img=(char*) malloc(lsizeinput*sizeof( char )); fread (img,1,lsizeinput,pinputfile); cout<<"length = "<< lsizeinput<<endl; return string::new((char *)img); }

ios - Xcode remove cell with animation programmatically -

hi have been searching around find way remove static cell animation have not found solution problem. have tried: [tableview deleterowsatindexpaths:[self.taskarray objectatindex:indexpath.row] withrowanimation:uitableviewrowanimationfade]; no success. you need hide cell before shown, in uitableviewdelegate's tableview:willdisplaycell:forrowatindexpath: method. last method in control can manipulate cell display. not remove space cell takes, thing can try set cell row's height 0 using tableview:heightforrowatindexpath: method of same protocol. - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [super tableview:tableview cellforrowatindexpath:indexpath]; if (yourcell) { return 0; } else { return [super tableview:tableview heightforrowatindexpath:indexpath]; } }

actionscript 3 - Open document function in Windows 7 with AIR App -

below code i'm working on open pdf file when button clicked. works fine in windows vista , windows 8+, pdf file gets opened once in windows 7. by clicking button again doesn't launch pdf file second time. function opendoc(event: mouseevent): void { nsstream.pause(); pausedbtn.visible = true; mcvideocontrols.btnpause.visible = false; mcvideocontrols.btnplay.visible = true; var realfile: file = file.applicationdirectory.resolvepath(_myfilename); //get user's home directory: var destination: file = file.documentsdirectory; //copy original file temponary user's home directory: destination = destination.resolvepath(_myfilename); realfile.copyto(destination, true); //open temponary copy user's home directory (acrobat or whatever): destination.openwithdefaultapplication(); } function oncuepoint(infoobject:object):void { opendocbtn.visible = true; timer1.start(); if (

javascript - get function name or some unique id of function from object -

window.vo = {}; window.viewobjects = function (viewname, view) { if (viewname in vo) { console.log('unbinding'); vo[viewname].undelegateevents(); } vo[viewname] = view; return view; }; i wrote above function deal multiple rendering of same view. but need pass unique name each view. window.viewobjects('booksindex', new views.dashboard.books.index()); is there way can avoid argument viewname? any way name of function view object. but issue when have views like dashboard.books.index() dashboard.stores.index() all backbone views have cid (client id) unique. use id identify views instead of assigning different name. something this: window.vo = {}; window.viewobjects = function (view) { if (view.cid in vo) { console.log('unbinding'); vo[view.cid].undelegateevents(); } vo[view.cid] = view; return view; }; the relevant part extracted backbone annotated code new

fullcalendar - Passing the name of a function as the eventMouseover callback -

i'm trying pass actual name of function rather anonymous function fullcalendar initialization so: $('#gcally_calendar').fullcalendar({ "eventsources": [...], "eventmouseover":"fc_hover_in" }); i'm getting console error when this, however: uncaught typeerror: array.prototype.slice.call not function . any thoughts on this? for thoroughness, function: function fc_hover_in(calevent, jsevent, view) { var tooltip = '<div class="tooltipevent" style="width:100px;height:100px;background:#ccc;position:absolute;z-index:10001;">' + calevent.title + '</div>'; jquery("body").append(tooltip); jquery(this).mouseover(function(e) { $(this).css('z-index', 10000); $('.tooltipevent').fadein('500'); $('.tooltipevent').fadeto('10', 1.9); }).mousemove(function(e) { $('.tooltipevent').css('top', e.pagey

Java HttpClient: I keep getting login page back when I request a different webpage even after I had already logged in successfully -

my goal: post login get image (link) within same session , post so far: i login via httppost , save cookie: private string sessionid = ""; .... private int logintoserver() throws ioexception { int result = 0; string httpsurl = "http://192.168.1.100:8080/foo/login.jsp"; httpresponse response; closeablehttpclient httpclient = httpclients.createdefault(); httpclientcontext httpcontext = httpclientcontext.create(); try { httppost httppost = new httppost(httpsurl); list <namevaluepair> nvps = new arraylist <namevaluepair>(); nvps.add(new basicnamevaluepair("username", "*****")); nvps.add(new basicnamevaluepair("password", "*****")); httppost.setentity(new urlencodedformentity(nvps)); response = httpclient.execute(httppost,httpcontext); //store cookies cookiestore cookiestore = new basiccookiestore()

vb.net - What methods to recognize sentence handwriting? -

i mean posts per sentence, not per letter. such doctor's prescription handwriting hard read. not normal handwriting. in example : i use data mining or machine learning doing training paper handwrited. user scanning paper hard read writing. the application doing image processing. and output sentence paper. and device use? (scanner or webcam) i newbie. if need example in vb.net emgucv/opencv , researches journals. any appreciated. welcome stack overflow! answer question twofold: a. if want recognize handwriting has happened i.e. presented image in trouble. computer vision still not enough provide reasonable accuracy. b. if have chance recognize handwriting “as it's happening” - in luck. download, example, gesture search app android play store , in business. the difference between 2 scenarios subtle significant. in second case have piece of information makes handwriting recognition possible. piece timing of each stroke. in other word

linux device driver - How many times same interrupt can be in pending state at a time? (In ARM CM-3) -

could not find answer how many times same interrupt can in pending state @ time? (in arm cm-3) e.g. : we processing 1 interrupt int_rx, @ same time 3 more packets received. expect 3 times more interrupt appear sequentially. notified 3 times or once or none? if processor doesn't service isr(interrupt service routine) @ first, there's no way check how many rx interrupts occurred later. seems rx isr doesn't work or there many other int's serviced rx due priority.

javascript - How to reload current page with variable from ajax response? -

i'm using ajax form send post data php file. , want reload current page variable response php. need update url in address bar after success response. code: type: 'post', success: function(data){ var data; if(data && data != 'error') { window.history.pushstate("string", "title", "article.php?do=$_get[do]&token='+data+'"); }else{ $('#savestts').html('error'); } my response variable php time stamp 1433428606 . need number reload page full url : www.test.com/admin/article.php?do=edit&token=1433428606 . tried reload data instead of timestamp server. please advice. this state push can done in chrome, safari, ff4+, , ie10+. the way you're doing looks right, having troubles? window.history.pushstate("object or string", "title", "/new-url"); there's response on topic here: updating

actionscript 3 - Flash Pro - AS3 embeded font not Showing up on Button Label in iOS -

so have annoying issue can't solve. creating app in flash pro/as3 ios. have button label font want change: var buttontextformat:textformat = new textformat("showcard gothic", 120); //buttontextformat.size = 120; //buttontextformat.font = "showcard gothic"; //buttontextformat.embedfonts = true; buttontextformat.color = 0x00ff00; //buttontextformat.embedfonts = true; smbutton.label = "pushme!"; smbutton.setstyle("textformat", buttontextformat); i used standard button found in components toolbox in flash. displays correctly during debug, once loaded iphone, label changed default font. i did embed desired font through text>font embedding... , works text field have, why not button label? i've tried buttontextformat.embedfonts = true; error: 1119: access of possibly undefined property embedfonts through reference static type flash.text:textformat. any appreciated. thanks.

swift - How to use YouTube iOS player helper with use_frameworks! with CocoaPods -

as question states, i'm trying use module in swift project using use_frameworks! option on podfile . so: platform :ios, "8.0" source 'https://github.com/cocoapods/specs.git' use_frameworks! pod 'youtube-ios-player-helper', '~> 0.1.3' pod 'reactivecocoa', '3.0-beta.6' pod 'moya' pod 'moya/reactive' i have checked pods project , has framework called youtube_ios_player_helper.framework since - invalid character name. when add import youtube_ios_player_helper swift file error saying not exist. i must have obj-c code in project , because of have bridging header file in project. make sure you're adding library correct target. my podfile: platform :ios, '8.3' target 'myapp' use_frameworks! pod 'youtube-ios-player-helper' end viewcontroller.swift: import uikit import youtube_ios_player_helper class viewcontroller: uiviewcontroller { // ... ov

excel - Best method to calculate provision from a table with provision levels? -

i have table provision levels. sales provision 0 5% 20 000 22% 100 000 30% a salesman has 5% provision on first 20 000, 22% on next 80 000 , 30% on above that. for example salesman sells 230 000 have provision =20 000 * 0,05 + 80 000 * 0,22 + 130 000 * 0,30 how can express efficiently formula? formula needs easy copy several rows (where salesman described each row) needs work if add more provision levels well can works (hopefully) requirement #2: needs work if add more provision levels but note unsure requirement #1: needs easy copy several rows (where salesman described each row) anyway, data: b c d e ------------------------------------------ 0 0.05 value 230000 20000 0.22 total provision 57600 100000 0.3 i used formula in e2: =iferror(sumproduct((indirect("a2:a"&match(e1,a:a,1))-indirect("a1:a"&match(e1,a:a,1)-1))*indirect("b1:

python - Element-wise operations in mpmath -

i looking perform element-wise mpmath operations on python arrays. example, import mpmath mpm x = mpm.arange(0,4) y = mpm.sin(x) # error alternatively, using mpmath matrices x = mpm.matrix([0,1,2,3]) y = mpm.sin(x) # error does mpmath have capibilities in area, or necessary loop through entries? mpmath not appear handle elemnt-wise operation, can use numpy functionality: import numpy np import mpmath mpm x = np.array(mpm.arange(0,4)) sin = np.vectorize(mpm.sin) y = sin(x)

objective c - Matching a string against multiple patterns -

i have question regarding style of solution pretty simple problem. i have program matches list of file names against number of patterns. if file name matches pattern, file renamed , counter incremented. currently i'm matching against 4 different patterns if ([file rangeofstring:pattern].location != nsnotfound) { counter ++; //rename file... } if ([file rangeofstring:pattern2].location != nsnotfound) { counter2 ++; //rename file... } [...] the solution works not scale. if have match against more patterns. so thought using like nsstring *someregexp = ...; nspredicate *mytest = [nspredicate predicatewithformat:file, someregexp]; if ([mytest evaluatewithobject: teststring]){ } however, not see way increment counters in such solution depend on exact match.... so wondering whether here knows more comprehensive/nice solution problem..... thanks in advance norbert how subclassing nsstring, adding counter track match count . @interface patternmatchings

Plone- In a dexterity.EditForm why is attempting to disable a widget causing a ConstraintNotSatisfied error? -

i'm trying disable widget in dexterity.editform, i'm getting error . here part of interface class particular widget want disable class irestaurant(iplace): restaurant_code = schema.textline(title=_(u""), required=false, ) iplace form.schema irestaurant inherits from. (from plone.directives) here code dexterity.editform class: class edit(dexterity.editform): grok.context(irestaurant) def updatewidgets(self): super(edit, self).updatewidgets() self.widgets['restaurant_code'].disabled = true when go edit form, error: constraintnotsatisfied: true why error occurring , how can fix this? also, version of plone using plone 4.3.5. edit: when tried printing type of object self.widgets['restaurant_code'].disabled was, said nonetype object. you might have better luck using mode property. try this: from z3c.form.interfaces import hidden_m

ios - UITableviewCell recursiveDescription showing no subviews -

Image
i'm creating prototype cell using xib , registering xib after loading uitableview . cell has been placed 2 uilabels as: i printed cell recursivedescription in cellforrowatindexpath keeping breakpoint. (lldb) po cell.recursivedescription <happeningnowsessionstableviewcell: 0x7fd93bc51300; baseclass = uitableviewcell; frame = (0 0; 380 65); autoresize = rm+bm; layer = <calayer: 0x7fd93bc952d0>> | <uitableviewcellcontentview: 0x7fd93bcf6460; frame = (0 0; 380 65); clipstobounds = yes; opaque = no; gesturerecognizers = <nsarray: 0x7fd93bc4b350>; layer = <calayer: 0x7fd93bca0030>> | <_uitableviewcellseparatorview: 0x7fd93bcb6b60; frame = (15 64; 365 1); layer = <calayer: 0x7fd93bca4410>> i wondered see no subviews in uitableviewcellcontentview . i'm able visualize assigned data in ui. i need subviews of cell's contentview per project requiremnt. why occuring so? please take @ uitableviewcells

java - Regex to find all fixed length numbers in a bigger number -

i want match fixed length numbers, in , bigger number. example; if number is 123456 i want obtain 123 , 234 , 345 , 456 . not looking other possible combination 135 or 654 . how can achieve this? i tried pattern \d{3} returned me 123 . thanks you can use lookahead based regex grab 3 digit numbers using captured groups: (?=(\d{3})) lookahead zero-width assertion giving ability lookahead 3 digit numbers without moving internal regex pointer. in java use: "(?=(\\d{3}))" regex demo

objective c - When to use Multiplier in iOS AutoLayout? -

an autolayout constraint can definded as: self.view.addconstraint(nslayoutconstraint(item: label, attribute: .bottom, relatedby: .equal, toitem: self.view, attribute: .bottom, multiplier: 1, constant: 0)) i did not understand use case using multiplier . when use multiplier in ios autolayout? one use case commonly use when want 1 view 30% of width of view. this: self.view.addconstraint(nslayoutconstraint(item: label, attribute: .width, relatedby: .equal, toitem: self.view, attribute: .width, multiplier: 0.3, constant: 0))

c# - Creating a parametrized field name for a SELECT clause -

i'm working on data api , generate sql query based on requested field names. field names publicly available , users able use alias rename data returned api. the records available in tables won't filed "top secret" still want prevent sql injection using parametrized field name , alias avoid people adding unwanted data. declare @requestedfieldname nvarchar(max) = 'firstname'; declare @alias nvarchar(max) = 'first name'; select @requestedfieldname @alias mytable there's plenty of examples using parameters in clauses , other clause involving value matched/assigned/set field... however, couldn't find example involving parametrized field name / alias in sql server (there's question jdbc , mysql none sql server) is there way parametrized field name or should consider building intermediate interface hold list of every available fields user can request? (i know second option used lot have lot of table , structure cha

Where can i set the duration for CarouFredSel javascript in wordpress? -

does knows can set duration caroufredsel javascript in wordpress? source: http://docs.dev7studios.com/jquery-plugins/caroufredsel duration listed in documentation under "hook carousel", meant? <script type="text/javascript"> $(document).ready(function() { // using default configuration $('#carousel').caroufredsel(); // using custom configuration $('#carousel').caroufredsel({ items : 2, direction : "up", scroll : { items : 1, easing : "elastic", duration : 1000, pauseonhover : true } }); }); </script>

php - Prevent changing checkbox value -

this question has answer here: prevent user editing checkbox value firebug? 2 answers can html checkboxes set readonly? 37 answers as i've found no other answer on web, i'm asking here : i'd find way prevent people changing checkboxes' values. i'm using serialize() , unserialize() set , checkboxes data on database, , problem if changes value of checkbox (using chrome or firefox dev tools exemple) messes retrieved values. i'd know if possible via php. it bit unclear ask: php can handle data on server side. if not want specific attribute of dataset read / write / database modified, don't it. no 1 forces consider data get, example inside $_post values form submission. however checkboxes presented @ client side. there users can modify va

jsf - XPages: How to acces an application scope bean from a session scope bean -

i need value application scope managed bean in session scope managed bean. not sure how done. saw poste here: https://guedebyte.wordpress.com/2012/05/19/accessing-beans-from-java-code-in-xpages-learned-by-reading-the-sourcecode-of-the-extensionlibrary/ bunch of errors... found this: jsf 2.0 accessing application scope bean bean im thinking maybe need redefine application bean??? totally clueless... how can make happen? here application scope bean's code: public class appconfig implements serializable { private static final long serialversionuid = 2768250939591274442l; public appconfig() { initdefaults(); initfromconfigdoc(); } // control number of entries displayed in widgets private int nbwidgetfavorites = 0; private int nbwidgetmostpopular = 0; private int nbwidgettoolbox = 0; // control number of entries display in what's new view private int nbwhatsnew = 0; private string showdetailswhatsnew =

How to turn off auto changing of words in reports like Height, Width and Count in Access 2000 -

for (old) project created report in access 2000. in report wanted create field multiplies 3 table fields values, namely: aantal, hoogte , breedte. so put in text field following: =[hoogte] * [breedte] * [aantal] . language of access 2000 dutch. what happens access automatically changed 3 words respectively [height] * [width] * [count] . field doesn't recognize these table fields since aren't named that. the problem 3 dutch words (hoogte, breedte, aantal) mean height, width , count in english. guess access thinks want use (which don't). ' the question is, how can stop auto filling/correcting/translating of these words? there setting turn off? i looked in options--->general tab--->auto name correction turned off in here (except keep/record information). height, width , count reserved words in access vba using them going cause problems. if working in form try changing text [form]![height]+[form]![width]+[form]![count] , report same except [re

php - Transfering a Laravel 5 app to live server -

i uploaded laravel 5 site localhost live server. added .htaccess file public folder , added following: rewriteengine on rewriterule ^(.*)$ public/$1 [l] i know places explain change public folder couldn't life of me work. now works except in /public/ folder. (wouldn't .htaccess added fix that?) anyway, please me add sort of redirect rule or else public folder work? in advance! my mistake. 1 of css files didn't transfer correctly. sees thread, above solution works.

shell - How to automate build process using python 3.4 and jenkins? -

i havep python (v3.4) project on git repository , using jenkins server automate build process. created job in jenkins, job pulls new version of project git , execute 2 shell commands : python setup.py build python setup.py install in console log error : .... nobounce.io 0.0.1 active version in easy-install.pth installing sample script /usr/local/bin error: [errno 13] permission denied: '/usr/local/bin/sample' build step 'execute shell' marked build failure finished: failure what doing wrong ? you're trying install software on server isn't allowed. one, don't have necessary permissions. , shouldn't anyway: imagine have 2 jobs create package (development , bug fixes last release). 1 find in /usr/local/bin/ ? pretty random. instead, should build egg other people can install , tell jenkins archive build result. if have dependencies, should virtualenv : https://jenkins-ci.org/content/python-love-story-virtualenv-and-hudson https:

Get second layer from PCAP with Python/Scapy -

i'm trying read , enumerate pcap file python when doing seem getting layer 3 data when layer 2 data present: here's code: import pprint scapy.all import * target_cap = 'hello.pcap' parser = pcapreader(root_dir + target_cap) i,p in enumerate(parser): pkt = p.payload pprint.pprint(pkt) ie output: <ip version=4l ihl=5l tos=0x0 len=52 id=12220 flags=df frag=0l ttl=128 proto=tcp chksum=0x453a src=192.168.2.100 dst=192.168.2.25 options=[] |<tcp sport=sddp dport=mbap seq=1584390497 ack=1497344211 dataofs=5l reserved=0l flags=pa window=65325 chksum=0xe356 urgptr=0 options=[] |<raw load='\x00\x00\x00\x00\x00\x06\xff\x01\x00\x00\x00\x01' |>>> <ip version=4l ihl=5l tos=0x0 len=50 id=30949 flags= frag=0l ttl=64 proto=tcp chksum=0x7c13 src=192.168.2.25 dst=192.168.2.100 options=[] |<tcp sport=mbap dport=sddp seq=1497344211 ack=1584390509 dataofs=5l reserved=0l flags=pa window=4096 chksum=0xd17d urgptr=0 options=[] |<raw

Peculiar issue with powershell Hashtable and array -

i working on today , during testing noticed peculiar issue $arry = @() $msg = @{body="this sample message";} $msg.brokerproperties=@{} $msg.brokerproperties.label= "msg1" $arry += $msg $arry | convertto-json # 1st result $msg.brokerproperties=@{} $msg.brokerproperties.label= "msg2" $arry += $msg $arry | convertto-json the 1st result of $arry | convertto-json below { "body": "this sample message", "brokerproperties": { "label": "msg1" } } the 2nd result of $arry | convertto-json below [ { "body": "this sample message", "brokerproperties": { "label": "msg2" } }, { "body": "this sample message", "brokerproper

javascript - use of printer using php -

i have developed pos application using codeigniter, want print bill using printer, can 1 me pass printer name php/javascript code printed in, appreciated you cannot directly u can use window.print() and hide elements u dnt want printed ur css @media print { .no-print, .no-print * { display: none !important; } }

python - copying a 24x24 image into a 28x28 array of zeros -

hi want copy random portion of 28x28 matrix , use resulting 24x24 matrix inserted 28x28 matrix image = image.reshape(28, 28) getx = random.randint(0,4) gety = random.randint(0,4) # 24 x 24 tile random location in img blank_image = np.zeros((28,28), np.uint8) tile= image[gety:gety+24,getx:getx+24] cv2.imshow("the 24x24 image",tile) tile 24x24 roi works planned blank_image[gety:gety+24,getx:getx+24] = tile blank_image in example not updated values tile thanks in advance if getting error, might because np array dimensions different. if image rgb image, blank image should defined : blank_image = np.zeros((28,28,3), uint8)

c# - For loop on Data table on condition -

i have result dataset, dataset dsresult = new dataset(); dsresult.tables[0].rows.count = 17 now want loop through data table first 5 rows , create dsresult.tables[1] and next 5 more rows dsresult.tables[2] and next 5 more dsresult.tables[3] then last 2 rows dsresult.tables[4] from below code getting number of tables required decimal remainder = decimal.divide(dsresult.tables[0].rows.count, 5); var numberofrequests = math.ceiling((decimal)remainder); or can in sql how genaralize logic. please guide me here. using linq simple var firstfive = dsresult.tables[0].asenumerable().take(5); var secondfive = dsresult.tables[0].asenumerable().skip(5).take(5); and on. not loop, let linq you. if later need convert results datatables msdn has example on how creating datatable query (linq dataset)

Using Amazon EC2 Ipaddress access application outside network -

i configured security group ec2 instance shown below. deployed application in tomcat on port 8085: security group ----------------- custome tcp 8085 0.0.0.0/0 using ec2 ip not able access application http://58.62.30.195:8085/healthprod i able access app using localhost like http://localhost:8085/healthprod

angularjs - How to build staging env constants using grunt-ng-constant? -

i trying inject environtment constants yo angular generated angular application using grunt-ng-constant. apart development , production, have 1 more environment called 'staging' host built dist folder. from followed on of blogs, run ngconstant:development while running grunt serve , ngconstant:production while doing grunt build . so, there way differentiate production env staging while running build. can pass arguments task?

c# - How to make hierarchical grid in using infragistics xamdatagrid? -

Image
how create below type grid using xamdatagrid ? i have use multiple xamdatagrid or have make list has parent child data?

How do i stop google sheets skipping a row with my formula when a new answer is entered? -

every time new row of answers added formula on shit skip referenced rows new data has been added. if manually drag down across number of fields updates , shows correct number. if have in fields when answer google form entered instead of updating show correct number stays 'false' , when referencing blank field, , field reference goes 1 skipping field referencing. i've tried absolute referencing "$b2" , moved different positions still skips row meant referencing. idea on how stop this. code below- =if('form responses 1'!b$16 = "dog","1",if('form responses 1'!b$16="cat","2",if('form responses 1'!b$16="frog","3",if('form responses 1'!b$16="bird","4")))) essentially there 3 columns, timestamp, pick word , email. populated automatically google form in sheet "form responses 1". column i'm working b pick word. if cell equals word co

Magento custom menu module not showing -

i have installed magento custom menu module , cannot resolve on site. have followed checklist in docs , seems fine, including following lines in layout page.xml, calls nav. come across or know what's going on? <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"> <block type="page/html_topmenu_renderer" name="catalog.topnav.renderer" template="page/html/topmenu/renderer.phtml"/> </block> when in console, can see navigation section, div empty , getting nothing in logs. found solution. magento connect installs files rwd folder default. if, me, use custom theme - copy skin/frontend/rwd/default/css/webandpeople/ to theme folder. hope helps others.

javascript - TypeError: Cannot read property '$cookies' of undefined -

i'm trying save response server cookies, , here how i'm trying do this.$http({ method: 'post', url: some_url, data: some_data, headers: { 'authorization': this.basicauthorization } }).success(function(data){ //console.log(data); this.$cookies.putobject('userdata', data); }).error(function(data){ }); } i provided: angular.module('mymodule', [ ...., 'ngcookies' ]) // ........ loginhandler.$inject = ['$http', '$cookies']; // ........ constructor($http, $cookies){ ... } what causing error? i'm using angularjs 1.4.0 update i have found out this not working expected in .success() etc. had store in other variable. try this, var self = this; this.$http({ method: 'post', url: some_url,

javascript - Date Formatting is not working in momentjs? -

following date formatting not working in momentjs var date ="01-12-2015";//dd-mm-yyy console.info(moment(date).format('yyyy-mm-dd')); how can solve this? you need tell momentjs how parse string giving: var date ="01-12-2015";//dd-mm-yyyy console.info(moment(date, 'dd-mm-yyyy').format('yyyy-mm-dd')); deprecation warning: moment construction falls js date. discouraged , removed in upcoming major release. please refer https://github.com/moment/moment/issues/1407 more info.

php - PSR for nested IF condition -

i migrate code in psr standard. not sure how write inside nested condition. confused line spacing. can use 1 line space after if condition ? below example code. if ($this->value) { if ($this->value === 'abc') { $x = $this->x(); } $x = 'lababala'; if ($this->value === '123') { $x = $this->y(); } $end = new object(); }

c# - Input a value in Dijit Combobox using the IJavaScriptExecutor -

i doing webdriver automation of webpage uses dijit webelements (they suck). one of elements infamous dijit comobobox: http://dojotoolkit.org/reference-guide/1.10/dijit/form/combobox.html the webdriver can input value doing several steps (click here, sendkeys, click there, etc), testing done in ie9 , slow. i want javascript function, like: document.getelementbyid("married_status").setattribute('value', 'nicely_married'); but doesnt work. can input text in field, not able select 1 of options.

python 3.x - how to get kivy run in a virtual box -

hej i try play litte around ubuntu 14 lts 64bit @ oracle vm on windows 7. installing kivy python3 works fine. when want create app in python got following error: [[1;32minfo[0m ] [logger ] record log in /home/stj/.kivy/logs/kivy_15-06-04_0.txt [[1;32minfo[0m ] [kivy ] v1.9.0 [[1;32minfo[0m ] [python ] v3.4.0 (default, apr 11 2014, 13:05:11) [gcc 4.8.2] [[1;32minfo[0m ] [factory ] 173 symbols loaded [[1;32minfo[0m ] [image ] providers: img_tex, img_dds, img_gif, img_pil (img_pygame, img_ffpyplayer ignored) [[1;31mcritical[0m] [window ] unable find valuable window provider @ all! egl_rpi - importerror: cannot import name 'bcm' file "/usr/local/lib/python3.4/dist-packages/kivy/core/__init__.py", line 57, in core_select_lib fromlist=[modulename], level=0) file "/usr/local/lib/python3.4/dist-packages/kivy/core/window/window_egl_rpi.py", line 12, in <module> kivy.lib.vidcore_lite import bcm, egl

angularjs - Why doesn't this animate? -

http://plnkr.co/edit/k9w3avdjs3spqxuunhmf i trying animate using $animate service animate.css library, can't seem right. blue block works because it's using animate.css class, how can make $animate.leave css class library. second, red block isn't entering , using .ng-enter classes. can explain why? this works: http://plnkr.co/edit/lvijrards4nu9vpsaul3?p=preview first, why example not working: blue box animates because uses animate.css classes directly , doesn't use angular.js animation pipeline @ all. red box doesn't animate, because animation set run on initial application start. angular prevents animations run on initial application setup prevent performance issues may caused lot of elements animate @ same time. you need following changes enable red box animation: $timeout(fn) function fn() { redblockelement = angular.element('<div class="red block"></div>') $animate.enter(redblockelement, bodyelemen