Posts

Showing posts from February, 2015

python - Django 1.6 coverage data showing virtualenv items -

i have django 1.6 project have minimal test coverage when run bash coverage run manage.py test mainapp coverage report --include=mainapp/* the output is name stmts miss cover -------------------------------------- mainapp/__init__ 0 0 100% mainapp/models 42 13 69% mainapp/tests 20 0 100% -------------------------------------- total 62 13 79% however misleading since coverage nowehre near that, , doesn't include views.py file. also if run coverage report shows coverage site-packages directory in virtualenv created using requirements.py file, the complete project @ https://github.com/vinu76jsr/librarymanagementsystem in projects, need add --setting manage.py , in case: coverage run manage.py test --settings=librarymanagementsystem.settings mainapp coverage report --include=mainapp/* for report command, --include mandatory avoid site-packages directory included in cov

layer - iOS - CALayer setShadowColor not working -

i need set bottom shadow button. have shadow somehow cannot change shadow color. doing wrong? here code: [self.buttonsbar.layer setshadowcolor:[uicolor colorwithred:227.0f/255 green:233.0f/255 blue:239.0f/255 alpha:1.0f].cgcolor]; [self.buttonsbar.layer setshadowopacity:1]; [self.buttonsbar.layer setshadowradius:1]; [self.buttonsbar.layer setshadowoffset:cgsizemake(0, 1)]; make sure self.buttonsbar.clipstobounds = no; make sure self.buttonsbar.layer.maskstobounds = no; first try large radius , offset make sure see them reduce numbers, not easy see shadow depending on background colors ...

php - how to make drop down list item selected in database -

i have mysql table 40 items in it. want reference 40 items in form on webpage drop down list. instead of writing out 40 items following know if item has been selected: <!doctype html> <html> </head> <body> <select> <option value="health & beauty"<?php if (isset($_post['sitetype']) && ($_post['sitetype'] == 'health & beauty')) echo ' selected="selected"'; ?>>health & beauty</option></select> </body> </html> , on 40 times... i wondering how instead using sql statement following: here have far. $sql = "select * sitetypes"; $f = mysqli_query($dbc, $sql) or trigger_error("query: $sql\n<br />mysqli error: " . mysqli_error($dbc)); while($row2 = mysqli_fetch_array($f, mysqli_assoc)){ echo '<option value="' . $row2['sitetypeid'] . '">' . $row2['sitetype'] . '</option&g

Import and python source file in folders -

i have troubles understanding how python import works. i forked this repository , going play having troubles understanding how python import works file in directories. the directory structure following: fitbit/ __init__.py gather_keys_cli.py api.py exceptions.py utils.py as preliminary step need run gather_keys_cli.py . depends on api.py , in turn depends on exceptions.py . if try run python interpreter works expected. if try run command line (as suggested in documentation ) have obtain following exception. $./fitbit/gather_keys_cli.py key secret traceback (most recent call last): file "./fitbit/gather_keys_cli.py", line 34, in <module> api import fitbitoauthclient file "/users/mariosangiorgio/fitbithacks/python-fitbit/fitbit/api.py", line 9, in <module> fitbit.exceptions import (badresponse, deleteerror, httpbadrequest, importerror: no module named fitbit.exceptions my understanding when invoke command li

nginx url rewrite blesta -

could me convert url rewrite ######################################################## # package: minphp # filename: .htaccess ######################################################## <files ~ "\.(pdt)$"> order deny,allow deny </files> # protect against clickjacking #header append x-frame-options "sameorigin" rewriteengine on # force https #rewritecond %{https} !=on #rewriterule ^ https://%{http_host}%{request_uri} [r=307,ne,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ index.php rewritecond %{request_uri} ^(.*)/install.php$ rewriterule install.php %1/install/ [r=301,l] here our current rewrite works fine few errors. such /index.php/ still being there in links when should /client/login , pages forces download file labled "download" # disallow access file .pdt extension location ~ (\.pdt) { return 403; } location / { error_page 404 = @blesta; #if file does

crash - Unity Android App Crashes On Test Device Immediately -

so porting new app onto crappy hauwei bought test app before release store. unity builds app , icon on test device, click device, app hardly attempts open before crashes. doesn't splash screen. happened development build checked , unchecked. this happens of apps have made, big or small. any suggestions? have no idea what's going on. i using mac latest version of os x , unity 4.0.3 :)

ios - WebView how can I lock the horizontal scroll? -

i webview fullscreen without being able scroll horizontal. both portrait , landscape orientation. i'm new ios , don't know how works feel storyboard , xib confusing compare xmls of android. when open src code quite lot of code , can't figure out. let me illustrate approach. consider untested pseudo-code. @implementation myviewcontroller - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)orientation { cgsize contentsize = self.webview.scrollview.contentsize; switch (orientation) { case uiinterfaceorientationportrait: contentsize.width = 320.0; self.webview.scrollview.contentsize = contentsize; return yes; case uiinterfaceorientationlandscapeleft: case uiinterfaceorientationlandscaperight: contentsize.height = 568.0; self.webview.scrollview.contentsize = contentsize; return yes; } return no; } @end the idea here when underlying scroll view's content si

C language:scanning of input string is skipped inside for loop -

this question has answer here: scanf skips every other while loop in c 10 answers whenever code executed, contents inside loop not executing first time, i.e., when i=0. loop executes after i=0, i.e., i=1,2,3,..n-1. can explain what's wrong here? #include <stdio.h> #include <stdlib.h> int main(int argc, char** argv) { char string[30][100]; int n,i; scanf("%d",&n); for(i=0;i<n;i++){ gets(string[i]); printf("%s\n",string[i]); } getch(); return (exit_success); } for(i=0;i<n;i++) { fflush(stdin); //clears buffer.insert here. gets(string[i]); printf("%s\n",string[i]); } after execution of scanf("%d",&n); leaving '\n' (when press enter key @ end) character in buffer.which should cleared before execution of other input operation. ff

javascript - Convert input text to lowercase on submitting a form -

i have form in there 1 text field provided submit button.on clicking submit button,it redirects second php page first php page. index.php <form action="submit.php" method="get"> <input type="text" name="search" id="search" /> <input type="submit" value="submit" onclick="convert()" /> </form <script type="text/javascript"> function convert() { alert("hi"); var str ; str = document.getelementbyid("search").value; document.writeln(str.tolowercase()); } </script> on submitting form,i want url become submit.php?search=text i want text in lower case,although if text entered uppercase. please guide me how make text lower case,i using above script converting lower case.but not converting text in lower case in url. please guide me on this.. you can using javascript few stuff: 1) give <form> id <form

Fast way to reset all the values in containers.map in matlab -

i used container.map construct map object code following: initialvalue=1:5 mapobj = containers.map(fullkeyset,initialvalue) now need reset values in mapobj, means values in mapobj should 0, how fast? thanks having 1 reference mapobj, creating new 1 fastest possibility: mapobj=containers.map(mapobj.keys,zeros(size(mapobj.keys)))

javascript - nth-child of CSS3 columns -

Image
i'm using css3 columns want control each column individually set different backgrounds / odd columns. i want result shown in picture: the html content: <div id="content"> content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text content body text </div> css: #content { column-gap:25px; column-count:3; } i want use like: column:nth-child(even) { background:#0000ff; } can use css3 :nth-child property? or can use javascript solution selector of individual column? please give suggested solutions

jquery - SVG animation and firefox -

i'm struggle svg animation drawing, work on browsers (even ie has no problems that), firefox not drawing correctly script self work on modern browsers script took - http://tympanus.net/development/svgdrawinganimation/ but when generate svg code vector image not work on firefox example - codepen it 100% svg path issue, code. what? if @ <path> styles in firefox dom inspector, you'll see refusing parse of stroke-dasharray values. without dash pattern, won't see animation on paths. in particular, paths firefox having problem reporting total lengths in billions of units. now, there's nothing in specs says path lengths , dash patterns can't billions of units long, not unreasonable firefox implementation works maximum. what unreasonable firefox calculating such extreme path lengths in first place. example, first path in drawing ff28 reports path length 308225966080, while chrome calculates around 920.6. turns out the problem gettotalle

<identifier> expected (Java) -

i'm new java. i'm writing code create object of pascal's triangle , method allow me newton's binomial factor value. getting enigmatic " expected" error not tell me much. i've searched through google , so, no avail. i'm sorry comments , class names in native language, that's tutor wanted. have code working in c++ if of help. the problem @ lines 17 , 56 (the method , constructor). here's code of class: package kp_lista04_java; import java.util.list; import java.util.arraylist; class trojkatpascalaexception extends exception { trojkatpascalaexception(string w) {super(w);} } class trojkatpascala { private list<list<integer>> matrix; private list<integer> row_final; private list<integer> row_temporary; public int wspolczynnik (int param_r, int param_p) throws (trojkatpascalaexception) { // r - numerator wiersza pascala int r = param_r; // p - numerator elementu wiersza

tomcat7 - GraniteDS 3.0.3, Spring 4.0, myBatis 3.2.4, Tomcat 7 Clustering -

we have implemented tomcat 7, spring 4, mybatis 3.24 , blazeds application in cluster. number of users growing facing issues. suggested friends replace blazeds graniteds , use hazel cast clustering , evaluating it. the application not use messaging; uses remoteobject(flex) calls java services. need may arise in future use messaging , chatting; 1 of reason consider graniteds well. blazeds not being updated reason. as of today have succeeded in having test application working required stack. want test clustering. blazeds jgroup config required. searched gds docs , web extensively not find example graniteds clustering. found mention supports clustering out of box. mean configuring tomcat clustering achieve want, without doing config gds?

A class with no contructor (Python) -

given need operate machine, need vendingmachine class: property stock(list) stores food items. methods: constructor takes in no arguments. get_stock_names(): returns list of strings represents names of food items in stock. load(food): adds food object stock and others, #predefined class food(object): def __init__(self, name, nutrition, good_until): self.name = name self.nutrition = nutrition self.good_until = good_until self.age = 0 def get_name(self): return str(self.name) def get_age(self): return self.age def get_nutrition(self): if self.age <= self.good_until: return self.nutrition else: return 0 def ripen(self, days): self.age = self.age + days return self.age def is_spoiled(self): return self.good_until < self.age #my code below class vendingmachine: def __init__(self): property = food.get_name #no clue how make p

Debug models with the rails console -

not sure why happening: 2.0.0p247 :001 > user.column_names => ["id", "user_name", "email", "password_digest", "created_at", "updated_at", "register_key", "culminated", "remember_token", "register_token_created_at", "profile_image", "licence_image", "first_name", "last_name", "nearest_town"] 2.0.0p247 :002 > user1 = user.create(user_name: 'james', email: 'james@killbots.com', first_name:'jj', last_name:'jj', nearest_town:'mordor') => #<user id: nil, user_name: "james", email: "james@killbots.com", password_digest: nil, created_at: nil, updated_at: nil, register_key: nil, culminated: nil, remember_token: nil, register_token_created_at: nil, profile_image: nil, licence_image: nil, first_name: "jj", last_name: "jj", nearest_town: "mord

timezone - Setting MySQL time_zone info without shell access -

i working on database contains number of "date" fields. these dates need converted utc output, intend using convert_tz('thefield','gmt','utc') . however, @@global.time_zone variable not set (returns "system" @ present), , timezone information table empty. believe needs filled running mysql_tzinfo_to_sql shell script ( http://dev.mysql.com/doc/refman/4.1/en/time-zone-support.html ). my problem don't have kind of shell access system in question, it's impossible me run mysql_tzinfo_to_sql script. therefore have 2 questions... 1) if mysql using "system" time zone @ moment, there way determine system time zone (remembering don't have shell or other access)? 2) possible generate information in mysql time zone table means other shell script, i.e. entirely within mysql itself? grateful suggestions, thanks. you can check time zone using with: select @@global.time_zone, @@session.time_zone; setting time

sql server - Checking for any column updated in triggers -

i need validate in trigger on sql server 2008r2 if of columns updated. basically have table example employee , employeehistory . insert/update/delete on employee table should generate record in history one. don't care column. example, can use if columns_updated() insert history??? else nothing? is right way of checking this? there other function? update() specific column. what's best practice this? i'm sure i'm not first 1 want create history record of table! using columns_updated() ok. but if nothing updated, trigger won't fire, it? what trying in end?

c++ - Visual Studio and GIT branch switch causes c1xx error for new files -

i have 2 git branches. 1)master branch , 2)dev branch.i work on dev branch , @ end merge master compiled final release build.everything long in dev branch there no new files.if add new class dev branch,when switch master branch , try compile receiving errors this: error c1083: cannot open source file 'somepath/tosource.cpp': no such file or directory c1xx it strange because made sure there files not exist physically in master branch.so means vs somehow keeps history of these dev branch?how can clean don't need sync 2 branches every time add new files dev branch?

c# - Windows mobile 6 self updating app -

is possible create application windows mobile 6 can either periodically or on demand update latest version? thinking of maybe creating project containing 2 solutions, first 1 runs on execution , overwrites second solutions executable of 1 on ftp server, starts second solution... do think work or have thoughts on better solution? have @ article http://msdn.microsoft.com/en-us/library/aa446487.aspx ; better project have implemented , works quite https://github.com/seboslaw/wmautoupdate , 2 going in right direction.

Shortcuts to points in the code Visual Studio? -

as code getting longer have jump between code sections tweak stuff , fix bugs, dropdown menu variables , functions not enough more. thinking whether there way define shortcut part of code, many games allow use ctrl+ number jump unit. collapsing code blocks ok use, have manually every block every time open project, again starting ineffective. aware of macros, seems me bit complex set macro this, right/wrong? using visual studio 2010. in advance answers, positive or negative. ctrl k + k (that hold ctrl , type k twice) place bookmark on current location. ctrl k + n navigate through them.

.net - Combine separate classes to superclass or not? -

i have following class structures category(mustinherit) the following classes inherits category strongperson weakperson then have class job (mustinherit) the following classes inherits job craft deskjob now user can can choose come characteristics , create person (in example craftsman). sub start() 'person dim s new strongperson(...) dim j new craft(...) sub end my questions: i used program procedually , sub start() reminds me lot of it. approach choose one? if not why? better use interfaces , build class person (using multi inheritance)? since there many more categories , jobs going quite complex categories * job posibilities . doese there exist recommendable design pattern? field of design patterns quite big , read through lot couldnt find apropriate one.

c# - I have a loop that initializes a list of objects with values, but as soon as it exits the loop the objects become identical -

as title suggests initializing objects in list through loop. become identical when loop exits. can see during loop not same. when loop exits change last object entered. public list<elevationlayout> layoutlist = new list<elevationlayout>(); public int layoutnumber { get; set; } public int worldwidth { get; set; } public random seed { get; set; } public xysize dimleft { get; set; } //i have narrowed down problem method //========================================================================================================================================================== //========================================================================================================================================================== //========================================================================================================================================================== public void init(world world) { dimleft = new

java - Android application has stopped working -eclipse -

i have been tried build first android application. every time open application in emulator, message says test has stopped working. must simple. hope can me. 04-06 15:43:47.806: w/dalvikvm(4275): threadid=1: thread exiting uncaught exception (group=0xa614d908) 04-06 15:43:47.826: e/androidruntime(4275): fatal exception: main 04-06 15:43:47.826: e/androidruntime(4275): java.lang.runtimeexception: unable start activity componentinfo{com.test/com.test.mainactivity}: java.lang.nullpointerexception 04-06 15:43:47.826: e/androidruntime(4275): @ android.app.activitythread.performlaunchactivity(activitythread.java:2180) 04-06 15:43:47.826: e/androidruntime(4275): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2230) 04-06 15:43:47.826: e/androidruntime(4275): @ android.app.activitythread.access$600(activitythread.java:141) 04-06 15:43:47.826: e/androidruntime(4275): @ android.app.activitythread$h.handleme

php - how to split the contents when finding the elements -

i'm working on php i'm using simple_html_dom find list of elements i'm looking before splitting contents separate. here output: <?xml version='1.0' encoding='utf-8' ?> <tv generator-info-name="www.mysite.com/test"> <p id='channels'>101 abc family</p> <p id='channels'>102 cbs</p> <p id='channels'>103 cnn usa</p> <p id='channels'>105 espn usa</p> <p id='channels'>106 fox news</p> <p id='channels'>107 animal planet</p> i want split contents 2 different variables 1 numbers , other 1 channels. i want split numbers this: 101 102 103 105 106 107 and want split channels: abc family cbs cnn usa espn usa fox news animal planet here php <?php ini_set('max_execution_time', 300); $errmsg_arr = array(); $errflag = false; $link; include ('simple_html_dom.php'); $xml = "<?xml version=&#

export - How to write Facebook/Twitter to address book in iOS? -

in app export data address book in order create new contact entries. can export want without problem, except facebook , twitter addresses. i'm lost on these two. here's code i'm using export non-facebook/twitter data work: abmutablemultivalueref multiphone = abmultivaluecreatemutable(kabmultistringpropertytype); abmultivalueaddvalueandlabel(multiphone, (__bridge cftyperef)(thephonemobile), kabpersonphonemobilelabel, null); abmultivalueaddvalueandlabel(multiphone, (__bridge cftyperef)(thephonehome), kabhomelabel, null); abrecordsetvalue(newperson, kabpersonphoneproperty, multiphone, null); cfrelease(multiphone); here's how i'm trying export facbeook not work: abmutablemultivalueref multisocial = abmultivaluecreatemutable(kabmultistringpropertytype); abmultivalueaddvalueandlabel(multisocial, (__bridge cftyperef)(thefacebook), kabpersonsocialprofileservicefacebook, null); abrecordsetvalue(newperson, kabpersonsocialprofileproperty, multisocial, null); cfre

java - Populate ComboBox with one value of the HashMap(Object) -

i have combobox want populate product names. have class called producto has values: private string name; private string code; private int price; so created hashmap this: map(integer, producto) mapproducto=new hashmap<integer, producto>(); i have method populate hashmap: producto stockproducto=new producto(); stockproducto.setnomproducto("steel bike"); stockproducto.setcodeproducto("bic001"); stockproducto.setprice(190000); getmapproducto().put(1, stockproducto); stockproducto.setnomproducto("aluminium bike"); stockproducto.setcodeproducto("bic002"); stockproducto.setprice(290000); getmapproducto().put(1, stockproducto); after populate combobox: iterator iter=getmapproducto().keyset().iterator(); while(iter.hasnext()) { this.cbonomproducto.additem(getmapproducto().get(iter.next())); } but since receives object of producto type, populates combo weird code, guess memory direction of object. want populate combobox name of p

css - What is the regex for php to get the href value in all stylesheet tags from HTML? -

what general way grab href tags using regex , preg_match_all href value given tag not in order. example: <link href="foo.css" rel="stylesheet" type="text/css"/> <link type="text/css" href="bar.css" rel="stylesheet"/> <link rel="stylesheet" type="text/css" href="bar1.css"/> <link type="text/css" href="bar2.css" rel="stylesheet"></link> <link href="path/foo.css" rel="stylesheet" type="text/css"/> should result in : array( 'foo.css', 'bar.css', 'bar1.css', 'bar2.css', 'path/foo.css', ) the regex expression looking this, require bit further refinement: <link\s+(?:[^>]*?\s+)?href="([^"]*)" testing against <link href="foo.css" rel="stylesheet" type="text/css"/> the returned value is

Displaying images from Google Sheets as a table in a web site -

i've created google spreadsheet logo images in 1 column of cells, when try create table add website images not display in table. i need them display logos visible within webpage? know why images not displaying in table format, or how can fix this. not sure method did choose display images. solution worked images embedded image function , not showing inside new spreadsheets, showing inside old. must admit haven't tested embedded documents should work too: space character offending character in new google spreadsheets when embedding images using image function. replace another, 'safe' character '-' or '_'

html - Ajax loading data from a different file -

can tell me why not working <script> $(document).ready(function() { $("#driver").ready(function(event){ $('#stage').load('index.php'); }); }); </script> what have on index.php table link, problem is hard click on 1 of link, have click 10 times make work, ideas why? index.php <script> $(document).ready(function() { $('#stage').load('index.php'); }); </script> <table width="200" border="1"> <tr> <td>name </td> <td>url address</td> </tr> <tr> <td><a href="https://www.google.com/">googe</a></td> <td><a href="https://www.google.com/">google</a></td> </tr> </table> i include same function on index.php, idea if make change on index page, , reflect change on test page. the ready event triggered on document, remove $(&qu

c - for loop for finding smallest element in an Array -

okay program suppose create array size [8] , once printed i'm using loop find smallest number in array. problem i'm having seems stopping @ second element , declaring smallest. can tell me wrong code #include <stdio.h> #include <stdlib.h> #include <time.h> void main(int argc, char* argv[]) { const int len = 8; int a[len]; int i; srand(time(0)); //fill array for(i = 0; < len; ++i) { a[i] = rand() % 100; } //print array (i = 0; < len; ++i) { printf("%d ", a[i]); } printf("\n"); getchar(); int smallest; (i = 1; < len; i++) { if (a[i] < smallest) smallest = a[i]; { printf("the smallest integer %d @ position %d\n", a[i], i); break; getchar(); } } } there mistakes in code, following : 1-the variable int smallest used before initializing. 2- logic inside last loop wrong. the right code : void main(int argc, char* argv[]) { const int len = 8;

python - Project Euler: Sum varying by a significant margin -

i'm trying solve problem 22 on project euler...which follows: **using names.txt (right click , 'save link/target as...'), 46k text file containing on five-thousand first names, begin sorting alphabetical order. working out alphabetical value each name, multiply value alphabetical position in list obtain name score. example, when list sorted alphabetical order, colin, worth 3 + 15 + 12 + 9 + 14 = 53, 938th name in list. so, colin obtain score of 938 × 53 = 49714. total of name scores in file?** here's code wrote solve problem: f = open("f:\gnames.txt", "r") strr = f.read() w = strr.replace('"', "") li = w.split(',') dic = {} sum = 0 ee in li: e in ee: if (e == "a"): sum+=1 elif (e == "b"): sum+=2 elif (e == "c"): sum+=3 elif (e == "d"): sum+=4 elif (e == "e"):

python - Opening external Url in Django template -

i've django template this: <ul> {% url in urls %} <li><a href="{{ url.url_name }}">{{ url.url_title }}</a></li> {% endfor %} </ul> url model stores url name , url title of particular url. thought using template, might able open page , redirected external url specified in: <a href="{{ url.url_name }}"> turns out, can't. how achieve this? i'm newbie in django , don't know do. please, try with: <a href="{{ url.url_name }}" target="_self">

php - eBay checkout on customised product? -

i've posted question once didn't reply. i'm hoping able me i'm hitting brick wall trying implement ebay checkout on listing customised product. i want ebay version of number plate builder have on website here: http://www.plate-trader.com/number_plate_builder.php on website, users checkout paypal , receive payment , details of order. copy across ebay , skip api's, want let buyers leave/receive feedback , show +1 sold on ebay listing. i'm not sure how this, know it's possible can see listing it: http://www.ebay.co.uk/itm/new-replacement-car-number-plates-show-plates-registration-plates-fast-p-p-/271327058016?pt=uk_carsparts_vehicles_carparts_sm&hash=item3f2c5a5860 can required code please :)? also, please try , keep things in pretty layman's terms i'm quite new of this. thanks in advance, karl

java - What does the "this" keyword as a parameter do exactly? -

this question has answer here: java keyword 6 answers so have searched lot -and "a lot" mean it-, both in website , in other ones, realize keyword this in java. i following tutorials these days develop game android. in these tutorials, uploader puts "this" parameter doesn't explain why it. what know far: it can used parameter (this part confused) it can put fish.this refer outer class (not sure one) it can used refer refer outer variables (worst definition ever, know) this: public class humans{ int name; //aka name1 public humans(int name){ //aka name2 this.name = name; //the name1 = name2 } i'd have in depth explanation of keyword since find confusing and, @ same time, prevents me moving on tutorials (please don't bother answering if response going brief, have things clear in mind because con

linux - Bash: Iteration through directories acts weird -

#!/bin/bash dir in "/home/$user/sessions/out/*/"; size=$(stat -c %s $dir/log) if [ 1 -ne 0 ]; echo $size. fi done started using bash today. trying check size of log file in directories in home/sessions/out. if 1!=0 (always, test), file size of log should printed. getting is: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 57344001 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 966904. i expect period after each file size, 1 period. file sizes appended variable size before reaches if clause? confused. the problem pathname expansion (expansion of '*') happens in stat invocation, not in loop declaration, because path in loop quoted, path in stat invocation not. i.e. 1 iteration of loop happening, dir having value of /home/$user/sessions/out/*/ . being expanded in stat invocation, supplying paths matching /home/$user/sessions/out/*/log stat . the solution unquote path in loop declaration , quote in stat invocation. like

javascript - both vertical and horizontal smooth scrolling between anchors -

i want smooth scrolling, using anchors, on same page. anchors spread out on page @ different horizontal or/and vertical levels. got code below, works scrolling vertically, , doesn't work scrolling horizontally. should make the scrolling go vertically , horizontally @ same time? $(function() { // scroll handler var scrolltoanchor = function( id ) { // grab element scroll based on name var elem = $("a[name='"+ id +"']"); // if didn't work, element our id if ( typeof( elem.offset() ) === "undefined" ) { elem = $("#"+id); } // if destination element exists if ( typeof( elem.offset() ) !== "undefined" ) { // scroll $('html, body').animate({ scrolltop: elem.offset().top }, 1000 ); } }; // bind click event $("a").click(function( event ) { // if it's anchor link if ( $(this).attr("href").match("#") ) { // cancel default event propagation event.preve

Android sample bluetooth code to send a simple string via bluetooth -

i want send simple string data such 'a' android device other 1 via bluetooth. looked sample bluetooth code in android sdk complex me. cannot understand how can send specific data when press button. how can solve problem? private outputstream outputstream; private inputstream instream; private void init() throws ioexception { bluetoothadapter blueadapter = bluetoothadapter.getdefaultadapter(); if (blueadapter != null) { if (blueadapter.isenabled()) { set<bluetoothdevice> bondeddevices = blueadapter.getbondeddevices(); if(bondeddevices.size() > 0) { object[] devices = (object []) bondeddevices.toarray(); bluetoothdevice device = (bluetoothdevice) devices[position]; parceluuid[] uuids = device.getuuids(); bluetoothsocket socket = device.createrfcommsockettoservicerecord(uuids[0].getuuid()); socket.connect(); outputstream =

sql server - SQL query sum()/join/order by/ - what's wrong? -

i learning sql, using northwind example database , i'm stuck on simple problem: want list products name in 1 column , total quantities sold each product in second column. first, did this: select p.productid ,sum(od.quantity) totalquantity products p join [order details] od on p.productid=od.productid group p.productid and that's ok - have product id's , total quantities, when try this: select p.productid ,p.productname , sum(od.quantity) totalquantity products p join [order details] od on p.productid=od.productid group p.productid i error: msg 8120, level 16, state 1, line 1 column 'products.productname' invalid in select list because not contained in either aggregate function or group clause.` when use aggregate functions (like sum ) have group by every other field in select you have modify query follows select p.productid, p.productname, sum(od.quantity) totalquantity products p join [order details] od on p.

Understanding REST Controllers Laravel -

after studying online links, i've seen have single route route::controller('categories', 'categoriescontroller'); and then, setting url's in forms of blade templated views, reach functions of controllers. getsignup() etc. it's basic question. how these things work? thanks alot, have nice day :d if declare routes request http://yoursite.com/categories routed categoriescontroller's getindex() method , form posting http://yoursite.com/categories/data (say) routed postdata() method. you can build more complex names using hyphens in routes. posting http://yoursite.com/categories/update-stuff route controller's postupdatestuff() method. there's explanation of in docs . though use cases prefer use resource controllers explained afterwards.

jquery - unaffix event for Bootstrap affix? -

i want combine affix plugin bootstrap navbar-fixed-top class. far have got working when scroll past navbar gets fixed. when scroll want go static state again. have seen code think older bootstrap versions , unaffix event. why gone? can create one? or how accomplish trying here? navbar_secondary = $( '.navbar-secondary:first' ); navbar_secondary.affix( { offset: { top: function () { return (this.top = navbar_secondary.offset().top ) } } } ); navbar_secondary.on( 'affix.bs.affix', function () { // wrong event this. want fire when *not* affixed console.log('affix'); navbar_secondary.removeclass( 'navbar-fixed-top' ).addclass( 'navbar-not-fixed' ); } ); navbar_secondary.on( 'affixed.bs.affix', function () { console.log('affixed'); navbar_secondary.removeclass( 'navbar-not-fixed' ).addclass( 'navbar-fixed-top' ); } ); figured out myself. event names

fibonacci - Calculating fib using List construction in Haskell - speed differences -

if we've defined following: lazyfib x y = x:(lazyfib y (x + y)) fib = lazyfib 1 1 (from 7 languages in 7 weeks book). why does fibnth x = head (drop (x-1) fib) evaluate slower fibnth2 x = head (drop (x-1) (take (x) fib) ? second 1 terminates infinite list required - intuitively expected (head) call terminate evaluation moment 1 item comes through "drop", regardless of whether there take limit on fib? can explain? (updated timings reference) : > :set +s > fibnth 100000 259740693472217241661550340212759154148804853865176... (1.16 secs, 458202824 bytes) > fibnth2 100000 259740693472217241661550340212759154148804853865176.... (0.09 secs, 12516292 bytes) if flip order of 2 functions in source file or interpreter, see second function lot faster. the reason? fib top level value gets evaluated once. on first call evaluate far needed, on second call breeze through list. you can @ this question notes on when such evaluation behaviour expe

javascript - get element type from element found by class -

im trying create function "value" of type of element has specific class (textarea, span,... whatever) to need test kind of element im dealing can enough alert($('#gdocdump').prop('tagname')); reason if grab elements of same class var varelems=$(".feedback"); , try loop through them testing each 1 var elementtype = elem.prop('tagname'); , error "typeerror: elem.prop not function" why happen? apparently elements stored in jquery object created $(".feedback") not quite same looking @ each individually? what need change var elementtype = elem.prop('tagname'); work below? jsfiddle: testing ground html <textarea id="gdocdump" class="feedback area" rows="1" cols="22" ></textarea><br /> <input id="scaleslider" class="feedback" type="range"value="1" min="1" max="9" step="1"

ios - NSMutableArray data sorting by a distance -

have problem mutablearray. i've data array in tableview, , ok, when data sorting distance , i'm choosing item in cell, shows me incorrect data in new viewcontroller. shows data without sorting. it's broken link) hope help) i'm new in obj-c, apologise) here code: list = [[nsmutablearray alloc] init]; [list addobject:@{@"name": @"central office", @"address":@"наб. Обводного канала, д.66А", @"phone":@"+7 (812) 320-56-21 (многоканальный)", @"worktime":@"ПН-ПТ: с 9:30 до 18:30", @"email":@"mail@ibins.ru", @"payment":@"Принимаются к оплате пластиковые карты visa и mastercard", @"longitude":@30.336842, @"latitude":@59.913950}]; [list addobject:@{@"name": @"second office", @"address":@"ул. Камышовая, д.38", @"phone":@"+7 (812) 992-992-6; +7 (812) 456-2

javascript - SIMPLE jQuery SELECT -

1) how alert when select 1_1.jpg, 1_2.jpg, 1_3.jpg or 2_1.jpg, 2_2.jpg, 2_3.jpg , other ones arn't selected? (something *_1.jpg, *_2.jpg, *_3.jpg) 2) how randomly position order of images (ex: first one: 2_1.jpg, second: 1_5, third:1_9 etc. end of src ( _ .jpg) should differe)? http://jsfiddle.net/alecstheone/br4bs/ html: <img class="image" src="../img/album1/1_1.jpg"> <img class="image" src="../img/album1/1_2.jpg"> <img class="image" src="../img/album1/1_3.jpg"> <img class="image" src="../img/album1/1_4.jpg"> <img class="image" src="../img/album1/1_5.jpg"> <img class="image" src="../img/album1/1_6.jpg"> <img class="image" src="../img/album1/1_7.jpg"> <img class="image" src="../img/album1/1_8.jpg"> <img class="image" src="../img/album1/1_9.jpg"

multithreading - PHP pthreads: Fatal error: Class 'Thread' not found -

i use php5.5 on webserver. want use pthreads. here's php config: http://dd19010.kasserver.com/infophp.php55 after implementing code..... <?php class asyncoperation extends thread { public function __construct($threadid) { $this->threadid = $threadid; } public function run() { printf("t %s: sleeping 3sec\n", $this->threadid); sleep(3); printf("t %s: hello world\n", $this->threadid); } } $start = microtime(true); ($i = 1; $i <= 5; $i++) { $t[$i] = new asyncoperation($i); $t[$i]->start(); } echo microtime(true) - $start . "\n"; echo "end\n"; ?> ... problem error: fatal error: class 'thread' not found in . have include include_once or similar make work? have do?? your phpinfo shows have php thread safety disabled. need install version of php thread safe use pthreads. may or may not fix current issue though. you may need copy pth

r - Lapply to Add Columns to Each Dataframe in a List -

this question has answer here: adding new column each element in list of tables or data frames 3 answers my question two-fold.. i have list of dataframes, , using lapply in r, add column each dataframe in list. the added column should take values sequentially list, if possible. have list same length list of dataframes, , each value in list should added column value. the reason i'm doing because file name of each data set i'm importing has date info, e.g. file name contains jun12_2003. want import each data set, , assign column year , date, taking info file name (so far doing part regexp). thanks help! use map . short mapply(..., simplify = false) suggested ari. df1 <- data.frame(x = runif(3), y = runif(3)) df2 <- data.frame(x = runif(3), y = runif(3)) dfs <- list(df1, df2) years <- list(2013, 2014) map(cbind, dfs, year = year

ios - UICollectionView loads async image in different cells due to reload during async image downloading -

when loading uicollectionview cells call method downloads image async. during download however, collection view reloaded , when async image downloaded set in 2 different cells. i have tried using nsoperationqueue in dealloc call cancelalloperations: , didn't work. what best way cancel download , can provide sample code? thanks. i think best practice launch requests lazily need images, cache results, , have no expectations state of collection when request completes. reloading collection not invalidating event request image in cell. scrolling away is, user might scroll back. make request, , in completion block request cache result , reloaditemsatindexpaths: on index path associated request. my answer here , provides working code.

java - Absolute/Relative path to files in Eclipse -

i working on assignment need use xml file in project. file in folder created called res . res folder under project folder. myproject --> res --> myxmlfile.xml the .java file calling xml file in src folder. myproject --> javaresources --> src --> edu.unsw.comp9321.assignment1(package) --> myjavafile.java i wondering how should refer file in java code if want code work when run project on computer? when use relative path appears searching folder eclipse installed, opposed workspace folder project exists. this have @ moment: file fxmlfile = new file("c:/users/giridhaar/workspace/comp9321assignment1/res/xml/musicdb.xml"); thank help. this should work : file fxmlfile = new file("res/xml/musicdb.xml");