Posts

Showing posts from February, 2013

Get Selected Row in DataGridView not working VB.Net -

i have pretty standard datagridview , have used .selectionmode = datagridviewselectionmode.fullrowselect .multiselect = false in order ensure entire row selected. situation : need obtain selected row in order load data in row screen "modify" data. using following selected row. private sub datagridview2_cellcontentclick(sender object, e datagridviewcelleventargs) handles datagridview2.cellcontentclick try if e.rowindex >= 0 dim row datagridviewrow row = me.datagridview2.rows(e.rowindex) globalvariables.selectedlineitemrowno = e.rowindex ' or row msgbox("globalvariables.selectedlineitemrowno ---> " & globalvariables.selectedlineitemrowno) 'textboxtst.text = row.cells("description").value.tostring end if catch ex exception msgbox(ex.message) end try end sub question : problem of time when 1 clicks on data within dgv code above run ,...

ios - How to setup SwiftyJSON on my Swift XCode App? -

i want handle json on swift xcode app, stuck trying mae swiftyjson work first time. far have done appears in post , , can access swiftyjson function calls code. however, code inside swiftyjson.swift file dragged project crawling "replace as!" warnings. how can rid of warnings? doing wrong? you need replace as! since updated xcode 6.3.1 , swift 1.2 . can use automatic assistant fix issue.

arrays - Serve json file from GO server to javascript client -

i have go server has respond javascript request serving json file. json file array of objects. my code : server side package expt import ( "net/http" ) func init() { http.handlefunc("/", handlestatic) http.handlefunc("/loadtrials", handleloadjson) } func handlestatic(w http.responsewriter, r *http.request) { w.header().set("cache-control", "no-cache") http.servefile(w, r, "static/"+r.url.path) } func handleloadjson(w http.responsewriter, r *http.request) { http.servefile(w, r, "static/trial.json") } client side loadtrials : function loadtrials() { var _this = this, load = this.shadowroot.queryselector('#load-trial'); load.url="http://url:8080/loadtrials"; load.go() load.addeventlistener('core-response', function(ev) { console.log(ev.detail.response) }, fal...

Error: Adobe creative SDK android -

i'm facing problems lines on manifest while trying work creative sdk and because getting error stack of post code , that's not allowed typing meaningless line :d :d "<3 luv u stack" we supposed add creative activity this <activity android:name="com.aviary.android.feather.sdk.featheractivity" android:configchanges="orientation|keyboardhidden|screensize" android:hardwareaccelerated="true" android:largeheap="true" android:process=":aviarysdk" android:screenorientation="unspecified" android:theme="@style/aviarytheme.dark" /> i errors in both lines android:process=":aviarysdk" android:theme="@style/aviarytheme.dark" my error log is :app:checkdebugmanifest :app:prereleasebuild up-to-date :app:preparecomadobecreativesdkbehance0394library up-to-date :app:preparecomadobecreativesdkfoundationassets0394libra...

email - PHPMAILER mail sent but not received -

i trying use phpmailer i'm having problem. test code: <?php require './phpmailer/phpmailerautoload.php'; $mail = new phpmailer; $mail->issmtp(); $mail->smtpdebug = 4; $mail->debugoutput = 'html'; $mail->host = "localhost"; //set smtp port number - 25, 465 or 587 $mail->port = 25; $mail->smtpauth = true; $mail->username = "donotreply@myservermail"; $mail->password = "mypassword"; $mail->setfrom('donotreply@myservermail', 'mail test'); $mail->addreplyto('myemail@live.com', 'first last'); $mail->addaddress('donotreply@myservermail', 'test mail'); $mail->subject = 'phpmailer smtp test'; $mail->msg = 'hello there test . '; $mail->body = 'this plain-text message body'; if (!$mail->send()) { echo "mailer error: " . $mail->errorinfo; } else { echo "message sent!"; } ?> ...

javascript - Dynamically Populating Drop down list from selection of another drop down value -

my requirement selection in 'meal' drop down list, second drop down list 'category' should dynamically populated values related selection in first drop down list. depending on selected in meal dropdown, list should change in category. have written following javascript function output i'm getting not freshly populating 2nd dropdown. on change of selection, new list getting appended old list. function changecat() { var selecthtml = ""; var = ["soup", "juice", "tea", "others"]; var b = ["soup", "juice", "water", "others"]; var c = ["soup", "juice", "coffee", "tea", "others"]; if (document.getelementbyid("meal").value == "a") { var select = document.getelementbyid('category').options.length; (var = 0; < select; i++) { document.getelementbyid(...

How to force use of curiously recurring template pattern in C++ -

i have following base template class. template<typename t> class base { public: void do_something() { } }; it intended used curiously recurring template pattern . should inherited class b : public base<b> . must not inherited class b : public base<someoneelse> . want statically enforce requirement. if uses wrong, expect error in compiling phase. what i'm doing putting static_cast<t const&>(*this) in do_something() . way class inheriting template or inherits class provided template parameter. sorry confusing expression. in plain english, requires b or inherits someoneelse in class b : public base<someoneelse> . i don't know if it's optimal way achieve this. looks gross me. however want more. want ensure b someoneelse itself. how can that? make constructor (or destructor) of base private, , make t friend . way thing can construct/destruct base<t> t .

java - Is using a Observable Singleton Class to handle network calls bad? -

i have develop client/server game uses lot of network request complete task. both client , server receive multiple command through socket. handle these commands created networkhandler class listens new input on separate thread , allow me send new commands. these "commands" heterogeneous , and used different classes. (for example "client ready" command used main server class, while "client wants card" used game class). so created commanddispatcher class listens networkhandler (observable pattern) , dispatch different commands right receivers. (all through interfaces ) the problem every class wants register "command receiver" need call commanddispatcher set listener. because there multiple class needs reference i'm thinking transform commanddispatcher in singleton class accessed everywhere. i know singleton , global class bad , i'm hiding dependency , difficult test, alternative see passing commanddispatcher mai...

javascript - How can i get the text box value on click button? -

i have 8 set of forms given below.all class names same , form names same. input providing different on forms. need input value text box when click on filter button.how can in jquery using $(this). ? here have tried. $(".filterit").click(function(){ $(this).$('myform').$('filter1').val(); }); html <form name="myform" method="post"> <table class="pop-table"> <tr><td><input type="text" value="" name="filter1" class="filter-1"><td></tr> <tr><td><input type="text" value="" name="filter2" class="filter-2"></td></tr> <tr><td><button class="btn btn-warning filterit">filter</button></td></tr></table> </form> use .closest() traversed closest element , .find() search elemen...

Facebook API Errors list -

Image
is there way list of errors sampled @ facebook analytics apps? as can see in image have collective data for get /schema in order reduce error rate need exact calls made. all appreciated. unfortunately not. error analytics 1 area think facebook improve upon.

javascript - ES6 Promise automatic post-processing / cloning results -

i have situation building data layer based on es6 js promises fetch data network. caching promises internally url. everything seems working fine except 1 thing. want ensure data coming out of network layer copy/clone of data retrieved network , not want everywhere in client code implements promise's handlers. i set handler automatically gets copy of cached data. to add twist this, configurable on url basis inside data layer promises post-processing copy while others return raw result. can suggest proper implementation accomplish this? should mention new copy of original raw result each time new client asks it. the current simplified pseudo implementation looks getcacheddata(url){ if (cache[url]) { return cache[url]; } else { var promise = new promise(function(resolve,reject){ var data = ...ajax get...; resolve(data); }); cache[url] = promise; } getcacheddata(url).then(result=>{ here want result copy of data resolv...

ide - java - Eclipse Helios SR 2 Package explorer error -

i need help. starting work on new project in eclipse , decided rid package explorer space of past projects within ide. had 2 projects saved prior opening ide: "new" , "project 1." proceeded delete project 1 ide permanently without issues tried delete "new." "new" project directory saved on desktop , upon deletion within ide right clicking, deleted random files , folders on desktop other files i'm not aware of within second, bypassing recycle bin-around 50gb of files. tried recover of files fragmented , therefore damaged. behaviour normal in eclipse? basically in eclipse when create project, create in workspace. default project gets stored in work space folder. can give specific directory save project the work space folder have information regarding projects. in eclipse have 2 kind of delete. i.e. 1) logical:- project deleted work space there wont actual delete of files. 2) physical:- complete deletion of project. i guess ...

python - Testypie modify 401 Unauthorized response body -

i using basic authentication , default in case of wrong username , password tastypie sending 401 unauthorized response header no response body. so how can change response body show custom error message in case of invalid authentication. use django authentication module tastypie follow: first import namespaces: from django.contrib.auth import authenticate, login django.conf.urls import url tastypie.resources import modelresource tastypie.http import httpunauthorized, httpforbidden then create class inherit modelresource: class userresource(modelresource): class meta: fields = ['username', 'password'] allowed_methods = ['post'] resource_name = 'user' include_resource_uri = false def override_urls(self): return [ url(r"^(?p<resource_name>%s)/login%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('login'), ...

meteor - What is the difference of defining a global var in server/ and in private/? -

for example, want insert init json data db when meteor startup. , have 2 ways. 1. define in server/init.js server/data.js: data1 = [{ "data": "to insert"}]; server/init.js meteor.startup(function() { inserttodb(data1); }); 2. define in private/data.json private/data.json [{ "data": "to insert"}]; server/init.js meteor.startup(function() { var data2 = assets.gettext("data.json"); inserttodb(data2); }); a. data1 live time? if so, if data big, waste memory? b. cons , pros? c. general purpose or scenario of private ? it has little whether loading data file or defining statically , more data variable scope. if define globally yes, stored in memory lifetime of process. if define locally within function once function exits, memory freed. for instance, can this: server/init.js meteor.startup(function() { var data1 = [{ "data": "to insert"}]; inserttodb(data1); }); with said, h...

How to build app for ubuntu in cordova? -

i've built app android in cordova in ubuntu 14.04. however, got error while trying run cordova build ubuntu in project folder, following: error building 1 of platforms: error: /home/ninger/cordova/vfinder/platforms/ubuntu/cordova/build: command failed exit code 1 may not have required environment or os build project error: /home/ninger/cordova/vfinder/platforms/ubuntu/cordova/build: command failed exit code 1 @ childprocess.whendone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23) @ childprocess.eventemitter.emit (events.js:98:17) @ maybeclose (child_process.js:743:16) @ process.childprocess._handle.onexit (child_process.js:810:5) after run cordova -d run ubuntu, got verbose output following, same hints: missing icon element in config.xml generating config.xml defaults platform "ubuntu" calling plugman.prepare platform "ubuntu" preparing ubuntu project processing configuration changes plug...

java - Play Framework - Ajax web service call image request issue -

i have developed web service using play framework. have created post rest service in play framework below. in routes file: post /imageupload controllers.application.imageupload() in application.java: public static result imageupload() { objectnode result = json.newobject(); multipartformdata body = request().body().asmultipartformdata(); filepart file = body.getfile("file"); file trainimg = file.getfile(); file temp = new file("/play_framework/temp.jpg"); trainimg.renameto(temp);// moved image folder check correct image. . . . return ok(result); } in service, have written code save image received request. have called service ajax given below. in index.html file: var formdata = new formdata(); var blob = new blob([imagedata], { type: "image/jpg"}); formdata.append("file", blob, "capturedimage.jpg"); $.ajax({ url: 'http://localhost:9000/imageupload', ...

javascript - AJAX loading files that use global resources, causing GET errors -

Image
my project uses mvc style coding, have main controller (index.php) loads in modules need subfolders, support/support.php, profile/profile.php, etc. in each of subfolder files (like profile/profile.php), use resources js/ , css/ in main folder. the problem when load these via jquery.load(), , index.php grabs these requests like: <link rel='stylesheet' href='../css/master.css' type="text/css"/> which causes errors these: any idea how fix this? change div use loading iframe , fix it, i'd rather not. how stop index.php reading href="../css/master.css" , other resources used subfolder files? thanks! you can try this <link rel='stylesheet' href='../../css/master.css' type="text/css"/>

json - How can I perform a LIKE query for a jsonb key? -

i have following jsonb structure: {'this': '1', 'this_that': '0', 'this_and_that': '5'} how select rows contain operator? select * myjson j ? 'this_%' returns 0 rows...was hoping match 'this_that' , 'this_and_that'. (note: characters following '_' potentially vary , therefore not able exact match). your example should not work because there not implicit cast between jsonb , text types. can enforce casting: select '{"this": 1, "this_that": 0, "this_and_that": 5}'::jsonb::text '%"this%'; it not clean solution. better unpacking json, , filtering on unpacked data lateral join postgres=# select key myjson, lateral jsonb_each_text(j) key 'this\_%'; ┌───────────────┐ │ key │ ╞═══════════════╡ │ this_that │ │ this_and_that │ └───────────────┘ (2 rows)

python - Have custom manager but keep objects keyword available -

i learning python + django (basically in love - 100% .net guy before), , trying learn concept of managers. i trying add custom manager called providermanager , objects depending on input. however, still want able stuff like: city= city.objects.filter(id = city_id).first() inside views.py file. i understand when add new custom manager, override objects keyword. however, question is: how both have objects available, new provider method, can city.provider.get_provider() ? current code: class providermanager(models.manager): def get_provider(country, city=0): return "abekat" class city(models.model): title = models.charfield(max_length=200) country = models.foreignkey(country, null=true) is_visible = models.booleanfield(default=false) providers = providermanager() def __str__(self): return self.title views.py: def city(request, country_id, city_id): country= country.objects.filter(id = country_id).first() ...

git - holding the commits and pulling a repository, and then pushing the commits -

i git-beginner, apologies naive question: i turning local repo mess doing following: changing things , committing them not pushing. repository on server has been changed other users. ideally want ignore commits, pull last version server, , commit change , push. there way of doing this? assuming master branch involved, this: $ git pull --rebase origin master you pull changes master branch, commits rebased if had first pulled new changes, , then, started making changes , committed. you can just $ git pull but you'll end merge commit. rebase first (or pull --rebase ) keep history easier read. check out these git tutorials: https://www.atlassian.com/git/

c++ - Function Pointer (Within Class) -

i'm trying use function pointer ( fnptr ) reference class method ( fnempty ) within class method, (in case constructor). the setup program main.cpp is #include <iostream> #include "test.hpp" int main(int argc, char* argv[]){ test test; return 0; } and test.hpp reads #ifndef _test_h #define _test_h #include <iostream> class test { private: public: void (*ptrempty)(void); void fnempty(){ std::cout << "got here" << std::endl;}; test(){ ptrempty = fnempty; }; ~test(){}; }; #endif most of material on net details being able reference class method from outside class (see microsoft page , newty.de ), not from inside class (as have done). using above files gives error in file included main.cpp:6: ./test.hpp:11:21: error: reference non-static member function must called; so 1) why error result? if change fnptr declaration on line 10 static reads static void fnemp...

How to reference many objects at once in Actionscript? -

so, question follows: i have set of objects , want function use elements of set in function. can do? for example: i have many instances of same movieclip. want function nextframe() executed movieclips name matches keycode of key i've pressed. how can reference these symbols @ once in "if" statement? you'll need use loop . assuming clips placed on timeline there few ways this. walk display list , search clips meet criteria. way can expensive if have tons of clips on stage. var i:int=this.numchildren; while(i--){ if(this.getchildat(i).name == namecriteria){ //do here, matches } } keep movie clips of class in array, , loop through array: var myarray:array = [mc1,mc2,mc3,mc4];//whatever movie clips instance names are... each(var clip:movieclip in myarray){ if(clip.name == namecriteria){ //do } } create custom class automatically adds instance of movie clip array loop through. save following code in file...

smlnj - Printing only print output with SML/NJ -

i'm trying use sml/nj, , use sml < source.sml run code, prints out information. for example, source.sml : fun fac 0 = 1 | fac n = n * fac (n - 1) val r = fac 10 ; print(int.tostring(r)); this output: standard ml of new jersey v110.77 [built: tue mar 10 07:03:24 2015] - val fac = fn : int -> int val r = 3628800 : int [autoloading] [library $smlnj-basis/basis.cm stable] [autoloading done] 3628800val = () : unit from suppress "val it" output in standard ml , how disable smlnj warnings? , , smlnj want remove "val = () : unit" every print statement execution , got hints how suppress them. i execute cm_verbose=false sml < $filename , added 1 line of control.print.out := {say=fn _=>(), flush=fn()=>()}; in code, still have message: standard ml of new jersey v110.77 [built: tue mar 10 07:03:24 2015] - 3628800 how can print out output? the sml command intended used interactively. sounds me better off building standalone ex...

ruby on rails - how to get number of last migration run in heroku? -

i'm trying debug app on heroku , seems 1 or more migrations didn't run. without going through each migration manually i'm trying figure out migration last 1 run. environment: rails, postgresql from terminal: heroku pg:psql --app app_name db_name select * schema_migrations; look last entry another way... terminal heroku run console --app app_name class schemamigration<activerecord::base end then write schemamigration.last

java - Drawing a Line - Maximum Point -

Image
i drew line @ angle based on slider. i trying make line's end y coordinate number (let's 300), if @ angle. any ideas on how this? here work on line far: double angle = intangle; angle = angle * math.pi / 180; double length = 300; graphics.setcolor(color.red); double startx = 300; double starty = 100; double endx = startx + length * math.cos(angle); double endy = starty + length * math.sin(angle); double end2x; double end2y; double dblangle; double angle2; int intangle2; double start2x = endx; double start2y = endy; intangle2 = 180 - intangle; angle2 = intangle2; angle2 = (angle2 * math.pi / 180); end2x = (start2x - length * math.cos(angle2)); end2y = (start2y - length * math.sin(angle2)); int intendx = (int)endx; int intendy = (int)endy; if(blnbutton == true){ graphics.draw(new line2d.double(startx, starty, endx, endy)); graphics.draw(new line2d.double(start2x, start2y, end2x, end2y)); } there's simpler way, basically, can calcul...

ios - Crop UIImageView and gesture recognizer -

i have imageview crop circle this: self.contentmode = uiviewcontentmodescaleaspectfill; self.layer.cornerradius = self.bounds.size.height / 2.0; self.layer.maskstobounds = yes; then added gesture recognizer it, fires in cropped area. how can avoid firing in cropped area? set class conforms uigesturerecognizerdelegate set gesture delegate self then use delegate decide if want fire or not -(bool) gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldreceivetouch:(uitouch *)touch example code -(bool)gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldreceivetouch:(uitouch *)touch{ cgpoint touchpoint = [touch locationinview:self.imageview]; if (cgrectcontainspoint(self.imageview.bounds, touchpoint)) { cgfloat centerx = cgrectgetmidx(self.imageview.bounds); cgfloat centery = cgrectgetmidy(self.imageview.bounds); cgfloat radius2 = pow((touchpoint.x -centerx),2)+ pow((touchpoint.y - centery), 2); if (radius2 < pow(cgrect...

php - Is it a good practice to define expectation in dataProvider -

quick example of dataprovider: return [ ['180d-1pc', '6m-1pc'], ] and test: public function test_convert($title, $expected) { $uut = new converter(); $this->assertequals($expected, $uut->convertdaytitle($title)); } (simply put: test if convert 180d(days) 6m(months)) can see - in data provider there input data defined , expected output. this works fine in many cases, keep having feeling maybe it's not best idea. i'm wondering if considered bad practice. if - when see bad idea it? one example is, when use same dataprovider in 2 tests - should define 2 expected values , use 1 of them? quick example (i made up, don't pay attention make product object title ;)): public function test_gets_discount_when_licence_period_longer_than_1year($title, $expectedtitle, $expecteddiscount) { $prod = new product($title); $this->assertequals($expecteddiscount, $product->hasdiscount(); } how make more elegant? what you'...

Using Ehcache to cache objects into JVM's memory and into Disk -

i want use cache manage 500mb data ,so made test. want put 200mb data jvm's memory , other 300mb put disk. so every element had put 2mb data, had set cachemanager's maxbyteslocalheap 250mb , cache's maxbyteslocalheap 200mb, when finished case, found there more 170mb data in jvm , disk data more 290mb. printed keys in disk, found there 250 keys, not 150 keys. it means that: disk data has 250 keys , there 500mb data in disk data , it's not wanted ... i don't know why ? watched codes, hadn't find reasons , test code : private static final string cache_path = "java.io.tmpdir"; private static string max_memory = "512m"; private static string block_max_memory = "512m"; private static string data_max_memory = "512m"; private static mcachemanager instance; private properties props = null; private cachemanager cachemanager = null; private cache memorycache; private cache datacache; public static mcachemanager getin...

winforms - Picturebox and button click -

ran confusing problem. need make fishtank in windows forms. every time button clicked, fish appear. thought putting code in button_click function. problem picturebox image doesn't appear when click button. using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; namespace windowsformsapplication1 { public partial class form1 : form { public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { backcolor = system.drawing.color.lightblue; } private void button1_click(object sender, eventargs e) { //picturebox pb = new system.windows.forms.picturebox(); picturebox pb = new picturebox(); pb.image = image.fromfile("c:\\users\\elonas\\desktop\\fishtank\\photo\\fish_right.png...

uiview - iOS - incompatible pointer types -

i warning: incompatible pointer types assigning 'uiimageview' 'uiview' with code: if ([gesturerecognizer.view iskindofclass:[uiimageview class]]) { curgraphicview = gesturerecognizer.view; } the code work. in case, how can make don't have warning? you have cast tell compiler sure uiimageview if ([gesturerecognizer.view iskindofclass:[uiimageview class]]) { curgraphicview = (uiimageview *)gesturerecognizer.view; }

python - What is the celeryev queue for? -

i'm running python celery mongodb broker since stores rest of application's data. (this experimental setup celery, know doing wrong.) have found celery messages collection contains 20 million documents ridiculous. deleted of documents older 7 days, still left me more million documents in messages. of them have queue like: celeryev.35159580-6c35-40cd-b75b-66eb8333963d . queue used , can safely deleted?

ember.js - What is the point of the .save() function in ember data? -

what utility .save() serve? don't understand why changes model aren't saved until call function. there reason ever not save changes? save() make call server. it terrible make server calls every time property changed (for example on every keyup), makes sense queue changes , call save when it's ready (for example hitting submit on form).

android - How set scrollable view when softkeyword is pop up? -

Image
i need show view textview work character counter , 2 edittext. 1 enter subject , other enter message. but when keyboard displayed, view can not scrolled. keyboard hides lower part of view. i need when keyboard displayed, view fits remaining space , allows user click , scroll view, similar view of compose mail of gmail. here layout doesn't work me: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <include android:id="@+id/toolbar" layout="@layout/toolbar" > </include> <scrollview android:layout_width="match_parent" android:layout_height="match_parent" android:isscrollcon...

Calculating differences between two rows for access sql query -

i trying create query new column containing differences between row n , row n+1 column x table 1. table 1 sample_id: 1, 2, 3, 4, 5 x: 42060, 42069, 42069, 42111, 42132 query 1 (ideal result) sample_id: 1, 2, 3, 4, 5 diff: 0, 9, 0, 42, 21 i used following sql. select [table1].sample_id,[table1].x - prev.x diff [table1] inner join [table1] prev on [table1].sample_id -1 = prev.sample_id [table1].sample_id > 1 however, omits first row; thus, instead of getting result presented above query 1, following. results sample_id: 2, 3, 4, 5 diff: 9, 0, 42, 21 how can retain first row (sample_id=1) 0 value? try this select [table1].sample_id,[table1].x - prev.x diff [table1] inner join [table1] prev on [table1].sample_id -1 = prev.sample_id [table1].sample_id >= 1 which pick rows have sampleid greater or equal 1 , or select [table1].sample_id,[table1].x - prev.x diff [table1] inner join [table1] prev on [table1].sampl...

Why am I getting unbound variable i bash? -

i have following script works part till hits specific line: #!/usr/bin/env bash set -eux # go home. cd /vagrant/freya/ cleaned_assets=false ## clean time! ## remove vendor , composer.lock folders - because. f in *; if [[ -d $f ]]; if [[ $f != ".git" ]] && [[ $f != "bin" ]] && [[ $f != "docs" ]]; if [[ $f == "loader" ]] && [[ $cleaned_assets == false ]]; cd "$f/" if [[ -d "assets" ]]; cd assets/ rm -rf vendor composer.lock docs let $cleaned_assets=true cd ../../ fi fi cd "$f/" rm -rf vendor composer.lock docs cd ../ fi fi done the issue when hits let $cleaned_assets=true not sure proper way set variable true, never enters loop again. keep getting: + let false=true bin/clean-directories: line 21: true: unbound variable cleaned_assets=true no let , no $ . in part...

Get next Date using Selenium IDE / javascript -

i can current date if use this... command: storeeval target: var d=new date(); ('0' + (d.getmonth()+1)).slice(-2)+'/'+('0' + d.getdate()).slice(-2) + '/' +d.getfullyear() value: testdate actual result > 05/14/2015 but need next date , not appearing format wanted. let today's date 05/14/2015, need output of 05/15/2015. have failing command: storeeval target: var d=new date(); ('0' + (d.getmonth()+1)).slice(-2)+'/'+(d.setdate(d.getdate() + 1)) + '/' +d.getfullyear() value: testdate actual result > 05/1431642394763/2015 expected result > 05/15/2015 *also above didn't mention slice, need work if days go 1-9. please need step in selenium ide, suggestions. found answer @ javascript how tomorrows date in format dd-mm-yy command: storeeval target: var d= new date(new date().gettime() + (86400000 *2)); ('0' + (d.getmonth()+1)).slice(-2)+'/'+('0' + d.getdate()).slice(-2...

gen tcp - Erlang gen_tcp:recv http_request abs_path -

i'm writing code in erlang accepts http requests. have working code shown below. the problem have i'm unsure returned result of gen_tcp:recv . i create listening socket , accept sockets using {ok, listensock}=gen_tcp:listen(port, [list,{active, false},{packet,http}]) {ok, sock}=gen_tcp:accept(listensock), i accept request (or other) using {ok, {http_request, method, path, version}} = gen_tcp:recv(sock, 0), handle_get(sock, path); then, url parameters (cgi parameters, e.g., ?foo=1&bar=2 ) have match path structure {abs_path, relativepath} . handle_get(sock, reqpath) -> {abs_path, relpath} = reqpath, parameters = string:substr(relpath, string:str(relpath, "?") + 1), while reading through docs of erlang gen_tcp , more recv method found the page describing httppacket . the grammar on page shows path in httppacket , , in case httprequest type, can have multiple types of httpuri . httprequest = {http_request, httpmethod, httpuri, ...

Bootstrap menu with equal menu items -

i have bootstrap menu , want use menu items equal width (using grid). problem is, can't add row class between ul , li elements, need this: <ul class="nav navbar-nav col-sm-6"> <li class="col-sm-4"><a href="#">menu 1</a></li> <li class="col-sm-4"><a href="#">menu 2</a></li> <li class="col-sm-4"><a href="#">menu 3</a></li> </ul> does know how can solve problem? like ted said above, have work. sounds want add space or gap between. if why not add... make sure allow in col-lg-x width. <style> .gapit { width:1%; background-color: blueviolet; height:50px; } </style> <li class="col-lg-2"><a href="#">home</a></li> <li class="gapit"></li> <li class="col-lg-2"><a href="#about">abou...

python socketserver connection timeout -

i new python socket programming. trying create simple chat application trying send data client program server in server program while receiving data encountering "timed out" my client program- import socket port = 3017 def handler(req): s = socket.socket(socket.af_inet, socket.sock_stream) try: s.connect(("localhost", port)) except socket.error, msg: print("error connecting socket") s = none finally: f.close() s.settimeout(10.0) s.send(req) line = s.recv(1024) s.close() return line if __name__ == '__main__': while(1): input = raw_input(">") resp = handler(input) print resp my server program- import socket import socketserver class echo_server(socketserver.streamrequesthandler): def handle(self): timeout_telnet = float(2.0) self.connection.settimeout(timeout_telnet) data = [] # read in line...

Using $injector in AngularJS when integration testing (without using ngMock) -

i'm needing setup integration tests in angularjs using karma/jasmine having trouble, because when not using ngmock (since want hit actual $http endpoints), there no module or inject methods. so how inject services tests? i've tried angular.injector.invoke(...) can't working, comes error unknown provider: authserviceprovider <- authservice . thoughts? try this 'use strict'; describe('login user', function () { var app, loginservice; beforeeach(module('app')) ; beforeeach(inject(function(_loginservice_) { loginservice = _loginservice_; })) ; it('should logged in', function () { var isloggedin = loginservice.isuserloggedin(); expect(isloggedin).tobetruthy(); }); });

c# - Replacing specific parts of a string in an array -

i'm pretty familiar finding , replacing things in array, i'm having trouble finding out how replace specific parts of string. instance, first item in array string of sixteen random numbers 1786549809654768. how go replacing first twelve characters x's example? because string can translated , array of char transform problem replace things in array problem: char[] characters = input.tochararray(); // replace logic here string result = new string(characters); or use substring . assuming n number of characters want replace beginning or string: string result = new string('x', n) + input.substring(n);

javascript - jQuery v1.11.3 sending me controls.png 404 (Not Found) -

in inspect element console section getting error: get http://.../img/controls.png 404 (not found) jquery-1.11.3.js:10208 extra: (anonymous function) @ jquery-1.11.3.js:10208 jquery.access @ jquery-1.11.3.js:4182 jquery.each.jquery.fn.(anonymous function) @ jquery-1.11.3.js:10204 shareswitch @ valnet.social.js?v=2.0:170 (anonymous function) @ include.js?v=2.0:40 m.callbacks.j @ jquery.js?ver=1.11.2:2 m.callbacks.k.firewith @ jquery.js?ver=1.11.2:2 m.extend.ready @ jquery.js?ver=1.11.2:2 j @ jquery.js?ver=1.11.2:2 when click on error sends me here: // create scrollleft , scrolltop methods jquery.each( { scrollleft: "pagexoffset", scrolltop: "pageyoffset" }, function( method, prop ) { var top = /y/.test( prop ); jquery.fn[ method ] = function( val ) { return access( this, function( elem, method, val ) { var win = getwindow( elem ); if ( val === undefined ) { ...

Using telnet localhost with genymotion's Android emulator -

im taking coursera course on android programming , have alter wifi signal. connects telnet using telnet localhost 5554 on emulator. find emulator uses slow me using genymotion emulator. however, telnet localhost 5554 command doesnt work me. ive tried using telnet localhost [my ipv4 address] , doesnt work either. any ideas? you should use genymotion shell app communicate genymotion virtual machine. after running shell type list available commands.

How do I solve the Eloquent Javascript "Chess Board"? -

new coder here trying learn js. did codecademy , working through eloquent javascript now. got after scratching head long while... doesn't work! i'm not quite sure if i'm approaching right angle know want use loops track progress through printing of # based grid. write program creates string represents 8×8 grid, using newline characters separate lines. @ each position of grid there either space or “#” character. characters should form chess board. passing string console.log should show this: # # # # # # # # # # # # # # # # # # # # # # # # my code below: var chessboard = ""; var size = 8; (var linecounter = 1; linecounter < size; linecounter++) { if (linecounter%2 === 0) { / /if linecounter number (var charcounter = 1; charcounter < size; charcounter++) { var evenodd = (charcounter%2 === 0); switch (evenodd) { case true: (chessboard += ...

actionscript 3 - how do I call a function if the image clicked is equal to its matching word? Actionscript3 -

when random word appears user has memorise , click correct corresponding image it. i'm trying write code runs if user selects right image. have paired words , images in array. i'm unsure how go calling function. this i've attempted far, isn't working. i'm new actionscript3 excuse lack of knowledge trying teach myself. all appreciated!! this 1 way can this: see code comments basket.visible = false; //------ home button ------\\ backhome1btn.addeventlistener(mouseevent.click, goback1click); function goback1click(event:mouseevent):void{ gotoandstop("homepage"); } //------------------- var score:int = 0; var items:array = new array(); //store food items in array var wordstoshow:array = new array(); //store words show in array - array keep track of has been asked (or rather not asked yet) //to reduce redundant code, call each food item (below) ...