Posts

Showing posts from April, 2010

workflow - Activity Conditional Flow -

i have movie ticket booking app. initial activity login activity there "continue guest" option in case doesn't want sign in or register. then there details activity, can see movie details, has button allow user book movie, if signed in. if not, opens alert dialog register or sign in. what want is, if going login activity details activity, want, after signing in, return details activity. but if user in login activity when opens app, should go movie list activity. use sharedpreferences save credentials. example : sharedpreferences preferences = preferencemanager.getdefaultsharedpreferences(this); sharedpreferences.editor editor = preferences.edit(); editor.putstring("activity","activityfromwhereusermoved"); editor.apply(); note: activityfromwhereusermoved whether directlogin or detailspage and check in loginactivity string value of key activity : sharedpreferences preferences = preferencemanager.getdefaultsharedpreferenc

javascript - How to configure mocha when external dependencies are involved -

my folder structure is -assets - apps - login -adminlogin.js - data - trackerdb.js -specs - apps -login -adminlogin_spec.js specrunner.js i have specrunner.js file have added test initialization in package.json in root "test": "node assets/spec_runner.js" specrunner includes test needs run. the first line of adminlogin.js define("trackerdb"),function(tracker){ //complete code} when writing test case source file , running it, throws error "cannot find trackerdb.js" so question need pass every js file relative path .. if external module jquery, underscore etc.. do have other way can directly configured mocha can find every path.

do-while loop in android app -

i'm program first app. use do-while loop. want button calculates out of edittexts. after want ask user if or wants calculate again. think do-while-loop great, because haven't 1 in app yet. problem i'm not sure how that? way tried says need delete token while.. maybe it's because it's in if/else instruction. problem don't know how program while condition. possible alert dialog? my question is: what's wring do-while loop? need write in while condition control if user clicked ok in altert dialog? how can add ''no'' button alert dialog? @override public void onclick(view v) { if(v==buttonspritkosten){ do{ //variablen erzeugen textview textviewpersonenzahl; textview textviewstrecke; textview textviewverbrauch; textview textviewpreis; double berechnung; string personenzahl; string strecke; string verbrauch;

php - Build a Gettext Wrapper -

these days i'm working on 2 projects based on laravel , have implement localization. found out used method using gettext. have difficulties translating strings gettext() , ngettext(). i'd build wrapper able translate strings so: fantasticfunction('hi name :name , have {n, 1 friend, :n friends}', [ 'name' => 'luca', 'n' => 1 ]) instead of writing: sprintf('hi name %s , have', name) . ' ' . $n . ngettext('friend', 'friends', $n) so problem is: if i'd make such wrapper, tools poedit not recognize strings. how can solve? you need add fantasticfunction keyword extraction — documented in xgettext docs , poedit has properties ui it. but nothing {n, 1 friend, :n friends} thingie. if decided use gettext, need follow model , isn't compatible it. have @ how ngettext works , read on plural forms in different languages in gettext before inventing own approach. you're vague "d

api - Defining a style with android parent style -

i've found here on how mix own style android's. was: <style name="something" parent="android:widget.holo.light.textview"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">match_parent</item> </style> but android studio gives me warning saying parent requires api 11, , unfortunately need program run on api 7. there way bypass issue?

sql - MySQL: Output rows created from columns containing delimited data -

this question has answer here: sql split values multiple rows 4 answers assuming have following data in mysql: **bond** | **node** | **edges** foo | 1 | 2,3 hak | 2 | 1 wat | 3 | 1,2 i wish return results create data suitable visualisation in cytoscape. requires each node have line devoted each edge. output like: **bond** | **node** | **edges** foo | 1 | 2 foo | 1 | 3 hak | 2 | 1 wat | 3 | 1 wat | 3 | 2 i think pivot operator might work somehow, have had no luck. assuming have edge master table in possible values edges stored. if assumption wrong, answer not hold good select bond, node, edgemaster.edgeid mytable join edgemaster on find_in_set(edgemaster.edgeid, mytable.edges) order bond, node, edgemaster.edgeid sql fiddle

python - Tkinter : Getting screen text unit width. (Not pixels) -

i'm using tkinter design ui application. i'm using grid geometry , while specifying button width (or widget width), realized width should specified in text units , not pixels. since want make platform independent , screen size independent there method max text unit width ? can math on basis of that. for example: i've 10 buttons in row, should of equal width. if hard code width value specific current screen value, not work on diff screen wise. thanks. if want make gui "platform independent , screen size independent", do not want measuring sizes yourself. unless, saying want platform independent, you're saying want button x pixels regardless of pixel density or screen resolution (which seems bad idea). the whole reason tkinter supports measuring in character units, along options widgets stretch , shrink, support platform independence. when start working @ pixel level, have many, many problems when run code on other platforms, or on other di

php - Compress base64 encoded binary data -

i'm making api request audio files language learning app. request seems take 2-3 seconds return, far long needs. i need pass them php script in smallest way possible. how can send binary data, such requested audio file, in fastest way possible? code if needed: js request: $.get('testphp.php/translate_tts?ie=utf-8&tl=zh-cn&q=你好', function (returned_data) { document.getelementbyid("audio").innerhtml= '<embed src="data:audio/mpeg;base64,'+returned_data+'" hidden="true" autostart="true" loop="false"/>'; php: $params = http_build_query(array("ie" => $_get['ie'],"tl" => $_get["tl"], "q" => $_get["q"])); $ctx = stream_context_create(array("http"=>array("method"=>"get","header"=>"referer: \r\n"))); $soundfile = file_get_contents("ht

visual c++ - incomplete reading data serial port -

i want read 6 data sensors arduino vc++ "handshaking" methods, send "1" arduino device send data pc. data format is: &data0,data1,data2,data3,data4,data5% but when read vc++ data incomplete, thought size of buffer enough data here snapshot of vc++ program, put on timer event dword nbytes; char buffer[24]; //read sensors if(!writefile( hnd_serial, "1", 1, &nbytes, null )){killtimer(ctimer1);messagebox(l"write com port fail!");return;} sleep(5); if(!readfile( hnd_serial, buffer, 23, &nbytes, null )){killtimer(ctimer1);messagebox(l"read com port fail!");return;} sleep(50); i have changed baud rate result still same. if reduce 1 data such data5 (become 5 sensors), data complete. have wrong program? you can put readfile() function inside do-while loop. do{ if(!readfile( hnd_serial, buffer, 23, &nbytes, null )){ //process error break; } if (nbyte

parse.com - Parse iOS SDK v.1.7.4 FacebookUrlSchemeSuffix -

does know how handle urlshemesuffix latest parse ios sdk? seeing now. [pffacebookutils initializefacebookwithapplicationlaunchoptions:launchoptions]; this used available in prior version of pffacebookutils v4 doesn't have it. #ifdef paid [pffacebookutils initializefacebookwithurlshemesuffix:@"paid"]; #else [pffacebookutils initializefacebookwithurlshemesuffix:@"free"]; #endif help please here's solution, answering own question: https://developers.facebook.com/bugs/115597585443651/

c - Driver Templates, Minimum Kernel Distro., drivers community, driver for Microcontroller? -

i post-newbie embedded linux driver development, have developed character, uart & simple usb drivers, , have worked sbc (raspberry pi 2). main learning resources are: essential linux device drivers, embedded linux system design & development, youtube tutorials , ldd3. because of lack of real life driver experience, have questions share: templates: there sort of driver templates speeding coding process e.g. have regularly used structures & functions being modified & customized specific drivers. what’s suitable minimum distribution: doing either building kernel image using buildroot inserting developed usb driver or inserting developed usb driver ubuntu. , proper testing have unload default usb driver (usb_storage); otherwise can’t test module. so, question regarding real-life development & how-to minimum kernel has no drivers, & how-to include module (to part of it) while building buildroot? what embedded linux driver development community suggest detail

R - Vary by Row the Rounding of Digits Produced by knitr::kable -

i trying produce markdown table using knitr::kable rounding of digits varies rows. example, suppose have following data.frame: example.df <- data.frame(a = c(0.1234, 2000), b = c(0.5678, 3000)) i'd create following markdown table, first row rounded 2 digits , second row rounded integer. | a| b| |----:|----:| | 0.12| 0.57| | 2000| 3000| instead, seem able format entire columns. library(knitr) kable(example.df, digits = c(2, 0)) which results in following markdown table: | a| b| |-------:|----:| | 0.12| 1| | 2000.00| 3000| any advice on how produce markdown table in r has row-wise formatting of digits? as pointed out @user20650, 1 solution consists in converting format of entries in dataframe in r before passing data knitr . done this: example.df <- rbind(formatc(as.numeric(example.df[1,]),format="f",digits=2), formatc(as.numeric(example.df[2,]),format="d")) colnames(example.df) <- c

java - Ending While loop with blank line(Enter key) inside SwitchCase -

*amended input scan i'm trying end while loop enter key/blank line test codes below works fine. scanner scan = new scanner(system.in); string line; while ( (line=scan.nextline()).length() > 0) { system.out.println(line); } however, when integrate within main program(while loop placed within int switch case within do-while loop) program skips codes @case2 , continue do-while loop int input; do{ system.out.print("choose function (-1 exit): "); input=scan.nextint(); switch (input) { case 1: break; case 2: //same while loop here break; } }while(input!=-1); sample output: choose function (-1 exit): 1 choose function (-1 exit): 2 //skip case2 coding choose function (-1 exit): 1 choose function (-1 exit): -1 //program ends i'm not 100% sure, think scanner not reading input. there's blank line (a newline character) in buffer when sc

javascript - Userscript that applies to all pages causes issues in StackExchange -

Image
this question has answer here: jquery in greasemonkey 1.0 conflicts websites using jquery 3 answers possibly related: google comes blank. my userscript here seems cause issues when use in firefox. google searches come blank, though can inspect , see code. however, main thrust of issue (since can band-aid previous 1 excluding sites) editor tools on stackexchange sites disappear, tags dropdown. here screenshot of i'm describing. it's going straightforward fix i've missed because don't have scripting background, i'm not sure fix this. your jquery version in conflict stackoverflow's jquery version. basically, using older jquery version support older browsers. use in code deprecated jquery function , browser uses jquery version try run these old functions not found. this how can make sure versions don't in conflict : v

.net - How can I interpolate a point along a line string using DbGeography? -

i have linestring dbgeography object , want find point along linestring given fractional value of total distance. example, if give 0.5, should midpoint of line dbgeography object point wkt (well known text). i've tried digging through dbgeography documentation, no apparent "easy" method seems exist. i think method similar google maps js api spherical geometry interpolate method. suggestions? i've done before using following approach: iterate through linestring's points until find pair of adjacent points between target point must lie (the target distance either given or can computed distance fraction mention); then use dbgeography.buffer on each of 2 points, providing "remaining distance target" + "small distance padding" * first , "distance between 2 points" - "remaining distance target" + "small distance padding" second; then use dbgeography.intersection on 2 points, obtaining small polyg

How to prevent a user from moving the size of a column in QtableWidget using Python and Qt? -

i created qtablewidget whith 2 columns in qt creator. i found out how set width of column setcolumnwidth() function. in gui user can still change width of columns. how can set width fixed size , forbid user modify it? use table.horizontalheader().setsectionresizemode(...) (or setresizemode in older qt versions) appropriate resize mode .

javascript - Covert encoded HTML in string to plain text for Input Fields using Agular -

i have use case, can have '&#' characters inside of json. name: "kenneth hinsvark &#38; maurice mcalister" address: "555555 w. canyon dr &#35; b212" the string values pulled database. apparently values saved db html encoding. need able display data in textfield without html characters. my main requirement input fields values converted plain text. name: <input type="text" ng-model="user.name" escape-to-plain-text></input> address: <input type="text" ng-model="user.address" escape-to-plain-text></input> how can translated input values plain text? using $sce isn't working me $scope.user.name = $sce.trustashtml('555555 w. canyon dr &#35; b212'); working code example: http://jsfiddle.net/egrendon/xa8cseoc/12/ right. need couple of things: inject ngsanitize module. do ng-bind-html on element want output $sce result. i've edi

Get the console buffer without the last line with C#? -

what i'm trying achieve self-compiled c# file without toxic output.i'm trying achieve console.movebufferarea method looks not work. eg. - save code below .bat extension : // 2>nul||@goto :batch /* :batch @echo off setlocal :: find csc.exe set "frm=%systemroot%\microsoft.net\framework\" /f "tokens=* delims=" %%v in ('dir /b /a:d /o:-n "%systemroot%\microsoft.net\framework\v*"') ( set netver=%%v goto :break_loop ) :break_loop set csc=%frm%%netver%\csc.exe :: csc.exe found %csc% /nologo /out:"%~n0.exe" "%~dpsfnx0" %~n0.exe endlocal exit /b 0 */ public class hello { public static void main() { clearc(); system.console.writeline("hello, c# world!"); } private static void clearc() { system.console.movebufferarea( 0,0, system.console.bufferwidth,system.console.bufferheight-1, 0,0 ); } } the output be: c:\>// 2>n

Python Curses window.getch() returns wrong value -

why when run code box.getch() returns wrong value , when change box.getch() screen.getch() returns right value? i've been looking on internet , there no 1 saying getch() works screens. if press 1 of arrows returns 27 chr of esc. (this code should print character untill user presses esc...) import curses screen = curses.initscr() curses.noecho() curses.cbreak() curses.start_color() screen.keypad( 1 ) curses.init_pair(1,curses.color_black, curses.color_cyan) highlighttext = curses.color_pair( 1 ) normaltext = curses.a_normal screen.border( 0 ) curses.curs_set( 0 ) box = curses.newwin( 22, 64, 1, 1 ) box.box() box.addstr( 14, 3, "you have pressed: ") screen.refresh() box.refresh() x = box.getch() while x != 27: box.erase() box.addstr( 14, 3, "you have pressed: " + str(x) ) screen.border( 0 ) box.border( 0 ) screen.refresh() box.refresh() x = box.getch() curses.endwin() exit() the answer (see bug refresh in python cu

c - Reading both strings and integers from a file -

i'm reading in text file lines begin asterisk, other lines contain numbers indicating size of rectangle. i'm confused on how should extracting information though. i'm trying use fgets() read strings , sscanf read integers, seen; while(fgets(line, max_chars, infile) != null) { if(line[0] == '*') { printf("%s\n", line); } sscanf(line, "%d%d", &height, &width); printf("height: %d, width: %d\n", height, width); } but it's printing this; *case #1 height: 0, width: 0 height: 10, width: 20 .... *case #2: shape height: 10, width: 20 height: 7, width: 7 .... should reading file character character instead? sample input: (the height , width aren't updated right away) *case #1 10 20 x x xxx *case #2: shape 7 7 xx xx x you forgot add else part after if . while(fget

java - sorting an array in the same line as instantiation/initialization -

if given array of ints : int[] age = new int [] {32, 25, 56, 56, 12, 20, 22, 19, 54, 22}; is there way sort(lowest-highest) in same line instantiation/initialization, elements of age be: 12, 19, 20, 22... ? not same line. but can do: public static int[] sort(int[] a) { arrays.sort(a); return a; } // ... int[] age = sort(new int[] {32, 25, 56, 56, 12, 20, 22, 19, 54, 22});

Docker container drive does not match available hard drive space on host -

i have loaded new custom image remote redhat 7 docker host instance. when running new container, container not attempt use entire disk. following output of df -h on container: rootfs 9.8g 9.3g 0 100% / /dev/mapper/docker-253:0-67515990-5700c262a29a5bb39d9747532360bf6a346853b0ab1ca6e5e988d7c8191c2573 9.8g 9.3g 0 100% / tmpfs 1.9g 0 1.9g 0% /dev shm 64m 0 64m 0% /dev/shm /dev/mapper/vg_root-lv_root 49g 25g 25g 51% /etc/resolv.conf /dev/mapper/vg_root-lv_root 49g 25g 25g 51% /etc/hostname /dev/mapper/vg_root-lv_root 49g 25g 25g 51% /etc/hosts tmpfs 1.9g 0 1.9g 0% /proc/kcore tmpfs 1.9g 0 1.9g 0% /proc/timer_stats but host system has more space: filesystem size used avail use% m

Need help C# textBox1.Text does not exist in current context -

{ if (("zippath" == "xixanpackinstaller")) ; textbox1.text = "successfuly found xixanpackinstaller!"; } else textbox1.text = "move xixanpackinstaller desktop!"; } i have code , it's broken because @ else on visual studio says invalid token else , on textbox1.text says textbox1.text not exist in current context { if (("zippath" == "xixanpackinstaller")) //**;** semi-colon textbox1.text = "successfuly found xixanpackinstaller!"; //}---please remove bracket here else textbox1.text = "move xixanpackinstaller desktop!"; }`enter code here`

swift - Assembler on 64-bit iOS (A64) -

i'm trying replace methods asm-implementations. target arm64 on ios (iphone 5s or newer). want use dedicated assembler-file, inline assembler comes additional overhead, , quite cumbersome use a64 memory offsets . there not documentation on over internet, i'm kind of unsure if how way go. therefore, i'll describe process followed move function asm. the candidate function question 256-bit integer comparison function. uint256.h @import foundation; typedef struct { uint64_t value[4]; } uint256; bool eq256(const uint256 *lhs, const uint256 *rhs); bridging-header.h #import "uint256.h" reference implementation (swift) let result = x.value.0 == y.value.0 && x.value.1 == y.value.1 && x.value.2 == y.value.2 && x.value.3 == y.value.3 uint256.s .globl _eq256 .align 2 _eq256: ldp x9, x10, [x0] ldp x11, x12, [x1] cmp x9, x11 ccmp x10, x12, 0, eq ldp

ruby on rails - How to define these owner/member relationships in Neo4j.rb? -

i'm trying figure out how define these owner/member relationships in neo4j.rb active::node models. users can create many teams (and become "owner" of teams) users can fetch teams have created teams have single owner (user) , many members (other users) owners can add other users members team users can fetch teams either owner or member of so far have this, isn't working right , totally lost. class user include neo4j::activenode has_many :out, :my_teams, model_class: 'team' end class team include neo4j::activenode property :name, type: string has_one :in, :owner, model_class: 'user' end user = create(:user) team = build(:team) user.my_teams << team expect(team.owner).to eq user firstly should make sure you're using 5.0.0 of gems released yesterday (yay!) secondly (and should error messages when upgrade), should specifying type option associations, this: class user include neo4j::activenode has_many

java - BeanIO write annotated class to fixedlength -

i trying write annotated class fixedlength file beanio. classes annotated getting exception "invalid field 'employees', in record 'team', in stream 'tm': type handler not found type 'com.mycompany.bio.employee'" below source code public static void main(string[] args) { streamfactory factory = streamfactory.newinstance(); streambuilder builder = new streambuilder("tm") .format("fixedlength") .parser(new fixedlengthparserbuilder()) .addrecord(com.mycompany.bio.team.class); factory.define(builder); employee e1 = new employee("empf1", "empl1", "developer", "1", new date()); employee e2 = new employee("empf2", "empl2", "developer", "2", new date()); team team = new team(); team.setteamname("great team"); team.getemployees().add(e1); team.getemployees().a

javascript - How to add Active Link or Image to image mapping -

when click link of first area want image 270orange.png active. i'm not sure if achievable, please me if is. img id="image-maps_9200905221105171" src="270vob.png" usemap="#image-maps_9200905221105171" border="0" width="270" height="270" alt="" map id="_image-maps_9200905221105171" name="image-maps_9200905221105171" area shape="poly" coords="134, 43, 211, 178, 219, 177, 231, 174, 243, 169, 254, 159, 263, 144, 267, 128, 267, 113, 263, 95, 257, 79, 249, 65, 237, 48, 224, 35, 207, 22, 185, 11, 168, 6, 148, 2, 128, 2, 111, 4, 92, 9, 78, 14, 69, 19, 82, 17, 95, 16, 108, 19, 119, 25, 129, 35" href="#" alt="identity" title="identity" onmouseover="if(document.images) document.getelementbyid('image-maps_9200905221105171').src= '270orange.png';" onmouseout="if(document.images) document.getelementbyid('

ruby on rails - Saving modified collection of records into instance variable -

i have collection of objects being pulled third party service. using each_with_index block iterate on them , make changes 1 of attributes in each object (payment_due_date__c). i'd have these records saved new instance variable can pass view , iterate on inside table. @payments.each_with_index |x, i| loan_start_plus = @loan_start_date + i.months x.payment_due_date__c = 3.business_days.before(loan_start_plus) end how can save updated records collection can pass view? maybe help: @payments.each_with_index.map |x, i| loan_start_plus = @loan_start_date + i.months x.payment_due_date__c = 3.business_days.before(loan_start_plus) end

html - Stacking div over floating div without content wrapping? -

i have 1 element (a div) floating right of content, , below content (which can varying in height) have div want stack above floated right div, stay below content. here's example: https://jsfiddle.net/8nap0qm6/ while close, need content within ".over" div not wrap when hits right-hand div, instead fill whole ".over" div while still overlapping right-hand div. putting "clear: both/left" on ".over" div pushes div below right-hand div instead of overlapping it. i know absolute position on div: .over { position: absolute; top: 200px; // or xx% left: 0px; z-index: 5; } but need vertically controlled content can't put set "top" on it. is there way achieve this? (make white text in blue box go full width of blue box.) i'm open using different code if necessary. you need set position: absolute; .over { position: absolute; z-index: 5; } jsfiddle

android - How to download a file on a click -

how doing ? making application, in application want click listview , application starts download link. have link. used following code but, application crashes: here listener handle clicks: mlistviewmagazine.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { downloadfromurl(mmagazine_title[position]); } }); the downloadfromurl function following: public void downloadfromurl( string filename) { //this downloader method try { url url = new url("http://themwl.org/web/sites/default/files/584_0.pdf"); file file = new file(filename); long starttime = system.currenttimemillis(); log.d("imagemanager", "download begining"); log.d("imagemanager", "download url:" + url); log.d("imagemanag

linux kernel - how to run make for a local subdirectory -

i trying port existing code larger project. larger project has main makefile makefiles in each sub-directory. sure path below tells how setup. want port code /working_directory/drivers/char/example and here content: sansari@ubuntu:~/working_directory/drivers/char/examples$ ls hello1.c makefile my question 1- should modify local makefile or main one? setting modify one, not sure. 2- other question if modify local file, can run make here , validate configuration instead of running make entire project? know make updates files changed; feel better when clean build environment before each make. have run situations, alone fixed issue. just background, did try include make file of target project, 1 trying import here -f command. did was: make -f makefile -f ../mytarget/core/makefile ran issues make not doing of normal things in primary project. instance, there include statement relative path header file, make gave me error not seeing it. abandoning strategy time being. @ah

Getting facebook profile picture -

i need facebook profile picture of passing id. no need use facebook api or graph else.. need give url id.. possible profile picture in way? tried in google didnt it. if knows please respond me... well, think options available are: https://graph.facebook.com/[profile_id]/picture (you can include url inside tag , work). scrap page corresponding profile, i.e. http://www.facebook.com/profile.php?id=[profile_id] , url of picture there. i suggest use first one, because gives more flexibility picture size ( ?type=small , ?type=thumbnail , etc). edit keep in mind answer 2011, , facebook makes changes in apis frequently.

python - Formatting Flask app logs in json -

i'm working python/flask application , trying logs formatted (by line) in json. using python-json-logger package, i've modified formatter app.logger follows: from pythonjsonlogger import jsonlogger formatter = jsonlogger.jsonformatter( '%(asctime) %(levelname) %(module) %(funcname) %(lineno) %(message)') app.logger.handlers[0].setformatter(formatter) this works expected. messages passed app.logger correctly formatted in json. however application automatically logging requests. information shows in stdout follows: 127.0.0.1 - - [19/jun/2015 12:22:03] "get /portal/ http/1.1" 200 - i want information formatted in json well. i've been looking logger/code responsible creating output no success. where output generated? mechanisms change formatting of logged information? when use app.logger attribute first time, flask sets log handlers: a debug logger set log level debug , filters on app.debug being true. a production logger

Using Youtube's Python API ProgrammaticLogin() gives SSL Error Python 2.7.9 -

edit: turns out i'm idiot , can't read looked up, fix brew uninstall openssl rm -rf /usr/local/openssl , run brew install openssl there's issue openssl installed before os x 10.10.3 , reinstalling fixes it. i'm trying create reddit bot searches specified users on youtube, , submits posts subreddit. when tries log in gives ssl error. i'm on python 2.7.9, , installed gdata through pip. here's code: import gdata.youtube import gdata.youtube.service import praw def main(): yt_service = gdata.youtube.service.youtubeservice() yt_service.ssl = true yt_service.email = '' yt_service.password = '' yt_service.source = 'reddit-youtube-submitter-bot' yt_service.programmaticlogin() if __name__ == "__main__": main() here's error: traceback (most recent call last): file "youtube_submitter_bot_mine.py", line 15, in <module> main() file "youtube_submitter_bot_mine

matrix - Fortran Seg Fault when assigning Matrices -

[update] code , few sentences changed reflect realization explained in second comment. code should compile line below, however, have older gfortran , may not seeing errors might. gfortran blu_implementation_copy.f90 -o blu_implementation_copy.x i'm getting incredibly inconsistent seg fault error @ runtime fortran 90. the overall objective of code factor randomly generated, complex, symmetric, diagonally-dominant matrix in blocks can parallelized. stripped down version (except relevant functions) can found @ end. i'm running error when breaking original matrix blocks (tiles) in function mat2tiles. line of code keeps failing: o(i,j)=cell(x(a:min(i*nblock,m), b:min(j*nblock, n))) this assigning block of input matrix x matrix o @ index i,j. accomplishes because each index of o matrix nblockxnblock through derived type: type cell complex*16 :: block(nblock,nblock) end type cell type(cell) :: o(m/nblock+rem,n/nblock+rem) for matrix sizes , tile sizes, works

mapreduce - Aggregating heterogeneous documents in MongoDB -

i writing tool inspect mongodb session store, in structure namespaces containing variables containing information on variables, roughly: { "some namespace" : { "some variable" : { "t" : "serialization type", "b" : "data value", "c" : "java class type" }, "some other variable in namespace" : { "t" : "serialization type", "b" : "data value", "c" : "java class type" }, ... }, ... // more namespaces } the names of namespaces , variables different. wrote map-reduce job loop through namespaces , loop through variables in each namespace , emit each variable in each namespace. however, want try switch mongo's aggregation framework avoid potential write lock problems. based on docs, seems have specify names of v

javascript - element slider start from 0 to bottom (negative) instead 0 to top in firefox -

the element slider in browsers starts 0 top (ex: 0 500 ) that's when direction of page left right , , when direction of page right left slider starts top 0 (ex: 500 0 ). firefox browser different when direction of page right left starts 0 bottom (ex: 0 -500 ) negative number. var box = document.getelementbyid('box'); var result = document.getelementbyid('result'); box.onscroll = function() { result.innerhtml = box.scrollleft; } body { direction: rtl; } #box { width: 500px; height: 250px; margin: 0 auto; overflow-y: hidden; overflow-x: scroll; } #childbox { width: 1000px; height: 250px; background: url('http://images.all-free-download.com/images/graphiclarge/school_symbols_seamless_pattern_311368.jpg') repeat-x; overflow: hidden; } <div id="box"> <div id="childbox"></div> </div> <div id="result"></div> also jsfiddle . ho

java - How do I use a HashMap from another class or function? -

here working code example. @markspace providing me it. code here makes hashmap , inserts values in it. public class rpgpersonexample { public static void main( string[] args ) { map<string, rpgperson> team = new hashmap<>(); team.put( "sgt. mayhem", new rpgperson( 100, 10, 0 ) ); team.put( "wizard", new rpgperson( 100, 1, 10 ) ); team.put( "dragon", new rpgperson( 1000, 100, 100 ) ); system.out.println( team.get( "dragon" ) ); system.out.println( team.get( "wizard" ) ); } } class rpgperson { private int hits; private int strength; private int magic; public rpgperson( int hits, int strength, int magic ) { this.hits = hits; this.strength = strength; this.magic = magic; } @override public string tostring() { return "rpgperson{" + "hits=" + hits + ", strength=" + strength + &quo

django - Python Mocking of Boolean Function -

so have begun working mock library perform unit testing. ran across problem mysterious me. when call below code stream.open() evaluates true, seems returning mock object rather false value. test code @patch('module.lib.stream') def test_error_raised(self, mock_stream): mock_stream.open.return_value = false self.assertraises(ioerror, get_query, 618) called function def get_query(id): id = str(id) fpath = os.path.join( path, '{0}.pdf'.format(id)) stream = stream() if not stream.open(fpath): raise ioerror("no file found") list = map(foo, stream.getdata()) first_entry = list[0] target_entries = list[1:] return first_entry, target_entries is there way mock function? from function here, stream seems class. since create instance of class , call open method on instance, need mock_stream.return_value.open.return_value = false in test function.

wordpress - ACF Google Maps with Bootstrap Tabs -

i have big problem site. can not bring map correctly last tab bootstrap page. http://www.sardiniadreamvillas.com/ville/villa-quattro/ my structure html of tab similar this: <ul class="nav nav-tabs" role="tablist" id="tab-menu"> <li role="presentation" class="active"><a href="#slide" aria-controls="slide" role="tab" data-toggle="tab" aria-expanded="false">slideshow</a></li> <li role="presentation" class=""><a href="#gallery" aria-controls="gallery" role="tab" data-toggle="tab" aria-expanded="false">galleria</a></li> <li role="presentation" class=""><a href="#maps" aria-controls="maps" role="tab" data-toggle="tab" aria-expanded="true">mappa</a></li> &l

how can I run my android app? -

unable run android app because runs image stored in res/drawable file whenever click "run app" application. i imported image in drawable folder of android project, , set background main activity, when try run app instead displays image file. also following message displayed in gradle build. error:execution failed task ':app:mergedebugresources'. c:\users\user\androidstudioprojects\gogetit\app\src\main\res\drawable\ggimain.jpg: error: invalid file name: must contain lowercase letters , digits ([a-z0-9_.]) this activity_main.xml coding <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" \\\android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_ver

c# - Is there a variable type for comparators? -

is there variable type (something string , int , or bool ) comparators? ( == , != , <= , >= , > , < ) , if not, how c# use them? i can use int integervariable = 0; but there can use do comp comparatorvariable = ==; ? the various operators you've listed not have type no. objects have types. you've listed operators, not objects, , have no type. if you're interested in how c# language uses operators, can @ language spec; section 7.3 of c# 5.0 specs titled "operators" , filled information on how c# handles operators.

php - Laravel Eloquent : belongsTo relationship - Error: Trying to get property of non-object -

first time try laravel eloquent relatioinstip i know it's simple getting error don't know what's wrong i have 2 tables in data base, news , news_image in database tables: news id | header | details news_image id | image | news_id and have 2 models news , newsimage newsimage model : class newsimage extends eloquant { protected $table = 'news_image'; public function news() { return $this->belongsto('news'); } } news model class news extends eloquent { protected $table = 'news'; public $timestamps = false; public function image() { return $this->hasmany('newsimage'); } } the view: foreach($news $new) <tr> <td> {{$new->id}} </td> <td> {{ $new->header}}</td> <td> {{ $new->details }}</td> </td> {{$new->news->image}}</td> </tr> when run it's error :

javascript - Scrollmagic Section Wipes -

i need has experience scrollmagic.js i trying create similar this: http://work.antonandirene.com/karimrashid/ where sections overlap scroll page. i using scrollmagic ( http://scrollmagic.io/ ) fiddle: http://jsfiddle.net/st86x71m/1/ the main problem had allowing content higher 100% scroll before next panel becomes visible. have kinda fixed problems... my issues: i need remove gap after additional content has finished scrolling, next panel shows when additional content @ bottom of parent , not -100% now. also need figure out how dynamically set z-index previous slide has higher z-index. setting them manually in css. any appreciated, thank in advance. jon. console.clear(); console.log("scrollmagic v%s loaded", scrollmagic.version); // init var controller = new scrollmagic.controller(); // define movement of panels var wipeanimation = new timelinemax() .fromto("section.panel.blue", 1, { y: "0" }, { y: