Posts

Showing posts from February, 2015

android - Best way to deal with connection errors when connecting to web services -

i have android app sends , receives information vb.net web service. things great if there solid , fast internet connection otherwise, becomes shaky. the process goes this: 1. app sends information (such id) 2. web service returns information based on id (like name) 3. app updates database within based on info sent web service. the problem comes when internet connection weak. happens app still sends information information being received incomplete or connection timeout occurs; , app still goes step 3. the app shouldn't updating database because transaction either incomplete or errors. ideas on how should go this? i thinking of making sure transaction complete before updating db. web service sends sort of 'complete' signal tell app it's time update db. idea or there better way go this? as connection timeout issue way catch that? i've seen catch timeout there other alternatives better? if connection times out happens data sent , received? much obliged

interface builder - iOS reuse a series of multiple views via storyboard -

in app, have series of multiple view controllers, through user navigates sequentially enter , submit data (let's "overview", "details", "review input", example). now need reuse flow in different parts of app (e.g. user can create new data edit existing data). different articles (such this one) suggest isolating common parts own storyboard files reuse. however, strategies seem target single views instead of sequence of views. what best strategy sharing more complex flows, consist of multiple views?

c++ - TestStack White doesn't detect an SEHException -

i'm writing few tests managed/unmanaged winform application. of bugs occur in unmanaged part, , result in process terminating due unhandled system.runtime.interopservices.sehexception exception . when exception occurs, windows pops message box explaining error. unfortunately, neither ms test nor white recognize this. test finishes without sign of error, though can see message box pop right before test goes on , closes application. how can detect kind of exception? the message box result of default unhandled exception handling of winforms application. i ended looking after test has finished. if message box there, fail test.

JGit merge issue -

we have existing git repo, , tried merge 2 branches using jgit api. below mergeresult.tostring() output: merge of revisions c16c719c793767b0e062790c53f7d28523cabf57, 81212b869024e95088811c5f908890720a261152 base 0000000000000000000000000000000000000000 using strategy recursive resulted in: merged-not-committed. it seems jgit failed detect merge base 2 branches. however, if doing same merge directly using git command line, merge base exists. git merge-base --all c16c719c793767b0e062790c53f7d28523cabf57 81212b869024e95088811c5f908890720a261152 c16c719c793767b0e062790c53f7d28523cabf57 don't know went wrong?

jsp - EL expression not evaluated -

here test servlet ; public class eventlistservlet extends javax.servlet.http.httpservlet { protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { process(request, response); } protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { process(request, response); } private void process(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { request.setattribute("name", "test1"); request.getrequestdispatcher("index.jsp").forward(request, response); } } and test jsp ; <html> <body> <h2>hello world!</h2> <p>${name}</p> </body> </html> and output ${name} it should write test1 :/ what's wrong ??? earlier versions of jsp disable el default. see: http://docs.oracle.com/c

java - When making a class to hold variables should the variables always be static? -

say wanted make class hold set of integers accessed multiple other classes , instances. don't want them reverting value had when code compiled. mean have static, in order keep them going original value? example the original stats holding class here: public class stats() { public static int numone = 0; public static int numtwo = 5; public static int numthree = 3 //etc... } it called on in 2 places. here: public class exampleclass() { private stats stats = new stats(); stats.numone += 5; //more variable changes. } also here: public class exampleclasstwo() { private stats stats = new stats(); stats.numone -= 3; //more variable changes. } will these calls reset variables original class value if variables not static? if so, mean should static? no, variables maintain state without static modifier

Java: printing or returning the name of a newly instantiated object in toString -

i typed on may have syntax errors, asked height, length, , name of object in tostring line. i'm getting height , length fine, don't know how name (rec1 , rec2) tostring. public static void main (string[] args) { rectangle rec1 = new rectangle(); rectangle rec2 = new rectangle(); system.out.println(rec1); system.out.println(rec2); } class rectangle { private double height; private double length; ***private string name;*** public rectangle() { height = 8; length = 6; ***name = this.name*** } i tried adding string rectangle constructor, didn't know initialize string name to. left , set (we mutating height , length) of height , length out convenience. ***public string getname() { return name; } public void setname(string name) { this.name = name; }*** public s

cookies - Slim setCookies not working -

i try $app->setcookies() , $app->getcookies() work. so heres $app config: $app = new \slim\slim(array( 'view' => new \slim\views\twig(), 'debug' => true, 'cookies.encrypt' => false, // <= no encrypt bug 'cookies.secret_key' => '6yxwi8fg4tr72', // <= random digits 'cookies.cipher' => mcrypt_rijndael_256, 'cookies.cipher_mode' => mcrypt_mode_cbc )); the middleware added injecting variables. [no sessionmiddleware] $app->get('/login',function () use ($app) { $app->setcookie('admin', true); $app->redirectto('home'); }); according answer on: why won't asp.net create cookies in localhost? edited /etc/hosts file. however no matter do, whenever $app->setcookies() called, retrieve blank page. if comment out, redirected homepage. no errors thrown well. i looked composer.json settings , found depen

c# - Read logfile with regex -

i need read added text logfile , extract parts of save in database (number > s3.20.140, start scan, scanid, scantime, result). need read following block: [2015-06-23 13:45:01.768] . [2015-06-23 13:45:01.768] scan requested [2015-06-23 13:45:01.768] random selection - s3.20.140 3 - 3 [2015-06-23 13:45:01.768] sv_et_cmd_type.sv_et_cmd_scan: s3.20.140 [2015-06-23 13:45:01.784] notification: activity=scan_started scanid=14 [2015-06-23 13:45:07.884] scumsgclient: receive 235 rectangles [2015-06-23 13:45:07.884] total scan 14 time: - 6.1 sec [2015-06-23 13:45:07.915] hip detection result "objects detected" [2015-06-23 13:45:07.915] scan results ready. [2015-06-23 13:45:11.128] user cleared scan 14 [2015-06-23 13:45:11.128] . this block same every scan, there other information in logfile not wanna process. best approach this? try this using system; using system.collections.generic; using system.linq; using system.text; using system.text.regularexpressions; usin

android - How to make Eclipse LogCat display all columns? -

Image
basically have exact same problem guy: eclipse logcat shows first letter each message but answer provided not work me. accepted answer tells go location , stuff: ~/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.android.ide.eclipse.ddms.prefs however when try go there, don't have "com.android.ide.eclipse.ddms.prefs" file. if check files there, this: as can see, not mention of android. so how fix this? maybe there package should've installed haven't? also, i'm using eclipse 4.5.0 (mars) on ubuntu 14.04. first of all, create file name : com.android.ide.eclipse.ddms.prefs written. after invisible log messages , columns : made work making 1 change @ time this: first add lines , save file, restart eclipse. ddms.logcat.auotmonitor.level=error ddms.logcat.automonitor=false eclipse.preferences.version=1 ddms.logcat.automonitor.userprompt=true logcat.view.colsize.level=54 exit eclipse, add lines below 1

java - How to add a list of card views in Android with only one of them removable by swiping? -

i'm trying make card list on main activity of app, , want user have ability delete first card, informative. rest of cards open layouts correspond them. check roman nurik's android-swipetodismiss: https://github.com/romannurik/android-swipetodismiss implementation example here: https://github.com/romannurik/android-swipetodismiss/blob/master/src/com/example/android/swipedismiss/mainactivity.java now in dismiss callback enable dismiss on first element. new swipedismisslistviewtouchlistener.dismisscallbacks() { @override public boolean candismiss(int position) { return position == 0; } ... }); not sure if second element becomes 1 @ position 0. if that's need track if header dismissed. anyways, can start , work out.

Write to a php file via wordpress -

i've built web page able send text messages employees @ company work. new employees being added , removed on constant basis, want integrate app wordpress employees can managed without editing code. each post contain user's name , phone number. name pulled in on webpage option user contact. when form submitted, go php form runs if/else find employee , match employee phone number so: //who text message to, establish phone # if($employee == 'brad'): $text_to[] = '+15555555555'; elseif ($employee == 'mary'): $text_to[] = '+15555555555'; elseif ($employee == 'tom'): $text_to[] = '+15555555555'; elseif ($employee == 'bill'): $text_to[] = '+15555555555'; elseif ($employee == 'joe'): endif; i want able not pull these names wordpress via loop display onto page, but able add or remove new entries, along phone number, php contact form . i know how loop through wordpress posts display

angularjs - ng-change in directive is updating the controller's model later then callback method is called -

i have ng-model / ng-change inside directives. 'mapped' controllers scope through attributes. when ng-change executed, controller's scope not updated yet. kind of lags 1 step time. why happen , recommended way make in sync?so calling 'change' directive should call 'do' on controller , value value of scope.params.v should date? example here use ng-click instead of ng-change in my-customer-iso.html refer this

python - trying to get info on boto docs -

i new python , looking boto quick list of sg. questions when @ boto docs listed below...how know attributes can use. example in sample output python below, create variable called inst....first used instance id, next used sg info....my question .... how know other attributes can get?? maybe instance type, ami-id etc.. reading doc below little bit confusing me new python...any help/pointers appreciated... http://boto.readthedocs.org/en/latest/ref/ec2.html#module-boto.ec2.instance >>> reservations = conn.get_all_instances() >>> in reservations: inst = i.instances[0] print inst instance:i-c8990c39 instance:i-c7e45537 instance:i-698047c1 >>> >>> in reservations: inst = i.instances[0].groups print inst [<boto.ec2.group.group object @ 0xf2c7d0>] [<boto.ec2.group.group object @ 0xf2c350>] [<boto.ec2.group.group object @ 0xf2c750> <boto.ec2.group.group object @ 0x10992d0>] also, how come not sg instan

php - Check if Wordpress User exists by email -

for life of me cant work (default example wp codex). created php file code , dropped in theme folder, when access file on web blank page, nada -- missing something, have put someplace else? appreciated. <?php $email = 'myemail@example.com'; $exists = email_exists($email); if ( $exists ) echo "that e-mail registered user number " . $exists; else echo "that e-mail doesn't belong registered users on site"; ?> simple answer, if template page, use this: <?php $email = 'myemail@example.com'; $exists = email_exists($email); if ( $exists ) echo "that e-mail registered user number "; else echo "that e-mail doesn't belong registered users on site"; ?> and ensure have correct opening , closing php tags. but if other tempalte page use this: <?php require_once("../../../../wp-load.php"); //add $email = 'myemail@example.com'; $exists = email_ex

Character Game - C Programming -

i need code. question is: write function void printsquare(char c, int size) accepts letter of alphabet , number between 3 , 10 , generates following rectangle of letters: if letter passed a , size 4: abcd bcde cdef defg if letter w , size 6, output should be wxyzab xyzabc yzabcd zabcde abcdef bcdefg i have been trying debug long time , cannot anywhere , need help. code looks right now: void printsquare(char c, int size); int main() { printsquare('b', 4); system("pause"); return 0; } void printsquare(char c, int size){ int counter = 0; char letters[26] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; (int = 0; <

opencv - Undefined reference in C with the open computer vision -

i'm trying test example using raspberry pi camera board opencv. code https://github.com/robidouille/robidouille/blob/master/raspicam_cv/raspicamcv.c when typing make error : undefined reference symbol cvsaveimage i have header contains function cvsaveimage . when don't use cvsaveimage compiles successfully. how know wich libraries missing? here output of pkg-config opencv --libs : /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_ocl.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopen

sql server - SSRS Not showing all column labels -

Image
i have issue ssrs, cannot see other labels this how looks on design view and @ preview-time the code behind it select sum(case when tr.testoverallresult = 1 1 end) failures, sum(case when tr.testoverallresult = 0 1 end) successes, 5 test dbo.testresults tr tr.methodcode '%' + @methodname + '%' any idea where's problem ? thanks it's values group issue, change order of values, label disappear, right click add back, rinse , repeat each 1 of value sets. run report , show them.

java - Android Studio see byte[] as string in debugger -

Image
i trying debug data, , have byte[] know has text in it. can't figure out how view text, or hex representation convert text. have tried creating custom type converter uses 'new string(this)', shows 'instance of java.lang.string' note: using android studio, build on intellij customize string data view view string

jquery - Anchor tag scroll animation using images with a tags -

the code below animates same-page anchor links <a href="#contact">contact</a> , animation doesn't work if combine image <a href="#to-top"><img src="images/logo.png"></a> . image, click take destination, without animation. the destinations have format this: <div id="contact">...</div> . any ideas i'm doing wrong? $('a').click(function(){ // tried changing 'a' 'img', no avail... var topoffset = 68; $('html, body').animate({ scrolltop: $( $.attr(this, 'href') ).offset().top-topoffset+2 }, 800); return false; }); but animation doesn't work if combine image . image, click take destination, without animation. appear perform animation effect @ stacksnippets ? $('a').click(function(){ // tried changing 'a' 'img', no avail... var topoffset = 68; $('html, body').anim

java - Spring : 2 EntityManagerFactory in 1 transaction -

i'd access 2 databases in same application. each database connection, have entitymanagerfactory. problem : can't merge 2 entity in 2 databases in same transaction. there beans.xml file : <context:component-scan base-package="com.example.testdatabase.business" /> <context:component-scan base-package="com.example.testdatabase.service" /> <context:component-scan base-package="com.example.testdatabase.ui" /> <bean id="entitymanagerfactoryorder" class="org.springframework.orm.jpa.localcontainerentitymanagerfactorybean"> <property name="datasource" ref="datasourceorder" /> <property name="packagestoscan" value="com.example.testdatabase.business.order" /> <property name="jpavendoradapter"> <bean class="org.springframework.orm.jpa.vendor.hibernatejpavendoradapter"

sql - How do I INSERT INTO SELECT from two different worksheets -

i have sheet bf_upload , has rows in it. i need add data 2 other sheets diamond , variations bf_upload . 2 input worksheets need joined, neither sheet has needed data. it might easier add column [diamond$].name variations sheet before moving data bf_upload sheet. sheets diamond , variations have common key [diamond$].code equivalent of [varations$].sku i think correct join statement. from [diamond$] inner join [variations$] on [diamond$].code = [varations$].sku to add records @ bottom of bf_upload believe need use a: insert statement the code working on included @ bottom of posting. code works sku, regular_price , sale_price fields. i cannot find way select data 2 sheets less join work. i have included source data below sample of desired output. worksheets: bf_upload has following columns: sku, post_title, regular_price, sale_price variations has following columns, not contiguous: sku, regular_price, sale price diamond has following

when launching boost::thread the .exe chrashes -

this function: void cmdchangesett(cmdbuf* cmd_buffer, ctimetag tagger, uint8_t chnum, int mask) { double* oldchannelvoltage = new double[chnum]; double* newchannelvoltage = new double[chnum]; bool* oldedge = new bool[chnum]; bool* newedge = new bool[chnum]; int newmask; double chdiff; int edgediff; int i; while (runacquisition) { (i = 0; < chnum; i++) { cmd_getthresh_getedge(cmd_buffer, i, oldchannelvoltage, oldedge); } sleep(500); newmask = 0; (i = 0; < chnum; i++) { cmd_getthresh_getedge(cmd_buffer, i, newchannelvoltage, newedge); chdiff = oldchannelvoltage[i] - newchannelvoltage[i]; edgediff = oldedge[i] - newedge[i]; //printf("\nold: %.2f, new: %.2f -> diff = %.2f", oldchannelvoltage[i], newchannelvoltage[i], diff); if (chdiff != 0) { warn(newchannelvoltage[i] > 1.5, newchannelvoltage[i] = 1.5f, "threshold of %.2fv exceeds channel %i's max. rounding %.2fv.&qu

winforms - C# Hide all labels/ controls -

is possible within windows form using c# hide specific controls upon form load, e.g. labels or buttons , chose show ones wan't shown? i've got program contains lot of buttons , labels want 1 or 2 shown upon load , feel doing method of label1.hide(); every label seems inefficient instead show labels want when want. maybe using loop, this: foreach (label) { this.hide(); } it sounds hide them in designer, , wouldn't have deal hiding them @ runtime. if have hide them @ runtime, can grab controls on form of type little linq: foreach (var lbl in controls.oftype<label>()) lbl.hide(); you filter controls based on name, hide ones want hide: foreach (var lbl in controls.oftype<label>().where(x => x.name != "lblalwaysshow")) lbl.hide(); if they're tucked inside of other controls, panels or groupboxes, you'll have iterate through controlcollections too: foreach (var lbl in panel1.controls.oftype<label>())

arrays - Count ip repeat in log from bash -

bash can tell repetition of ip within log through specific search? by example: #!/bin/bash # log line: [sat jul 04 21:55:35 2015] [error] [client 192.168.1.39] access denied status code 403. grep "status\scode\s403" /var/log/httpd/custom_error_log | while read line ; pattern='^\[.*?\]\s\[error\]\s\[client\s(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\].*?403' [[ $line =~ $pattern ]] res_remote_addr="${bash_rematch[1]}.${bash_rematch[2]}.${bash_rematch[3]}.${bash_rematch[4]}" echo "remote addr: $res_remote_addr" done i need know end results obtained few times each message 403 ip, if possible sort highest lowest. by example output: 200.200.200.200 50 times. 200.200.200.201 40 times. 200.200.200.202 30 times. ... etc ... this need create html report monthly log of apache in series of events (something

how to feed a non R file in a function within a package? -

i creating package including functions use generate report. use template report. wondering whether can include template (a word doc file) inside folder in package & make function use it? more specifically, couldn't figure out how need specify filepath of doc file inside function. help? library(reporters) if(!exists("temp")) temp = docx(title> ="summary", template="c:\users\user\a_template.docx") syntax above current setup. with of @benbolker's suggestion, able fix syntax. if(!exists("temp")) temp <- docx(title = "summary", template=system.file("a_template.docx", package="my.package"))

javascript - Query data from an API onto page in Node & Express without page refresh -

i have form on website user can fill out , return information page. page refreshes , wondering if possible without need complete page refresh, still have data auto update. view doctype html html head title= title link(rel='stylesheet', href='/stylesheets/style.css') body form(name="yelp-form", method="post") div.input span.label city input(type="text", name="city") span.label search term input(type="text", name="term") div.actions input(type="submit", value="add") block content route router.post('/', function(req, res){ var businesses = []; if(req.body.city === '' || req.body.term === ''){ res.render('api', {title: 'locatemycoffee', businesses: businesses}); } // console.log(req.body); // console.log(req); yelp.

performance testing - Load Runner set-up error -

i downloaded hp load-runner 12 community edition additional components. tried install after extracting files temp folder installation closed. didn't pop select "loadrunner full setup" please installing loadrunner in system http://www8.hp.com/in/en/software-solutions/loadrunner-load-testing/try-now.html this proper place download hp loadrunner latest version, enter correct details , after downloading take default path of program files. sure won't create problem.

javascript - Get sums by grouping a collection in Meteor -

i have collection fields: number , a , b , c . i want divide collection in 3 based on number , separate sums of a , b , , c each group division. i have done with function sumlist(amountlist) { return _.reduce(amountlist, function(sum, amount) { return sum + amount; }, -1); } // cursors var group1 = groups.find({ number: { $lte: 32 } }).fetch(); var group2 = groups.find({ number: { $gte: 33, $lte: 70 } }).fetch(); var group3 = groups.find({ number: { $gte: 71 } }).fetch(); // sums group1 var group1suma = sumlist(_.pluck(group1, "a")); var group1sumb = sumlist(_.pluck(group1, "b")); var group1sumc = sumlist(_.pluck(group1, "c")); // sums group2 var group2suma = sumlist(_.pluck(group2, "a")); var group2sumb = sumlist(_.pluck(group2, "b")); var group2sumc = sumlist(_.pluck(group2, "c")); // sums group3 var group3suma = sumlist(_.pluck(group3 "a")); var group3sumb = sumlist(_.pluck(group3, "b&q

python - Python3 can't install bcrypt -

when try install bcrypt, python3 -m pip install bcrypt , i : `command /usr/bin/python3 -c "import setuptools, tokenize; file ='/tmp/pip-build-vhc0qtab/bcrypt/setup.py';exec(compile(getattr(tokenize, 'open', open)( file ).read().replace('\r\n', '\n'), file , 'exec'))" install --record /tmp/pip-v9cb4je7-record/install-record.txt --single-version-externally-managed --compile --user failed error code 1 in /tmp/pip-build-vhc0qtab/bcrypt storing debug log failure in /home/vkristof/.pip/pip.log the debug log: http://pastebin.com/uea3weg3 one of error messages states, libffi missing. on debian-like system try $ sudo apt-get install libffi6 libffi-dev .

c++ - Maybe my understanding of [class.access]/7 isn't correct, but -

from [class.access]/7 have following sentence: similarly, use of a::b base-specifier well-formed because d derived a , checking of base-specifier s must deferred until entire base-specifier-list has been seen. class { protected: struct b { }; }; struct d: a::b, { }; see live example clang. matter of fact, clang complains snippet, no deferment necessary. class { protected: struct b { }; }; struct d: a, a::b { }; why code not compile? ps: gcc , vs21013 don't compile codes either. this compiler bug. normative text of standard supports example. fact multiple compilers have same bug means part of standard tricky right. there open bugs for gcc , for clang . note few related cases subtle differences between c++03 , c++11, far can tell, not one. [class.access]/1.2 merely states protected ; is, name can used members , friends of class in declared, classes derived class, , friends (see 11.4). and 11.4 not expand on this. using name b

rewrite asp to php based on asp query -

i have seen several questions similar , tried solutions @ loss. need redirect example.com/products.asp?lob=health to example.com/services/healthcare/ i need several lob= different value . there way can redirect each url. maybe kind of rewrite condition on lob if value of lob = health, redirect here. if equals home, redirect somewhere else? not sure "correct" way works. rewritecond %{query_string} ^lob=value1$ [nc] rewriterule ^products.asp$ http://example.org/sample/one/? [r=301,l] and different value: rewritecond %{query_string} ^lob=value2$ [nc] rewriterule ^products.asp$ http://example.org/sample/two/? [r=301,l] and doesn't match value: rewriterule ^products\.asp$ [insert new url here] [r=301,l] the last example works if want redirect .asp url .php. keep in mind have other conditions , rules removing .php extension , adding / files: rewritecond %{request_filename} !-f rewriterule ^([^/]+)/$ $1.php rewriterule ^([^/]+)/([^/]+)/$ /$1

php - Any ideas on class isn't instantiating in Magento for the correct event firing (SMTPPro event vs. test event)? -

i wondering if might have advice me on why i've got event observer class instantiating fine when tie controller_action_predispatch , absolutely nothing when i'm tying in aschroder_smtppro_before_send , need work. i don't want end skipping on doing right way, , override in zend_mail , instead, i'm getting little desperate after amount of hours i've spent trying figure out why isn't working @ all, when tied correct event. all of regarding implementing simple blacklist of domains intercept , block transactional email (handled through smtppro on our server) applicable domains. mean, eventually. right it's test code, can see following. config.xml follows : <?xml version="1.0" encoding="utf-8"?> <config> <modules> <myorganization_emailblacklist> <version>0.1.0</version> </myorganization_emailblacklist> </modules> <global> <hel

swift - Alternetive to TableView -

Image
i'm doing app retrives data server , show in view using tableview. i'd view showing content images side side. image: is there native ios component tableview, spefic concept? should better approach this? thanks! yep, take @ uicollectionview . it's sort of generalized tableview can support number of scrolling layout types. for mockup posted, you'll want use uicollectionviewflowlayout configured cell size , horizontal/vertical spacing need.

java - Eclipse updgrade 32 bit to 64 bit windows 7 -

i running 32 bit windows 32 bit eclipse luna , 32 bit java 7 android development. no issue. planning upgrade ram , install 64 bit windows 7 . question if upgrade windows 7 32 64 bit , keeping program files(which in c drive) , download , install 64 bit eclipse mars java 7/8 64 bit , workspace open , work now? or have format c drive, install 64 bit windows 7 , freshly install android sdk etc ? workspace in d drive. if want switch 64 bit. need download eclipse , java 64 bit. , can link existing sdk new eclipse in windows tab. did same thing in pc it's working fine me linking android sdk eclipse in eclipse --> window --> preferences --> click on android --> browse sdk location --> click ok .

c - GDB setting multiple breakpoints -

i set multiple breakpoints @ once in different files in gdb. is possible have script or other way can run once enter gdb debugger , have breakpoints set instead of setting them 1 one using traditional set break command. all resources searched pointed how set breakpoints effectively. but, nothing seems address concern. you can use source command in gdb. you can put commands in .gdbinit file sourced when start gdb. put commands there , run without doing more.

php - Scandir variable not a string? -

i have piece of php code lists directories , creates div's information regarding directories inside of it. when $newspieces[i] doesn't include name of folder in string, why? <?php $newspieces = scandir("posts"); ($i = 2; $i < count($newspieces) , $i < 10; $i++) { $titlefile = fopen($newspieces[i] . "/title.txt", "r"); $textfile = fopen($newspieces[i] . "/text.txt", "r"); $fullelement = "<div class='newspiece'><div class='newsimageholder'><img class='newsimage' src='" . $newspieces[i] . "/image.jpg'></div><div class='newscontent'><h1 class='newstitle'>" . fread($titlefile, filesize($newspieces[i] . "/title.txt")) . "</h1><p class='newstext'>" . $piece[] = fread($textfile, filesize($newspieces[i] . "/text.txt")) . "</p><

django - how to compare related Sum with a value itself -

class investor(model): name = charfield(max_length=16) class project(model): plan_finance = integerfield() class projectprocess(model): project = onetoonefield('project') investors = manytomanyfield('investor') class investship(model): project = foreignkey('project') investor = foreignkey('investor') invest_amount = integerfield() how find project have finished being financed , in other words, the money received investors' > plan_finance . you can use annotation on related set , filter on it. from django.db.models import sum project.objects.annotate(invested_sum=sum('investship_set__invest_amount')).filter(invested_sum__gte=plan_finance)

c# - What passable value can I use, besides an object instance, to access multiple functions? -

i'm learning c# , i'm looking solution problem perhaps caused bad architecture , doesn't affect real-life programs. i want pass "something" (not class) holds multiple functions , doesn't need instantiated, example, want have class list of hours , tasks in dictionary, so, example, @ 12:00 want class 'lunch', lunch may depend on other variables, have dict entry check {12, lunchtask}, lunchtask subclass/implementation/derivation of 'task' can safely pass , call sometask.start, sometask.pause, sometask.stop. i though using dictionary (int,system.type) couldn't working, tried statics can't subclassed , delegates single functions far know. want pass in dict has functions can accessed directly without instantiating. 1 solution know work find inelegant have static class instances of different tasks. i don't know of better way achieve such basic functionality , perhaps i'm doing terribly wrong. if guys point me in right directi

ios - Basic Forecast app for iphone -

i building basic weather app iphone, novice in programing, app gives me 1 message instead of showing weather, error message have written default, don't know what's wrong it, here code: import uikit class viewcontroller: uiviewcontroller { @iboutlet var usercity: uitextfield! @ibaction func findweather(sender: anyobject) { var url = nsurl(string: "http://www.weather-forecast.com/locations/" + usercity.text + "/forecasts/latest") if url != nil{ let task = nsurlsession.sharedsession().datataskwithurl(url!, completionhandler: { (data, response, error) -> void in if error == nil { var urlcontent = nsstring(data: data, encoding: nsutf8stringencoding) nsstring! var urlcontentarray = urlcontent.componentsseparatedbystring("<span class=\"phrase\">") if urlcontentarray.count > 0 { var weatherarray = urlcontentarray

c# - Throw a ConfigurationErrorsException when run .net app on ubuntu with mono4 -

i wrote , compiled helloworld app in vs2015rc: namespace test { class program { protected static readonly namevaluecollection appsettings = configurationmanager.appsettings; private static readonly string rootdir = appsettings["rootdirpath"] ?? ""; static void main(string[] args) { console.writeline("hello world"); console.writeline(rootdir); console.readkey(); } } } when run app on on ubuntu mono4, configurationerrorsexception thrown: lijing@ubuntu:~/desktop/iqq.net$ mono test.exe unhandled exception: system.typeinitializationexception: exception thrown type initializer test.program system.configuration.configurationerrorsexception: error initializing configuration system. system.configuration.configurationerrorsexception: unrecognized configuration section (/home/lijing/desktop/iqq.net/test.exe.config line 3) this config file: &l

php - Dynamic Website Content without Javascript? -

being comfortable javascript, html5, , css3, allows me achieve want accomplish in given design, removing javascript equation leaves little offer in terms of dynamic content. being users prefer disable javascript, albeit exception rather norm, in such use cases, there alternative technologies (could) not disabled, , allow workaround-dynamic content still present in absence of javascript? in order satisfy these requirements following criteria have met: (1) technology has cross-browser compatibility (nearly) modern browsers. (2) technology need allow user input on website (such text fields), sent sever-side processing, return data (such chunk of html). (3) then, technology need able take chunk of html/data , add page without refresh (ideally, though refresh able tolerated if necessary). doing own due diligence, have come part of answer, though not sure feasibility of approach, , hear think using server-sided scripting (like php) , http-meta-refresh, achieve such result. do

javascript - AngularJS - Trouble with $watch -

i trying remove "red" , "blue" drop down list options on product sku, if user member of "high" group on store site. code came below, partially works; thing works window alert. now, if remove logic looking user's group, work, user has set value of color drop down begin with. function speccontroller($scope) { angular.foreach($scope.user.groups, function (g) { if (g.name == "high") { alert('you in correct group!'); $scope.$watch('user.groups.name', function (val) { if (!val) return; if (val == "high") { $scope.variant.specs.color.options = $scope.variant.specs.color.options.filter(function (item) { return item.value !== 'red' && item.value !== 'blue'; }); } }); } }); } your goal put watch on groupname lies insid

android - OnClick in fragment without creating tons of onclicklisteners -

how can handle onclick method in fragment without making ton of onclick listeners each button , having huge switch statement them. example, have 10 checkboxes in layout , want fragment handle them in same way (have same onclick) its pretty easy. if want handle them same way; view.onclicklistener listener = new view.onclicklistener() { @override public void onclick(view v) { toast.maketext(mainactivity.this,"asdasd",toast.length_short).show(); } }; item1.setonclicklistener(listener); item2.setonclicklistener(listener); item3.setonclicklistener(listener);

r - ggvis integrated into a function -

i trying create basic function enter currency , function returns ggvis linegraph, issue occurs due quotation marks current code: ggcurr<-function(curr="aud"){ fx<-read.csv("rates.csv") fx$date<-as.character(fx$date) fx$date<-as.posixct(fx$date) gginput<-noquote(paste("~",curr,sep="")) fx%>%ggvis(~date,gginput)%>% layer_lines() } this code returns straight line. i have attempted as.name() no avail many thanks! all solved , parse function worked, thank's helped! in addition solution found parse , sort of thing prop function ggvis can used for. for example, if wanted take simple line graph mtcars %>% ggvis(~mpg, ~wt) %>% layer_lines() with y-variable wt given string doing in function, this: curr = "wt" mtcars %>% ggvis(~mpg, prop("y", as.name(curr))) %>% layer_lines()

android - How to add the back arrow in the action bar? -

Image
i wondering how add arrow in action bar. have action bar can add icons @ right hand side , possible center label? first, you'd have define parent activity 1 you'd display button in. via manifest. do in androidmanifest.xml somewhere within application tag: <activity     android:name="com.example.myfirstapp.displaymessageactivity"     android:label="@string/title_activity_display_message"     android:parentactivityname="com.example.myfirstapp.mainactivity" >     <!-- parent activity meta-data support 4.0 , lower -->     <meta-data         android:name="android.support.parent_activity"         android:value="com.example.myfirstapp.mainactivity" /> </activity> that done, you'd need call on target activity , right within oncreate() method: getactionbar().setdisplayhomeasupenabled(true); ..or, if happen use appcompat library in project: getsupportactionbar().setdisplayhomeasu

javascript - how to get socket.io number of clients in room? -

my socket.io version 1.3.5 i want number of clients in particular room. this code. socket.on('create or join', function (numclients, room) { socket.join(room); }); i use code clients in room : console.log('number of clients',io.sockets.clients(room)); to number of clients in room can following: function numclientsinroom(namespace, room) { var clients = io.nsps[namespace].adapter.rooms[room]; return object.keys(clients).length; } this variable clients hold object each client key. number of clients (keys) in object. if haven't defined namespace default 1 "/".

Go templates: How do I access array item (arr[2]) in templates? -

how access array item (e.g. a[2]) in templates? whenever "bad character u+005b '['" {{ .a[2] }} you need use index template function. {{index .a 2}}

perl - I'm not getting HTML tag while parsing -

the fragment of html code want parse this: <ul class="authors"> <li class="author" itemprop="author" itemscope="itemscope" itemtype="http://schema.org/person"> <a href="/search?facet-creator=%22charles+l.+fefferman%22" itemprop="name">charles l. fefferman</a>, </li> <li class="author" itemprop="author" itemscope="itemscope" itemtype="http://schema.org/person"> <a href="/search?facet-creator=%22jos%c3%a9+l.+rodrigo%22" itemprop="name">josé l. rodrigo</a> </li> i want extract whole <a> elements, while i'm trying parse www::mechanize::treebuilder content names of authors. so: content i'm expecting: <a href="/search?facet-creator=%22charles+l.+fefferman%22" itemprop="name">charles l. fefferman</a>, <a href="/

ios - Can link in Obj C, can't find symbols and won't link in Swift -

i'm working convert ios project else wrote obj c swift. the project in obj c form builds , runs fine, , shows it's under x86_64 architecture. when try build in swift, error 'undefined symbols architecture x86_64'. message : undefined symbols architecture x86_64: "_drcollectionviewtablelayoutsupplementaryviewcolumnheader", referenced from: __tfc13cvtablelayout14viewcontroller11viewdidloadfs0_ft_t_ in viewcontroller.o __tfc13cvtablelayout14viewcontroller32collectionviewtablelayoutmanagerfs0_ftgsqcso34drcollectionviewtablelayoutmanager_14collectionviewgsqcso16uicollectionview_19headerviewforcolumnsu9indexpathgsqcso11nsindexpath__gsqcso24uicollectionreusableview_ in viewcontroller.o the values referenced defined in drcollectionviewtablelayout.h, between #import , @class line, this: /** * supplementary view kind column headers */ static nsstring * const drcollectionviewtablelayoutsupplementaryviewcolumnheader = @"drcollectionvie