Posts

Showing posts from June, 2013

ios - UIScrollView with UITableView not scrollable -

ios - UIScrollView with UITableView not scrollable - my app (xamarin/monotouch iphone) consists of 3 uitableview add together uiscrollview (all done programtically) each of tables not scrollable mytableview.scrollenabled = false; i calculate height needed x number of items , set in runtime. mytableview.frame = new rectanglef (0, 27, 320, mytableviewheight); the problem uiscrollview not scrollable: int caclulatescrollviewheight = mylistheight + olistheight + 104; scrollview.contentsize = new sizef (320, caclulatescrollviewheight); scrollview.frame = new rectanglef (0, 135, 320, caclulatescrollviewheight); scrollview.delayscontenttouches = true; scrollview.cancancelcontenttouches = false; this.view.add (scrollview); any thought can cause that? don't set scrollview frame height same calculated view height. frame box on screen want occupy; you'll want maintain less or equal screen size. if content size matches frame size, won't scroll (because...

ORACLE SQL Joining tables based on different time based events -

ORACLE SQL Joining tables based on different time based events - i have 2 tables: processor_event(id, time, machine, name, state) comm_event(id, time, machine, name, type) i want retrieve difference between processor_event.time , next comm_event in time before next processor_event.time. i.e. first comm_event event after processor_event occurs before next processor_event. example data: processor_event(id, time, machine, name, state) 1, 01:00:00, trx4, ignition, heated 2, 01:00:03, trx1, movement, triangulating 3, 01:00:23, trx4, movement, heated 4, 01:00:32, trx4, direction change, stable 5, 01:00:56, trx4, stopping, heated comm_event(id, time, machine, name, type) 1, 01:00:02, trx4, direction request, request 2, 01:00:15, trx4, direction acknowledgement, acknowledgement 3, 01:00:16, trx1, position change, command 4, 01:00:34, trx4, direction request, request 5, 01:01:02, trx4, position change, command expected return: processor_event.time, processor_event.mac...

shell - How to disable creating a new python IDLE session when compiling through Notepad++? -

shell - How to disable creating a new python IDLE session when compiling through Notepad++? - when i'm compiling python through notepad++ new python shell ( idle ) everytime, rather maintain 1 fixed window, instead of new window on position. so example, when write script prints "hello world!" , compile python shell displays text, , when modify script "goodbye world!" same shell prints text. or that shell gets closed, @ same position new shell emerges new text. could please help me i'm having hard time figuring out.. many in advance! you might have noticed, python source code not require compilation run. python source-code rather beeing interpreted on-the-fly, language "engine". your issue related notepad++ settings , o/s settings. idle program, has typically been set in o/s associated-application set of filename-extensions ( .py , etc ) if notepad++ compile not phone call o/s "launch" file, problem ceases exi...

Eclipse luna crashed (Eclipse IDE closed abrubtly) during Eclipse Marketplace loading -

Eclipse luna crashed (Eclipse IDE closed abrubtly) during Eclipse Marketplace loading - i installed jdk-1.8_20 , eclipse luna in linux mint 16. when clicked eclipse marketplace form menu, eclipse luna crashed (eclipse ide closed abrubtly). checked next answers answers not matched scenarios: eclipse marketplace hangs (luna, java8) market place not working in eclipse luna is possible resolve issue? update: have added log /workspace/.metadata/.log file: !entry org.eclipse.core.resources 2 10035 2014-10-13 20:32:16.558 !message workspace exited unsaved changes in previous session; refreshing workspace recover changes. !entry org.eclipse.m2e.logback.configuration 2 0 2014-10-13 20:32:17.080 !message exception while setting logging:org.eclipse.osgi.internal.framework.equinoxconfiguration$1 cannot cast java.lang.string !stack 0 java.lang.classcastexception: org.eclipse.osgi.internal.framework.equinoxconfiguration$1 cannot cast java.lang.string @ org.eclipse.m2e.logback....

layout - CSS: Why block element wrap around floating element -

layout - CSS: Why block element wrap around floating element - see illustration @ http://jsfiddle.net/w1xhpp2c/. don't understand why div.b wrapped around float element. thought inline element wrap float elements, while block elements not. .wrap{ width: 500px; } .a{ float: left; width: 200px; } .b{ background-color:#eee; width:500px; } <div class="wrap"> <div class="a"> a<br/> a<br/> </div> <div class="b"> b<br/> b<br/> b<br/> </div> </div> block boxes flow under floating elements. css 2.1 spec says since float not in flow, non-positioned block boxes created before , after float box flow vertically if float didn’t exist css layout

c++ - Ubuntu Shared Memory Between 2 Processes, Code Not Working -

c++ - Ubuntu Shared Memory Between 2 Processes, Code Not Working - i'm writing 2 processes separately should interact through shared memory , can't spot i'm going wrong. first process has created shared memory , if reprogrammed, can read shared memory too. however, sec output programme can't seem read @ all. utilize shmget in both programs create memory, bring together it. insert char array namearray input program, output should read shared memory , cout name. any help appreciated, code below :) input: #include <iostream> #include <sys/types.h> #include <sys/shm.h> #include <sys/ipc.h> #define shm_key 982 using namespace std; main() { int shmid; char namearray[] = "bill gates"; unsigned length = sizeof(namearray)/sizeof(namearray[0]); shmid=shmget(shm_key,256,0777|ipc_creat); if(shmid!=(-1)) /*error checking measure ensure shared memory creation successful*/ { char * ptr=(char *)sh...

javascript - Gulp does't copy all files as expected -

javascript - Gulp does't copy all files as expected - i tried create gulpfile.js personal website project. i've never done before little 'trial , error' works in acceptable way. the thing doesn't work after 1000 modifications simple copying files , folders. var files = { data_src : [ './files.json', 'data/**/*.*' ], distribution_dest : '_distribution' }; gulp.task('copy-data', function() { gulp.src(files.data_src, { base: './' }) .pipe(gulp.dest(files.distribution_dest)) .pipe(notify({message: 'data copied distribution!'})); }); this should re-create sub-folders , files gulp.dest . copies half of them, folders ignored if alter names etc. (no special characters, same subfolder construction 1 time got copied correctly ...) - nil worked. can't see pattern in this. there no error message while running gulp. nil help me find error. why folders or files excluded copying? ...

javascript - how to open new Web page with that Row details when click that Row's Link button inside the Kendo UI Grid Field in Asp? -

javascript - how to open new Web page with that Row details when click that Row's Link button inside the Kendo UI Grid Field in Asp? - i searched on google, didnt requirement, screen if click scheme name means want display row details in web page how it? code like' var grid= $("#divgrid").kendogrid( { datasource: datasource4, scrollable: true, sortable: true, filterable: false, reorderable: true, resizable: true, pageable: true, toolbar: [ { text : "add new record", name: "popup", iconclass: "k-icon k-add"} ], editable : { mode : "inline" // template: kendo.template($("#custompopuptemplate").html()) }, navigable: true, columns: ...

xcode6 - Getting strange error on iTunes Connect - ITC.halliday.error.unavailble with Xcode 6 iOS 8.1SDK -

xcode6 - Getting strange error on iTunes Connect - ITC.halliday.error.unavailble with Xcode 6 iOS 8.1SDK - i'm trying upload new build via xcode 6 itunes connect release, , see few errors, might related. the build validates successfully, when seek submit error: when check out prelease section on itunes connect, see unusual error "itc.halliday.error.unavailble" are these related? help. update: apple seems have fixed on end. able submit successfully. "itc.halliday.error.unavailble" message disappeared. xcode6 ios8.1

laravel - Webapp on Citrix and sessions issue -

laravel - Webapp on Citrix and sessions issue - does know sessions mix ups when webapp running through citrix client. we experience issues users beingness mixed when our laravel application accessed through citrix client. the sessions stored files currently. session laravel citrix

java - Using a JDialog as input -

java - Using a JDialog as input - i trying utilize jdialog input string . text before click button. this dialog: public class addmemberdialog extends jdialog { private jtextfield name; public addmemberdialog() { super(new jframe("add member"), "add member"); this.setdefaultcloseoperation(jdialog.hide_on_close); this.setminimumsize(new dimension(500, 500)); this.name = new jtextfield(); jbutton add together = new jbutton("add"); add.addactionlistener(new actionlistener() { public void actionperformed(actionevent arg0) { close(); } }); this.setlayout(new gridlayout(2, 1, 5, 5)); this.add(name); this.add(add); this.pack(); } private void close(){ this.dispose(); } public string getname(){ homecoming this.name.gettext(); } } and here using string : addmemberdialog input =...

algorithm - Distribute list elements between two lists equitatively -

algorithm - Distribute list elements between two lists equitatively - i have list 'n' elements (lets 10 ie), want distribute elements 2 lists, each 1 balanced other criteria, evaluating valour of each element. ie output should 2 lists 5 elements aproximately balanced each other. thanks time. you employ greedy strategy (i'm not give "optimal" results, should give relatively results @ least). start finding total value of elements in list, v. goal create 2 lists each value half amount (ideally close 1/2*v possible). start 3 lists, list_original, list_1, list_2. pull off items list_original (starting largest, working way downwards smallest) , set them list_1 if , if adding them list_1 doesn't cause total value of list_1 exceed 1/2*v. else goes list_2. the result list_1 @ 1/2*v , list_2 @ to the lowest degree 1/2*v. in event subset of items sums 1/2*v might equality. haven't tried prove/disprove yet. depending on how close balanced ...

mysql - PHP pass variable value form one php to another php -

mysql - PHP pass variable value form one php to another php - i new php code, know how pass multiple variable info 1 php file php file. below detailed description. in first file (file1) have assigned query value want read in sec file( file 2). please help. below code file 1: $query = "select * table1 field1 = 'abc' , feild2='xyz'"; $query1 = "select * table2 field1= 'abc' , feild2='xyz'"; $query2 = "select * table3 field1= 'abc' , feild2='xyz'"; <a target="_blank" href='file2.php' >firstquery</a> <a target="_blank" href='file2.php' >seconquery</a> <a target="_blank" href='file2.php' >thirdquery</a> file2: echo $query; echo $query1; echo $query2; you need utilize parameters in links if understanding question correctly. not however, want pass entire query or save query session. instead want...

javascript - Changing an element with js toggle -

javascript - Changing an element with js toggle - i made function, when click on link 'play', div black background changes iframe video. seems working fine. problem is, want add together multiple play links multiple videos. don't know how it, when click on sec play link, video changes first video sec in same place. my code: <script> var toggle = function() { var mydiv = document.getelementbyid('videoholder');document.getelementbyid("frame").src="http://www.youtube.com/embed/yuobzwf0aws"; if (mydiv.style.display === 'block' || mydiv.style.display === '') mydiv.style.display = 'none'; else mydiv.style.display = 'block' } </script> <a href="javascript:void(0)" onclick="toggle();">play</a><br> <div style="width:560px; height:315px; background-color:#111111;"> <div id="videoholder...

cloud9 ide - Autocomplete on module object -

cloud9 ide - Autocomplete on module object - intellisense suggestion list doesn't include properties , methods imported module object, unless utilize them 1 time in importing module. if it's supposed behaviour, cloud9 team have future plan improvement? cloud9-ide

javascript - Scrollbar on parent window is missing when fancybox is open -

javascript - Scrollbar on parent window is missing when fancybox is open - i loading ajax response in fancybox. moment fancybox opens, scrollbar on parent window disappears. not sure if default behavior of fancybox. scrollbar not seen until close fancybox. want see scrollbar on parent window. please allow me know if missing in fancybox code. thanks! j.fancybox({ content : fb, autosize : false, scrolling : 'no', padding : 0, autoresize : false, autoheight : false, autowidth : false, closebtn : false, beforeload : function() { this.width = document.getelementbyid("jqi").offsetwidth; this.height = document.getelementbyid("jqi").offsetheight; this.minwidth = document.getelementbyid("jqi").offsetwidth; this.minheight = document.getelementbyid("jqi").offsetheight; } }); javascript jquery html scrollbar fancybox-2

asp.net - Javascript to verify specific String from textbox -

asp.net - Javascript to verify specific String from textbox - here textbox result looks like, please add together next dns entries 144.68.238.87 name.domain 144.68.238.88 name.domain 144.68.238.89 name.domain the goal validate name.domain making sure user replace name.domain server name on textbox before submit it. if user doesn't replace name.domain server name, send alert message , homecoming false until user replace correctly. here codes, function domainvalidate() { var arrayoflines = document.getelementbyid('txt').value.split('/n'); arrayoflines.shift(); //use shift skip first line (i = 0; < arrayoflines.length; i++) { //somewhere here need split name.domain , verify var domainname = arrayoflines[i].split(" ", 2); if(domainname.equals("name.domain") { alert("you must replace name.domain new server name"); ...

css3 - Is there a way to display a dropdown menu inside/on top of the parent body in pure CSS -

css3 - Is there a way to display a dropdown menu inside/on top of the parent body in pure CSS - i'm looking create dropdown menu shows inside/on top of parent menu. in pure css. have made quick illustration of looking for(in photoshop). here link. here have now, makes normal dropdown menu , not 1 stays in parent container. css: .titlebox ul { text-align: center; font-size: 15px; font-family: arial,sans-serif; line-height: 32px; margin: 0; width: 100%; background: #555; list-style: none; border-radius: 2px !important; transition: 0.15s ease; } .titlebox ul:hover {background: #666;} .titlebox ul:active {background: #444;} .titlebox ul li { display: block; color: #fff; position: rela...

javascript - Java Script Regular expression for number format not working -

javascript - Java Script Regular expression for number format not working - i want input user 888-999-6666..i.e. 3 numbers '-' 3 numbers 1 time again '-' , 4 numbers. using next regular look in javascript. var num1=/^[0-9]{3}+-[0-9]{3}+-[0-9]{3}$/; if(!(form.num.value.match(num1))) { alert("number cannot left empty"); homecoming false; } but not working. if utilize var num1=/^[0-9]+-[0-9]+-[0-9]$/; wants @ to the lowest degree 2 '-' no restriction on numbers. how can re requirement? , why above code not working? remove + symbol nowadays after repetition quantifier {} . , replace [0-9]{3} @ lastly [0-9]{4} , allow 4 digits after lastly - symbol. var num1=/^[0-9]{3}-[0-9]{3}-[0-9]{4}$/; demo you write [0-9] \d . javascript regex

Browser update to a file without a web server -

Browser update to a file without a web server - i need create browser based user interface update xml file. possible without total blown web server? i read php in-built web-server wasn't clear whether suit requirement. help appreciated. yes, can this, using simplexml, php. easy , clear. need documented. see: http://php.net/manual/en/book.simplexml.php http://www.w3schools.com/php/php_xml_simplexml_read.asp http://php.net/manual/en/book.xml.php http://www.w3schools.com/php/php_ref_xml.asp web browser

Excel powerpivot data drill down using filtered data -

Excel powerpivot data drill down using filtered data - i created powerpivot info model current sales orders. have 6 columns @ end of dataset indicate attribute of order (example - if order has ship date, have 1 in shipped column). created pivot table summarizes orders attribute, , numbers correct, when drill of cells, see records attribute flag assigned. so, if summarizing shipped orders, want see lines 1 in shipped column. drill downwards returns lines. know if there function exclude rows criteria drill downwards results? tried calculate filter of [table].shipped=1, didn't exclude lines without 1. summed lines 1. excel powerpivot drilldown

java - Comparing two arraylists unequal sizes - heap issue post comparison -

java - Comparing two arraylists unequal sizes - heap issue post comparison - i comparing 2 arraylist<string> average size of list one, 50k , , list two, 200k . int size = mssqllist.size(); (int index = 0; index < size; index++) { if (!oraclesqllist.contains(mssqllist.get(index))) { logger.debug(" *[possible miss]* oracle missing record id: " + (mssqllist.get(index))); } } the list have info in string 16 chararcters, i.e. a89eerdd12312445 etc... running collection.sort(list) on both before entering above loop. the average comparing times close 160 seconds. best approach or can much better? question 2: results have guessed beingness fetched db, 5 day interval. ideally can 1.1 1000000 records if take 30 days interval. old array list implementation throwing outofmemory due load. so quick follow question can force load 1.1 1000000 ,30 day interval ? your biggest problem...

Weird behavior with C's file IO -

Weird behavior with C's file IO - i've been writing virtual machine, , i've noticed unusual things have happened, though wrote function ages ago. anyhow, virtual machine reads file this: 0002 000a 0001 0004 0000 however, when don't have whitespace after 0000 or new line... crashes. weird thing, leads me believe it's not file loading, when remove 0000 file, , whitespace... works?! i've tried running through gdb, works -- apparently called heisenbug or something. think it's due way files loaded, can see in this function here on github, or read snippet below. void load_program(vm *self) { file *file = fopen("testing.ayy", "r"); if (file != null) { if (fseek(file, 0, seek_end) == 0) { long file_size = ftell(file); if (file_size == -1) { perror("could not read filesize\n"); exit(1); } self->source = malloc(sizeof(char) ...

c++ - Switch statement issue -

c++ - Switch statement issue - i've made modifications , i'm having issue switch statement. functions supposed read random access files. when run program, displays menu , when take alternative outputs first alternative choose. if take option, doesn't output letters. how can prepare this? //random-access files programme //this programme reads file beg end, end beg, beg 4th position, //8th 15th position, end 21st position, , 22nd position end #include <iostream> #include <fstream> using namespace std; void begtoend(fstream &, char); void endtobeg(fstream &, char); void begto4th(fstream &, char); void eighthto15th(fstream &, char); void endto21st(fstream &, char); void twenty2ndtoend(fstream &, char); int main() { char letters; //holds character int choice; fstream file("alphabet.txt", ios::in | ios::binary); //this opens file { cout << "enter 1 read origin end" ...

objective c - code sign error in iOS8 using ldid script -

objective c - code sign error in iOS8 using ldid script - i have developed app jailbreak iphone5s running ios 8.1.when tried sign app using ldid script not error in terminal.when pushed app iphone , viewed console see next error: nov 10 17:27:51 iphone installd[63] <error>: 0x581000 -[miexecutablebundle needsdatacontainer]: code signature not verified don't have entitlements non-user app, means can't determine if needs container. nov 10 17:27:52 iphone installd[63] <error>: 0x581000 -[micodesigningverifier performvalidationwitherror:]: 186: failed verify code signature of <miexecutablebundle : path = /applications/testapp.app identifier = com.bundle.s.testapp type = 1> : 0xe800801c (code not signed) nov 10 17:27:52 installd[63] <error>: 0x581000 +[milaunchservicesdatabasegatherer entryforbundle:incontainer:witherror:]: failed validate code signing app file:///applications/testapp.app/ : error domain=miinstallererrordomain code=13 "failed v...

embedded - generate sound in assembly for IC 2051 -

embedded - generate sound in assembly for IC 2051 - 1) iphone developer need little work on assembly, have code in assembly language generate sound (suppose beep sound) 2) have convert .asm file .hex file , write programming ic 2051 after have connect hardware (i have) generate sound i stuck first part, help highly appreciated stuck in since weeks following sample code section .text global _start ;must declared using gcc _start: ;tell linker entry point mov edx, len ;message length mov ecx, msg ;message write mov ebx, 1 ;file descriptor (stdout) mov eax, 4 ;system phone call number (sys_write) int 0x80 ;call kernel mov eax, 1 ;system phone call number (sys_exit) int 0x80 ;call kernel section .data mov dx,2000 ; number of times repeat whole routine. mov bx,1 ; frequency value. mov al, 10110110b ; magic number (u...

Ruby regex or string manipulation -

Ruby regex or string manipulation - i trying create rails app takes in rss feeds , displays news stories page. when summary article save string, summary every single story has lot of markup @ end unnecessary. example: the miami dolphins have suspended defensive lineman after allegedly touched women , took "aggressive fighting stance" when police force attempted arrest him, according probable cause affidavit.<div class="feedflare"> <a href="http://rss.cnn.com/~ff/rss/cnn_topstories?a=4w6duenqkry:kemjff3bscg:yil2auoc8za"><img src="http://feeds.feedburner.com/~ff/rss/cnn_topstories?d=yil2auoc8za" border="0"></img></a> <a href="http://rss.cnn.com/~ff/rss/cnn_topstories?a=4w6duenqkry:kemjff3bscg:7q72wntakba"><img src="http://feeds.feedburner.com/~ff/rss/cnn_topstories?d=7q72wntakba" border="0"></img></a> <a href="http://rss.cnn.com/~ff/rss/...

multithreading - Synchronise muti-threads in Python -

multithreading - Synchronise muti-threads in Python - the class brokenlinktest in code below following. takes web page url finds links in web page get headers of links concurrently (this done check if link broken or not) print 'completed' when headers received. from bs4 import beautifulsoup import requests class brokenlinktest(object): def __init__(self, url): self.url = url self.thread_count = 0 self.lock = threading.lock() def execute(self): soup = beautifulsoup(requests.get(self.url).text) self.lock.acquire() link in soup.find_all('a'): url = link.get('href') threading.thread(target=self._check_url(url)) self.lock.acquire() def _on_complete(self): self.thread_count -= 1 if self.thread_count == 0: #check if threads completed self.lock.release() print "completed" def _check_url(self, url): se...

javascript - Creating a new DOM element from an HTML string using built-in DOM methods or prototype -

javascript - Creating a new DOM element from an HTML string using built-in DOM methods or prototype - i'm trying create element dynamically using html string. here's simple illustration using both prototype , dom: // html string var s = '<li>text</li>'; // dom var el1 = document.createelement(s); // prototype var el2 = new element(s); $('mylist').appendchild(el1); $('mylist').appendchild(el2); both approaches insert empty listitem list. i know using prototype's element constructor requires tagname , optional attributes parameter, figured may allow me pass in html string too. however, msdn states "you can specify attributes within createelement method using html string method argument."... i'm not sure problem is. and yes, know in jquery, unfortunately we're not using jquery. overlooking simple here? should obvious, link msdn article regarding ie feature. generally next cross-browser trick ...

Java How to write a string in file as bytes and get string back -

Java How to write a string in file as bytes and get string back - i need write string in file bytes in utf-8 , these bytes file , convert string , consiquence same string. may sounds easy there hidden problem such wrong symbols in file. mean after appending in file must contain like: 00000008 d0bad0bb d18ed187 00000010 etc... but contains stuff that: mystring ---a lot of space--- (and symbol doesn't display here) so, have done? i've tried way: before code read this: maintain strings in hashmap < string, string > that's why code contains get(...) etc. try { fileoutputstream ostream = new fileoutputstream("filename.txt"); set<string> keyset = storage.keyset(); bytebuffer buffer = bytebuffer.allocate(1024); (string key : keyset) { byte[] keyinbyte = key.getbytes("utf-8"); byte[] valueinbyte = storage.get(key).getbytes("utf-8"); ostream....

objective c - Xcode iOS - Empty Array after XML parsing -

objective c - Xcode iOS - Empty Array after XML parsing - i despairing right now. i've app worked perfectly. stopped working no reason. after logging-in app doing html request sends xml answer. parse reply , receive array of location info (that display on map later on). the app working alright simulator , on device i've got on here. no reason doesn't work anymore (the xml isn't parsed correctly, there empty array) when upload .ipa file our company server , download there. does know problem? can help me? regards rob ios objective-c xcode xml-parsing

How to mark the start of the shell session from Vim? -

How to mark the start of the shell session from Vim? - when using vim-figitive shells out commands git push , on. every time opens shell see leftovers previous session, like: press come in or type command go on it sets me off every time because can't figure out if output current session or previous one. is there way mark sort of line every time shell out vim? in .zshrc think: if [ -n $vim ]; echo "----------------------------------------------------------------------------------" fi update works when run :sh , not when run commands vim-fugitive . there way intercept system() calls or whatever using? from @tpope: my recommendation disabling "alternate screen" terminal emulator (or terminal multiplexor). that's do. just add together next tmux.conf # tmux.conf # tmux , alternate-screen alternative defaults on set-window-option -g alternate-screen off shell vim vim-fugitive

php - How do I calculate and get the next latitude-longitude estimated by time between two points every 10 minutes having the start and end point? -

php - How do I calculate and get the next latitude-longitude estimated by time between two points every 10 minutes having the start and end point? - i need help have next 2 points on map point lat1/long1 , point b lat2/long2 in google map have distance, arrived_time, bearingradians , speed. with these info how can estimated latitude longitude (google map format) next point on 10 minutes,20,30 , 40 minutes ?, having start , end point. point lat1=37.78472 lon1=-122.39913 point b lat2=37.78240 lon2=-121.23208 bearingradians=270 distance=102 km arrive_time=50 minutes speed =122 km/h example: http://hmarina.sytes.net/mapagoogle.jpg what need calculate nexts points, going utilize php, or should start thank you there multiple ways calculate this. of them quite complex. you utilize vincenty's formula, used bearing , distance calculations. formula needs long/lat of starting point, bearing , distance. doubt, want reimplement algo, here go: implementing ...

python - getattr in current function -

python - getattr in current function - is there way variable of name in below? def save_info(self): name = 'hello' var1 = 'other item' var2 = 1 ... tv_series_fields_to_update = ['name', 'var2', 'var3', 'var4', ...] field in tv_series_fields_to_update: current_value = getattr_or_none(obj, field) new_value = # how variable of `name` ("hello") ? given string of variable name, how value within current function? use locals() : def save_info(): name = 'hello' var1 = 'other item' var2 = 1 tv_series_fields_to_update = ['name', 'var1', 'var2'] field in tv_series_fields_to_update: print field, locals()[field] save_info() however, i'd urge consider using explicit dictionary instead of having bunch of unrelated variables. python

sql - Unable to total number of words that appear in a table -

sql - Unable to total number of words that appear in a table - i'm having problem trying find total amount of times word appears in entire table. code counts number of times word appears in each row. how around issue? select comments, count(*) total ae comments '%&#39;%' grouping comments if anymore code please inquire :) will number enough? select count(comments) total ae comments '%&#39;%' sql

c++ - Dynamic array allocation during constructing object, invalid use of non-static variable -

c++ - Dynamic array allocation during constructing object, invalid use of non-static variable - class array { public: array(unsigned h, unsigned l, std::initializer_list<double>); .... private: unsigned length; double * array; ... }; array::array(unsigned l, std::initializer_list<double> il) : length(l) { array(new (std::nothrow) array[l]); if (!array) throw outofmem(); (auto el = il.begin(), int = 0; < length; i++) { if (el === il.end()) throw wrongdim(); array[i] = *el; el++; } } } it's justthe draft of original class have assignment. compiling results in error: invalid utilize of non-static info fellow member 'length' unsigned length; anyone got clue how prepare this? what about: int i=0; (auto &el : il) array[i++] = el; if (i!=l) throw wrongdim(); c++ arrays d...

c# - WP8.1 Live Tile with badge -

c# - WP8.1 Live Tile with badge - i've 2 questions regarding tilesquare71x71iconwithbadge/tilesquare150x150iconwithbadge/tilewide310x150iconwithbadgeandtext templates. why have set "image" attribute? provided logos (in visual assets in bundle manifest), why doesn't app grab icons there? where can find logo templates tiles? can't seem right using regular app logos. you don't need update tile set badge. if want default tile plus badge can update badge , leave tile alone. the *iconwithbadge tiles allow custom icons, why need set image. won't utilize app's default icon. example, phone app changes icon phone phone tape indicate presence of voice mail service messages. you can find descriptions of templates , illustration xml in tile template catalog. see details on sizing, padding, scaling, , transparency windows phone store apps c# xaml windows-phone-8.1

ruby on rails - ChartKick charts do not show when rendering to PDF using Wicked_PDF -

ruby on rails - ChartKick charts do not show when rendering to PDF using Wicked_PDF - i using rails 4, wicked_pdf , chartkick gem's google charts use: <%= javascript_include_tag "//www.google.com/jsapi", "chartkik" %> the html view comes charts , expected. when append .pdf url pdf document shows in browser chartkick charts not show. next error appears chart should be: error loading chart: no adapter found i have found next online in pdfkit documentation. resources aren't included in pdf: images, css, or javascript not seem downloading correctly in pdf. due fact wkhtmltopdf not know find files. create sure using absolute paths (start forwards slash) resources. if using pdfkit generate pdfs raw html source create sure utilize finish paths (either file paths or urls including domain). in restrictive server environments root_url configuration may looking alter asset host. i assuming wkhtmltopdf not find...

ios - Playing live streaming video apart from using MPMoviePlayerController -

ios - Playing live streaming video apart from using MPMoviePlayerController - i have issue (audio issue) playing live streaming video using mpmovieplayercontroller different reason my existing query related videocore [mpmovieplayercontroller alloc] initwithcontenturl:url] my question here is, there other approach can utilize playing live streaming video apart using mpmovieplayercontroller in ios? please suggest. thank you try playing avplayer here documentation apple it. here illustration apple provided it. is not simple mpmovieplayercontroller give more command on it. happy coding. ios objective-c live-streaming

nls - Fitting Generalized Nonlinear Model in R -

nls - Fitting Generalized Nonlinear Model in R - i want fit next generalized nonlinear model: probit(g)=k+1/sigma*(temp-t0)*time . naive model, created probits(g) qnorm(g) , fitted nonlinear model . want fit nonlinear model logit link similar glm function in r . highly appreciate if help me fit such generalized nonlinear model logit link in r . in advance help. data <- structure(list(temp = c(23l, 23l, 23l, 23l, 23l, 23l, 23l, 23l, 27l, 27l, 27l, 27l, 27l, 27l, 33l, 33l, 33l, 33l, 33l, 33l, 33l, 35l, 35l, 35l, 35l, 35l), time = c(144l, 168l, 192l, 216l, 240l, 264l, 288l, 312l, 120l, 144l, 168l, 192l, 216l, 240l, 72l, 96l, 120l, 144l, 168l, 192l, 216l, 96l, 120l, 144l, 168l, 192l), g = c(15, 25.5, 27, 28, 28.5, 39.5, 41.5, 43, 13, 21.5, 29.5, 30.5, 32.5, 35, 13.5, 28, 32.5, 33.5, 35, 39.5, 42, 6.5, 30, 39.5, 57, 58.5 )), .names = c("temp", "time", "g"), class = "data.frame", row.names = c(na, -26l)) data$germra...

rust - Why do slices in a structure require a lifetime, but not vectors? -

rust - Why do slices in a structure require a lifetime, but not vectors? - when define next structure: struct test<'a> { a: &'a [i64], b: vec<i64>, } both piece , vector contain pointer. why piece require lifetime, not vector? a vector owns elements. means vector responsible allocating , freeing elements points to. lifetime of vector's elements same lifetime of vector itself, there's no need specify lifetime vec type. a piece borrows elements of vector or array may allocated statically or dynamically. piece must indicate lifetime of borrowed elements compiler can create necessary safety checks. another way express comparing sequence of events between 2 options. for vector: a vec allocated. no storage allocated elements (when vec empty). as elements added vector, storage elements allocated heap. vec stores pointer storage. when vector dropped, storage elements first freed, vec freed. for slice: some stora...

Query regarding tsv file parsing in Python -

Query regarding tsv file parsing in Python - i have written python function going calculate distance between 2 points, using google api. function shown below: import urllib import json simplejson def calculatedistance(sourcelatitude, sourcelongitude, destinationlatitude, destinationlongitude): sourcecoordinates = sourcelatitude, sourcelongitude destinationcoordinates = destinationlatitude, destinationlongitude url = "http://maps.googleapis.com/maps/api/distancematrix/json?origins={0}&destinations={1}&mode=driving&language=en-en&sensor=false".format(str(sourcecoordinates),str(destinationcoordinates)) result= simplejson.load(urllib.urlopen(url)) resulting_distance = result['rows'][0]['elements'][0]['distance']['text'] print "the distance is: " + resulting_distance #calculatedistance(5.341612, -3.913602,5.342044, -4.143452) #calculatedistance(5.342044, -4.143452,...

php - MySQL photo like count. How to store & count millions of likes for photos? -

php - MySQL photo like count. How to store & count millions of likes for photos? - i attempting build instagram-like app , not sure how calculate count each photo. option 1: user table - user_id - username ... photo table - photo_id - user_id - image_path ... photo_like_relation table - like_id - photo_id - user_id ... so setup able retrieve count after counting results a query like. "select * photo_like_relation photo_id = x" option 2: user table - user_id - username ... photo table - photo_id - user_id - image_path - like_count ** ... photo_like_relation table - like_id - photo_id - user_id ... with alternative 2 self explanatory on how retrieve like_count sense messy if there ever lapses in system? perchance like_count total vs count() total of photo_like_relation may not match? so method better? or there improve method? assume there millions of photos/likes posted in app. i attempting recreate popular page feature, instagram, g...

ios - stringByEvaluatingJavaScriptFromString functions in Swift -

ios - stringByEvaluatingJavaScriptFromString functions in Swift - i trying create javascript code website (footlocker.com) run in webview in app when button pressed. how can format code when press button in app, run javascript code website pressing button me pretty much. believe have stringbyevaluatingjavascriptfromstring string not sure. please allow me know if have ides. and also, how can javascript code of website? think inspect element not sure. this javascript code got inspect elemen of button want app press footlocker.com (add cart button) not sure if correct: <input title="add cart button" tabindex="869" name="pdp_addtocart" value="add cart" type="submit" class="active_step"> thanks! ios swift

python - Django runtime error during insertion from admin -

python - Django runtime error during insertion from admin - i have django model follows: class m1(models.model): m1code = models.charfield(max_length=25) m1title = models.charfield(max_length=500) m1description = models.charfield(max_length=1000, null=true, blank=true) def __unicode__(self): homecoming self.m1title class m2(mpttmodel): m1 = models.foreignkey(m1) name = models.charfield(max_length=500, unique=false) parent = treeforeignkey('self', null=true, blank=true, related_name='children') def __unicode__(self): homecoming self.name def save(self, *args, **kwargs): degreeroot = m2.objects.get(name=self.m1.m1title) requirement = m2.objects.create(name=self.name, parent=degreeroot, m1=self.m1) here have 2 models 1 model m2(mptt model) has foreign key m1. whenever create entry m2 admin, want django automatically come in value parent in m2 based on selection of m1. here have defined save() ...

forms - Span button is not reacting to a click event in jQuery -

forms - Span button is not reacting to a click event in jQuery - i'm doing complicated multistep form using parsleyjs service request , encountered weird issue today. i've got span elements treated prev/next buttons. spans works , of them not. i've uploaded multistep form server. can check here. demo purpose, in first form input please type in1615 , go next 2 times. in step 3 (krok 3) next button not working. isn't reacting jquery click event. $('.next').click(function(){ console.log('it should work! why not?'); }); anyone know why happens? help or advice useful me. thanks. $(document).on()try adding apostrophes .next $('.next').click(function(){ console.log('it should work! why not?'); }); also, didn't deep if beingness built dynamically, might improve off using $(document).on('click','.next', function() { //console.log('it should work! why not?'); console.log('it d...

javascript - Read list back in angular without using ngrepeat -

javascript - Read list back in angular without using ngrepeat - i have list of divs want able drag , move in list. got part need read list , able tell div order based on id or kind of disingusing name on each div. cant set these divs in background , utilize ngrepeat populate list. have tried putting ul in model <ul ui:sortable ng:model="list"> , model on each div <div class="item" ng:model="list.one">one</div> , id on div <div class="item" id="one">one</div> , comes undefined. have work in fiddle http://jsfiddle.net/q3m4loq5/ javascript html angularjs

Android unlock screen by power button or by sliding -

Android unlock screen by power button or by sliding - i wrote android app , i'm disapppointed unlock behaviour: on phone utilize slide lock screen. if lock screen in app pressing powerfulness button, phone screen gets locked. if press powerfulness button 1 time again phone unlocked , straight returns app. want slide gesture needed unlock. for other apps of phone need slide gesture unlock after pressing powerfulness button. assume unwanted behaviour due app preferences, don't preferences resposible. how can have sliding unlock app? i found codeline resonsible behaviour. in mainactivity in oncreate added flag_dismiss_keyguard. if remove line, app uses "unsecure" slide screen again. looking for. public abstract class mainactivity extends activity { @override public void oncreate (bundle savedinstancestate) { super.oncreate (savedinstancestate); getwindow ().addflags (windowmanager.layoutparams.flag_dismiss_keyguard); //remove ...

powershell - Select-Object doesn't return object? -

powershell - Select-Object doesn't return object? - the next code returns expected list. $groups = ps | grouping name $groups | sort-object name | % { $g = $_.group | measure pm -sum; new-object psobject -property @{ name2 = $_.name; count = $g.count; sum = $g.sum } } however, next script, utilize select create custom object, returns nothing? read select-object way create psobject ? $groups = ps | grouping name $groups | sort-object name | % { $g = $_.group | measure pm -sum; select -property @{ name = 'name'; look = { $_.name }}, @{ name = 'count'; look = { $g.count }}, @{ name = 'sum'; look = { $g.sum }} } update: tested on powershell 2.0 , 3.0. behave same. windows powershell copyright (c) 2012 microsoft corporation. rights reserved. ps h:\> $groups = ps | grouping name ps h:\> ps h:\> $groups | sort-object name | % { >> $g = $_.group | measur...

phalcon - Get Related Records Fails -

phalcon - Get Related Records Fails - i'm having problem getting phalcon orm load related records. simple illustration code truncated brevity: can tell me why calls related tables "forget" foreign key parent table? for given table users, there can many useraddrs create table `users` ( `id` int(10) unsigned not null auto_increment, ..... primary key (`id`), unique key `password_unique` (`password`) ) engine=innodb auto_increment=2806 default charset=latin1 and../ create table `user_addrs` ( `id` int(10) unsigned not null auto_increment, `users_id` int(10) unsigned not null primary key (`id`), key `fk_user_addrs_users1_idx` (`users_id`), constraint `fk_user_addrs_users1` foreign key (`users_id`) references `users` (`id`) on delete cascade on update cascade ) engine=innodb auto_increment=15 default charset=latin1 /models/users.php public function initialize() { $this->hasmany("id", "phalconrest\models\userad...

c++ - request for member 'scale' in '((Circle*)this)->Circle::_radius', which is of non-class type 'double'| -

c++ - request for member 'scale' in '((Circle*)this)->Circle::_radius', which is of non-class type 'double'| - void circle::scale(const point& center, double s) { _radius = _radius.scale(center, s); } can explain me why not work? error get. request fellow member 'scale' in '((circle*)this)->circle::_radius', of non-class type 'double' class circle : public shape { public: circle(point center, double radius, color edgecolor=color::black, color fillcolor=color::transparent); virtual void scale(const point& center, double s); virtual void translate(double x, double y); virtual void draw(graphics& g) const; virtual void fill(graphics& g) const; virtual void print(std::ostream& os) const; virtual shape* clone() const {return new circle(*this);} virtual rectangulararea boundingbox() const; virtual void get(std::istream& in); private: ...

api - How to share a dynamic link in PHP? -

api - How to share a dynamic link in PHP? - i have generated link in php takes user's id , places @ end of referral link track refers using referral system. illustration of link via php: http://example.com/index.php?page=act/reg&inv=$arrusr[0] i'm trying create share button facebook, twitter, email, , add together shortener using bitly api - maintain running same problem... not update user id, , instead literally send url is. i'm doing stupid. help appreciated. how link shared: <a class='btn btn-tw' href='https://twitter.com/home?status=http://example.com/test/index.php?page=act/reg&inv=$arrusr[0]'><i class='fa fa-2x fa-twitter twcolor'></i></a> the link works is. if want create simple link, give me illustration (depending on user of course): http://example.com/index.php?page=act/reg&inv=43 how come, when utilize facebook, twitter, or bitly api share link refuses populate user i...