Posts

Showing posts from July, 2015

Taking mouse control in C# WPF -

i watnt o create tutorial/guide inside in application, creating "demonstration". purpose, need capture mouse of computer, , able move , click it. i want feel if else there controling computer. completed video of someone, make feel doing live in moment. thank in advance!!! there isn't wpf solution. have use p/invoke. to disable keyboard/mouse use blockinput api (as far understand, don't want user break "demo"). simulate user input, use sendinput api. sendinput @ pinvoke.net: http://www.pinvoke.net/default.aspx/user32.sendinput another option use third-party simulators, this .

php - Counting, highlighting and printing the duplicates between two arrays -

first time posting on stackoverflow. after printing main array, have managed highlight values found in second one, want print number of times duplicate occurs in brackets @ same time. have run out of ideas on how last part, stuck in multiple loops , other problems. paste here what's working now. the code: $main = array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ); $secondary = array( 1, 6, 10, 6, 17, 6, 17, 20 ); foreach ( $main $number ) { if ( in_array( $number, $secondary ) ) { echo $item; // 1 supposed highlighted, html code disappears on stackoverflow /* number of duplicates should appear in bracket, example: highlighted number( number of duplicates ) */ } else { echo $item; // 1 simple } } expected result: 1(1), 2, 3, 4, 5, 6(3), 7, 8, 9, 10(1), 11, 12, 13, 14, 15, 16, 17(2), 18, 19, 20(1) basically brackets contain number of times value found in second array, aside being colored, can't paste ht

javascript - Ember JS - Improving Performance of Select View -

Image
i have select box contains list of 350-400 <option> element. element data loaded via ajax. loads fine. but when ember tries create list. browser hangs high ram , cpu uses unresponsive script error shown in browser. given enough time renders. it seems ember doesn't caches rendered element because every time comeback same page problem repeats. so, there way can improve performance of view select ? the sample code select view: {{view "select" prompt="-- select --" content=controllers.application.companies optionvaluepath="content.id" optionlabelpath="content.name_abbr" classnames="form-control" value=dailyid}} i know 1 of alternatives using typeahead script using text box. want save plan b now. warning : solution due deprecated of ember 2.0 according this blog entry: removals .... manually rendering string buffer in view i don't think have answer you,

Unable to execute dex: Multiple dex files define Lcom/google/android/gms/analytics -

i got error while executing android application. what's actual problem of this. know post it. you have multiple project dependencies use same classes. in case, com.google.android.gms.analytics duplicated - should ensure using library once. check build.gradle file, libs folder , anywhere else define dependencies. i believe if use com.google.android.gms:play-services dependency, newer versions contain google analytics default

python - using dictionary in pycuda -

i have dictionary , know if possible use parameter of kernel. for instance i have cuda kernel signature __global__ void caltab(tableaux) tableaux c structure corresponding typedef struct { float *tab1; float *tab2; } tableaux; in python tableaux correspond dictionary below: tableaux={} tableaux["tab1"]=[] tableaux["tab2"]=[] is possible use dictionary c structure without using c api? thank in advance none of proposing possible. in pycuda, cannot pass dictionary kernel pass list kernel directly translate dictionary c++ structure in device code directly translate list c++ linear array in device pycuda can use python classes c++ structures , has numpy array use on gpu. points 3 , 4 possible, not them. both techniques discussed in documentation, here gpuarray , here structures .

ruby - Pascal triangle using nested for loop -

i need primed shape. need output like: 1 0 1 0 1 0 1 0 1 0 i tried print left side of triangle, don't know print full triangle. code printing left side of triangle: for in 1..5 j in 1..i if (i%2 == 0); k = (j%2 == 0) ? 1:0; else; k = (j%2 ==0) ? 0:1; end print k," " end puts end i output this: 1 0 1 1 0 1 0 1 0 1 1 0 1 0 1 just add print " "*(5-i) , this: for in 1..5 print " "*(5-i) j in 1..i if (i%2 == 0); k = (j%2 == 0) ? 1:0; else; k = (j%2 ==0) ? 0:1; end print k," " end puts end

how to get a random value from one array to another in java -

i want random array value char[] vowel , char[] consonant char[] firstname , char[] lastname . my ide (eclipse) shows no errors firstname[i]=consonant [random.nextint(consonant.length)]; however when running code i'll error `exception in thread "main" java.lang.arrayindexoutofboundsexception: 0 @ _01namegenerator.main(_01namegenerator.java:27)` how shall fix statement? // http://www.javapractices.com/topic/topicaction.do?id=62 import java.util.random; public class _001namegenerator { public static void main(string[] args) { random random = new random(); int firstnamelength = 7; // fixed length, not "random" int lastnamelength = 5; system.out.println("your firstname "+firstnamelength+" , lastname "+lastnamelength+" characters long."); char[] vowel = {'a', 'e', 'i', 'o', 'u', 'y'}; char[] consonant

javascript - fullcalendar remove event by popup modal strange behavior -

Image
i have made fullcalendar event remove popup modal. partly working there strange behavior. newbie this, have tried several different way can't make stange behavior away. , don't know how make jsfiddle reproduce exact behavior without copying code. code contains lot things. can't provide jsfiddle. , related code stated here. think has experience this. think can see through code. appreciated advice. have spent time on it. strange behavior event remove popup modal, removes other event closed close button. in following explanation contains details. i have made this: 1) div code popup modal <div class="modal fade" id="modalremove" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="cl

java - Partial update in an API -

i have use case in need update of fields of api. example: if api updatestudentdetails , input takes is: name cgpa address hostel name here want update name only. 1 way fields , update name , call updatestudentdetails fields. requires 1 read call @ client side prior update call. other ways are: 1. ask client needs updated. in case api signature might like: name cgpa address hostel name studentdetailstoupdate here studentdetailstoupdate list of enums , enum can have values name, cgpa, address, hostel_name . based on enum list provided client can update respective fields. take actions based on field value. in case if cgpa passed null client not want update , if name non-null client wants update. i not able find major pros , cons in above 2 approaches , seek community’s guidance. bit inclined towards first approach intention clear me , not taking decisions based on field values might possible other language might not h

Could I use Capybara on frameworks outside Rails (PHP)? -

i test php web app (specifically magento) capybara. i've used capybara success when used rails before want replicate success. know if possible or maybe there capybara php? yes possible. have define url server serves pages want test. example, if use rspec in spec_helper.rb . additionally have specify different driver not want start app (which not present), example selenium : capybara.app_host = 'http://www.site-to-test.com' # site lives capybara.default_driver = :selenium # use selenium control external browsers a basic gemfile this: source 'https://rubygems.org' gem "rspec", '~> 3.0' gem "capybara" gem "selenium-webdriver", '~> 2.45' if run tests, fire browser window (if browser installed in non default path have configure this, too), open page , interact it.

java - Tomcat with Rest - HTTP Status 500 - Servlet execution threw an exception -

Image
i'm trying code simple restful webservice, following tutorials. i'm searched everywhere can't find solution after several tries fit problem. i'm using netbeans 8.0.2 , apache tomcat 8.0.15 (installed netbeans). i've had several issues tomcat managed solve them, except one. helloworld.class package com.example; import javax.ws.rs.get; import javax.ws.rs.path; import javax.ws.rs.produces; import javax.ws.rs.queryparam; import javax.ws.rs.core.mediatype; import org.codehaus.jettison.json.jsonexception; import org.codehaus.jettison.json.jsonobject; //path: http://localhost/<appln-folder-name>/hello @path("/hello") public class helloworld { // http method @get // path: http://localhost/<appln-folder-name>/hello/world @path("/world") // produces json response @produces(mediatype.application_json) public string dohello(){ jsonobject obj = new jsonobject(); try { obj.put(&q

concurrency - Synchronous_Fifo of Objects in Ada -

i created record in ada , later created synchronous_fifo out of these records: type basic_record record argument_1: integer; operator: character; argument_2: integer; product: integer; end record; package tasks_fifo new synchronous_fifo(basic_record); use tasks_fifo; buffer : fifo; and working fine. later wanted same synchronous_fifo out of objects: package adding_machine protected type add_machine entry store_record(task_record: basic_record); entry push_button; entry get_product(product: out integer); private my_record : basic_record; my_product: integer; end add_machine; end adding_machine; use adding_machine; package object_fifo new synchronous_fifo(add_machine); use object_fifo; buffer: fifo; and result got several errors: multiple markers @ line - occurrence of package - actual non-limited "element_type" cannot limited type - instantiation abandoned in line, creating object_fifo . how should create fifo? or m

ios - How to keep the same document layout in UITexView between different device sizes and orientations? -

so let's have put text , images in uitextview , , looks way on iphone 6 in portrait orientation. achieve have same of content (like document, without misplaced text) of uitextview , when rotate device, or when open same content on device. i'm thinking of solution pick default width content , have width scaled among different screen sizes/orientations. highly appreciated. thanks!

php - (Help) Get results from multiple dropdown with one submit button -

i make 4 horizontal dropdown menu. here code : <div class="menusearching" id="searching"> <div class="menu1" id="menu1"> <p> lembaga</p> <form style="margin-top:-20px;margin-left:-2px;"> <select name="droplembaga" autofocus required id="droplembaga"> <option value="no" selected="selected">---choose one---</option> <option value="flashcom">flashcom</option> <option value="internusa">internusa</option> <option value="hexacompare">hexacompare</option> </select> </form> </div> <div class="menu2" id="menu2"> <p> paket kursus</p> <form style="margin

java - Restricting javax.servlet.Filter to specific URL pattern -

i'm trying implement filter project in adobe cq 5.6.1. seems nifty used doing some, say, authentication stuff each page gets displayed. i've read on documentation on filters , i've coded annotations way: @slingfilter( label = "filter implementation", metatype = true, generatecomponent = true, generateservice = true, order = 1, scope = slingfilterscope.request ) @properties({ @property(name="service.description", value="a filter"), @property(name="sling.filter.pattern", value="/some/path") }) i've compiled code , looked logs, somehow, doesn't seem filtered specific path indicated in sling.filter.pattern. don't seem find samples on how implement i'm in dark feature. i'm sure of don't want filter run on every url gets loaded. any leads appreciated. thanks! as mentioned in question's comments, sling.filter.pattern s

javascript - OpenCart: Search no longer works after repositioning -

i designing own template making changes default template code of opencart 2.0.2.0. after repositioning search field, no longer works: not submit on pressing enter, , search value not submitted in url when clicking search button in form (the form submits though). in order try , find goes wrong when relocating input field, have made fresh installation of opencart on wampsever, , without changing else, moved input field main nav, right after categories ul -- copying php tag prints search template: <?php echo $search; ?> nothing else. form submits on pressing enter on keyboard, , submits on clicking search button, search parameter no longer appended url, e.g. http://localhost/opencart/index.php?route=product/search&search=macbook i need find out why happens , how can move search field without losing functionality. suppose javascript related not sure how. to answer own question: yes, javascript related. since search input field not wrapped in , in order subm

linked data - "if" in a SPARQL query -

my problem simple: have source my:g1 contains: my:a1 my:b "literal 1" then have second source my:g2 contains: my:a2 my:b my:c. my:c rdfs:label "literal 2" how can set sparql query produces like: | ?a | ?b | ?literal | |-------|-------|-------------| | my:a1 | my:b | "literal 1" | | my:a2 | my:b | "literal 2" | ie. how can tell sparql use same variable both "literal 1" , "literal 2" : i'm looking like select ?a ?b ?literal { if (?g = my:g1) graph ?g { ?a ?b ?literal} else if (?g = my:g2) graph ?g { ?a ?b ?c. ?c rdfs:label ?literal} } note: know query horribly wrong, clarify intention edit: in specific case "union" statement select ?a ?b ?literal { { graph my:g1 { ?a ?b ?literal} } union { graph my:g2 { ?a ?b ?c. ?c rdfs:label ?literal} } } would work, not "real" case. there other solutions? you can use property path , filter. trick here proper

c# - Postgresql with Entity Framework 6 (database first approach) -

is possible use ef6 postgresql database using database first approach? found solution requires manually writing c# classes based on db structure unsatisfactory me. use sql server , choose server , database list, choose tables want use , voilà . what did installing npgsql . can add database in server explorer tab, when want create ado.net entity model can't find database in list.

JavaScript runs only last function -

i have following testing code: edit: var getit = function () { return this.x; }; var obj1 = { : getit, x : 11 }; var obj2 = { : getit, x : 12 }; obj1.get(); obj2.get(); obj1.get(); when run code, last function returns value of 11 . instead of seeing 3 values, see last one. if delete last line, see 12 why that? i believe running code in console or wouldn't seeing value @ all. default behavior of consoles display result of latest expression. if want values logged, can explicitly log individual expressions using console.log . console.log(obj1.get()); console.log(obj2.get()); obj1.get(); note code doesn't run, assumed did since haven't mentioned errors.

asp.net - I can't get my static class working with a Generic List -

i have static class needs pass generic list of strings function using integer index list in class. problem static class doesn't have list collect , don't have proper index access class in function passed to. class, calling code, , receiving function below. my class: public class querycontainer { public static querycontainer instance = new querycontainer(); private int _id; private string _query = ""; private int _searchid; public querycontainer() { } public string query { { if (instance != null) return instance._query; else return ""; } set { _query = value; _id =+ 1; } } public int id { { return _id; } } public int searchid { set { _searchid = value; } { return _searchid; } } } the calling code: public int getaccountsortbyaccountcode(int account) { int id = 0; querycontainer.i

ubuntu - Port 9000 not listed -

i using puphpet ubuntu/nginx/hhvm. everything works until restart virtual machine. after vagrant reload or halt/up 502 error. notice after 1 of mentioned actions port 9000 not listed. have restart hhvm service port started. how can make port (9000) listed @ virtual machine start? the hhvm getting started wiki page indicates solution this. (i think it's printed on console when apt-get install hhvm ): sudo update-rc.d hhvm defaults

android - How to filter the input of EditText? -

i want filter input of edittext , digits , letters allowed, first use textwatcher deal last input character, when move cursor or past content edittext , method failed, want know there way filter illegal input , give user feedback. add inputfilter edittext & provide toast user . this code snippet you. inputfilter filter = new inputfilter() { public charsequence filter(charsequence source, int start, int end, spanned dest, int dstart, int dend) { (int = start; < end; i++) { if (!character.isletterordigit(source.charat(i))) { // accept letter & digits ; otherwise return toast.maketext(context,"invalid input",toast.length_short).show(); return ""; } } return null; } }; edittext.setfilters(new inp

php - Search Using IN Condition in MySql -

i writing web services ios in cakephp , stuck in in condition. i have table dog_temperaments , has values "happy,dependent,shy" . now if ios send me array (happy,shy) search this select dog_temperaments.* temperaments in(happy,shy) its work fine if ios send me array 0 or any(means search temperament) how search........ any means search temperaments if 0 or any no need condition ishould return of them. so aassuming $type contain temperaments array , 0 / any single element case. if(count($type) == 1 && in_array(($type[0], array('0', 'any'))) { $condition = ""; } else { $condition = "where temperaments in ('" . implode("','", $type) . "')"; } and query - "select dog_temperaments.* dog_temperaments ".$condition

asp.net mvc - How to use Dependency Injection with a Controller -

i have below code work without issue mausercontroller.cs public class mausercontroller : apicontroller { ilogservice loggerservice; imauserservice _service; public mausercontroller(ilogservice loggerservice, imauserservice service) { this.loggerservice = loggerservice; this._service = service; } } dependencyinstaller.cs public class dependencyinstaller : iwindsorinstaller { public void install(iwindsorcontainer container, iconfigurationstore store) { container.register( component.for<ilogservice>().implementedby<logservice>().lifestyle.perwebrequest, component.for<idatabasefactory>().implementedby<databasefactory>().lifestyle.perwebrequest, component.for<iunitofwork>().implementedby<unitofwork>().lifestyle.perwebrequest, alltypes.fromthisassembly().basedon<ihttpcontroller>

javascript - jQuery callback function in callback function -

i want data store in var searchedusers, problem when alert(searchedusers); there nothing in it. if alert(searchedusers); under var user code. there in it. i assume because code runs before executed. guess have add callback function in there somewhere doesn't seem work errors. function addfriend() { var formdata = "name=" + $("#nameform").val() + "&familyname=" + $("#familyname").val() + "&emailaddress=" + $("#emailaddress").val(); var searchedusers = []; $.ajax({ type : "post", url : "controllerjavascript?action=addfriend", datatype : "xml", data : formdata, success : function(xml) { $(xml).find("user").each( function() { var user = $(this).find("name").text().trim() + " " + $(this).find

amazon web services - AWS Lambda subscribed to SNS topic doesn't process all messages to the topic -

i building alerting system powered amazon services. i drop file onto s3 daily spawns lambda function (let's call generator function) process file. generator builds alerts based on file , posts multiple messages sns topic (let's call outbox) - 1 message each recipient calculated generator. i have second lambda function (let's call courier) subscribed outbox should take each message , it. the generator code: // 'generator' function exports.handler = function (event, context) { console.log('reading options event:\n', util.inspect(event, {depth: 5})); var users = {}; var usersubscriptions = {}; var alerts = {}; var artists = {}; var tracks = {}; async.waterfall([ function downloadsubscribersfile (next) { // stuff }, function downloadandformatactionsfile (next) { // download data file , analyse }, function publishalerts (next) { // have alerts built, need mail them out var recipients = obj

c# - How to return DateTime.Today as a FieldNullValue in FileHelpers -

i'm trying set fieldnullvalue datetime variable in filehelpers class today value (so if when read .csv there no entry, defaults today's date). code i've tried is: [fieldoptional] [fieldnullvalue(datetime.today)] public datetime date; however error "error 1 attribute argument must constant expression, typeof expression or array creation expression of attribute parameter type". please can explain i'm doing wrong? the obvious approach [fieldoptional] [fieldnullvalue(typeof(datetime), datetime.today.tostring("m-dd-yyyy"))] public datetime date; but seems fieldnullvalueattribute unable evaluate expressions case datetime.today.tostring() , way go hardcode fixed date string (not want in our code): [fieldoptional] [fieldnullvalue(typeof(datetime), "5/15/2015")] public datetime date;

java - Getters and setters in abstract class? -

i'm working on game in java , have problem using setters , getters abstract class. let's class looks this: public abstract class objects { protected int velx, vely; public objects(int velx, int vely){ this.velx = velx; this.vely = vely; } //getters, setters , other methods } now, if want use these methods in class not extend abstract class objects, not work properly. game run throws nullpointerexception when tries execute part of code getters , setters. example: public class hud { private objects o; public hud(......) public void somemethod(){ if (o.getvelx > 0){ o.setvely(3); } } } this bad example, if ran throw nullpointerexception. have initialize class objects in different way? i order use o , must initialize reference instance of concrete class extends objects abstract class. otherwise o remains null, , call o.something throws nullpointerexception . has nothing setters

android - gradle placeholder can not solve the ${com.nssb.zssb} -

gradle placeholder support problem : my placeholder looks ${com.nssb.zssb} how can gradle deal situation, tried following command: manifestplaceholders = [com.nssb.zssb:"djdssb"] but didnt worked. suggestion? many thanks~~~~~ my mainifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="differentbuild.com.mike.differentbuild" > <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="${com.nssb.zssb}" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="${com.nssb.zssb}" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:

javascript - Better way to find object in array instead of looping? -

example link: http://jsfiddle.net/ewbgt/ var test = [{ "name": "john doo" }, { "name": "foo bar" }] var find = 'john doo' console.log(test.indexof(find)) // output: -1 console.log(test[find]) // output: undefined $.each(test, function(index, object) { if(test[index].name === find) console.log(test[index]) // problem: way slow }) problem in above example have array objects. need find object has name = 'john doo' my .each loop working, part executed 100 times , test contain lot more objects. think way slow. the indexof() won't work because cannot search name in object. question how can search object name = 'john doo' in current array? jquery $.grep (or other filtering function) not optimal solution. the $.grep function loop through all elements of array, if searched object has been found during loop. from jquery grep documentation : the $.grep() method re

java - ActiveMQ configuration with Spring Boot -

i use activemq embedded spring boot. seems broker created trough activemqconnectionfactory. understand way configure broker set parameters in query broker. described here : http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html i setup features dlq, it's in destinationpolicy attribute, attribute type not simple type complex type, how can write query parameter disable dlq, please ? good question. properties on vm-transport auto-broker creation great, point think have hit. my suggestion define broker configuration have done in xml , refer xml in uri. destination policies indeed complex structure , don't see how idea define them simple query params if possible. vm://localhost?brokerconfig=xbean:activemq.xml

Scheduled posting to Facebook in PHP cURL -

i have been trying post status @ scheduled date/time facebook using php curl. i using unix timestamp value parameter scheduled_publish_time , published=false . in facebook can see post being scheduled @ given time. but unfortunately nothing gets posted @ time , facebook still shows message "next post scheduled #time" after time has elapsed. code: <?php $facebook_page_id='xxx'; $facebook_page_access_token="xxx"; //facebook page post $status='scheduled post'; $fb_page_post="https://graph.facebook.com/{$facebook_page_id}/feeds?message=$status&scheduled_publish_time=1431683900&published=false&access_token=$facebook_page_access_token"; $ch=curl_init(); curl_setopt($ch, curlopt_url, $fb_page_post); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_referer, ''); curl_setopt($ch, curlopt_encoding, 'gzip,deflate'); curl_setopt($ch, curlopt_autoreferer, true); cur

How to get all the metrics via Metrics Servlet in JSON format (as in Web UI) from Apache Spark -

the apache spark web ui gives ton of useful information workers, driver, storage etc. metrics servlet gives few information. eg, following /metrics/json : { "version":"3.0.0", "gauges":{ "local-1431683138663.<driver>.blockmanager.disk.diskspaceused_mb":{ "value":0 }, "local-1431683138663.<driver>.blockmanager.memory.maxmem_mb":{ "value":3179 }, "local-1431683138663.<driver>.blockmanager.memory.memused_mb":{ "value":169 }, "local-1431683138663.<driver>.blockmanager.memory.remainingmem_mb":{ "value":3009 }, "local-1431683138663.<driver>.dagscheduler.job.activejobs":{ "value":1 }, "local-1431683138663.<driver>.dagscheduler.job.alljobs":{ "value":1 }, "local-1431683138663.<driver>.dagscheduler.stage.

java - Adding and Calling a JSP to a Running WebApplication -

not sure if possible or not once webapp running, possible add new jsp webcontent folder, , assuming know name of newly added jsp make requst new jsp? edit: adding more details we have java batch application generate jsp files embeded java scriplets e.g."<% person.getname() %>". want able run these jsp within web container populate javacode. the problem these jsp files generated externally webapplication , cannont restart webapp everytime new jsp produced. as webapp running after deploy project in server, change made while webapp running won't affect project until deploy project again.

ios8 - iOS 8 custom alarm using uilocalnotification and playing sound in background when phone is on silent -

i trying build custom alarm application. challenge facing getting sound played while app in background. first method, uilocalnotification , according apple programming guidelines, right way make alarm is - (void)schedulealarmfordate:(nsdate*)thedate { uiapplication* app = [uiapplication sharedapplication]; nsarray* oldnotifications = [app scheduledlocalnotifications]; // clear out old notification before scheduling new one. if ([oldnotifications count] > 0) [app cancelalllocalnotifications]; // create new notification. uilocalnotification* alarm = [[uilocalnotification alloc] init]; if (alarm) { alarm.firedate = thedate; alarm.timezone = [nstimezone defaulttimezone]; alarm.repeatinterval = 0; alarm.soundname = @"alarmsound.caf"; alarm.alertbody = @"time wake up!"; [app schedulelocalnotification:alarm]; } } problem is, if user has phone on silent, noti

crystal reports page footer not showing on the first page if no page header -

i have several crystal reports (2008) , layout want on first page contains report header (summary graph of data) , page footer (text-box , number). works fine on 3 reports. there report not working. i have positioned in report same elements of same sizes , of same positions in other reports. page setup same in of them. when problematic report have same report header size (18,75cm), in other reports leaves space footer, footer not showing. when decrease size of report header-section 17cm page header pops there footer. can guessed, don't want page header appear in bottom of first page... not in other reports. what makes crystal "think" page header should displayed before showing page footer?

How to use / where to find Haskell API? -

is documentation should use learning various haskell functions: https://www.haskell.org/platform/doc/2013.2.0.0/ghc-api/ghc.html ? can search here or other haskell doc how each type should used? example if wanted learn more int type (without tying :t on command line) can searched upon ? if above api seems more minimalist java/scala api. perhaps 1 of strong points of haskell provide succinct, yet powerful set of base functions build abstractions upon ? ghc-api api interacting ghc compiler. "standard library" documented @ http://hackage.haskell.org/package/base .

Android Twitter conversion tracking through MoPub SDK issue -

i integrated twitter conversion tracking through mopub sdk , integrated fabric sdk through eclipse. facing issue not track app. i added new mopubconversiontracker().reportappopen(this); in oncreate() method. and added api key in manifest file this <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="io.fabric.apikey" android:value="api-key" /> <activity android:name="com.mopub.mobileads.mopubactivity" android:configchanges="keyboardhidden|orientation|screensize" /> <activity android:name="com.mopub.mobileads.mraidactivity" android:configchanges="keyboardhidden|orientation|screensize" /> <activity android:name="com.mopub.common.mopubbrowser" android:configchanges="keyboar

python - Replace for-loop across week with list comprehension -

how replace following for loops more efficient list comprehension or similar? numpy , pandas not option not installed on client system, perhaps itertools useful? n_day_cells = 24*60/240 week_matrix = list() in range(7): j in range(n_day_cells): week_matrix.append([i,j,0]) edit: sorry, should perhaps have been bit more specific. i'm on python 2.7 no other packages "core" packages such itertools . code needs run ~1m-1b times in script. you can using: week_matrix = [[i,j,0] in range(7) j in range(n_day_cells)] in case ranges bigger , on python2, might want use xrange instead of range iterator. if bent on saving more time, use xrange, , create list of tuples instead of list of lists (all examples in python2): in [3]: %timeit [[i,j,0] in range(7) j in range(n_day_cells)] 100000 loops, best of 3: 6.51 µs per loop in [4]: %timeit [(i,j,0) in range(7) j in range(n_day_cells)] 100000 loops, best of 3: 4.6 µs per loop in [5

javascript - Html image hotspot switch image -

i have image hotspot on map swops image out on hover keep image open longer , have close (and change original) if users moves cursor outside of new swapped image outline instead of original hotspot, possible? herewith code far <div class="mapwrap" style="text-align:center;"><img src="/dev/test/templates/jwd25template/images/map-blank.png" alt="wc" name="map" width="700" height="400" usemap="#mapmap" id="map" border="0" ></div> <map name="mapmap"> <area shape="poly" coords="231,299,236,309,239,314,242,324,242,333,241,340,237,342,232,342,232,346,236,348,239,352,242,359,244,360,246,363,249,371,245,374,243,378,244,379,252,373,253,375,255,378,255,380,260,382,260,381,266,384,269,387,272,389,275,390,276,390,279,390,287,386,288,383,293,381,298,380,303,379,306,379,307,380,310,380,314,378,317,378,320,378,322,376,325,374,330,372,337,370,3

android - why Bitmap convert to byte[] will cause size increase? -

i have funtion compress bitmap below 32k. when got returned bitmap, converted byte[], size increased. code demo below, output : before: 30 after: 85 did use bitmap in wrong way? bytearrayoutputstream baos = new bytearrayoutputstream(); image.compress(bitmap.compressformat.jpeg, 100, baos); int options = 100; while (baos.tobytearray().length / 1024 > 31 && (count++ < 8)) { // compress below 32k baos.reset(); options -= 10; image.compress(bitmap.compressformat.jpeg, options, baos); } bytearrayinputstream isbm = new bytearrayinputstream(baos.tobytearray()); bitmap bitmap = bitmapfactory.decodestream(isbm, null, null); ll.d("before: " + (baos.tobytearray().length/1024)); // here return bitmap; bytearrayoutputstream output = new bytearrayoutputstream(); bitmap.compress(bitmap.compressformat.jpeg, 100, output); ll.d("after: " + (output.tobytearray().length/1024));

android - onActivityResult data always returns null inside fragment -

gallery.class import android.content.intent; import android.os.bundle; import android.support.v4.app.fragment; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.relativelayout; public class gallery extends fragment { private static final int pick_from_gallery = 1; relativelayout gallerylayout; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view v = inflater.inflate(r.layout.mainfragment, container, false); gallerylayout = (relativelayout) v.findviewbyid(r.id.gallery_layout); gallerylayout.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { firegallery(); } }); return v; } private void firegallery() { intent intent = new intent(); intent.settype("image/*"); intent.pu

php - Get values from javascript slider -

i want use bootstrap price range slider in shop, don't know how value php. have code in bootstrap-slider.js file: $(function() { $("#pricelimit") .slider({}) .on('slide', function() { $('#output').html(this.value); }).trigger('slide'); }); and have code in html file: <script> var slidervalue = ...... </script> <?php $slidervalue="<script>document.writeln(slidervalue);</script>"; ?> what have put after 'var slidervalue' value slider? <script> var slidervalue = $('#output').val(); </script> that should work, assume value stored in id output, right ? if not working - can please provide html , js in codepen, jsbin ?

Android Layout textview (Margin/padding) issue in Samsung Galaxy S3 Version 4.3 -

Image
its kind of chat screen, textview contains image(9-patch image) background drawable. devices working perfectly. please refer image: problem encountered in android 4.3 in samsung s3, image(9-patch) unable take margin or padding textview. background image not getting stretch give margin. please refer image : i have tried margin doesn't reflect in android 4.3. device specific or android 4.3 bug? how can solve this? when using 9-patch image background don't have set margin/padding inner view. content area of 9-patch defined in right , bottom 1 pixel stripe. yours image has content area set on of , results in behavior reffered in question. try image correctly set content area:

ember.js - Obtaining component elementId in parent template -

i obtain component auto-generated elementid in parent template, e.g. <script type="text/x-handlebars" data-template-name="index"> my-component elementid: {{mycomponentelementid}} {{my-component}} </script> is there simple way without altering parent controller or my-component ? elementid being generated during initialization of component. can sure id set after component inserted dom. therefore, can use didinsertelement action this: some-example elementid: {{mycomponentelementid}} {{some-example elementidproxy=mycomponentelementid}} didinsertelement: function() { this.set("elementidproxy", this.get("elementid")); } thus, proxy elementid via other binding ( elementidproxy in situation). recommend not set id explicitly, must unique within app. ember takes care that, it's not idea reinvent wheel. fully working example in jsbin here

php - XAMPP Apache Virtual host on NAS -

i tried create virtual host local xampp apache (windows7) no luck. tried: hosts contains: 127.0.0.5 mycloud httpd-vhosts.conf contains: <virtualhost 127.0.0.5:80> documentroot \\wdmycloud\user servername mycloud directoryindex index.html index.php <directory "\\wdmycloud\user"> options indexes followsymlinks includes execcgi order allow,deny allow allowoverride require granted </directory> </virtualhost> apache runs service local user, not system. 'user' in directory has same password on local machine , nas. includes index.html. i tried lot of different variations, apache won't start. configuration apache starts eror log shows following: [fri may 15 08:51:49.224900 2015] [authz_core:error] [pid 12280:tid 1720] [client 127.0.0.1:53075] ah01630: client denied server configuration: c:/wdmycloud the network drive must have letter z: , not c:. can help? thanks.

android - Writing a driver i2c for MPC6050 -

i'm new in c, , try write driver mpc6050 accelerometer. (kernel 3.4 android 4.2.2). following of question . this page , one helped me, can't use driver yet: arch/arm/mach-sun7i/core.c:77:44: warning: ‘sun7i_i2c_platform_data’ defined not used [-wunused-variable] arch/arm/mach-sun7i/core.c:136:41: warning: ‘sun7i_i2c_platform_device’ defined not used [-wunused-variable] i'm working on /android/lichee/linux-3.4/arch/arm/mach-sun7i/core.c file. (the equivalent of board-machine.c) i have pasted struct of each structure base. init functions are, hope ok, this: /* accelerometer*/ #include <linux/i2c-gpio.h> #include <linux/mpu.h> #include <linux/i2c.h> #include <mach/i2c.h> #include <mach/gpio.h> #define i2c_sda twi_lcr_sda_en #define i2c_scl twi_lcr_scl_en /* * /////////// linux/i2c-gpio.h ////////// * struct i2c_gpio_platform_data { unsigned int sda_pin; unsigned int scl_pin; int udelay;

php - SQL SELECT query not working - unable to find error -

the following select query search keyword 'law' multiple tables tbl_books , tbl_author , tbl_books_subject select * tbl_books p, tbl_books_author d, tbl_books_subject m p.title = 'law' or d.author = 'law' or m.subject = 'law' limit 0,30 this query giving error. please me it. you can achieve in single query need have foreign key in other tables. here check code below. select b.*, ba.*, bs.* tbl_books b full outer join tbl_books_author ba on ba.book_id=b.id full outer join tbl_books_subject bs on bs.book_id=b.id b.title 'law' or ba.author 'law' or bs.subject 'law' limit 0, 30; look @ query can see have used tbl_books.id make joins should in other tables identify particular records. hope helped you.

android - Is it possible to show the preview of the activity in another activity as a scrollable preview? -

i have long scroll view contains text views,edit texts,radio buttons,check boxes,sliders etc.. want show preview of scroll view , contents whatever user had entered , should non editable. there possibility in android can this?. i have 2 suggestions 1.disabling scroll view entering inputs , 2.showing preview of scroll view. is there possibilities of these 2 or else other methods achieve in android. need help, in advance.. this method helped disable views. private static void setviewandchildrenenabled(view view, boolean enabled) { view.setenabled(enabled); if (view instanceof viewgroup) { viewgroup viewgroup = (viewgroup) view; (int = 0; < viewgroup.getchildcount(); i++) { view child = viewgroup.getchildat(i); setviewandchildrenenabled(child, enabled); } } } hope 1 else. check this

sql - Sqlite: Get Modal/Mode from two related columns -

this extract table games: id wuser buser 1 ddyer bdot 2 ddyer ronaldinho 3 bluedog ronaldinho 4 ronaldinho bluedog 5 bluedog ronaldinho 6 ddyer bobc 7 bobc ddyer the table database website boardspace.net in people play board games. in database wuser , buser white , black players, , id game played. want know players played most. white players: select wuser, count(wuser) game group wuser order count(wuser) desc; result is: wuser count(wuser) dumbot 75926 guest 22541 image13 1594 drraven 1460 eucalyx 1147 loizz 963 then have same black players: select buser, count(buser) game group buser order count(buser) desc; buser count(buser) dumbot 59489 guest 29324 eucalyx 1007 image13 756 drraven 746 loizz 715 alexis 660 i can sum manually did below, how result single sql statement: user count(as both buser , wuser) dumbot 135412 guest 51865 image13 2350 drraven 2206

ruby - Rails Gemfile Clarification -

so despite fact i've created 3 rails apps of increasing complexity on own. haven't deployed of them. decided tonight create app (well redoing older app new things i've learned) , hit me. i don't understand gemfile, second guess myself quite bit. seems obvious , straightforward, yet here on stackoverflow asking clarification or @ least ease second guessing. my understanding of gemfile follows. default gems gems persist across environments (test, dev, , production), test gems live in test environment, dev gems in development environment, , production gems in production environment. up point i've kinda been throwing of gems in default, want correct before make habit. using rails' built in testing (i know, boo, hiss) , use minitest reporters, guard minitest , minit backtrace helpers. i'm told best practice put them , gem related testing in obvious test environment. don't think i've ever setup test db, less used test environment. why wouldn

Ruby longest palindrome - why does a slight modification in a while loop break my code? -

i'm trying solve ruby problem , can't figure out why having minor while loop difference renders 1 test false: longest_palindrome("abba") outputs "bb" instead of "abba", false. can solve , while loops, please no advanced methods. it's easier highlight difference in code block (first 1 working solution, second mine. assume palindrome? method defined): def longest_palindrome(string) best_palindrome = nil idx1 = 0 ***while idx1 < string.length length = 1 while (idx1 + length) <= string.length substring = string.slice(idx1, length)*** if palindrome?(substring) && (best_palindrome == nil || substring.length > best_palindrome.length) best_palindrome = substring end length += 1 end idx1 += 1 end return best_palindrome end def longest_palindrome(string) longest = nil = 0 ***while < string.length i2 = 1 while i2 < string.length*** if palin

unity3d - Revmob Unity : Banner ads not clickable -

i developing game required show revmob banner ads. i can show banner ads, can't not click on it. it's media id testing mode. my code below. private revmob rev mob; void awake() { revmob = revmob.start(revmob_app_ids, "revmob"); } void start() { revmob.createbanner(revmob.position.bottom); revmob.showbanner(revmob.position.bottom); } please me. try adding following line in androidmanifest.xml file within activity tags unityplayernativeactivity <meta-data android:name="unityplayer.forwardnativeeventstodalvik" android:value="true" /> example <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:largeheap="true"> <activity android:name="com.unity3d.player.unityplayernativeactivity" android:label="@string/app_name" android:screenorientation="portrait" and