Posts

Showing posts from June, 2011

html - Use tamil fonts in php mysql application -

i use tamil fonts in php mysql application? suggest ideas type tamil in input fields default. best unicode tamil font support following api script, <script type="text/javascript"> var poplo =new array("textareaid"); enabled_tiweb = "http://api.tamilsg.com/data/lookuptable.js"; var fileref = document.createelement('script'); fileref.src = "http://api.tamilsg.com/hplus.js"; document.documentelement.appendchild(fileref); thanks lot.

html - Button not linking properly -

for reason button not linking correctly. please show me im doing wrong? <div class="btn-group"> <button type="button" class="<%= @most_popular %> btn btn-default"><%= link_to "most popular", posts_path %></button> </div> link_to creates anchor tag. reference. nesting anchor tag inside button not correct html afaik. if want link button can try this. bootstrap happily accepts button classes on anchor tags. <%= link_to 'most popular', posts_path, :class => "btn btn-default #{@most_popular}" %>

java - How do I modify this Client class to read input from an array of Strings (rather than from standard input)? -

i have following code, in java client class ( it's knockknock client/server pair ) : try { kksocket = new socket("localhost", 4444); out = new printwriter(kksocket.getoutputstream(), true); in = kkjokes[0]; //new bufferedreader(new inputstreamreader(kksocket.getinputstream())); // in2 = new bufferedreader(new inputstreamreader(kksocket.getinputstream())); } i want have automatically read string array (that contains predefined jokes ) , : string kkjokes[] = {"who's there?", "turnip who?", "y", "who's there?", "who's there?", "blah" }; /* more cod */ try { kksocket = new socket("localhost", 4444); out = new printwriter(kksocket.getoutputstream(), true); (int = 0; i< kkjokes.length; i++) { in = new bufferedreader( new inputstreamreader( kkjokes[i] )) ; } } but

gcc - C++ makefile building multiple dll and project structuring -

i have tried searching answer no avail, given project has got following structure makefile ./src strings.cpp networking.cpp ./bin strings.dll networking.dll ./build strings.o networking.o ./include strings.h networking.h ./lib boost i new makefiles , research have done far have managed (not complicated, know) cc = g++ src = src/strings.cpp out = bin/strings.dll obj = build/strings.o inc= -i include all: strings.dll strings.dll: strings.o $(cc) -shared -o $(out) $(obj) strings.o: $(src) $(cc) $(inc) -dbdll -c $(src) -o $(obj) the issues/questions have 1- goes through whole compilation process, when have not changed source code ? 2- how make things more 'effective' ? saw examples of people using wildcards , such, had difficulty following along. use wildcards begin since want separate dlls each target ? 3 - lets introduced algorithms.h , algorithms.cpp recommended way of including in build ? thanks help, appreciate it

javascript - Creating a trie (or tree) for a branch and bound multiple TSP -

i'm struggling increasing speed of pseudo branch & bound algo & thought trie structure might fit, i'm stuck. the problem (simplified & isolated best can): i've got 9 nodes & 3 vehicles. each vehicle must visit 3 unique nodes. so, created every possible trip (9 choose 3 = 84) & stuck in array. now, want find every combination. example, trip 1 111000000 . trip 2 000110001 , trip 3 000001110 . (84^3 = 592704 combinations). find out if match, bitwise & , accept trip combination if value 0. i can't use nested loops since # of vehicles may change, keep track of combinations counter ticks depth-wise odometer (e.g. 0,0,82 , 0,0,83 , 0,1,0 ). i reduce combinations keeping following digit greater 1 increased (e.g. 11,83,83 goes 12,13,14 because less 12 in 2nd column repeat 12,1,1 duplicate of 1,1,12 ). i perform bitwise , check @ each change (e.g. if (val[12] & val[13]) > 0 don't bother checking 71 possibilities in 3rd colum

c# - How to provide delete authorization to certain user profiles ASP.NET -

i want give permission user profiles (i.e. administrators, managers have in db) delete records in db if press delete button in asp.net web application page. can me on this? or provide me useful resources. there many options handle user roles. 1 of them forms authentication . makes role management easy , won't have spend time on once set up. more info here . if wanted set own role management system, add column users table called role , set visibility of controls based on value of role . if me, add class called currentuser having properties users table (including role ). insert() , update() , , delete() methods might this: if (currentuser.role == "admin" || currentuser.role == "manager") { // allow insert, update, or delete process }

java - Camel Netty4 udp Multicast not working on windows -

i have been trying camel netty4 udp multicast work on windows , nettyudpmulticastasynctest seems failing java.nio.channels.closedchannelexception. same test seems working on osx. both machines running java 1.7 have updated interface name in test , able run nio udp multicast sample on same interface. using camel 2.14.1 not seem working on 2.15.x well. the stack trace below. tests run: 1, failures: 0, errors: 1, skipped: 0, time elapsed: 0.026 sec <<< failure! - in org.apache.camel.component.netty4.nettyudpmulticastasynctest testudpinonlymulticastwithnettyconsumer(org.apache.camel.component.netty4.nettyudpmulticastasynctest) time elapsed: 0.023 sec <<< error! java.nio.channels.closedchannelexception: null @ sun.nio.ch.datagramchannelimpl.innerjoin(datagramchannelimpl.java:832) @ sun.nio.ch.datagramchannelimpl.join(datagramchannelimpl.java:894) @ io.netty.channel.socket.nio.niodatagramchannel.joingroup(niodatagramchannel.java:409)

c++ - Creating String Array from CSV -

i have csv file of atomic elements atomic number, symbol, , name. file formatted as: 1,h,hydrogen 2,he,helium 3,li,lithium ... i'd create array of symbols referenced atomic number. ie. arrayname[32]="ge"; i've been trying use sscanf hasn't been working. rough code below: char temp[200]; float temp_z; std::string temp_ele; std::string temp_name; while(!fin.eof()) { fin.getline(temp,200); sscanf(temp, "\"%f\",\"%s\", \"%s\"",&temp_z, &temp_ele, &temp_name); cout<<temp_z<<endl; cout<<temp_ele<<endl; cout<<temp_name<<endl; } you can read each element so: string thestrings[200]; //initialize correct size int = 0; string name; while(!fin.eof()) { getline(thefilestream, name, ',' ); thestrings[i++] = name; cout<<name<<endl; }

.htaccess - redirect drupal 7 site to https -

i have drupal 7 site default .htaccess file. need redirect site possibilities 1 https site. need is: http://example.com -> https://example.com http://www.example.com -> https://example.com https://www.example.com -> https://example.com i have tried many options still error: "this webpage has redirect loop." default .htaccess looks like: .htaccess [edited] found solution: remove www , retirect https: rewritecond %{http_host} ^www\.(.+)$ [nc]<br> rewriterule ^ https%{env:protossl}://%1%{request_uri} [l,r=301] redirect non www https: rewritecond %{server_port} 80 rewriterule ^(.*)$ https://%{http_host}%{request_uri} [r=301,qsa,l]

html5 canvas - Fabric.js doesn't maintain group when exporting/importing JSON -

so have issue fabric.js that's once again down own ignorance. imagine using free draw scribble line paths on canvas. when finished, disable free draw , @ point want take objects drawn , group them in single entity. i've created fiddle here shows grouping stage. var grp=new fabric.group(); canvas.getobjects().map(function(o){ if(o.type=="path"){ o.hascontrols=o.hasborders=false; grp.addwithupdate(o); //canvas.clear(); // seems break grouping } }); canvas.add(grp); canvas._activeobject = null; canvas.setactivegroup(grp.setcoords()).renderall(); this appears work enough (even if paths appear darken once group has been created). i want export json, save @ db, , in future reload , replicate whole layout. in fiddle above reproduce sort of behaviour first saving canvas json after group has been created, , attempt reload it. as you'll see, reload works fine , positioning item grouped has been loaded in it's constitue

json - Is it possible to use the bunyan cli formatter to process logback logs? -

my logback logs java app generated in json format. node service generating json logs via bunyan. possible use buynan cli on logback log stream make logs human readable cli can node buynan logs? or there similar cli use logback output reformatting? as long configure logback formatter output in format bunyan expects, yes should work. it's idea in fact.

haskell - Bizarre precedence and associativity -

looking through operator associativity , precedence found following: infixr 0 $ infixl 1 & infixl 4 <$> infixl 1 <&> this seems bizarre. & , <&> have same precedence, $ , <$> not have different precedence, associate in different directions. is there reason this, or historical wart? if it's historical wart, how go changing it? i'm assuming <&> you're talking lens package. in case, lens operators set along other lens operators, , don't worry regular operators, <&> , & coincidence. other two, however, more thought out. $ lowest precedence, definition. why exists; change order of text drastically can reduce need parentheses quite bit. it's naturally set @ 0. meanwhile, <$> application inside context, need do, opposed $ syntax help. <$> of higher precedence along other operators it, example alternative class operator <|> @ lower precedence calls can chained

Android SQLite query returning multiple same columns -

this query below in android sqlite returning multiple of same columns. example, returning "meet_id" (3) times. first (2) "meet_id" correct right number while third 1 empty. same happens "athlete_id" , "event_id". assuming because of left join since 3rd table empty of shouldn't if return 1 column each column attribute (1 meet column , more rows?): cursor cursortemp = db.rawquery("select * " + table_meets + " left join " + table_meets_athletes + " on " + table_meets + "." + col_meet_id + " = " + table_meets_athletes + "." + col_meet_id + " left join " + table_meets_athletes_splits + " on " + table_meets_athletes + "." + col_meet_id + " = " + table_meets_athletes_splits + "." + col_meet_id + " , " + table_meets_athletes + "." + col_athlete_id + &quo

windows - Python resolution of datetime.now() -

from datetime import datetime import time in range(1000): curr_time = datetime.now() print(curr_time) time.sleep(0.0001) i testing resolution of datetime.now() . since supposes output in microsecond, expected each print different. however, that. ... 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.212073 2015-07-10 22:38:47.213074 2015-07-10 22:38:47.213074 2015-07-10 22:38:47.213074 2015-07-10 22:38:47.213074 2015-07-10 22:38:47.213074 2015-07-10 22:38:47.213074 2015-07-10 22:38:47.213074 2015-07-10 22:38:47.213074 2015-07-10 22:38:47.213074 2015-07-10 22:38:47.213074 2015-07-10 22:38:47.213074 ... why happen? there way can accurate timestamp down microsecond? don't

Sharing classes between multiple TypeScript files using Node.JS Tools for Visual Studio -

i working on node.js project written in typescript using node.js tools visual studio (ntvs). have few classes , enums spread out in 3 or 4 files in project. trying use classes defined in files main app file. previous work node, know need require call import each other file/class if working text editor , command-line compiler. but, if open typescript file in project , start typing name of class defined in different file, visual studio shows intellisense autocomplete class name , members. makes me think ntvs and/or typescript configuration automatically making of classes available project-wide. if click 'run' button, errors printed console because node can't find referenced classes @ runtime. this behavior leads me believe intellisense isn't telling me classes available, exist (which seems odd). if add require call top of file, , use imported value instead of original class name, node finds class , can use in code. presents 2 problems: i must come new name use

dart - <input type='date'> crashes Dartium on selection of a date -

any attempt select date crashes dartium. given simple .html markup below, calendar renders expected, selection of date crashes dartium browser <div> <input required id='birthday' type='date'> </div> i reported earlier , fixed, has returned. using webstorm on windows 8 x64 latest dart-sdk (x64) , dartium (x32) (dev both). it seems bug. it's known issue in dartium. see http://dartbug.com/23416 .

jquery - RSSHow can I pull just ONE cell of data at a time for Google Sheets to embed into my HTML content? -

in google's new version of spreadsheets, ability export data public sheets using rss seems missing. can find plenty of tutorials on how take entire spreadsheet , embed html page, or way use csv file display data in table on html page, that's not i'm trying do. what want take contents of individual cells of spreadsheet , display them inline in html page part of page's content matched formatting of text around it. used able using following: <script> if (window.xmlhttprequest) { xmlhttp=new xmlhttprequest(); } else { xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.open("get","https://spreadsheets.google.com/feeds/cells/spreadsheet_key/od4/public/basic/r1c1",false); xmlhttp.send(); xmldoc=xmlhttp.responsexml; var x=xmldoc.getelementsbytagname("entry"); (i=0;i<x.length;i++) { document.write(x[i].getelementsbytagname("content")[0].childnodes[0].nodevalue); } </script> the &qu

ios - Unable to get devices using AVCaptureDevice -

i've managed find code give me access devices of phone (such camera). issue when compile code (and i'm printing different devices) using xcode, empty array. here wrote: import uikit import avfoundation class viewcontroller: uiviewcontroller { let capturesession = avcapturesession() var previewlayer : avcapturevideopreviewlayer? // if find device we'll store here later var capturedevice : avcapturedevice? override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. capturesession.sessionpreset = avcapturesessionpresethigh let devices = avcapturedevice.devices() println(devices) // loop through capture devices on phone (device in devices) { // make sure particular device supports video if (device.hasmediatype(avmediatypevideo)) { // check position , confirm we've got camera if(device.position == avcapturedeviceposition.back) {

Test Source Directories for Multi Dimension Flavors not recognized in Android Studio -

i have issue test , androidtest source directories multi-dimension flavors. given following flavors: flavordimensions "taste", "serving" productflavors { chocolate { flavordimension "taste" } strawberry { flavordimension "taste" } kiwi { flavordimension "taste" } sample { flavordimension "serving" } whole { flavordimension "serving" } } there no issues "non-test" source directories (of flavor combination) being recognized in android studio: src/sample, src/whole, src/chocolate, src/strawberry, src/kiwi, src/chocolatesample, src/chocolatewhole, src/strawberrysample, src/strawberrywhole, src/kiwisample, src/kiwiwhole my issue "test" source directories. only single dimension flavors recognized: src/testsample, src/testwhole, src/testchocolate, src/teststrawberry, src/testkiwi . multi-dimension flavors

javascript - increase number by 1 if order_id found (localStorage) -

var arr = json.parse(localstorage.getitem('cart')) || []; var obj = {}; $.each(arr, function(){ if(obj.order_id == this.order.id){ obj.order_id = '1'; obj.order_name = 'cake'; obj.price = '$1.10'; obj.qty = 1; obj.qty = parseint(this.qty) + 1; }else{ obj.order_id = '1'; obj.order_name = 'cake'; obj.price = '$1.10'; obj.qty = 1; } }); arr.push(obj); localstorage.setitme('cart',json.stringify(arr)); how can alter quantity of order if order_id exist in localstorage? above code snippet insert set of array object although quantity part correct. since, want update array value when id matches, don't create new object in case. instead change if part of code - $.each(arr, function(){ if(obj.order_id == this.order.id){ this.qty = parseint(this.qty) + 1; //assuming want edit qnty value } also ensure push obj in else block only.

python - JIRA not recognizing dictionary object in cURL call -

this error getting while using jira-python python module automate logging jira. traceback (most recent call last): file "/home/csd-user/test/libs/utils/butler.py", line 217, in <module> main() file "/home/csd-user/test/libs/utils/butler.py", line 214, in main b.log_bug_exec(url) file "/home/csd-user/test/libs/utils/butler.py", line 47, in log_bug_exec cls.process_file(stdout) file "/home/csd-user/test/libs/utils/butler.py", line 108, in process_file cls.submit_bug(bug) file "/home/csd-user/test/libs/utils/butler.py", line 207, in submit_bug iss = cls.my_server.create_issue(fields=bug.json_dict['fields']) file "/opt/clearsky/lib/python2.7/site-packages/jira/client.py", line 706, in create_issue r = self._session.post(url, data=json.dumps(data)) file "/opt/clearsky/lib/python2.7/site-packages/jira/resilientsession.py", line 81, in post return self.__verb(

Convert SQL Server CTE into Oracle CTE -

here sql server cte, trying convert oracle cte or regular oracle query.. ;with cte (select ac, m, y, d, e, f, cd tbla (y = year(getdate()) , m = month(dateadd(month, -1, getdate()))) ), cte2 (select a.ac,max(a.y)as y, max(a.m) m, max(a.cd) cd tbl inner join cte b on b.ac = a.ac a.cd not null , b.cd null group a.ac) , cte3 (select c.ac, c.y, c.m, c.d, c.e, c.f, c.cd tbla c inner join cte2 d on c.ac = d.ac , c.y= d.y , c.m = d.m , d.cd = c.cd ) select * cte union select * cte3; assuming didn't have m , y columns reversed on purpose in cte/cte3 select lists, think rewrite query as: with cte1 (select a.ac, a.m, a.y, a.d, a.e, a.f, a.cd, max(case when a.cd not null , b.cd not null a.y end) on (partition a.ac) max_y, max(case when a.cd not null , b.cd not null a.m end) on (parti

python - How do you add a text file in IEER? -

i want make text file in ieer corpus format can use functions extract_rels() , parsed_docs() directly. how that? using python , nltk. what tried ws = nltk.corpus.reader.ieer.ieercorpusreader(corpus_root, 'doc1.txt') print ws.fileids() #ws instantaneous of ieer corpus relation=re.compile(r'\bin\b') t in ws.fileids(): doc in ws.parsed_docs(t): rel in nltk.sem.extract_rels('per', 'loc', doc , corpus='ieer', pattern=relation): print nltk.sem.clause(rel, relsym= 'relation' ) did no output coming , no error..

How to create a custom ListView In Android? -

here mainactivity.java contains listview . public class mainactivity extends activity { string maintext[] = { "item 1", "item 2", "item 3", "item 4", "item 5", "item 1", "item 2", "item 3", "item 4", "item 5", "item 1", "item 2", "item 3", "item 4", "item 5" }; string text[] = { "342", "3542", "3523", "23654", "3545", "342", "3542", "3523", "23654", "3545", "342", "3542", "3523", "23654", "3545", "342", "3542", "3523", "23654", "3545" }; listview list; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); s

How to convert decimal to scientific in SQL Server 2008 R2 -

i have table named product . table looks this: id product volume 1 xyz 4654.000000000000000 2 abc 121.000000000000000 i want represent volume in scientific notation. volume of datatype decimal(20,8) . how can conversion? normally, formatting , presentation of data should done ui, on client side, if insist... declare @t decimal(20,8) = 4654.000000000000000; select @t, convert(nvarchar(32), cast(@t float), 2) result 4654.00000000 4.654000000000000e+003 first cast decimal float (please note, may loose precision), convert float nvarchar using style 2 : always 16 digits. use in scientific notation. note float type has 15 digits of precision, can't store decimal(20,8) without loss of precision.

vb.net - ID # being reset in ASP.NET -

in controller action attempting retrieve record db: dim surveydb = db.surveys.find(sid) where sid instantiated @ class level: private sid new integer when first create new survey (if surveydb nothing), add db , set sid so: db.surveys.add(survey) await db.savechangesasync() sid = survey.surveyid that seems go fine (say new survey goes row 20 survey.surveyid = 20), except if go page, sid getting reset reason, surveydb nothing. why in asp.net class-level variable getting reset? how find record i'm looking for? the code after if depends on result above line: this should automatic (as far aware) when have await, when expression attempts use value should suspend until await finishes. important figure out before attempt solution 1 below. otherwise.... one option wait complete (or number of them complete): dim surveydb = db.surveys.findasync(sid) task.whenall(surveydb) if isnothing

IPTC metadata automatically added to uploaded images on Facebook -

many images uploaded on facebook contain iptc/iim fields apparently automatically added during upload process: special instruction , string beginning "fbmd" original transmission reference . see example (personnal) image uploaded on facebook , decoded using jeffrey's exif viewer: http://goo.gl/j8ltxx what this?

Usage of class in PHP from different directory -

i have been using classes in php. i have directory, test, in there index.php sub-directory test new, has checkuser.php code checkuser code: <?php public class checkuser{ public function checkuser() { echo "this class"; } } ?> code index.php: <?php include('new/checkuser.php'); ?> <html> <head> </head> <body> <?php checkuser::checkuser(); ?> </body> </html> but throws error. please help. what kind of error that? there more things: you declaring class "public" parse error: syntax error, unexpected t_public on line 2 you calling non-static method statically fatal error: non-static method checkuser::checkuser() cannot called statically on line 17 you including file, without being aware of context, suggest practice: <?php include( dirname(__file__) .

java - Get previous occurrence of a LocalTime -

how previous occurrence of specified local time instant , system timezone ? this means getting today @ specified time or yesterday @ specified time depending whether specified time today before or after now. of course, need take account timezone switch because of daylight saving. is, timezone offset can different today , yesterday. this i've got : public instant getpreviousoccurence(localtime scheduledtime) { instant = instant.now(); instant todayatspecifiedtime = now.with(scheduledtime); return todayatspecifiedtime.isafter(now) ? todayatspecifiedtime.minus(1, chronounit.days) : todayatspecifiedtime; } but after checking source of instant.minus() , noticed removes 84600 seconds day, wrong in case. additionally, i'm not sure whether instant.with() use system timezone or utc. edit 1 in case there no occurrence of specified time today (because of timezone shift), instant of timezone shift should returned. in case there 2 occurrences of specified tim

javascript - Extracting images to flexslider -

i'm using image slider known flexslider . i'm adding images manually, want enhance images can extracted specific folder , added <li> elements. i'm looking jquery function so. possible? jsfiddle: http://jsfiddle.net/t3sgbq5w/ html: <div class="flexslider"> <ul class="slides"> <li> <img src="http://placehold.it/350x150" /> </li> <li> <img src="http://placehold.it/350x150" /> </li> <li> <img src="http://placehold.it/350x150" /> </li> </ul> </div> no. javascript client-side technology , cannot on server. use ajax call server-side script (e.g. php) return information need. think need php or asp this, here code in php: <div class="flexslider"> <ul class="slides"> <?php $folder = 'images/galerija'; // chose folder

excel vba - Type mismatch error in vba using activecell -

i getting error type mismatch.. trying set active cell equal cell. if activecell = e4:e18 here code can tell me i'm doing wrong in here. if activecell.row = range(cells(4, 5), cells(18, 5)) activesheet.cells(activecell.row, 4) = if activecell.row = range(cells(4, 8), cells(18, 8)) activesheet.cells(activecell.row, 7) = which i'm trying set active cell = e4 e18 ' you trying compare number activecell.row against range object range method returns. need use this: if activecell.row = range(cells(4, 5), cells(18, 5)).row however, not work how want to. activecell ever single cell, row property single number. selection range can more single cell. however, row property still returns row number first row of cells. if trying check if activecell within range e4:e18, use intersect method see if returns range object: if not (intersect(activecell, range(cells(4, 5), cells(18, 5))) nothing) msg

Ruby on Rails - Devise always redirect to the root_path -

in ruby on rails application use devise authenticate "admins". i'm using "admin" model modified 'routes.rb' file define custom routes of site routes.rb rails.application.routes.draw resources :contacts devise_for :admins #personal devise admin routes :admin #session block "/login" => "devise/sessions#new", :as => :admin_session_login delete "/logout" => "devise/sessions#destroy", :as => :admin_logout #account block "/register" => "devise/registrations#new", :as => :admin_register "/edit_account" => "devise/registrations#edit", :as => :admin_edit end end i saved file , restarted server when try navigate 1 of custom routes '/login' application redirect me http://localhost:3000/ i post server console log when try navigate /login: console server log started "/login" 127.0.0.1 @ 2

c# - combine several DbGeography polygons -

i looking ways combine several polygons reduce number of points. way forward: var pol1 = dbgeography.polygonfromtext("polygon ((-2.91790532309701 53.3657440952224, -2.91790532309701 53.3567508791632, -2.90283703655041 53.3567508791632, -2.9028338560513 53.3657440952224, -2.91790532309701 53.3657440952224))", 4326); var pol2 = dbgeography.polygonfromtext("polygon ((-2.90283703655041 53.3657440952224, -2.90283703655041 53.3567508791632, -2.88776875000381 53.3567508791632, -2.88776556950469 53.3657440952224, -2.90283703655041 53.3657440952224))", 4326); var pol3 = dbgeography.polygonfromtext("polygon ((-2.91641048851245 53.3747373112816, -2.91641048851245 53.3657440952224, -2.90133902146673 53.3657440952224, -2.90133583925323 53.3747373112816, -2.91641048851245 53.3747373112816))", 4326); var combined = (pol1.union(pol2)).union(pol3); basically, if polygons touch each other, want them combined. disjoint polygons should remain disjoint. at moment no

iphone - Swift/SpriteKit - How to add points when an object collides with a player -

i want know how give player plus 1 point every time player collides object. every time object collided with, @ on previous amount. example: if have 5 coins , collected 5 in current game overall amount of coins have 10. grate if link me place has tutorial of in swift not in objective-c. note: have set-up coins spawning , collision works when player collides game ends. code, have removed code not necessary: import foundation import spritekit class gamescene: skscene, skphysicscontactdelegate { var movingground: ppmovingground! var square1: ppsquare1! var wallgen: ppwallgen! var diamondgen: ppdiamondgen! var isstarted = false var screentapped = avaudioplayer() var isgameover = false var isdiamondcontact = false override func didmovetoview(view: skview) { addmovingground() addsquare1() adddiamondgen() addwallgen() start() adddiamondslabels() } func ad

html - Email an angular Js form -

i wrote form in html , have used angular js there. nothing fancy, simple form mail to:email address in action. the link http://www.chami.com/tips/internet/010597i.html says should work alone mailto added action attribute. but not work.what else need add? <!doctype html> <html lang="en-us" ng-app="myapp"> <head> <meta charset="utf-8"> <title>form</title> <meta name="viewport"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script> <script type="text/javascript" src="js/script.js"></script> <link rel=&qu

python - Non-interfering printing from threads -

doing threading python script , spits out stuff in kinds of orders. however, want print out single "remaining: x" @ end of each thread , erase line before next print statement. basically, i'm trying implement progress/status update erases before next print statement. i have this: for in range(1,10): print "something here" print "remaining: x" sleep(5) sys.stdout.write("\033[f") sys.stdout.write("\033[k") this works fine when you're printing out way is; however, implement threading, "remaining" text doesn't wiped out time , "something here" right before wipes out previous line. just need bit of trying figure out best way progress/status text organized multithreading. thanks. since code doesn't include threads it's difficult give specific advice doing wrong. if it's output sequencing bothers you, however, should learn locking, , have threads share lock. id

ddms seems to be disabled for genymotion in android studio -

Image
i on mac . started genymotion emulator , via android studio started ddms . kindly note send button in location control not clickable . if not use genymotion emulator , use directly emulator android studio button not disabled , works fine . do need steps before using ddms genymotion emulator in android studio. genymotion's fake gps positions cannot controlled ddms. there several other ways it: the ui widget . can open widget clicking on gps icon on right of device it allows send mock data device (lat, long, altitude, accuracy , bearing). can open googlemap view choose location more easily. the java api you can control gps position of device directly instrumented tests usgin java api. api gives same level of control ui widget. can find more information on the documentation . here how it: genymotionmanager genymotion = genymotionmanager.getgenymotionmanager(ctx); genymotion.getgps() .setlatitude(64.13367829) .setlongitude(-21.8964386

javascript - Error running express with node -

i'm trying start simple server on mac can access file localhost. i have node , express installed , in server file. var express = require('express'), app = express(); app.use(express.static(__dirname, '/')); app.listen(8080); console.log("app listening on port 8080"); when try do: node server i response: /users/mt_slasher/node_modules/express/node_modules/serve-static/index.js:47 var opts = object.create(options || null) ^ typeerror: object prototype may object or null: / @ function.create (native) @ function.servestatic (/users/mt_slasher/node_modules/express/node_modules/serve-static/index.js:47:21) @ object.<anonymous> (/users/mt_slasher/desktop/my projects/basket/site/server.js:4:23) @ module._compile (module.js:460:26) @ object.module._extensions..js (module.js:478:10) @ module.load (module.js:355:32) @ function.module._load (module.js:310:12) @ function.module.runmain (module.js:

Intellisense not working in VS 2013 community edition -

Image
i have installed vs 2013 community edition. seems intellisense not working properly. nothing happens on pressing "tab" key. have explicitly press "ctrl + space" keys intellisense working. else facing similar issues? this might solve issue you: go tools >> options >> text editor >> languages >> general , make sure both auto list members , parameter information checked (not half-checked/square state). soruce: http://omegacoder.com/?p=1008

ios - Can I have two ECSlidingViewController Drawer from left and right? -

i want have 2 drawer menus, 1 left right. possible using ecslidingviewcontroller 2 . if no can suggest better way achieve same? check out library residemenu easy , have left , right menus here sample code - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { uiviewcontroller *firstviewcontroller;// initial view controller uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:firstviewcontroller]]; uiviewcontroller *leftmenuviewcontroller; // left menu uiviewcontroller *rightmenuviewcontroller; // right menu residemenu *sidemenuviewcontroller = [[residemenu alloc] initwithcontentviewcontroller:navigationcontroller leftmenuviewcontroller:leftmenuviewcontroller rightmenuviewcontroller:rightmenuviewcontroller];

javascript - JQuery Selector for multiple elements of one ancestor -

i have dom structure similar this: <div id="ans1"> <input id="in1" /> <input id="in2" /> </div> <div id="ans2"> <input id="in1" /> <input id="in2" /> </div> how can select of descendants of ancestor? something like: $("#ans1 #in1, #ans1 #in2") you can use children function $("#ans1").children("#in1, #in2") you should use unique ids thought dom, use classes specify elements same in nature. change children have same class of in1 $("#ans1 > .in1") will select direct descendants of ans1 class of in1.

android - Google Play Subscription orderId not present -

we've completed implementation google play subscriptions v3 in our app , testing alpha builds on play store. works perfectly, apart orderid , not returned part of google play api json response on device. token returned expected though. happening because testing using alpha testing, or issue? if so, shouldn't orderid still sent google play api token is? so apparently expected behaviour when doing pre-release testing of subscriptions testing account licences, google play api won't send out orderids because no actual real life purchase being made, google wallet doesn't create order. translates no orderid being received app. the official response google play developer support representative on matter: currently, test subscriptions not appear in google wallet merchant center because not assigned valid order ids. i'm sorry confusion. to manage test subscriptions, instead need use developer api refund, defer, cancel, or revoke test subs

javascript - Return the index of a div inside ng-repeat to use in jQuery ui droppable -

i have ng-repeat looping through bunch of different fries. <div class="normal-fries"> <div ng-repeat="fry in normalfries"> <div class="normal-fry"> <h3>{{ fry.name }}</h3> <p>energy: {{ fry.energy }}</p> <p>protein: {{ fry.protein }}</p> </div> </div> </div> i have created draggable method normal-fry $(".normal-fry").draggable({ addclasses: false, }); i'm trying return index of fry (div) dropped can access information fry within jquery. $(".normal-plate").droppable({ accept: ".normal-fry", drop:function(event, ui){ console.log($(this).index()); } }); however can't work out how index of dropped div. i've tried, $(this).index(): and $((ui.draggable).index()); and variations of two. can't work out. i grateful suggestions. thanks. you ex

ios - PFUser logInWithUsernameInBackground in Swift - Missing argument for parameter 'target' call -

i implementing login function parse written in swift. getting error: missing argument parameter 'target' call it doesn't seem i"m missing parameters though - i'm following declaration in pfuser.h. here code: //declarations @iboutlet weak var usernametextfield: uitextfield! @iboutlet weak var passwordtextfield: uitextfield! @ibaction func loginbuttonpressed(sender: uibutton) { let useremail = usernametextfield.text let userpassword = passwordtextfield.text //check both fields filled if usernametextfield != "" && passwordtextfield != "" { pfuser.loginwithusernameinbackground(useremail, password: userpassword) { (user: pfuser, error: nserror) -> void in { } } thank help! you have curly braces , username , password checks wrong. try below code (copy & paste please) works: @ibaction func loginbuttonpressed(sender: uibutton) { let useremail = usernametextfield.te

azure - Notification to Cloud Service Instance when another instance goes down -

i have cloud service multiple instances. i'm trying find way notify instance if instance b goes down. there way hook azure notifications rather have each instance poll others? polling simplest approach. aware takes time azure detect if instance goes down (depends on how outage occurs , how manifested). in fact, if app crashes, azure may not detect outage @ all. i'm involved product called cloudmonix @ http://cloudmonix.com , provides sophisticated monitoring/automation azure , has set of features where-by can call apis when detects issues in environment. perhaps used detect issue instance , post api method implement? hth

ibm mq - How to find local transmission queue of remote MQ queue in Java? -

in java application mqqueue object using mqqueue tqueue = qmanager.accessqueue(tqname, tqoptions); the queue remote queue. there way corresponding local transmission queue ? (using mq 7.5 ) thanks yes, using runmqsc console. first on command prompt run runmqsc <qmgr> . once console opens run dis qr<remote q> xmitq to display transmit queue used remote queue definition. update another method use pcf classes. pcfmessageagent pcfma = new pcfmessageagent("qm"); pcfmessage pcfcmd = new pcfmessage(mqconstants.mqcmd_inquire_q); pcfcmd.addparameter(mqconstants.mqca_q_name, "q.remote"); pcfmessage[] pcfresponse = pcfma.send(pcfcmd); string xmitqname = (string) pcfresponse[0].getparametervalue(mqconstants.mqca_xmit_q_name); system.out.println("xmitq name " + xmitqname);

php - Error when building models from propel schema -

i got errors below when running command below. have schema file generated reverse engineering through propel. command vendor/bin/propel build error 1 [runtimeexception] unable write "" directory error 2 [symfony\component\filesystem\exception\ioexception] failed create "": mkdir(): invalid path. sounds propel doesn't know put files. typing propel --help give command line options. there find option specify output folder. propel model:build --output-dir c:\temp (you'll have specify local os x path instead of windows temp folder) as i'm trying out propel myself, following post has lead me suspicion propel.ext file incomplete. https://github.com/propelorm/propel2/issues/694

playframework 2.3 - How Play FrameWork2 using Akka -

i using play framework 2.3 scala i have read play uses actor system akka i wanted ask how play controllers using akka, there separate actor each controller or separate actor each controller action in every controller thanks

Update field with max and min value in mysql -

i update percentage field maximum value of 1 , minimum of 0 relative value (eg. "add 25% current value") this doesn't work: update table set field = max(0, min(1, field+0.25)) update: if value eg 0.85 should update 1 update i'm using now: update table set field = greatest(0, least(1, field+0.25)) update your_table set field = case when field > 0.75 1 else field + 0.25 end especially in mysql can do update your_table set field = least(1, field + 0.25) for values can negativ can use update your_table set field = case when field + ? > 1.0 1 when field + ? < 0.0 0 else field + ? end

magento getting product id based on custom option value -

i need retrieve array of cross sell product ids product based on product id retrieved based on value in product custom option. i have researched how using straight mysql statements. how using standard magento calls? here mysql process: select option_type_id mage_catalog_product_option_type_title option_type_id eq 'desired value'; then: select option_id mage_catalog_product_option_type_value option_type_id eq option_type_id; (from above step) then: select product_id mage_catalog_product_option option_id eq option id; (from previous step) then: select linked_product_id mage_catalog_product_link product_id eq product_id (from previous step) , link_type_id ='5'; (i'm experienced in php/mysql barely past novice level in magento) can help? thank very, much! mark try solution: $collection = mage::getmodel('catalog/product_link')->getcollection()->addfieldtofilter('option_type_id','desire

android - RecyclerView with CardView rows where each row has 1 or more TextViews stacked vertically all loaded from same cursor -

Image
i have recyclerview in application each row in cardview data loaded database using loader/cursor . basic recyclerview/cardview stuff. data db structured this: | _id | main_id | sub_id | title | |----- |--------- |-------- |-------------- | | 1 | 1 | 1 | main 1 sub 1 | | 2 | 1 | 2 | main 1 sub 2 | | 3 | 2 | 1 | main 2 sub 1 | | 4 | 3 | 1 | main 3 sub 1 | | 5 | 3 | 2 | main 3 sub 2 | | 6 | 3 | 3 | main 3 sub 3 | i have been able display distint main_id 's , title each record in recyclerview/cardview . below the question proper: i want display this: is possible same cursor? have custom recyclerview adapter view holder. please how go it.thanks

ios - Share a link via URL scheme (via Telegram for example) -

i want share link via url scheme lets telegram. i have created this: tg://msg?text = www.example.com?t=12 the link, opens telegram nothing else happens. i have used same code viber, , works: viber://forward?text = www.example.com?t=12 and opens new message in viber text: www.example.com in other word cuts url. any idea? you can use telegram.me share link falls webogram if telegram app not installed on device. https://telegram.me/share/url?url=<url>&text=<text>

Why Dataset columns are not recognised with CSV on Azure Machine Learning? -

i have created csv file, no header. 1496 rows of data, on 2 columns in form: real; string example: 0.24; "some long string" i go new - dataset - local file pick file, , no header csv format but after done loading error message cant decrypt: dataset upload failed. internal service error. request id: ca378649-009b-4ee6-b2c2-87d93d4549d7 2015-06-29 18:33:14z any idea going wrong? at time azure machine learning accepts comma , seperated, american style csv. you need convert comma separated csv

ios - How to set the number of Touch ID retry attempts? -

how set number of retry attempts touch id? presenting alert evaluatepolicy, don't see way set number of retries... i highly doubt can. , should not able it. reasons should not able lower amount of possible attempts: annoy user, if misplaces finger , cant authenticate. bad design choice of reduce number of tries. reasons should not able increase amount of possible attempts: limit there remove possibility brute-force way in, e.g. trying every finger of ones hand, etc. if allow app increase number of attempts security risk.

c - Is it OK to share the same epoll file descriptor among threads? -

is safe share same epoll fd (not socket fd) among several threads? , if so, each thread have pass own events array epoll_wait(2) or can share it? for example void *thread_func(void *thread_args) { // extract socket_fd, epoll_fd, &event, &events_array // thread_args // epoll_wait() using epoll_fd , events_array received main // threads using same epoll_fd , events array } void main( void ) { // create , bind socket // create events_fd // allocate memory events array // subscribe events epollin , epollet // pack socket_fd, epoll_fd, &events, &events_array // thread_args struct. // create multiple threads , pass thread_func , // same thread_args threads } or better this: void *thread_func(void *socket_fd) { // create events_fd // allocate memory events array // subscribe events epollin , epollet // epoll_wait using own epoll_fd , ev