Posts

Showing posts from April, 2015

ios6 - Can I support iOS 6 and iOS 7 at the same time? -

we have agreement our customers support current version plus 1 back. cannot drop ios 6 until ios 8 released. is possible use ios 7 enhancements , still support 6. love deploy 2 version of app or have runtime conditionals, however, not see how possible. you could. mean not knowing if it's possible? have wrap bunch of code in if() statements or preprocessor macros determine api availability, , maybe include corresponding xibs each version if necessary. people have been supporting previous ios versions long time. also want add, devices support ios6 support ios7. there minimal reason not add support ios7 fear of losing ios6 customers. ios5 capable devices can run ios6 well. ipad1 stuck on ios5, know. commenter stated 3gs , 4th gen ipod don't ios7. so really, it's not big deal drop support ios6 when 7 comes out, if targeting 6 anyway. you'll piss off jailbreakers , other people have use ota updates on 7.

python - pandas looks for scikits.statsmodels instead of statsmodels -

i have: statsmodels 0.5.0 (formally known scikits.statsmodels) pandas 0.12.0. (all installed source) i error: file "/home/username/.local/python27/lib/python2.7/site-packages/pandas-0.12.0-py2.7-linux-x86_64.egg/pandas/stats/ols.py", line 53, in __init__ import scikits.statsmodels.api sm importerror: no module named scikits.statsmodels.api why pandas still looking scikits.statsmodels? should install old version of scikits.statsmodels parallel statsmodels 0.5.0? version 0.12 first tries import statsmodels library , if fails, pandas fall scikits module. here piece of code tries that: try: import statsmodels.api sm except importerror: import scikits.statsmodels.api sm if type in interpreter: import statsmodels.api sm what error get?

compilation - Modules of Qt 5.1 and their interdependency? -

i looking way create minimal static build of qt 5.1. minimal, mean build basic set of widget classes available (including 2d graphics acceleration through opengl canvas/widget). aiming static build on windows 7 32-bit using mingw-builds gcc 4.8.1 bundle of msys , tools. i have downloaded entire source tree, , have met problems compiling due dependency of packages such openssl , icu (the latest openssl did not compile). wanted see, if avoid dependencies of these packages and, @ same time, achieve minimal static build of qt 5.1 final executable not gigantic in size. i took @ list: http://download.qt-project.org/official_releases/qt/5.1/5.1.0/submodules/ . q1 : of these modules, need select have basic qt build without fancy stuff? q2 : these modules interdependent on each other in way (i assume dependent on "qtbase")? q3 : use names list, (for example: "qtxmlpatterns", "qtx11extras", "qtwebkit", etc.), deselect them in configuratio

c# - Multi-dimension IReadOnlyDictionary typed using an interface for the inner value type -

this little tricky put words, i'll explain example. following code not compile: var data = new[] { new {item = "abc", values = new[] {1,2,3}}, new {item = "def", values = new[] {1,2,3}}}; ireadonlydictionary<string, ireadonlydictionary<guid, int>> target; target = new readonlydictionary<string, ireadonlydictionary<guid, int>>( data.todictionary( => i.item, v => new readonlydictionary<guid, int>( v.values.todictionary( => guid.newguid(), b => b)))); the error is: the best overloaded method match 'readonlydictionary<string,ireadonlydictionary<guid,int>> .readonlydictionary(idictionary<string,ireadonlydictionary<system.guid,int>>)' has invalid arguments yet if declare target using class instead of interface inner values, compiles: ireadonlydictionary<string, reado

c# - Using SQL "In" instead of "Like" using %wildcards% in Linq -

if search within description field using linq receive different results when searching these 2 queries. first %module%allen bradley% , second query %allen bradley%module% . these search queries give me result these words appear in place of description field. i read sql using like searches pattern in string in correct order, instance searching %module%allen bradley% force result in particular order within string. using keyword "in" searches wildcards anywhere within string. how achieve in linq? this linq method: public list<item> searchitems(string itemid, string description) { return (from allitems in _dbc.items sqlmethods.like(allitems.number, itemid) && sqlmethods.like(allitems.description, description) select allitems); } you can create query in more 1 line , execute using tolist() method: public list<item> searchitems(string itemid, string description) {

javascript - Onclick Image open/popup file field -

i have file field in form. field looks odd. want make image. click on image , opens file field(choose file). give me best solution. browsers support. this should : html code <label class="filebutton"> browse file! <span><input type="file" id="myfile" name="myfile"></span> </label> css styles label.filebutton { width:120px; height:40px; overflow:hidden; position:relative; background-color:#ccc; } label span input { z-index: 999; line-height: 0; font-size: 50px; position: absolute; top: -2px; left: -700px; opacity: 0; filter: alpha(opacity = 0); -ms-filter: "alpha(opacity=0)"; cursor: pointer; _cursor: hand; margin: 0; padding:0; }

Python code to cause a backspace keystroke? -

i keep finding ways map backspace key differently, that's not i'm after. i'm in program writing python code, , want write line of code causes program think hit backspace key in gui (as backspace key deletes something) how code in backspace key stroke? the character backspace '\b' sounds want affect gui. if program changes gui, delete last character active input field.

consistency - cassandra replica exception HUnavailableException -

i have cassandra 2 datacenter pair single replication each datacenter containing single node , each datacenter located on separate physical servers on network. if 1 datacenter crashes, other 1 continue available reads , writes started java application, on 3rd server, , running ok. it's reading , writing cassandra. next disconnected, pulled network cable, 2nd datacenter server network. expected application continue running no exceptions against 1st datacenter, not case. the following exception started occur in application: me.prettyprint.hector.api.exceptions.hunavailableexception: : may not enough replicas present handle consistency level. @ me.prettyprint.cassandra.service.exceptionstranslatorimpl.translate(exceptionstranslatorimpl.java:60) @ me.prettyprint.cassandra.service.keyspaceserviceimpl$9.execute(keyspaceserviceimpl.java:354) @ me.prettyprint.cassandra.service.keyspaceserviceimpl$9.execute(keyspaceserviceimpl.java:343) @ me.pret

how to make java program detect changes to a file? -

i have program reads , displays colour in jlabel , based on input supplied input.txt file. doubt that, program able read updates supplied input.txt file? the input.txt file supplied linux keeps updating o/p either 0 or 1. 0 - display red. 1 - display green. i able read & display output. if input changed means manual/auto program needs restart display change in input. what need implement file watcher warns changes in files, here oracle's documentation how directory: http://docs.oracle.com/javase/tutorial/essential/io/notification.html .

jquery - How can I programmatically set the time value in the Anytime datetimepicker widget? -

Image
i think anytime datetimepicker widget cat's meow (or rolls royce's roar ( why key elements of anytime jquery plugin blending in background/invisiblized? )), i implement way: html <label for="begindatetime" class="staticlabel">begin date range</label> <input id="begindatetime" name="begindatetime" required="true" /> jquery anytime.picker("begindatetime"); var d8 = new date(); d8.sethours(0); d8.setminutes(0); d8.setseconds(0); $('#begindatetime').val(d8); ...but, although setting time zilch/midnight works (sort of) @ first: (actually, want date , time, not gmt jazz, etc.) ...when mash input element invoke/drop down anytime widget, forgets set zilch, , over[rid,writ]es current time: how can anytime widget preserve value assign when dropped down (until when , if user changes explicitly, of course)? update i tried this: $( "#begindatetime" ).click(functio

Python: `choice()` selecting the same choice -

i attempting write simple math expression generator. problem having achieving expression random numbers selected within range, , inserting random operator between each number. here's have far: from random import randint random import choice lower = int(raw_input("enter lower integer constraint: ")) higher = int(raw_input("enter higher integer constraint: ")) def gen_randoms(lower, higher): integers = list() x in xrange(4): rand_int = randint(lower, higher) integers.append(rand_int) return integers def gen_equations(integers): nums = map(str, integers) print nums operators = ['*', '+', '-'] equation = 'num op num op num op num' equation = equation.replace('op', choice(operators)) equation = equation.replace('num', choice(nums)) print equation nums = gen_randoms(lower, higher) gen_equations(nums) the problem here output repeat operator choice , ran

mysql - Query taking very long the first time it runs -

Image
my website has serious issues during peak visit times. after doing troubleshooting have figured out problem database. i have main query runs on index retrieves table of data. on busy day site takes between 30 , 45 seconds load first time every time after loads 5 minutes after slows down again , site goes down due load. i tested query directly on database , performs same. would more query or mysql config? it works fine small return result on busy day when lists big slows down , kills site. edit: thank suggestions. i have reworked query , did ammendments db because of names not sensible. after suggestions have modified query remove wildcard searches , redundant requests table no longer necessary. here query itself: select g.id, g.`name`, g.scores, g.sportfk, g.`desc`, g.`date`, s.id streamid games g left join streams s on s.gamefk = g.id (g.date >= '" . $date . "' , g.date <= '" . $new

java: static methods and inheritance. Is there a way around this? -

i have following problem: there's engine invokes static method of superclass (which call superclass.staticmethod). have no access code of engine can reflect on it. i subclassed superclass (generating subclass) , able edit private fields inherited superclass through reflection. ok point. the engine has class (let's call constants) has static final instances of lot of classes, including superclass, not subclass, since it's not part of engine. now, superclass.staticmethod equivalent of this: public int staticmethod(int i) { if(i == 0) return constants.superclassinstance.field_1; else if(i == 1) return constants.superclassinstance.field_2; } both superclass.field_1 , superclass.field_2 private (and not static, people thinking were, i'm editing question bit), static method has visibility of them because it's member of superclass. said, able set values of fields on inherited subclass through reflection, because of way supperclass.st

xamarin - How to create const and variables in Resource.designer.cs? -

why need write code: public const int mybutton = 2131034112; what other way create button (and other variables)? just confirm vote made daniel, if want add resources can access via resource.id.{controlname} or resource.layout.{layoutname or view name}, need add layout files project. layout files contain controls appears in app , you'll able use layoutinflater create views them. i this, in xamarin studio.. you'll need close resource.designer.cs file.. because you'll make changes.. , won't reflect in file.. immediately. when i'm doing monodroid work.. frustrated how have close , re-open file controls or layouts working in intellisense.

java - No keyboard input working KeyAdapter -

i wrote application , wanted add keyboard input it. main class extends jpanel add keyadapter constructor. keyadapter new class called "inputadapter" extending keyadapter it's keypressed() , keyreleased() method. on click or release console should print string, e.g. here "test" i don't know why, console won't print text. also, when tell turn sprites visibility false nothing happens well. so guess keyadapter isn't working properly, take closer codelines? i guess issue has nothing other implemented classes wrote because when removing them, issue non working keyboard input remains. package com.ochs.game; public class game extends jpanel implements runnable{ private static final long serialversionuid = 1l; public static final int width = 320; public static final int height = 240; public static final int scale = 3; public boolean isrunning; public game() { addkeylistener(new inputadapter()); setfocusable(true); requestfocus();

javascript - JQuery .append of a </select> tag ignored -

this question has answer here: weird insert problem jquery 2 answers i have following html: <div id='show-label'> <select id="comboboxshowlabel"> <option value="">hide or show labels?</option> <option value="show labels">show label</option> <option value="hide labels">hide label</option> </select> </div> i want add the <select></select> parent div @ runtime, ala: <div id='show-label'> </div> $("#show-label").html("<select id='comboboxshowlabel'>") .append("<option value=''>hide or show labels?</option>") .append("<option value='show labels'>show label</option>") .append("

c# - StringBuilder: AppendFormat and Capacity -

in code try appendformat message length bigger string builder's capacity: static void main(string[] args) { stringbuilder sb = new stringbuilder(10); sb.appendformat("1234567890123"); // 13 characters console.writeline(sb.capacity); } do know should output (answer @ bottom)? okay, let's try change code , init stringbuilder capacity, still less string length, example 12: static void main(string[] args) { stringbuilder sb = new stringbuilder(12); sb.appendformat("1234567890123"); // 13 characters console.writeline(sb.capacity); } so, question is: appendformat double start capacity of stringbuilder if string couldn't appened? if appended string's length should 24 characters, capacity become 48 ? output code: 20 & 24 does appendformat double start capacity of stringbuilder if string couldn't appended? yes -- see here . whenever appen

how to decrypt a large file in java / android -

main i looking way encrypt file , decrypt on android device. best solution was: encrypt file openssl decrypt in java using method shown here . problem: file apparently large (5 mb) , 'out of memory' exception when running on android emulator. additional i thankful if add following answer, though if have answer previous section fine: compression: using zip archive compress encrypted file. has minor effect (20% compression on encrypted file vs 80% on non encrypted version of file). there better way this? encryption method: able compress file using standard linux commands i.e. openssl aes-256-cbc -a -salt -in password.txt -out password.txt.enc fast on secure: prefer fast decryption method, on cost of being not secure method. your main issue you're trying keep in memory (obviously). i'd recommend changes in workflow: get rid of base64-encoding files. there multiple issues that, 1 files larger need be, 1 other need decode encoding (which reduce

c# - Which is beginner friendly Linq to sql or Entity framework? -

i have started learning asp .net web forms, have knowledge of web development have done few todolist , blog type pet projects php , have created simple crud in codeigniter. wondering learn , easy beginner grasp linq sql or entity framework ? wanted learn faster , create have in mind startup project. have 1 month learn database layer , 15 days at-least master basic crud of .net rest 1 moth spent on learning asp's stuff , ajax. few suggesting me first learn ado.net ? maybe i'm messed these technologies because of lack of knowledge in .net field. first of all, it's worth noting there 3 approaches can taken entity framework: model first code first database first while may incorrect in assumption, experience has been model first has lost quite bit of popularity, boiling down 2 options. said, fact there more 1 way "skin entity framework cat" means adding inherent complexity. second of all, entity framework incredibly powerful. true orm incredibl

matlab - Interpolation through fourier space padding -

i tried implement on matlab simple example of interpolation method using zéro padding in fourier domain. not able work properly, have small frequency shift, barely not visible in fourier space, thay generates huge error in time space. as zéro padding in fourier space seems common (and fast) interpolation method, assume there missing: here matlab code: clc; clear all; close all; fe = 3250; te = 1/fe; nech = 100; f1 = 500; f2 = 1000; fmax = 1500; time = [0:te:(nech-1)*te]; timediscrete = [1:1:nech]; frequency = (timediscrete/nech)*fe; signal = cos(2*pi*f1*(time))+cos(2*pi*f2*(time))+cos(2*pi*fmax*(time)); %compute fft spectrum=zeros(1,nech); k = timediscrete l = timediscrete spectrum(k) = spectrum(k) + signal(l)*exp(-2*pi*j*l*k/nech); end end %compute de inverse fft reconstruction=zeros(1,nech); k = timediscrete l = timediscrete reconstruction(k) = reconstruction(k) + spectrum(l)*exp(2*pi*j*l*k/nech); end end reconstruction=reconstruction/

javascript - When is it appropriate to use a directive scope without its own controller? -

my understanding directives should concerned dom interaction , templating. setting application logic related $scope responsibility of controllers instead. yet angular allows create scope directive itself, such { scope: true } . if this, when supposed initialize in controller constructor -- in post-link function? seems inappropriate use of directive, since it's not concerned dom. when it appropriate use angular directive scope instead of creating controller must used directive instead? yet angular allows create scope directive itself, such { scope: true }. if this, when supposed initialize in controller constructor -- in post-link function? seems inappropriate use of directive, since it's not concerned dom. a directive can have own controller, defined controller option. controller has same function application controller: provide behavior directive. said, think correct place initialize scope directive's controller, not link function. i thin

javascript - Lightbox 2 Image Title Not Always Showing -

i'm having slight issue on personal site i'm using lightbox 2. i'm able images , gallery , running no problem, in cases when click on picture links site titles not load. seems totally random, , not associated of pictures. show up, , other times not. the page happening on here . in second paragraph, first sentence, links images through words "hiker" "skier" "golfer" "traveller" , "adventurer". any on might causing appreciated. minor issue, frustrating me nonetheless. thanks, marcus

jquery length gives different values in chrome and firefox -

i have div id="gallery" , , 3 images within: <div id="gallery"> <a class="trigger" href="images/fulls/01.jpg"> <img class="thumb" src="images/thumbs/01.jpg"> </a> <a class="trigger" href="images/fulls/02.jpg"> <img class="thumb" src="images/thumbs/02.jpg"> </a> <a class="trigger" href="images/fulls/03.jpg"> <img class="thumb" src="images/thumbs/03.jpg"> </a> </div> so when $('#gallery img').length; value 3 in chrome, expected. but, in firefox value 51. opera, safari, , internet explorer give 3 also. here's fiddle link: http://jsfiddle.net/ncd9h/

php - Trouble with referencing a javascript variable using jquery -

i'm trying animate div element changes width. the problem want change width variable that's stored in .js file , i'm not sure how recognize it. my html code: <section style="width:100%; height:120px; clear:both;" > <section class="campaign_statistics" style="background-color:#efefef;"> <?php include('progress_chart.php'); ?> </section> </section> uses include php file contains: if ($blog_id == 9) echo ' <script> var percent = string(businessprogress.getpercent()); document.write(businessprogress.tostring()); </script> ' ; i defined variable percent referenced in jquery. .js file has object made stores variables , made getters info when needed. the tostring() method: this.tostring = function(){ var string = '<div class="campaign_progress" style="width:0%;"> <div class="campai

What is the frequency threshold for google cloud messaging throttling -

as https://developer.android.com/google/gcm/adv.html#throttling indicates , blockquote , optimize overall network efficiency , battery life of devices, gcm implements throttling of messages using token bucket scheme. messages throttled on per application , per collapse key basis (including non-collapsible messages). each application collapse key granted initial tokens, , new tokens granted periodically therefter. each token valid single message sent device. if application collapse key exhausts supply of available tokens, new messages buffered in pending queue until new tokens become available @ time of periodic grant. is there exact threshold or related data implying proper sending frequency?

ruby on rails 3 - Bxslider not working -

i'm implementing bxslider in rails app, i'm having trouble making work, far issue transition not working instead appear each 1 below other. can point me i'm missing? html: <!--bxslider--> <ul class="bxslider"> <li> <%= image_tag "header1.png" %> <div class="row text-center"> <div class="span10 offset1"> <h1>tittle one</h1><br /> <a class="btn-main" href="about.html">learn more</a> </div> </div> </li> <li> <%= image_tag "header2.png" %> <div class="row text-center"> <div class="span10 offset1"> <h1>tittle 2</h1><br /> <a class="btn-main" href="about.html">learn more</a> </div>

sql - soql query in salesforce -

aggregateresult[] groupedresultcall = [ select account_vod__c, count(id) call2_vod__c call_date_vod__c >= :quarterstartdate , call_date_vod__c <= :quarterenddate , account_type__c =: accstaticrec.account_type__c , territory_vod__c =: accstaticrec.territory__c , status_vod__c = 'submitted_vod' , (call_type_vod__c != 'call only' or call_type_vod__c != 'event only' or call_type_vod__c != 'event detail') , account_vod__c in :accidset

string - Reading the number of entries in a data file in C -

i trying write c program reads how many lines/entries there in set data file. have used code below , works fine (gotten from: what easiest way count newlines in ascii file? ) #include <stdio.h> int main() { file *correlations; correlations = fopen("correlations.dat","r"); int c; /* nb. int (not char) eof */ unsigned long newline_count = 0; /* count newline characters */ while ( (c=fgetc(correlations)) != eof ) { if ( c == '\n' ) newline_count++; } printf("%lu newline characters\n", newline_count); return 0; } but wondering if there way change bit if ( c == '\n' ) newline_count++; into else if data looks like 1.0 2.0 3.0 (with entry new line space entry space) instead of 1.0 2.0 3.0 how differentiate between character/string/integer , new line? tried %s didn't work.. trying out first on small file 3 entries, using big file later on have spaces be

forwarding - Procmail sends an extra email -

i use procmail forward 'from' gmail account /home/user/.procmailrc :0c * !^from_mailer * ^from: .*aaa | bbb | ccc.* ! ^x-loop: user@gmail\.com | formail -k -x "from:" -x "subject:" \ -i "to: user@gmail.com" \ -i "x-loop: user@gmail.com" :0 * ^from: .*aaa | bbb | ccc.* $default this works fine on server inbox 'undelivered' mail the mail system <"^x-loop:"@my-name-server.com> (expanded <"^x-loop:">): unknown user: "^x-loop:" how can avoid this? i've tried delete these mails. not best way. anyway not work. :0b * <"\^x-loop:"@my-name-server.com> /dev/null the recipe contains multiple syntax errors, bounce message comes because lack asterisk on 1 of condition lines, makes action line instead. the general syntax of procmail recipe is :0flags # "prelude", optional flags * condition # optional, can have 0 condi

Variable code in AJAX coding -

i found code fore ajax tutorial,and not familiar part of code there ajaxrequest.onreadystatechange = function(){ if(ajaxrequest.readystate == 4){ document.myform.time.value = ajaxrequest.responsetext; } } ajaxrequest.open("get", "pay.php", true); ajaxrequest.send(null); can please tell me above code means,are there variables,etc? aware pay.php php file reffers to,but first 3 line of coding mean? the xmlhttprequest object has property called readystate. status of server's response stored. response can processing, downloading or completed. each time readystate changes our onreadystatechange function executes. when property readystate 4 means response complete , can data. the function refers textbox named time,in form named myform"the value taken code in pay.php file.

How to change a rails controller default router from index to other? -

as know, if have userscontroller , when /users default /users/index . if want map /users /users/show , can do? (this can apply other controllers, not users.) you can modified file global.asax. there method named 'registerroutes',change 'index' in 'action=index' 'show'

Add a Foreign Key to an Existing Table that Contains what would be Invalid FK Values (MYSQL) -

i need add foreign key table exists , populated data contain invalid foreign key values. (mysql) i know there several questions along these lines, can't seem find answer scenario. table , data structure "gbltable" contains "org" field needs become fk of org table. org table has pk field called "number". currently, gbltable contains non-existent org numbers (ie. if org table has rows pks 1,2, , 3, gbltable might have rows org 4 or 5). while case, cannot apply constraint reference gbltable.org org.number. i believe best approach particular situation will set fk field in rows null before apply constraint. null valid gbltable.org value program, achieve acceptable outcome. what have far want set gbltable.org values null not match valid org.number. in pseudocode: set gbltable.org null gbltable.number 1 of following: ( select gbltable.numbers gbltable.org not match existing org.number ) in sql, error "you can't

Java Google App Engine with IntelliJ: Cannot Resolve taglib with uri "http://java.sun.com/jsp/jstl/core" -

i have experience google app engine in eclipse thought try intellij app development see better. have project using app engine sdk cant seem find jstl jar. know in eclipse did automatically without me having manually import jstl jars there way in intellij? thanks! it turns out tags working editor isn't showing inside editor, thanks!

jquery - Show footer if at bottom of page or page is short else hide -

check out jsfiddle see going on: http://jsfiddle.net/amp3rsand/edwhx/2/ if uncomment second .content div in article see footer hiding should un-hiding when bottom of page. trouble show footer when content shorter viewport when second .content div commented out. (ie. window.height > document.height right?) on actual website .content divs replaced different divs unique id's each page couldn't figure out how target them specifically. i'm doing correct way it? here code people don't want use jsfiddle reason: html <article> <div class="content"></div> <!-- <div class="content"></div> --> </article> <footer> <ul id="footerlinks"> <li><a href="#">home</a></li> <li><a href="#">contact</a></li> </ul> </footer> <div id=&q

Camel Multicast issue -

we using below configuration send file single source multiple remote destinations. <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:util="http://www.springframework.org/schema/util" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <routecontext id="gcgratesoutbound" xmlns="http://camel.apache.org/schema/spring"> <route id="gcgratesfileout">

json - How to implement offline mode on android -

we load lots of data json objects arrays in our application , handled while online. move kind of caching, how can implement off line mode android?, there external storage can write to?, there thousands of records. you use lrucache caching objects. here's example on how cache bitmaps example.

php codeigniter - var_dump shows array but return is null -

so, weird, have method called treetrunk runs parent child relationship , supposed return array if ids "branchpath" - method seems working fine var_dump in terminating condition shows proper array. if try call method returned array "null" - dont it.. model method: function treetrunk($id){//1st id in page id if($id == '0'){ var_dump($this->branchpath); //this shows perfect array return $this->branchpath; //this returns null } else{ $q = $this->getwhere(array('id'=>$id),null,null); array_push($this->branchpath, $q[0]['pageparent']); $this->treetrunk($q[0]['pageparent']); } } calling via controller: $d = $this->pages_mdl->treetrunk('150'); var_dump($d); // <- == null var_dump within method outputs "array(3) { [0]=> string(3) "148" [1]=> string(3) "146" [2]=> string(1) "0" } "

android - View Pager Current View Selection -

i using view pager in application have jump feature in application user can jump desired page selecting index of grid view. i have no idea method of view pager select desired page in tab host have method tabhost.setcurrenttab(tabindex); i need thing this try this: pager.setcurrentitem(integer.parseint(jumpto_et.gettext().tostring())-1); //pager view pager object , //jumpto_et edittext object getting page index navigate.

declaration - declare extern variable within a C function? -

i define variable in c file: int x , , know should use extern int x declare in other files if want use in other files. my question is: should declare in other files? outside of functions, // in file a.c: int x; // in file b.c: extern int x; void foo() { printf("%d\n", x); } within function(s) use it? // in file b.c: void foo() { extern int x; printf("%d\n", x); } my doubts are: which 1 correct?, or which preferred if both correct? both correct. which 1 preferred depend on scope of variable's use. if use in 1 function, declare in function. void foo() { extern int x; <--only used in function. printf("%d",x); } if used more 1 function in file, declare global value. extern int x; <-- used in more 1 function in file void foo() { printf("in func1 :%d",x); } void foo1() { printf("in func2 :%d",x); }

ios - how to trim or crop music from itunes library -

i grab music user's library audio music fingering. required 30 sec of each songs. how go ? not need save audio using it. ios audio trimming trim audio ios are above 2 links way go ? thanks reading , appreciated comments. cheers to access music user has in device library, use mpmediaitemcollection class . sample code on using (although old , not using arc) can found in apple docs in "add music" sample. i not sure audio player using, if seek particular point in song or audio file, can using currenttime property in avaudioplayer class, (noted in apple docs) . to implement this, simple as: youraudioplayer.currenttime = 60; this jump song 1 minute mark. not 100% sure on how before song plays, put in play ibaction, before starts playing: - (ibaction) playorpause: (id) sender { if (self.player.playing) { [self.button settitle: @"play" forstate: uicontrolstatehighlighted]; [self.button settitle: @"play"

java - Cannot cast object to hashmap -

my code: object res = stub.call(sessionid, "sale.list", "11111"); hashmap<string, string> map = (hashmap<string, string>) res; converting object hashmap got following exception, exception in thread "main" java.lang.classcastexception: [ljava.util.hashmap; cannot cast java.util.hashmap can me how retrieve object data? you can cast res hashmap if stub.call(sessionid, "sale.list", "11111") returns hashmap object. [ljava.lang.hashmap; indicates getting array of hashmap , not single hashmap.

C# Audio with SoundPlayer - Is that really all there is to it? -

i'm attempting teach myself audio programming in c# through online tutorials. i'm using wave files (*.wav) soundplayer. what confuses me this: why tutorials bother reading in , chopping wave file if we're going blindly feed soundplayer anyway ? i feel i'm missing gigantic conspiracy. trouble soundplayer simple, , need take more advanced control ?? thank in advance! fyi - tutorials i'm using are: http://www.codeproject.com/articles/7906/a-simple-c-wave-editor-part-1-background-and-analy http://blogs.msdn.com/b/dawate/archive/2009/06/24/intro-to-audio-programming-part-3-synthesizing-simple-wave-audio-using-c.aspx i'm not familiar soundplayer or c#, read audio files in parts avoid exhausting memory. allows start playback faster, since first part of file available in less time entire file.

c++ - QT Creator compile Non-QT project with VC++ -

Image
i'm trying use vc++ (from visual studio 2012) complile projects qt creator 2.8. try create non-qt project in qt creator see says "cmake build". after steps (name of project, version control...) shows message: i have kit detected: how can solve problem? have cmake 2.8.11.2 installed. know can use mingw, need both x32 , x64 compilers, c++11 support (, nullptr, auto , on). know, cmake can generate vs's project files me, if need compile them rather often? creating *.sln , opening in vs, , compilong needed platform seems bit irrational me. or maybe there compiler suits needs (x32, x64, c++11)? you can use vc's compiler cmake projects fine. use "nmake makefiles" generator , build project invoking nmake . further improvement (at least large projects) use jom , using generator "nmake makefiles jom".

objective c - UIButton is 0x0000 when reload TableView in ios -

i added uibutton each uitableview row when nedd reloaddata, uibutton 0x0000. can give me suggestions? much. used code: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { /*nsstring *cellidentifier = [nsstring stringwithformat:@"%d,%d",indexpath.section,indexpath.row]; // nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [_tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) {*/ nsstring *cellidentifier = [nsstring stringwithformat:@"%d,%d",indexpath.section,indexpath.row]; uitableviewcell *cell = [_tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier] autorelease]; uilabel *pricelabel = [[uilabel alloc] initwithframe:cgrectmake(80, 0, 80, 30)]; pricelabel.backgroundcolor = [

android - Rectangular Window For Face Detection -

am particularly new android. making application in want program launches camera takes image , rectangular window painted around face use detect face. here code: import android.app.activity; import android.content.context; import android.content.intent; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.graphics.pointf; import android.media.facedetector; import android.media.facedetector.face; import android.os.bundle; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.imageview; public class mainactivity extends activity { final int camera_pic_request = 0; private int imagewidth, imageheight; private int numberofface = 5; private facedetector myfacedetect; private facedetector.face[] myface; float myeyesdistance; int numberoffacedetected; bitmap thumbnail