Posts

Showing posts from March, 2013

Ruby On Rails, params lost after redirect -

i have page user pays fees, , on submit gets redirected same page showing payment done. i'm passing id on redirect, lost causing error. here controller action: def pay_all_fees @target_action='pay_all_fees' @target_controller='parent_wise_fee_payments' if params[:id].present? id = params[:id] else id = 4 end @students=student.find_all_by_sibling_id(guardian.find(id).ward_id) @guardian = guardian.find(id) @students.each |student| fetch_all_fees end if request.post? status=true multifeestransaction.transaction multi_fees_transaction= multifeestransaction.create(params[:multi_fees_transaction]) begin finance_transactions=financetransaction.create!(params[:transactions].values) rescue exception => e status=false end if status , (multi_fees_transaction.valid? && finance_transactions.all?(&:vali

ios - How to manage many (>500) background URLSession downloads with AFNetworking 2.x? -

i have app on app store uses afnetworking 2.x download large files in background nsurlsession-based downloads, because user put app in background (it gets terminated after while of course, downloads finish same. wonderful). app working well. users downloading few files @ time. now need make similar app, time instead of few large files, user want download large number of smallish files: example, 500 files 1-5mb each. again, app put in background, want stay nsurlsessiondownloadtask unless there's reason not to. my question is, can create 500 nsurlsessiondownloadtasks @ once? afnetworking clever throttling not overload system? or ios it? or nothing it, , have painfully track & organize state of transfers across restarts of app (ie. because gets put in background terminated) ? if knows limits of how many nsurlsessiondownloadtasks can create reliably simultaneously, awesome... thanks! p.s. prefer obj-c swift, thx :) last checked (haven't looked @ ios 9 beta

javascript - How to design client side data and business layers -

we designing enterprise application. we looking ideas our client side design (maybe existing lib, books, design patterns, experience) managing data , business layer in decoupled way chosen framework render dom (angular, react, etc.). our experience aiming write business in pure javascript , not on top of specific framework can more flexible , independent. some notices: the data/entities can shared between different components. each component can use data in own way, depending on business logic. the data/entities may refreshed several time.

hyperlink - Is it possible to attach a file to an MMS via an HTML link? -

i read here it's possible prepopulate sms body text via html link : how pre-populate sms body text via html link does know if it's possible add base64 image (becoming mms) (e.g) "&attachment=" parameter ? something : <a href="sms:?body=/* body text here */&attachment=data:image/jpg;base64,/* base64 image here */;"></a> and if it's not, idea how ? thanks

search - Python - How would I isolate and utilize the "answer" sometimes provided at the top of the page when something is searched in google -

for example, when phrase "liam neeson age" searched,displayed in bold font, @ top of page "63 years (june 7, 1952)." have tried toying concepts presented previous question( google search python app ) little success. can links , not actual "answers." ideally able input string , have return "answer" provided google. if there no "answer," searches, able know well. scrape javascript-enabled browser firefox , selenium webdriver .

php - Function name must be a string fatal error -

i have fatal error, i've been staring @ code hours.. think has nothing name of function action_send , must silly 'missing parenthesis' or something... can me please ? if (...) {} else if (!historic_exist($id)) { action_send($req, '0', (strpos($req['tag'], 'admd') !== false) ? $req['id_act'] : ''); //the error in line : if ((strpos($req['wf'],'install') !== false) && $req('id_equ') !== '') action_send($req, '', '0'); } in php can call functions dynamically using variables. in code using $req('id_equ') php considers function call. but $req array php parser throws fatal error: fatal error: function name must string in \..\file.php on line .. you must change $req('id_equ') $req['id_equ'] .

java - Inject Spel parameter on annotation parameter (like what is done with @Value on a field) -

i'm using annotation provided spring-starter-elastic-search to create document , inject parameter indexname dynamically: @entity @document(indexname = "myindex") public class stockquotation in bean have done using @value on field: @value("${elasticsearch.index.name}") public string indexname; however, have tried inject in same way in annotation , translation not done: @entity @document(indexname = "${elasticsearch.index.name}") public class stockquotation as exception: caused by: org.elasticsearch.indices.indexmissingexception: [${elasticsearch.index.name}] missing what appropriate approach this? thanks

javascript - What's the difference between setInterval(func) and setInterval(function(){func()}) -

my ex boss had weird bug when used setinterval long delay interval : setinterval(func, 3000000 /*50 minutes*/); node.js crashed. func can simple function console.log('something') . someone suggested him wrap anonymous function around func , , solved issue. as know, shouldn't make difference , considered bad practice @ least in browsers' javascript. is there difference in node.js between setinterval(func, delay) setinterval(function(){func()}, delay) or bug in node.js? update: bug report on github to address question directly: yes, there difference. not in functionality of setinterval , in scope function have when it's run. scenario 1: setinterval(function() { console.trace(); }, 3000000); every 50 minutes, stack trace printed console. in case because function console.trace has been called directly maintain context of console . scenario 2: setinterval(console.trace, 3000000); this throw error because invoked con

xml - Xslt copy element into renamed element -

i'm struggling xslt produce i'm after. i have following xml <data> <things> <name>a</name> </things> <other> <type>b</type> </other> </data> and want output xml be <data> <stuff> <name>a</name> <type>b</type> </stuff> </data> i have following xslt far doesn't produce i'm after <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" > <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="node()|@*" name="identity"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="data/things"> <xsl:elemen

Maven UnsupportedClassVersionError Unsupported major.minor version 51.0 -

so installed maven using homebrew. seemed working fine. got error. tried uninstalling reinstalling maven. can't type mvn --version without getting error. i've double checked using javac -version , java -version. i'm using 1.8.0_51. that isn't problem. any ideas? maven doesn't use javac on path, uses java_home. execute mvn -v see java version used maven.

sql server - how to get result if value is comma seperated in like codition -

i trying following query not getting results: select * internationalpropertylocals propertyname '%chatham,ma%' but if try below query expected result: select * internationalpropertylocals propertyname = 'chatham, ny' are missing whitespace after comma? try: select * internationalpropertylocals propertyname '%chatham, ma%' if know exact propertyname looking avoid using like = describes intentions better, not mention performance concerns.

javascript - Detect dates between strings and times using momentjs -

i have string this occurs every 1 weeks on sunday, monday, tuesday, wednesday, thursday, friday , saturday effective 2015-07-23t00:00:00 t16:00:00 t17:00:00 you can see got words, times , dates. need apply formats dates , times, , internationalization strings. the code works this var result = ''; // values array var arrvalue = value.split(' '), resultarr = []; // iterate in each element (var = 0; < arrvalue.length; i++) { // validate date if (moment(arrvalue[i], moment.iso_8601).isvalid() && (arrvalue[i].indexof('t') != -1)) { // push array resultarr.push(moment(arrvalue[i]).format('l')); // validate time } else if (moment('0001-01-01' + arrvalue[i], moment.iso_8601).isvalid() && (arrvalue[i].indexof('t') != -1)) { // push result date resultarr.push(moment('0001-01-01' + arrvalue[i]).format('lt')); } else { // push string in coll

In Meteor, how to short-circuit-assign a helper variable with user object? -

i'm running latest meteor (v1.1.0.3) on os x 10.6.8 in firefox 39.0. i'm using accounts-ui , accounts-google login management. have hand-rolled profile form (among other things) 'name' field. initial value of field should either name set in profile or 1 google supplies. i've defined following template helper: template.profile_edit.helpers({ my_name: (function () {var u=meteor.user(); return u.profile.name || u.services.google.name;}()) }); i use value in template {{ my_name }} . when start meteor compiles fine, when load profile page following javascript error: typeerror: u undefined ...me: (function () {var u=meteor.user(); return u.profile.name || u.services.googl... not relevant, completeness: after page loads, 'name' field in form blank. i am logged in. when pull meteor's mongo instance in terminal can see user record; name in profile not set, name in services.google.name set. why error happening , how can solve it?

java - show multiple cardview one above another in android layout -

i want design application want put multiple card-view revolving . , on vertical slide open card content in fragment above card view . want design below image card view ] 1 try stack view. check here example https://examples.javacodegeeks.com/android/core/widget/stackview/android-stackview-example/

objective c - Alternative option of UIButton addTarget:action:forControlEvents: method in IOS -

i know question has been asked many times want pass custom object argument on clicking button. uibutton addtarget:action:forcontrolevents: doesn't allow important me can further on basis of custom objects. if alternative add target possible, please give solution. the code this: custom object: headerdata *cell ; button: _forward =[uibutton buttonwithtype:uibuttontyperoundedrect]; [_forward settitle:@"f" forstate:uicontrolstatenormal]; _forward.frame = cgrectmake(300, (_cell_height-_label_height)/2, 10 ,_label_height);] [_forward addtarget:web action:@selector(functionname:) forcontrolevents:uicontroleventtouchupinside]; and function called on clicking uibutton _forward is: -(void)functionname:(uibutton *)sender{ //code further programming on basis of cell. } you make custom subclass of uibutton: @interface customdatabutton : uibutton @property (nonatomic, strong) id userdata; @end then in functionname, can pull data out: -(void)fu

HOW to echo New record with selected old record in PHP Mysql? -

Image
i new in php. have query "select r.client_id,c.id,t.id,a.id,o.id,c.name cname,t.title ttitle,a.title atitle,o.title otitle, l.title ltitle, s.title stitle og_ratings r left join og_companies c on r.client_id = c.id left join og_rating_types t on r.rating_type_id = t.id left join og_actions on r.pacra_action = a.id left join og_outlooks o on r.pacra_outlook = o.id left join og_lterms l on r.pacra_lterm = l.id left join og_sterms s on r.pacra_sterm = s.id c.id= 338 order r.id desc limit 2"; result of query is now want print first row of of resulted query , success. want echo 2 columns ltitle , stitle second row. here failed. here code <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "pacra1"; $conn = new mysqli($servername, $username, $password, $dbname); //$id2 = $_get['id']; $sql= "select r.client_id,c.id,t.id,a.id,o.id,c.name cname,t.title ttitle,a.title atitle,o.title

objective c - Uncrustify obj-c: Newline before and after call to super, interface declaration and implementation declaration -

Image
how can add newline after call super uncrustify current: - (void)somefunction { [super somefunction]; more stuff; , more stuff; } desired: - (void)somefunction { [super somefunction]; more stuff; , more stuff; } and how can add newline before , after interface declaration , implementation declaration current: @interface scloginscreenviewcontroller () @property (weak, nonatomic) iboutlet uiview *someview; @property (weak, nonatomic) iboutlet uiview *anotherview; @end @implementation scloginscreenviewcontroller - (void)somefunction { } desired: @interface scloginscreenviewcontroller () @property (weak, nonatomic) iboutlet uiview *someview; @property (weak, nonatomic) iboutlet uiview *anotherview; @end @implementation scloginscreenviewcontroller - (void)somefunction { } i using bbuncrustifyplugin , uncrustifyx unfortunately uncrustify doesn't support of these features @ moment. 1 the "new line after" options shown b

vimeo-api remove part of JSON response -

is possible (sending specific parameter in request) remove part of json response? like youtube api v3 part parameter: part parameter specifies comma-separated list of 1 or more video resource properties api response include. thanks, the vimeo api supports fields whitelist, instead of saying "exclude this", include list of want. there more documentation here: https://developer.vimeo.com/api/spec#json-filter but idea add parameter fields , , comma separated list of fields. nested data should broken periods. following representation { "name": "dashron", "websites": [{ "name": "facebook" },{ "name": "twitter" }], "metadata": { "albums": { "uri": "...", "options": "...", "total": "..." } } is result of api call following field

c# - Cannot extract <link> element using HtmlAgilityPack and XPath -

i using html agility pack select out textual data within rss xml. every other node type (title, pubdate, guid .etc) can select out inner-text using xpath conventions when querying "//link" or indeed "item/link" empty strings returned. public static ienumerable<string> extractalllinks(string rsssource) { //create new document. var document = new htmldocument(); //populate document rss file. document.loadhtml(rsssource); //select out of required nodes. var itemnodes = document.documentnode.selectnodes("item/link"); //if 0 nodes found, return empty list, otherwise return content of nodes. return itemnodes == null ? new list<string>() : itemnodes.select(itemnode => itemnode.innertext).tolist(); } does have understanding of why element behaves differently others? additional: running "item/link" returns 0 nodes. running "//link" returns correct number of nodes inner text 0 chars in leng

node.js - How to load contents of an external file into gulp browser-sync -

i loading browser-sync proxy , want load search , replace terms external file in order amend page loaded browser. the reason want load search , replace terms separate file because want make use of gulp-watch , reload browser-sync search , replace terms updated. my project folder: regex/search.txt <- search term stored in file regex/replace.txt <- replace term stored in file gulpfile.js contents of gulpfile.js: var gulp = require('gulp'), fs = require("fs"), browsersync = require('browser-sync'); var proj_url = "http://www.example.com"; var search_text = ""; var replace_text = ""; gulp.task('readregex', function() { return gulp.src('regex/*.txt') .pipe(fs.readfile("regex/search.txt", "utf-8", function(err, data) { search_text = data; })) .pipe(fs.readfile("regex/replace.txt", "utf-8", function(err, data) { replace_tex

tcpreplay installation failed, libpcap/collect -

i not install tcpreplay on rhel 6.6 when try run ./configure got following error checking inet_addr... yes checking libpcap... no configure: error: libpcap not found [root@tcpreplay-4.1.0]# ldconfig -p | grep libpca libpcap.so.1 (libc6,x86-64) => /usr/lib64/libpcap.so.1 [root@tcpreplay-4.1.0]# ldconfig output shows there installed libpcap i tried --with-libpcap=/usr/lib64 option got same error. i have rhel 6.6 similar config, uninstalled tcpdump, libpcap yum. installed latest libpcap , tcpdump tarball without error. got no error on ./configure command of tcpreplay tarball. (in installation libpcap installed /usr/local/lib) but when try make got following error. /usr/local/lib/libpcap.a(pcap-dbus.o): in function `dbus_activate': /directory/libpcap-1.7.4/./pcap-dbus.c:185: undefined reference `dbus_connection_open' /directory/libpcap-1.7.4/./pcap-dbus.c:191: undefined reference `dbus_bus_register' /directory/libpcap-1.7.4/./pcap-dbus.c:230: un

javascript - How Do I pass an image source to a variable in a function to be then shown to a image tag -

i have image gallery has 3 images, created thumbnail 3 images , if ever click on thumbnail want show on main image tag. this main image tag: <img style="width: 100%;" ng-model="" id="viewpic" name="viewpic" src="something.jpg" > this thumbnails: <img style="width: 28%;" src="images/terminus_63_img3.jpg" onclick="functionshow();"> <img style="width: 28%;" src="images/terminus_63_img3.jpg" onclick="functionshow();"> <img style="width: 28%;" src="images/terminus_63_img3.jpg" onclick="functionshow();"> <img style="width: 100%;" id="viewpic" name="viewpic" ng-src="viewpic" > <img style="width: 28%;" src="images/terminus_63_img3.jpg" ng-click="functionshow('images/terminus_63_img3.jpg');"> <img style="width: 28%;

android - GcmNetworkManager perodic task handling -

i need schedule task runs every 24 hours small data remote server. gcmnetworkmanager seems prefect candidate need support sdk 15+. (jobscheduler 21+). the way achieving extending application. oncreate , create periodictask specific tag , call .setupdatecurrent(false) (so 1st 1 gets scheduled , subsequent tasks should ignored should not update existing task). in documentation read important: when google play services or client app updated, scheduled tasks removed. gcmnetworkmanager invokes client app’s oninitializetasks(). override function reschedule necessary tasks. in scenario, should not matter oncreate of application creating update task. there better way doing? (also wish there way check if there pending periodic task given tag) unless listening action_my_package_replaced in broadcastreceiver (and scheduling task there well), should still override oninitializetasks() create same periodictask . otherwise, there may time between when app updated google

c - why after writing with memcpy in a portion of memory mmaped, I don't see in the file? -

when open file after run of program, saw first phrase. void writeinfilemmaped(){ void* file_memory=null; char* path="/home/testfile"; int fdtest=0; struct stat buftest; char *phrase= "hi, i'm phrase"; //make file 20m system("truncate -s 20m /home/testfile"); //open testfile if((fdtest=open(path,o_rdwr))==-1){ perror("open testfile"); exit(exit_failure); } if(fstat(fdtest,&buftest)==-1){ perror("stat"); } file_memory=mmap(0, buftest.st_size, prot_read|prot_write, map_shared, fdtest,0); if(file_memory==map_failed){ close(fdtest); perror("error mapping file"); exit(exit_failure); } memcpy(file_memory,phrase,strlen(phrase)); printf("%sn",file_memory); memcpy(file_memory+100, phrase,strlen(phrase)); printf("%sn",file_memory+100); } the output good, in file appears "hi, i'm phrase" try sprintf , result same. think problem null

Ruby on Rails RESTful controller function order -

i'm pretty new rails , have been going through process of building rest service. in rails guide seems pretty specific when tell in controller class add functions: create after new, show before new, etc. guess curious if there convention people use ordering (when rake routes order is: index, create, new, edit, show, update, destroy). not big deal long project consistent, there "conventional order" people use? if not, guess argue who's order better. thanks! the order of controller actions isn't important @ all, follow same convention rails uses in it's own scaffolded controllers. this way, can scan controller action i'm looking when open controller file. index, show, new, edit, create, update, destroy i think order makes sense, index , show both concerned "showing" or "reading" data, primary concern in web app. then new , edit , , create concerned "creating", should grouped together. after crea

google app engine - New deployment isn't reflected on custom domain -

i uploaded site few months ago , since deployed on custom domain: http://viamotion.viadialog.com.br/ today, wanted update site , new version deployed on http://viamotion-br.appspot.com/ custom domain still shows previous version. why? in case, i'm not talking dns propagation since nothing has changed @ dns setup level. going old gae admin console (for reason, couldn't find menu in new one), no domain listed in domain setup. don't remember process went through when assigning site custom domain i'm pretty sure should have been in section (and cname points ghs.googlehosted.com.). tried add domain (again) once google apps admin console , see domain viadialog.com.br verified (as additional domain of main google apps account), have no option "push" gae. thanks this answer might related procedure used before: https://support.google.com/a/answer/91077 . check particular gae app mappings via google apps: in google apps admin console ( https://

web services - How to develop a simple database based project -

i want start information provider service. works way: employees find information needed , fill database manually. users request data need on client side apps on own platforms. of project specifications follows: 1) data go between database server , clients small(suppose ordinary images). 2) client side apps don't need kept updated. once user of app clicks update button(for example) app request server send required information. 3)it's important run client side apps on several platforms like: windows, windows phone, android, ios,... 4) database doesn't need vary fast or vary big. note: , it's important note i'm not expert , have limitations. know java , html, css, javascript. think enough project. (am right?) so decided design development architecture: 1)using hibernate , provide layer server stands above hibernate , used database-specific tasks. layer provides protocols client side apps communicate server. enables me change database later without changing clie

Where would I find the css bootstrap after installing it via the composer? -

i new composer. trying add css booststrap tp laravel 5.1 project to download framework command used composer require twbs/bootstrap but can't find css files in laravel project. is there step need make css booststrap part of project? maybe has changed since laravel 5.0, bootstrap included default in default app.blade.php view. that may you, if want css files local, check in /vendor directory or public/css one.

html5 - Adding schema.org tags to a site's header: how and which schema? -

i have website provides transportation services, not products (with mean don't sell widgets of brand, other model...; provide 1 kind of transportation service). i'm bit unclear how should add schema.org microdata site, looked @ ryanair doing (since our product resembles theirs) , copied markup (changing our company's name, obviously). markup such: <meta content="ie=edge" http-equiv="x-ua-compatible"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="#22356b" name="theme-color"/> <meta content="book cheap flights direct @ official ryanair website europe's lowest fares. allocated seating , more available online" name="description"/> <meta content="summary" name="twitter:card"/> <meta content="@ryanair" name="twitter:site"/> <meta content="cheap flights | cheap flights e

xcode - React Native project initial compilation error -

i created new react native project , ran in xcode. following error in terminal , can't figure how fix: error eacces, permission denied '/users/andrey.pokrovskiy/.babel.json' {"errno":3,"code":"eacces","path":"/users/andrey.pokrovskiy/.babel.json","syscall":"open"} error: eacces, permission denied '/users/andrey.pokrovskiy/.babel.json' @ object.fs.opensync (evalmachine.:438:18) @ object.fs.writefilesync (evalmachine.:977:15) @ save (/users/andrey.pokrovskiy/desktop/lab/newiosapp/node_modules/react-native/node_modules/babel-core/lib/api/register/cache.js:35:19) @ process._tickcallback (node.js:419:13) @ function.module.runmain (module.js:499:11) @ startup (node.js:119:16) @ node.js:906:3 i've tried chown file , looked solution no luck. meanwhile xcode throws apple mach-o linker error 25 errors inside. never worked xcode have no clue means. seemingly easy installation turned nightmare

c++ - Strange error with cuda::reprojectImageTo3D and OpenCV 3.0 -

hello trying mat xyz cordenates disparity map have generated cuda::stereobm object, screenshot of disparity map created "disparity map" when add function cuda::reprojectimageto3d(d_disp,d_xyz,d_q,3,stream); error can't understand, if coment line of code no error shown moment try use function next error window and error code is: opencv error: function/feature not implemented (you should explicitly call download method cuda::gpumat object) in cv::_inputarray::getmat_, file c:\opencv\sources\modules\core\src\matrix.cpp, line 1211 bellow code, note of mats declared global , declarations not in slot function void mainwindow::on_botonmostrardispsgbmcuda_clicked() { if(map_l1.empty()&&map_l2.empty()&&map_r1.empty() &&map_r2.empty()){ filestorage fs(xmlname,filestorage::read); fs["map_l1"]>>map_l1; fs["map_l2"]>>map_l2; fs["map_r1"]>>map_r1; fs["

Strange python syntax, or in print statement -

i can't find this, i'm forced ask here. i'm sure it's easy question knows python well. python 2: print raw_input() == 0 or hash(tuple(map(int, raw_input().split(' ')))) python 3: print(input()==0 or hash(tuple(map(int,input().strip().split())))) i trying understand why 'or' in print statement. code in question has boolean operator inside print statement, comparing boolean , int. need explained me. specific python. code print in case input()==0 returns true? how can compare boolean , hash, , again, doing making boolean comparisons inside print statement? in python, comparisons or or and make use of 2 features: truthy , falsey values , and short-circuiting . so, when have this: print(input()==0 or hash(tuple(map(int,input().strip().split())))) it'll follow order of operations, checking whether input() returns 0 . since it's or next term, if it's true next term has no impact on result , won't evaluated.

jmeter json path bean post processor -

i have following entries got extracted response using jsonpath extractor entries = ["e-1553","e-1552","c-1052","e-1551","c-1050", "e-1550","c-1049","e-1549","c-1051","e-1548", "c-1048","e-1547","c-1047","e-1546","c-1045", "e-1545","e-1544","c-1046","e-1543","e-1542", "c-1026","e-1541","e-1540","e-1539","e-1538", "c-1025","e-1537","e-1536","c-1024","f-1535", "f-1534"] i want iterate on entries start " e- " e.g. " e-1553,e-1552" etc. in foreach controller , exclude other entries such "c-1052, c-1050" etc. so can use http://somesite.com/e-1553 etc. how do that? give

Elasticsearch: transform date with groovy script -

i have following (simplified) mapping: { "event_date": { "_source": { "enabled": true }, "_all": { "enabled": true }, "dynamic": "strict", "properties": { "start_date_time": { "type": "date", "format": "dateoptionaltime" }, "start_date_day": { "type": "date", "format": "dateoptionaltime", "index": "not_analyzed" } } } } the indexed objects this: { "start_date_time": "2017-05-08t18:23:45+0200" } the property start_date_day should contain same date, time set 00:00:00. in example above start_date_day must "2017-05-08t00:00:00+0200". i think,it possible achieve transform mapping , groovy script, developed groovy code did not work in elasticsearch-context , no

python - Changing Path windows for nmap -

code: import nmap nscan = nmap.portscanner() error: 'nmap program not found in path. path : c:\python27' i changed path in environmental variables , program still unable find it. suggestions? language python os windows 7

rest - What's wrong with this Last.fm geo.getEvents API query? -

i'm attempting use geo.getevents method in last.fm's web services, can read here: http://www.last.fm/api/show/geo.getevents i'm attempting use this: http://ws.audioscrobbler.com/2.0/?method=geo.getevents&lat=40.7903&long=73.9597&api_key=0382f639e72b14c9265d41993d28a110&format=json those latitude , longitude coordinates new york city. however, responses saying there not events there. if add distance parameter, says same thing. if round coordinates integers. is there wrong queries, or service messed up? thanks. new york 73 deg. west , need use negative value longitude, , url should be: http://ws.audioscrobbler.com/2.0/?method=geo.getevents&lat=40.7903&long=-73.9597&api_key=0382f639e72b14c9265d41993d28a110&format=json

asp.net mvc - How to use Flux and event emitter with .net MVC? -

i trying learn flux pattern. i learned use react .net mvc , rendered server side. i learn flux tutorials use node js. i don't use node. i don't know how implement event emitter part because uses node function. https://www.codementor.io/reactjs/tutorial/react-js-flux-architecture-tutorial about 1/3 of way down: "event emitter – event emitter responsible notifying subscribers after store has completed data action. conversely, needs able register observers specific events. we’re going using node’s event emitter in todo application." given flux pattern, there can use .net mvc, in absence of node, handle event emitter part? thoughts appreciated, thanks. you can use .net delegates, documented here https://msdn.microsoft.com/en-us/library/edzehd2t%28v=vs.110%29.aspx delegates multicast, means can hold references more 1 event-handling method. this of course server-side implementation of flux pattern.

objective c - swift adding zoom to container view -

i have page view controller embedded inside container view in order swipe between images. trying add touch make image go full screen "lightbox" zoom available , swipe through images while in full screen mode. i can work, , messing around auto layout seems work consider have lot of other stuff in vc. so know image slider github written in swift? - without need of cocopods. thanks! it's easy enough write 1 yourself. in full-screen mode, use uipageviewcontroller , because has swipe left & right support built in.

java - Persist Object with Hibernate in OneToMany -

i have problem hibernate casscade. i'm trying persist set of document. data model following: corpus 1 --- n document 1 --- n textblock n --- 1 speaker n --- 1 party my scenario following: speakerfacade sf = new speakerfacade(); textblockfacade tf = new textblockfacade(); corpus corpus = new corpus(); document doc1 = new document(corpus); textblock tb1 = new textblock(new speaker("david", "müller", new party("asdf")), "tb1", doc1); tf.createtextblock(tb1); textblock tb2 = new textblock(new speaker("benedikt", "müller", new party("jklÖ")), "tb2", doc1); tf.createtextblock(tb2); textblock tb3 = new textblock(sf.findpersonbyid(1), "tb3", doc1); tf.createtextblock(tb3); so in first block create new textblock. cascade rest should created too. in second block create textblock within same document. in last block create antoher textblock same speaker. getting following exception

c# - How to pause for loop when pause button is clicked? -

when run program , try click pause button, nothing happens. not sure how can work exactly. have bool variable called pause , pause set false. once pause button clicked should set variable true. loop checks , should display message user. appreciated! namespace practice2 { public partial class form1 : form { photocopier printer = new photocopier(500, 2500); bool pause = false; public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { } private void btnstart_click(object sender, eventargs e) { if (checktext(txtnumbercopies.text) == true) { int numbercopies = convert.toint32(txtnumbercopies.text); int toner = convert.toint32(lbltoneramount.text); int papercapacity = convert.toint32(lblpaperamount.text); if (toner <= 625 && papercapacity <= 125) { txtmessage.text = "printer low on

jquery - If statement to move HTML element -

i have search bar can't recreate. can moved. can move statement: $('#containertbright').insertbefore('search2'); the problem need statement work on every other page , 1 below work on links. $('#containertbright').insertbefore('search2'); i created if statement reason not getting desired result. right way this? if (window.location.href == 'http://support.com/support/default.asp' || window.location.href == 'http://support.com/support/default.asp?pg=pgoldmainmenu' || window.location.href == 'http://support.com/support/default.asp#') { $('#containertbright').insertbefore('search1'); } else { $('#containertbright').insertbefore('search2'); } you can add class page need execute else block , write if condition follows. assuming add class exception body tag of page. if ($('body').hasclass('exception')) { $('#containertbright').in

python - Error while trying to migrate database (slalchemy, slqite3) -

i have next models.py file: from app import db, bcrypt sqlalchemy import foreignkey sqlalchemy.orm import relationship class blogpost(db.model): __tablename__ = "posts" id = db.column(db.integer, primary_key=true) title = db.column(db.string, nullable=false) desc = db.column(db.string, nullable=false) author_id = db.column(db.integer, foreignkey('users.id')) def __init__(self, title, desc): self.title = title self.desc = desc def __repr__(self): return "titulo >> " + self.title class user(db.model): __tablename__ = 'users' id = db.column(db.integer, primary_key=true) name = db.column(db.string, nullable=false) email = db.column(db.string, nullable=false) password = db.column(db.string, nullable=false) posts = relationship("blogpost", backref="author") def __init__(self, name, email, password): self.name = name self

recordset - VBA on click_ delete records of a table -

i trying delete records of table rather deleting records of form. have following code, not work: please can help. private sub cmd_x_click() dim db dao.database dim rs dao.recordset dim rscount integer dim bizno field dim bank_role field dim i, j integer set db = currentdb() set rs_date = db.openrecordset("trd_pricing-in date_real") set pe_id = rs_date.fields("pricing_element_id") rs_date.movelast rs_datecount = rs_date.recordcount msgbox (rs_datecount) msgbox (me.pricing_element_id) msgbox (pe_id.value) rs_date.movelast = 1 rs_datecount if me!pricing_element_id = pe_id rs_date.delete else rs_date.moveprevious end if next end sub in loop not comparing right elements. when do: set pe_id = rs_date.fields("pricing_element_id") you set pe_id value of pricing_element_id of first record. intend set reference it, , everytime recordset advances next record, want reference updated. that's not how works. have

Extracting words from text using python regex -

i have text (string) , want perform task in python : i perform countvectorizer method in order make bag of words. may find method here: http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.countvectorizer.html this method includes stopwords removal , works fine. removes punctuation , break every word. besides words returns lots of trash single letters , numbers. this method though, has 1 parameter called "token_pattern" takes string (regex) can give me better results. what want is: a) exlude words start, end or include numbers. b) exclude numbers text c) exclude any words <= 2 letters b) exclude http pages for example, regex should give me this: text = "it can dangerous take fido ride: http://t.co/er2wfanzbi http://t.co/rf3bhpnpwr ',each year, on average, 20 billion empty miles incurred trucks, costs economy billions" final_text = "can dangerous take fido ride each year average billion empty miles incur

c++ - QString, Parse and replace some specific sections -

suppose have string this: qstring str = "23+34-343+$t$-3+$opc$"; i want replace every sections enclosed 2 $ replaced %0, %1 , on. above example : "23+34-343+%0-3+%1" i can detect sections using qregularexpression , pattern: "\$.+?\$" what best , optimized way (not use loops , indices) replace sections %0, %1, %2 , on. how this: qstring str = "23+34-343+$t$-3+$opc$"; qregexp rx; rx.setminimal(true); rx.setpattern("\\$.+\\$"); str.replace(rx, "x"); //first replace every pattern 'x' for(int i=0 ;str.indexof("x")!=-1; i++) str.replace(str.indexof("x"), 1,"%"+qstring::number(i));

ios - How to create a timer (chrono) with NSDateFormatter? -

this regular timer (chrono) minutes , seconds. works fine there way have same result nsdateformatter. var min = 0 var sec = 0 func stringfromtimeinterval(interval: nstimeinterval) -> string { let interval = int(interval) let seconds = interval % 60 let minutes = (interval / 60) return string(format: "%2d:%02d",minutes, seconds) } func updatetimer(){ sec++ self.timeelapsed.text = self.stringfromtimeinterval(double(sec)) } here attempt : var sec = 0 func thetime(interval:nstimeinterval) -> string { var dateformatter = nsdateformatter() var date = nsdate(timeintervalsince1970: nstimeinterval()) dateformatter.dateformat = "mm:ss" return dateformatter.stringfromdate(date) } func updatethetime(){ sec++ self.newtimer.text = self.thetime(double(sec)) } i'm doing wrong because 00:00. how can make work? you can use nsdate , nsdateformatter time string. create object of nsdateformatte

selenium webdriver - How to get the current URL in Robot framework? -

when 'apply' link clicked, opens new browser in robot framework. how current url of page? here code: open server set browser implicit wait 60 go ${server}/jobs element should visible xpath=.//*[@id='txtjobsearch'] input text xpath=.//*[@id='txtjobsearch'] ${job title search} element should contain xpath=(.//*[@class='clearfix tit-job']/div)[1] ${job title} element should visible xpath=(.//*[@class='btn btn-sm btn-primary btnapply'])[1] click element xpath=(.//*[@class='btn btn-sm btn-primary btnapply'])[1] after line, opens new window. how url of newly opened page , actions input text? set browser implicit wait 20 wait until page contains element xpath=.//*[@class='text-primary'] have tried using select window keyword? http://rtomac.github.io/robotframework-selenium2library/doc/selenium2library.html#select%20window click link popup_link # opens new window selec

java - Is there a way to get the captions in Vaadin to appear on the left side without using FormLayout? -

Image
is there way captions in vaadin appear on left side without using formlayout ? bolded because i'm trying avoid being first answer. understand formlayout offers ability in cases need use gridlayout able have 2 columns of data (for example firstname , lastname, start date , end date, , on). there no easy way it, because every layout generates appropriate space components inside them. can change order of caption , corresponding component inside "box" generated layout using simple css rules hard dynamically determine size of box - thats layouts do. demonstrate in following image: as can see, able swap order of caption , textfield using css: #your-id .v-caption { position: relative !important; top: 10px !important; } #your-id .your-component { top: 0px !important; left: 0px !important; position: absolute !important; } and code gridlayout l = new gridlayout(2,2); l.addstylename("your-id"); for(int i=0; i<4; i++){

c# - ASP.Net MVC IdentityServer3 broke my webapi routing -

so implementing security on project working on , followed guide identityserver3 add mvc5 application. got through complete setup , thought good, until realized routes in api, unless basic ones, /api/.../ no longer work. config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}/{id}", defaults: new { id = routeparameter.optional } ); i using default routing, , on various pieces of api controllers have put route attributes guide them in event fall outside of format. example: [route("api/location/getbyareaincludefilestore/{id}")] public ienumerable<location> getlocationsbyareaidincludefilestore(int id) { if (id <= 0) { return null; } ienumerable<location> locations = _lookupservice.getlocationsbyareaidincludesfilestore(id); return locations; } and said earlier, prior adding identity server th

ios - Hide only the Navigation Bar when scrolling like Instagram iOS8 -

in app trying hide uitableviewcontroller 's navigation bar when scrolling. have tried using self.navigationcontroller.hidesbarsonswipe = yes; adds strange bottom blank space , hides background of uistatusbar . to, when scrolling down, hide navbar, , when scrolling little, make navbar re-appear. behavior im looking instagram's feed, hides navbar when scrolling. could guide me how achieve simple code , not involve github project or external source of kind. customize performance needs. thanks. register view controller uiscrollviewdelegate example. - (void)scrollviewdidscroll:(uiscrollview *)scrollview; - (void)scrollviewdidenddecelerating:(uiscrollview *)scrollview; - (void)scrollviewdidenddragging:(uiscrollview *)scrollview willdecelerate (bool)decelerate; from within de uiscrollviewdelegate methods can new contentoffset , translate uinavigationbar or down accordingly. setting alpha of subviews can done based on threshold values , factors can set , compute.