Posts

Showing posts from January, 2015

How to download a dataset using java -

i want make app download paper mentioned in image taking domain input. have been able download single file other website unable download paper form acm digital library. need download entire data set. here code used download single file. string filename = "1.txt"; url link = new url("http://shayconcepts.com"); inputstream in = new bufferedinputstream(link.openstream()); bytearrayoutputstream out = new bytearrayoutputstream(); byte[] buf = new byte[2048]; int n = 0; while (-1!=(n=in.read(buf))) { out.write(buf, 0, n); } out.close(); in.close(); byte[] response = out.tobytearray(); fileoutputstream fos = new fileoutputstream(filename); fos.write(response); fos.close(); how can modify download entire data set

ui automation - Appium android settings -

i unable test simple app on device using appium error shown below. weirdest thing similar error shown when not connecting device. struck @ place long time. have done pre-conditions required this. have attached images android settings in appium tool please me! code package com.sasken; import io.appium.java_client.android.androiddriver; import io.appium.java_client.remote.mobilecapabilitytype; import java.io.file; import java.net.malformedurlexception; import java.net.url; import java.util.hashmap; import java.util.concurrent.timeunit; import org.junit.after; import org.junit.before; import org.openqa.selenium.by; import org.openqa.selenium.javascriptexecutor; import org.openqa.selenium.webdriver; import org.openqa.selenium.webelement; import org.openqa.selenium.remote.desiredcapabilities; import org.testng.annotations.test; public class appiumtestingapp { private androiddriver driver ; @before public void setup() { string apk_path = system.getproperty("user.d

c# - Extract content data from HttpCllient's FormUrlEncodedContent -

my content is: var content = new dictionary<string, string> { {"pickup_date", pickupdate.tostring("dd.mm.yyyy hh:mm")}, {"to_city", "victoria"}, {"delivery_company", "4"}, {"shop_refnum", parameters.reference}, {"dimension_side1", "20"}, {"dimension_side2", "20"}, {"dimension_side3", "20"}, {"weight", "5"} }; var httpcontent = new formurlencodedcontent(content); how can extract content httpcontent? i found readasformdataasync() method in system.net.http.formatting: namevaluecollection hcdata = await httpcontent.readasformdataasync(cancellationtoken);

php - Get the name of a variable in a string -

hi want create function in can pass variable , output name of variable , value sting. this: $firstname = 'john'; $lastname = 'doe'; echo my_function($firstname); // outputs: "var name: firstname , has: john" echo my_function($lastname); // outputs: "var name: lastname , has: doe" take @ get_defined_vars() you can var_dump , show variables defined. loop through , dump each ones value too. http://php.net/get_defined_vars

laravel - Php FFMPEG request timout -

i using laravel 4.2 . i working on project of uploading video. uploaded video should played in devices using php-ffmpeg package git-hub . the requirement transcoding should done in background. using wamp 2.5 . what doing is, after upload firing asynchronous ajax request transcode video , after successful completion should insert record database containing video name, path etc. the problem if upload large size video, facing error maximum execution time of 120 seconds exceeded . i know possible solution setting max_timelimit in php.ini don't think feasible solution because if there larger video, same error occurred again. is there technique can bypass transcoding process in background? my code below : try{ $video_id = input::get('video_id'); $video_path = input::get('video_path'); $path = '/video/'.date('y').'/'.date('m'); $path .= '/'; $explode

mongodb - APScheduler run async function in Tornado Python -

i trying develop small app gather weather data api. have used apscheduler execute function every x minutes. use python tornado framework. the error getting is: info job "getweather (trigger: interval[0:01:00], next run at: 2015-03-28 11:40:58 cet)" executed error exception in callback functools.partial(<function wrap.<locals>.null_wrapper @ 0x0335c978>, <tornado.concurrent.future object @ 0x03374430>) traceback (most recent call last): file "c:\python34\lib\site-packages\tornado\ioloop.py", line 568, in _run_callback ret = callback() file "c:\python34\lib\site-packages\tornado\stack_context.py", line 275, in null_wrapper return fn(*args, **kwargs) greenlet.error: cannot switch different thread which think coming coroutine getweather() as, if remove asycn features it, works. i using motor read needed coordinates , pass them through api , store weather data in mongodb. import os.path, logging import tornado.

python 2.7 - Adding ManyToMany related object on the fly in django -

let's have 2 models those: class property(models.model): name= models.charfield('property name', max_length=200) slug = models.charfield(max_length=200) def save(self, *args, **kwargs): if not self.id: self.slug= slugify(self.name) super(tag, self).save(*args, **kwargs) class thing(models.model): name = models.charfield('name',max_length=200) description = models.textfield('description') pub_date = models.datetimefield('pub date',default=datetime.now()) properties = models.manytomanyfield(property, blank=true) when create new thing, i'd able create new related properties, if don't exist. like, on ipotetically "thingform.save()", want iterate through properties selected, create ones not exist , link them new thing how can achieve this? this how can create new properties , link them thing afterwards: # assuming have list of names of selected properties s

c++ - Is typelist comcept still actual with variadic templates? -

since c++14 has variadic template concept, it's not clear why ever should use typelist s defined alexandrescu. instance, mean following: template <class t, class u> struct typelist { typedef t head; typedef u tail; }

reactjs - How to package react-native application -

Image
i building sample react native application. running using node server.node server serving js file. can see in following screenshot: i want shift option2, this, if there change in js file, need run curl command manually. is there alternative this? afaik there's nothing in place , work in progress. see: https://github.com/facebook/react-native/issues/12 we plan on putting in sort of build step "compiles" js source directly resource file in app bundle. in production wouldn't have server running nearby. there's bit of discussion here . at moment think you're stuck curl option.

python - argument 2 to map() must support iteration -

hi i'm making basic raycast engine think nice start minimap problem class map ask mapgrid in constructor , when pass python give me error argument 2 map() must support iteration this code: main part import pygame def map(object): def __init__(self,grid,scale): self.grid= grid self.mapwidth= len(grid[0]) #number of map blocks self.mapheight= len(grid) self.minimapscale= scale #how many pixels draw map block self.miniwidth= self.mapwidth * self.minimapscale #size of minimap self.miniheight= self.mapheight * self.minimapscale self.rectgrid= grid y in range(self.mapheight): x in range(self.mapwidth): self.rectgrid[y][x]= pygame.rect(x,y,self.miniwidth,self.miniheight) def blitminimap(): pass data file mapgrid= [ [1,1,1,1], [1,0,0,1], [1,0,0,1], [1,1,1,1] ] size = [640, 480] map class import pygame def map(object): def __init__(self,grid,sc

c# - Latest file download from FTP -

in ftp location there several files. like file0215_27_1.zip file0315_02_1.zip file0315_12_1.zip here wannt file0312_12_1.zip latest one. how latest 1 using ssis? should script task code? use script task , pick working code starting point. if google "find latest file in directory c#", find several examples, such https://msdn.microsoft.com/en-us/library/bb546159.aspx . http://sqlage.blogspot.com/2013/12/ssis-how-to-get-most-recent-file-from.html . if still need help, please post relevant portion of solution, , or else here you.

How can I search an object created array in Java? -

i've made array of class artist user able enter details of artist console , saves array want able search artist allowing user enter artist name in console , if matches name of in array print out found or else not found! use loop run through array, , in loop use if/else statement, if word entered matches array holds in spot display it, else nothing. for(int = 0; < array.length; i++){ if(thingentered.equals(array[i])){ print out } }

javascript - Getting html of <td> -

i using following function try , html of element referencing row above (i feel have reason won't go into). function test() { var rowamount = $("#ordertable > tbody > tr").length; for(i = 0; < rowamount; i++) { $( "#ordertable > tbody > tr :eq(i)" ).setattribute( "id", "row" + (i + 1) ); } alert($( "tr#row1" ).next().find( "td.qty" ).html()); } i using loop set id of rows have, ones wish reference from. inserting new rows depending on value within these. the error getting line, $( "#ordertable > tbody > tr :eq(i)" ).setattribute( "id", "row" + (i + 1) ); is returning error, undefined not function. does know why? thanks in advance. mike. setattribute javascript function not jquery(you try use jquery object). can use jquery .attr() like: $("#ordertable > tbody > tr :eq(" + + ")").att

web services - Facing java.lang.IncompatibleClassChangeError -

Image
trying make simple restful service. i used tutorial link here link of jar using in program after follow each , every step ..... face error. please ... pom.xml <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.javacodegeeks.enterprise.rest.jersey</groupid> <artifactid>jaxrs-helloworld</artifactid> <version>0.0.1-snapshot</version> <repositories> <repository> <id>maven2-repository.java.net</id> <name>java.net repository maven</name> <url>http://download.java.net/maven/2/</url> <layout>default</layout> </repository> </repositories> <dependencies> <dependency> <groupid>com.sun.jersey</g

python - Form sending error, Flask -

there form 2 <input type="submit"> . when i'm sending it, second submit causes error. layout : <form action="{{ url_for('index') }}" method="post"> <input type="submit" name="add" value="like"> <input type="submit" name="remove" value="dislike"> </form> main.py : ... if request.method == 'post': if request.form['add']: return redirect(url_for('index')) elif request.form['remove']: return redirect(url_for('index')) ... first submit(add) works well, second(remove)...: bad request browser(or proxy) sent request server not understand. how can fix error? upd : it pretty simple: request.form returns immutablemultidict: ... if 'like' in request.form.values(): ... elif 'dislike' in request.form.values(): ... as @blubber points ou

scala - Seq, SeqLike, GenSeq or GenSeqLike? -

when create function, should have take argument seq , seqlike , genseq , or genseqlike ? (so many choices!) my requirements can map on , produce collection same number , order of arguments before. typically "program interfaces" , choose general type possible. in case, genseqlike . is correct/idiomatic? seqlike implementation layer seq allows specify return types. there extremely few things seqlike not seq , , arguably error. can feel comfortable not worrying -like s. (if want build new collections of type given , keep types straight, use canbuildfrom instead.) so question whether use genseq or seq . problem genseq processing might done in parallel, means have avoid using operation violate expectations (e.g. summing foreach ). furthermore, general consensus seems genx part of collections hierarchy overcomplicates collections , makes more difficult incorporate alternative choices of parallel collections. recommendation seq unless pretty sure

Ruby on Rails marketability -

i've been researching ruby on rails , marketability today. how compare other programming languages (like java)? great time learn now? beneficial me learn primary programming language? i wanted know highs , lows technology before dive in , start learning. your opinions appreciated. the name of programming language ruby. ruby on rails awesome framework fast, efficient building of web applications. ruby interpreted language in opposition java or c#, compiled. ruby there's no need type definition or type casting, no semicolons @ end of line, no parentheses method invocations, operators overload, getters/setters automatically available instance variables , many, many more. (copied here ) i think learning curve ruby steep. but, after all, above opinion ... opinion. , you're question "would great time learn now?" answered pragmatic programmers: learn new programming language every year. so, why not starting learn ruby now?

What is the data column name for showing website conversion of facebook ad report stats? -

i can retrieve facebook report stats value specifying data column names "impressions", "clicks", "ctr" etc. below. cannot find data colum name number of website conversion. would let me know how retrieve number of website conversions? curl -g data_columns=["adgroup_id","impressions","clicks"] https://graph.facebook.com/<api_version>/act_<ad_account_id>/reportstats website conversions tracked in ad's tracking or conversion spec , considered 'actions' take place , tracked against ad. the actions_* columns (specified in data_columns parameter) contain information conversions occured, including website conversions can group output action type using &actions_group_by=['action_type'] you can add filter if want website conversions, adding filter this: &filters=[{ field: 'action_type', type:'in', value: ['offsite_conversion'] }]

string - Error handling in Swift non-optional-valued functions -

this question has answer here: trim end off of string in swift, getting error @ runtime 1 answer trying grips swift programming, wrote following: var s : string = "dog" var i1 : string.index = advance(s.startindex, 2) var t1 : string = s.substringtoindex(i1) executing code in playground, t1 has value "do" , expected. however, if try construct index exceeds string's length, happens: var s : string = "dog" var i2 : string.index = advance(s.startindex, 4) var t2 : string = s.substringtoindex(i2) this time, line var i2 ... shows error execution interrupted, reason: exc_bad_instruction (code=exc_i386_invop,subcode=0x0). i read swift documentation, entry string.substringtoindex reads in entirety: func substringtoindex(index: string.index) -> string [foundation] returns new string containing characters of

Modularizing and distributing bash script via Homebrew -

context i have functions defined in ~/.bashrc i'd turn homebrew package. currently, these functions act custom commands on command line: # .bashrc function foo() { # interesting } # @ terminal $ foo # => interesting thing approach i've created homebrew formula using brew create . current approach follows: move function definitions separate file, script , within directory, brew-script make brew-script downloadable tarball, brew-script.tar.gz have brew formula append text end of ~/.bash_profile include script when terminal session starts concerns is modifying .bash_profile in brew formula bad practice? (eg. when uninstalling brew uninstall script , brew should somehow remove text appended .bash_profile ... parsing .bash_profile doesn't seem fun.) is there convention established including functions in bash scripts available command line? is common ask user add text .bash_profile or .bashrc ? desired result should able install cleanl

Cmd String to PAnsiChar in delphi -

i relatively new delphi , want make quick application uses shellexecute command. i want use string values in edit boxes add command line doing processing job outside of application. everything works fine, error : "incompatible types: string , pansichar" i have tried convert using: variable := pansichar(ansistring(editbox.text) , no avail. can assist me problem please. in delphi 7, it's simple typecast pchar , pansichar : pchar(yourstringvariable); or pchar('some text here'); // cast not needed; demonstration pchar('c:\' + afilename); // cast needed because of variable use using shellexecute : afile := 'c:\mydir\readme.txt'; res := shellexecute(0, 'open', pchar(afile), nil, nil, sw_normal )

Assign unique random integers in an array (C) -

im struggling long, can fill array random numbers not unique. can't spot problem in code :( can me? thanks int getuniquenumber(int *p, int i) { int x,j,found; { x=rand()%100000 + 1; found=0; j=0; while(j<=i && found==0) { if(p[i]==x) found=1; else j++; } } while(found==1); return x; } p[i] == x should p[j] == x .

image processing - How to get user freehand input in matlab? -

i trying write handwriting recognization software, , need user input. can use imfreehand (with parameter, closed = 0) function let user write on top of blank plot axis. however, have 2 issues that: i cannot control thickness of lines i cannot convert scribble image i need 2, because, comparing handwriting training images stored in library. any idea on how on these or alternatives? thanks. to answer second question first, can use getframe . here minimal exemple: % --- free hand drawing imfreehand('closed', 0); % --- image axis off f = getframe; img = f.cdata; % --- display image figure imshow(img); then, answer first question regarding line thickness, it's little bit more tricky. have coordinates of curve, plot desired thickness , use getframe . it's little more complicated make clean respect application because of background color , axes scales, here try: clf xl = get(gca, 'xlim'); yl = get(gca, 'ylim'); h = imfreehand

DCT of buffered image using JTransform - Java -

i'm trying dct of bufferedimage using jtransform. when visualise transform looks http://tinypic.com/r/2vcxhzo/8 in order use jtransform need convert bufferedimage 2d double array. i've tried 2 different methods change bufferedimage double array public double[][] convertto2darray(bufferedimage image) { final byte[] pixels = ((databufferbyte) image.getraster() .getdatabuffer()).getdata(); final int width = image.getwidth(); final int height = image.getheight(); double[][] result = new double[height][width]; final boolean hasalphachannel = image.getalpharaster() != null; if (hasalphachannel) { final int pixellength = 4; (int pixel = 0, row = 0, col = 0; pixel < pixels.length; pixel += pixellength) { int argb = 0; argb += (((int) pixels[pixel] & 0xff) << 24); // alpha argb += ((int) pixels[pixel + 1] & 0xff); // blue

php - setting up local web server on mac yosemite -

i have followed steps here set local web server not working. double , triple checked each step know each step done properly. by not working mean http://localhost/~username/*.html not valid web address. can point me in right direction? not sure information helpful if need post leave in comment. are using yosemite (as in tutorial) or mavericks? have replaced ~username actual mac username? have tried http://127.0.0.1/~yourusername/ * ?

regex - Writing grammar rules in SML Using Regular Expressions -

i want write converter icalendar csv in sml. hence, need write grammar rules it. understand rules can written defining them datatype . begin with, facing problems write rules regular expressions (terminals). as example, want write given regex in sml : label → [a-za-z0-9-]+ can tell me how write rule in sml? edit so far, have declared datatype variables denotes various variables of grammar. datatype variables = label of string i have declared function islabel . takes input s (of type string ) , returns label(s) if satisfies given regex (by checking if ascii values lie in given range) else raises exception. gotta feeling have found way solve. other symbols/variables of grammar can defined in datatype variables. see unix programming standard ml page 163+ example of sml/nj's regular expression library in action. steps: add sml/nj library. in smlnj repl use: cm.make "$/regexp-lib.cm" make regular expression engine: structure re =

javascript - how to get href value in <a> tag using jQuery -

inside html source code, there's <a> tag href attribute, want whatever has after second slash after individuals in case 22284494 . exact tag is: <a href="/individuals/22284494" class="i-photo"> how do using jquery? something target anchor, attribute, split on / , last part var numb = $('a.i-photo').attr('href').split('/').pop();

modelsim - What's wrong with this VHDL code - BCD Counter? -

Image
i'm studying vhdl right now, , have pretty simple homework assignment - need build synchronous bcd counter count 0 9 , when reaches 9, go 0. wanted experiment little decided not code in (at least way see it) traditional way (with if, elseif) when-else statement (mostly due fact counter 0 9 , has go 0 once hits 9). library ieee; use ieee.std_logic_1164.all; entity sync_counter port (rst, clk: in std_logic); end entity; architecture implement of sync_counter signal counter: integer range 0 10; begin counter <= 0 when (rst = '1') else counter + 1 when (clk='1' , clk'event) else 0 when (counter = 10); end architecture; so compiles, in simulation, counter jumps 0 2, after cycle (0-9 - 0) acting normal, meaning counter goes 0 1 should be. same if force rst = '1'. simulation image: why jump 0 2 in start? thank you. it may not explain why goes 0 2. please post testbenc

wordpress - Get link to another taxonomy from a taxonomy list -

i'm working on site artists directory. i have 2 custom taxonomies; artists , artist genre tied custom post type of artwork. i can loop list of current artist genre taxonomies, i'm tyring them link go page list of artists associated artists genre taxonomy. this current loop have: <?php $args = array('type' => 'artwork', 'taxonomy' => 'artist-genre', 'hide_empty' => false); $categories = get_categories($args); foreach($categories $category) { $img = get_field('bg-image', 'artist-genre_'. $category->cat_id .''); echo' <li> <h3><a href=" '. get_term_link($category, $catergory->taxonomy) .' "> '. $category->name . '</a></h3> <img src="'. $img['url'] .'" alt="'. $img['alt'] .'" /> <a class="button" href=" '. get_term_link($ca

winapi - Enabling visual styles with C++ Win32 API? -

Image
according msdn article, visual styles supposed applied win32 applications default. however, ui elements appeared windows classic until inserted header: #pragma comment(linker,"\"/manifestdependency:type='win32' \ name='microsoft.windows.common-controls' version='6.0.0.0' \ processorarchitecture='*' publickeytoken='6595b64144ccf1df' language='*'\"") now, when try add button using call: createwindow(l"button", l"quit", ws_visible | ws_child, 120, 50, 80, 25, hwnd, null, hinst, null); the result looks this: that looks windows 8 button windows classic font. missing apply full windows 8 visual style? the button themed, did not set font button. because of that, button has default font.

c# - How do I normalize Non-CSV data in Encog -

so i'm using jeff heaton's neural network library. when trying solve iris plant classification problem have issue data normalization. i able normalize csv file using following method: public void normalizefile(fileinfo sourcedatafile, fileinfo normalizeddatafile, fileinfo normalizationconfigfile) { var wizard = new analystwizard(_analyst); wizard.wizard(sourcedatafile, _useheaders, analystfileformat.decpntcomma); var norm = new analystnormalizecsv(); norm.analyze(sourcedatafile, _useheaders, csvformat.english, _analyst); norm.produceoutputheaders = _useheaders; norm.normalize(normalizeddatafile); // save normalization configuration, can used later denormalize raw output. _analyst.save(normalizationconfigfile); } so far good... program works high degree of accuracy. the problem occurs when want enter values console application. i have input data sepal width sepal length petal width p

java - How to escape HTML in JSON -

i'm wondering how can escape html code in json ? i'm using jackson json mapper. in content have various characters: tags, single quotes, double quotes, new lines character (\n), tabs etc. tried use characterescapes class, no results. my json response blows after using characterescapes. tried escape manually, without results. so question is, lets have: <p>some text</p>\n<p>"sometext"</p> how can send browser value of json object? update: input is: { "code": { "num": 12 }, "obj": { "label": "somelabel", "order": 1 }, "det": { "part": "1", "cont": true }, "html": "<p>mine text</p>" } output: { "code": { "num": 12 }, "obj": { "label": "somelabel", "order": 1 },

elasticsearch - Unable to rebuild index in django haystack -

i trying run manage.py rebuild_index getting below error. `(django_project)deep@deep-thinkpad-edge:~/doroko$ python manage.py rebuild_index no handlers found logger "django_facebook.models" /home/deep/.virtualenvs/django_project/local/lib/python2.7/site-packages/django/utils/image.py:150: removedindjango18warning: support pil removed in django 1.8. please uninstall & install pillow instead. removedindjango18warning system check identified issues: warnings: ?: (1_6.w001) project unittests may not execute expected. hint: django 1.6 introduced new default test runner. looks project generated using django 1.5 or earlier. should ensure tests running & behaving expected. see https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner more information. system check identified issues: warnings: ?: (1_6.w001) project unittests may not execute expected. hint: django 1.6 introduced new default test runner. looks project generated using django 1.5 or ea

java - Convert CSV file into 2D array using StringTokenizer -

i'm trying convert csv file 2d array i'm having problems. code seems print out first name in csv file 10 times , gives me out of bounds exception. e.g if player name rob, print out rob on , on again. if more clarification needed ask try{ int col = 0, row = 0; system.out.println("reading " + filename + " ..."); fr = new filereader(filename); bf = new bufferedreader(fr); string line = bf.readline(); while (line != null) { stringtokenizer st = new stringtokenizer(line,","); while(st.hasmoretokens()){ system.out.println(st.nexttoken()); data[row][col] = st.nexttoken(); col++; } col = 0; row++; } }catch(ioexception e){ system.err.println("cannot find: "+filename); } i think code reads 1 line. continue while loop using following code snippet - string line = bf.readline(); while ((line = br.readline()) != null) {

javascript - jQuery fade out HTML text when replacing it with new text instead of just appearing -

i have following little script... $(document).ready(function() { $('#search').bind('keyup', function(event) { if($('#search').val().length == '0') { $("#products").html("all products"); } else { $("#products").html("searching products"); } }); }); when #search has in it, shows 'searching products', , when empty, shows 'all products'. problem changes no fade effect, looks bit choppy. how have fade 1 other, no matter direction (from empty typed or typed empty) it's going? try $(document).ready(function() { var search = $("#search") , products = $("#products"); search.bind('keyup', function(event) { if (search.val().length === 0 || search.val().split(/\s/).every(function(val) { return val === "" })) { if (products.html()

ios - Stop custom collection view section at needed position -

i have problem shifting section of collection view. using csstickyheaderflowlayout so see calculation here: - (void)updateheaderattributes:(uicollectionviewlayoutattributes *)attributes lastcellattributes:(uicollectionviewlayoutattributes *)lastcellattributes my section starting @ middle of screen , need know when has origin.y = 64pt should stop moving top. the problem don't know how current y position of section.

if statement - Excel nested IF with "AND" operator behaving weird -

i having weird situation in excel spreadsheet. i'm applying simple nested if statement below: = if( and(a1-int(a1)>=0.3,a1-int(a1)<=0.7),int(a1)+0.5, if( and(a1-int(a1)>=0,a1-int(a1)<=0.2),int(a1), if( and(a1-int(a1)>=0.8,a1-int(a1)<=0.9),int(a1)+1, "non-checked" ) ) ) suppose if "a1" contains value 32.9, result should 33. works fine until value of "63.9". a1 contains value of "64.9", not check last condition , prints out "non-checked". it's strange thing works fine until value of 63.9 , after starts become false. i tried same formula in office suit , google docs too. am missing here ? you can test formula here: sample spreadsheet thanks. please try replacing a1-int(a1) round(mod(a1,1),10). seems work numbers less 10^9. if work higher numbers, should decrease precision.

ios - Apple Mach-O Linker Error with Parse OBJC classes -

hi have looked on similar questions , tried can seem fix code. every time try , archive apple mach-o linker errors parse user, object, file, query, parse , linker command failed exit code 1. first ld: warning: ignoring file .., missing required architecture arm 64 in file parse.framework.parse then following errors: undefined symbols architecture arm64: "_objc_class_$_pfuser", referenced from: objc-class-ref in signupviewcontroller.o objc-class-ref in loginviewcontroller.o objc-class-ref in inboxviewcontroller.o objc-class-ref in editfriendsviewcontroller.o objc-class-ref in friendsviewcontroller.o objc-class-ref in cameraviewcontroller.o "_objc_class_$_pfobject", referenced from: objc-class-ref in cameraviewcontroller.o "_objc_class_$_pffile", referenced from: objc-class-ref in cameraviewcontroller.o "_objc_class_$_pfquery", referenced from: objc-class-ref in

Python counting number of livestock -

this question has answer here: function number of animals in python [closed] 1 answer to illustrate have 2 type of animals 1 pig , other chicken. user inputs number of heads , legs 2 particular type of animals. example if run , input 20 heads , 56 legs 12 chicken , 8 pigs. have @ here: def solve(numlegs, numheads): numchicks in range(0, numheads + 1): # how 12 chickens here? numpigs = numheads - numchicks # numpigs = 20 - 12 = 8 ? totlegs = 4 * numpigs + 2* numchicks # 4 * 8 + 2 * 12 ? if totlegs == numlegs: return [numpigs, numchicks] return[none, none] def barnyard(): heads = int(raw_input('enter number of heads:')) legs = int(raw_input('enter number of legs:')) pigs, chickens = solve(legs, heads) if pigs = none: print 'there no solution' else: print 'number

linux - shell script to find a word in a list of files, all of them given as parameters -

i need simple shell program has this: script.sh word_to_find file1 file2 file3 .... filen which display word_to_find 3 - if word_to_find appears in 3 files or word_to_find 5 - if word_to_find appears in 5 files this i've tried #!/bin/bash count=0 in $@; if [ grep '$1' $i ];then ((count++)) fi done echo "$1 $count" but message appears: syntax error: "then" unexpected (expecting "done"). before error was [: grep: unexpected operator. try this: #!/bin/sh printf '%s %d\n' "$1" $(grep -hm1 "$@" | wc -l) notice how script's arguments passed verbatim grep -- first search expression, rest filenames. the output grep -hm1 list of matches, 1 per file match, , wc -l counts them. i posted answer grep -l require filenames never contain newline, rather pesky limitation. maybe add -f option if regular expression search not desired (i.e. search literal text).

cocos2d wait for action to finish in Python -

here code. self.wolf.do(moveto((x, y + 10))) sprites = (self.farmer, self.boat,self.wolf) n in sprites: n.do(moveby((-350, 0), 1)) i want wait finish wolf's action, before run on loop.what can do? if want call function after "moveto" action finished can use sequence "+" operator callfunc : self.wolf.do(moveto((x, y + 10)) + callfunc(self.on_move_completed))

windows - How to restore all environment variables to default in a batch script -

i have .bat script. runs commands , alters/adds environment variables. then, @ point need revert them default if i'm exiting script , starting new 1 scratch. so, need 1 of two: 1. either clear variables (restore defaults fresh cmd session gets); 2. or push variables when start script , pop later revert these values. how can that? have tried using setlocal? here information on it: http://ss64.com/nt/setlocal.html

Java different parameter type needed for identical SOAP Web Service? -

i have web service client 2 identical soap web services called company1service , company2service. both these web services have exact same purchaseorder class. however, when want call m1processpurchaseorder() method , m2processpurchaseorder() method each web service, require different parameter types po object. yet, purchaseorder class identical both services. i using netbeans , generated sources (jax-ws). public boolean m1processpurchaseorder(ab.service.company1.purchaseorder po) { ab.service.company1.company1service port = service1.getcomapny1serviceport(); return port.processpurchaseorder(po); } public boolean m2processpurchaseorder(ab.service.company2.purchaseorder po) { ab.service.company2.company2service port = service2.getcomapny2serviceport(); return port.processpurchaseorder(po); } what have ab.service.company1.purchaseorder parameter type both company1service , company2service. here error if try change m2processpurchaseorder() parameter type

asp.net - List not populating dropdown -

i using standard list method lookups use winforms , works fine trying re use on web , not displaying items. public list<sislookuplists> getgender() { list<sislookuplists> lookups = new list<sislookuplists>(); try { var q = lookup in schoolentities.genders orderby lookup.description select new { code = lookup.code, description = lookup.description.trim() }; if (q != null) { array.foreach(q.toarray(), l => { lookups.add(new sislookuplists(l.code, l.description)); }); } } catch (exception ex) { throw new entitycontextexception("getgender failed.", ex); } return lookups; } public sisdbcontext _db = new sisdbcontext(

php - Timestamp before 1970 is saved as 0000-00-00 00:00:00 -

i have timestamp column corresponding model property. when try save timestamp before 1970 in table appears value of 0000-00-00 00:00:00 . am not using appropriate format? date more suitable? there workaround don't need change schema? the unix epoch (or unix time or posix time or unix timestamp) number of seconds have elapsed since january 1, 1970 (midnight utc/gmt), not counting leap seconds (in iso 8601: 1970-01-01t00:00:00z). if you're planning on using times fall previous date, recommend using date field.

c# - Making decisions from a menu -

this first post , first semester in c#. have homework assignment i've been working on days , can't figure out. i'm going try explain best can. so have create class call 2 other class , compile classes print. user suppose select number menu , number suppose math operation , print answer. can't code produce selection , perform math operation. here first class. class mainmodule { static void main() { string assignment = "assignment#3b-math operations modified"; mathoperationui mynumber = new mathoperationui(); mynumber.mathmainmodule(); console.readline(); here second class. class mathoperations { int firstoperand; int secondoperand; public int firstoperand { { return firstoperand; } set { firstoperand = value; } } public int secondoperand { { return secondoperand; }

python - Send data to Arduino on keypress Raspberry Pi -

i'm trying build car (wild thumper) can drive raspberry pi. i'm using raspberry pi on ssh. should send data arduino knows when has go forward or when turn. i've tried making scripts called jquery (apache on pi) , send integer on serial port requires delay , not ideal. (example forwardstart.py:) import serial ser = serial.serial('/dev/ttyacm0', 9600) ser.open() # here delay needed ser.write('4') # go forward ser.close() to solve tried looking single python script read keyboard , send correct integer. however, keylisteners require display , can't used on ssh. can me python script or idea works? thanks! you should start reading here . idea like import serial ser = serial.serial('/dev/ttyacm0', 9600) ser.open() # here delay needed try: while 1: try: key = sys.stdin.read(1) # wait user input actionkey = key2action(key) # translate key action ser.write(actionkey) # go forward