Posts

Showing posts from January, 2011

node.js - Node Express - empty query after form submit -

i pars url after form submit. have simple form: form(method='post', action='/recipe/create') hr div div.input.text label(for='recipetitle') tytuł przepisu: input(type='text', name='recipetitle', id='recipetitle') div.input.text label(for='photofilename') nazwa zdjęcia: input(type='text', name='photofilename', id='photofilename') after submit code executed. exports.create = function(req, res){ var url = require('url'); var url_parts = url.parse(req.url, true); console.log(url_parts); my question why console shows empty query { protocol: null, slashes: null, auth: null, host: null, port: null, hostname: null, hash: null, search: '', query: {}, pathname: '/recipe/create', path: '/recipe/create', href: '/recipe/create' } this happens because you're posting url

iphone - Create a UIView in storyboard -

how create uiview in storyboard uibarbuttonitem presenting popovercontroller. possible create separate uiview without having uiviewcontroller? requirement uibarbuttonitem in uiviewcontroller when pressed should present uiview popover controller, has uitableview in it. thanks help. if want present table view, better off having table view controller, regardless how showing table (popover or otherwise). simply setup new view controller in storyboard, add segue bar button , specify "style" popover.

Where is Ruby's string literal juxtaposition feature officially documented? -

i realized if juxtapose sequence of ruby string literals (e.g. 'a' "b" 'c' ), it's equivalent concatenation of string literals. however, can't find language feature documented anywhere. i've searched using terms "juxtaposition" , "concatenation", found reference in couple of stackoverflow responses. can point me definitive reference? update this now officially documented in rdoc ships ruby. changes propagate rubydoc next time build documentation. the added documentation: adjacent string literals automatically concatenated interpreter: "con" "cat" "en" "at" "ion" #=> "concatenation" "this string contains "\ "no newlines." #=> "this string contains no newlines." combination of adjacent single-quote, double-quote, percent strings concatenated long percent-string not last. %q{a} 'b' &

c# - Error with Mongo Client -

when try connected mongo server mongo client, following warning: error while trying show server startup warnings: no such cmd it still gives me access , can access database. issue when try accessing db c#. warning throws exception, , application terminates. the mongod command used mongod --port 30000 no startup scripts far can tell. the mongo server running on debian, on machine. update the error thrown .net is unable connect server xxx.xxx.xxx.xx:30000: command 'ping' failed: no such cmd (response: { "errmsg" : "no such cmd", "bad cmd" : { "ping" : 1 }, "ok" : 0.0 }). solved. server version older client version.

Calling nant from msbuild -

i'm attempting run existing nant task msbuild targets file. there way this? google gives me lots of examples of calling msbuild nant, nothing other way around. thank you. you call nant msbuild's exec command. don't think there's other command in msbuild call nant specifically. calling nant target msbuild this <exec command="nant -buildfile:your.build yourtarget"/> and if want nant return something, try in nant: <echo message="yourreturnparameter" file="yourfile.tmp" /> and let msbuild read it: <readlinesfromfile file="yourfile.tmp" > <output taskparameter="lines" itemname="yourreturnparameter"/> </readlinesfromfile> source: http://msdn.microsoft.com/en-us/library/x8zx72cd.aspx

asp classic - SQL Server Stored Procedure SCOPE_IDENTITY() issue -

i have stored procedure , inside can see use 2 scope_identity(); problem second scope_identity assign @status variable when execute stored output @status variable null strange thing 2 inserts works fine. i want return output of stored scope_identity of second insert. can me? alter procedure [dbo].[sp_userinsert] ( @username nvarchar(50)=null, @password nvarchar(50)=null, @email nvarchar(50)=null, @roleid int = 0, @userid int = 0, @typeop int, @status int = 0 output ) begin set nocount on; if (@typeop = 1) /*creazione nuovo recordo nella tabella utenti*/ begin if exists(select * gruppi gruppi.groupid =@roleid) begin insert dbo.utenti(username,password,email) values(@username,@password,@email) set @userid = scope_identity() if (@userid > 0) begin insert dbo.ruoli(userid,groupid) values(@userid,@roleid) set @status = @@rowcount end end end end now hav

c# - I don't understand a piece of someones answer -

this odd question in someones else's answer in different question posted following try { pingreply reply = pinger.send(nameoraddress); pingable = reply.status == ipstatus.success; } how pingable = reply.status == ipstatus.success; work? me looks if statement without if. reply.status == ipstatus.success will return boolean assigned pingable variable. same thing happen inside if statement: first expression calculated, true or false result, , result checked branch condition.

php - How to send the value of a variable between two views in yii -

suppose, in yii framework if other parameter has sent other file. how can this. if admin.php have send variable update.php. how can this if update.php child view inside admin.php , can follow on admin.php $this->renderpartial('update', array('param1'=>'value1', 'param2'=>'value2', ...)) (noted example update.php same folder level admin.php ) if both of files came 2 different actions, or have own url below public function actionadmin(){ ...; $this->render('admin');} public function actionupdate(){ ...; $this->render('update');} you have treat query string admin.php example: <?php echo chtml::link('go update',array( 'controller/update', 'param1'=>'value1', 'param2'=>'value2', ...)); ?> more yii url managger , querystring http://www.yiiframework.com/doc/guide/1.1/en/topics.url

java - JSF and Libraries Unclarity -

after time spent servlets , jsps i'm trying learn jsf. i've learned basics, made couple of simple examples, have basic ideea of 'workflow' still can't understand what's javax.faces.webapp.facesservlet thing. <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> i know "faces servlet" it's 'internal' name xml , gets bind class, in case: javax.faces.webapp.facesservlet. class anyway?! i'm using eclipse, created new dynamic project, glassfish 4.0 server, jsf 2.0 configuration (selected no library) , neither did import jar. how can working? , when try run same thing jboss must import javax.faces-2.2.2.jar file. ok,

saucelabs - Is it possible to limit ammount of concurrent builds in Travis-CI -

we use travis-ci opensauce test our web application. opensauce has limit concurrent running of tests - 2 tests. travis-ci default can run more build/tests in parallel. result of different limits our builds fail randomly. so, possible set limit amount of parallel running builds on travis-ci side? on travis ci project on github there's issue open limiting concurrent builds per project: https://github.com/travis-ci/travis-ci/issues/1366

javascript - How to get the source or id from youtube player onstatechange callback -

this question similar how pass arguments addeventlistner scenario bit different using youtube player's api. so have multiple youtube player on same page, using swfobject: swfobject.embedswf("http://www.youtube.com/v/"+video_id+"?enablejsapi=1&version=3&modestbranding=1&theme=light&color=white&autohide=1&controls=1&showinfo=0&iv_load_policy=3&autoplay=0&playerapiid=<%= "ytplayer#{index}" %>", "<%= "ytplayer#{index}" %>", "500", "280", "8", null, null, params); where i'm using ruby generate ytplayer object id. , i'm listening event onstatechange in function. ytplayer.addeventlistener("onstatechange", "onytplayerstatechanged"); function onytplayerstatechanged(newstate) { if(newstate == -1){ //unstarted }else{ debugger; } } but problem cannot know ytplayer event comes from. (find sourc

How to Avoid Recalculation of Data in R -

when working in r typically create number of intermediate data frames saved off during execution of code. allows me avoid recalculating intermediate data frames if need restart script or crashes. code ends lot of these ugly if/else checks see if intermediate data frame exist. data <- null pathtodata <- "work/data.rds" if(file.exists(pathtodata)) { # load calculated data data <- readrds(pathtodata) } else { # calculate data data <- ... saverds(data, pathtodata) } is there better/simpler way this? ideally done in manner transparent in code. one option wrap ugly code in function, , wrap intermediate steps in other functions. has advantage of making testing easier, , using functions on scripts considered best practice reproducible data analysis. calcdata <- function(...) { #calculate data } lazycalc <- function(fn, ...) { if(file.exists(fn)) { data <- readrds(fn) } else { calcdata(...) return(data) }

sql server 2008 - CURSOR Table Error When Executing: Select statements included within a function cannot return data to a client -

i trying pass 2 values in function using cursor table. correct? modified post earlier. when execute function, executes successfully. unsure how test in sql. use [pmclw1] go /****** object: userdefinedfunction [dbo].[func_pnms_ca] script date: 08/13/2013 14:41:16 ******/ set ansi_nulls on go set quoted_identifier on go alter function [dbo].[func_pnms_ca](@scrdet_seqid int, @jobseqid int) returns varchar(5000) begin declare @retval varchar(5000), @temp varchar(1000) declare cacur cursor select top 1 isnull (spcops_answer, '') spcops scrdet_seqid = @scrdet_seqid declare cacur cursor select b.jbstat_description jbwork inner join jbstat b on a.jbstat_seqid = b.jbstat_seqid a.prjobs_seqid = @jobseqid , a.dptmnt_seqid=7 open cacur fetch next cacur @temp set @retval = '' while @@fetch_status = 0 begin if len(@retval) = 0 set @retval = @temp else set @retval = @retval + ', ' + @tem

java - How to cut/copy/paste text to JTextField when some JComponent is clicked? -

i'm creating custom popup menu, using extended jcomponent menu items , extended jwindow hold them. question - how send signal jcomponent instance when it's clicked (has mouselistener ) jtextfield perform cut/copy/paste actions? edit: i try explain more precisely. jtextfield class (simplified): public class textinputfield extends jtextfield implements focuslistener { private menupopupwindow popup; public textinputfield() { popup = new menupopupwindow();//menupopupwindow class extends jwindow menuitem paste = new menuitem("paste", new imageicon(getclass().getresource("/images/paste_icon.png")), "ctrl+v");//menuitem class extends jcomponent, has implemented mouselistener - , when mouseclicked(mouseevent e) occurs, somehow action signal have sent class menuitem copy = .... menuitem cut = .

php - Get data using variable from query string? -

i hope title used here understandable... i have database 2 columns: ward_id , ward_name. i wish create dynamic pages each ward , have ward_name show in page title. have created header.php file including. i passing id through url using ....?wid={$row['ward_id']} working fine when create other queries use id data database. however problem having page refuses display ward_name page title. expected work: $wardid = $_get['wid']; $query = "select ward_name, ward_id wards ward_id=$wardid"; $result = mysql_query($query); while ($row=mysql_fetch_array($result)) { $pagetitle = "$row['ward_name']"; } but doesn't, have tried many variations on above can't possibly remember them hope can me... here code stands: header page: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="

c# - Umbraco Request.QueryString is null if it's the first time the page is loaded -

i have maddening problem (aren't all?). i supporting umbraco 4.9.0 site experiencing issue querystring property on the request null, first time page loaded. example, www.site.com/download.aspx?id=d99fe4df-28d9-4565-b444-b42499fcefd3 in code-behind, on page_load method, attempting id: var id = request.querystring["id"]; this works except first time page loads. example, first time hit above url, id null. if hit url again, id set value you'd expect. furthermore, if stop , restart web app via visual studio, id variable continues work expected. however, if modify code base @ (example below), again pass non-populated query string first time, , work after time that. var test = "my modification test"; var id = request.querystring["id"]; i noticed request.urlreferrer null, request.url www.site.com/download.aspx. any appreciated! instead of var id = request.querystring["id"]; try var id = request["id&q

What is the most efficient way to create an N-times-a-character string in JavaScript? -

this question has answer here: repeat string - javascript 29 answers i have char (' - ') , number ( 80 ) of times should repeated in string. need string of char repeated given number of times: ------------------------------------------------------------------------------------------------------------- i know can result += mychar x n times in loop. don't think efficient. there better way that? by efficient mean: fastest well, best come with, after couple minutes playing, is: string.prototype.repeat = function (len) { return (new array(len + 1)).join(this); } console.log('-'.repeat(5)); js fiddle demo . which is, unfortunately, cheapened little @nnnnnn commented correct answer 2 minutes beforehand. sigh...

java - broadcast intent cancelled. Android GCM -

i've been struggling error lot , gave up. every time try send message using gcm error appears on logcat. i'm failing do? i've followed android examples set gcm notifications. logcat error edit: message gets through don't think error normal. 08-12 17:13:15.888: w/gtalkservice(2237): [datamsgmgr] broadcast intent callback: result=cancelled forintent { act=com.google.android.c2dm.intent.receive cat=[com.testing.encuesta] (has extras) } androidmanifest.xml <permission android:name="com.testing.encuesta.permission.c2d_message" android:protectionlevel="signature" /> <uses-permission android:name="com.testing.encuesta.permission.c2d_message" /> <uses-permission android:name="com.google.android.c2dm.permission.receive" /> <uses-permission android:name="android.permission.internet"></uses-permission> <uses-permission android:name="android.permission.vibrate"></uses-perm

css - HTML: Can't get DIV to wrap tightly around inner divs -

i've looked around stackoverflow solutions, , far none of them working. i'm trying span wrap tightly around interior divs, goes little bit wider divs inside. i've tried different display, float, margin, , padding properties no luck. #column1, #column2, #column3 { display:block; float:left; width:33%; height:100vh; text-align:center; border: 1px solid black; } #weather_header { width:70%; border: 5px outset skyblue; background-color: skyblue; color: white; } #weather_body { width:70%; border: 5px inset skyblue; background-color: lightblue; color: black; } #clock_header { width:70%; border: 5px outset skyblue; background-color: skyblue; color: white; } #clock_body { width:70%; border: 5px inset skyblue; background-color: lightblue; color: black; } div.widget_box { display: inline-block; border: 1px solid black; } div.widget_header { float:left; text-align:left; padding: 5px 10px; display:inline-block; bord

javascript - Rails 3 + JQuery-File-Upload + Multiple Files -

i using carrierwave allow users upload (1) file per event created. expand options , offer customers availability add multiple images per event. i stuck on how complete task. i know want use jquery-file upload project: http://blueimp.github.io/jquery-file-upload/basic-plus.html stuck on if need create new model called "galleries" , assign each event gallery or if can using setup have , allow user upload, lets say, 5 files per event without having fill out 5 individual file fields , have javascript work on end. any suggestions? need use nested models per: http://railscasts.com/episodes/196-nested-model-form-revised tia

ios - Optimizing workflow to update internally owned cocoapods dependencies? -

let's have main project a several cocoapods dependencies (which internally owned our organization's cocoapods repo). let's i'm working on project a , , while working on find fix on dependencyb , modify code in dependency while still being on projecta's xcode project. what best workflow push changes on dependency it's own repository , updating dependency in project a ? i ways avoid , completely automate or simplify following workflow (which pita) worflow avoid git clone git@github.com:organization/dependencyb.git make changes in dependency project (the same changes made while fixing issue found while working on project a ) update dependencyb.podspec file s.version = "0.1.7" s.source = { :git => "https://github.com/organization/dependencyb.git", :tag => "0.1.7" } commit & tag dependency's version git add -a git commit -m 'made changes' git tag -a 0.1.7 -m 'this awesome tag :d'

Android Bluetooth Low Energy Pairing -

how pair bluetooth low energy(ble) device android read encrypted data. using information in android ble page , able discover device, connect it, discover services , read un-encrypted characteristics. when try read encrypted characteristic (one cause ios show popup asking pair , complete read) getting error code 5 , corresponds insufficient authentication . i not sure how device paired or how provide authentication information read complete . i toyed bluetoothgattcharacteristics trying add descriptors, did not work either. appreciated! when gatt_insufficient_authentication error, system starts bonding process you. in example below i'm trying enable notifications , indications on glucose monitor. first i'm enabling notifications on glucose measurement characteristic can cause error appear. @override public void ondescriptorwrite(bluetoothgatt gatt, bluetoothgattdescriptor descriptor, int status) { if (status == bluetoothgatt.gatt_success) {

erb - Rails Comments ID => nil -

i have comments table , users comment on movie. comment belongs_to :movie , movie has_many :comments my problem when create new comment, field has there <%= f.text_field :movie_id %> , , if remove it, no route matches {:action=>"show", :controller=>"movies", :id=>nil} this absolute path create new comment http://localhost:3000/movies/:movie_id/comments/new i've checked action in movies controller , can't see anything. i've played create action in comments controller still nothing. having field in view can quite confusing user. have solution this? this *comments_controller.rb* class commentscontroller < applicationcontroller # /comments # /comments.json before_filter :load_movie before_filter :authenticate_user!, only: [:create,:destroy,:edit,:destroy] ... # /comments/new # /comments/new.json def new @movie = movie.find(params[:movie_id]) @comment = @movie.comments.new @search = movie.

osx - What the heck is Apple_Ubiquity_Message? -

osx 10.8.4 > printenv ... apple_ubiquity_message=/tmp/launch-yzdhda/apple_ubiquity_message ... > ls -al /tmp/launch-yzdhda/apple_ubiquity_message srw-rw-rw- 1 user wheel 0 jul 25 10:01 /tmp/launch-yzdhda/apple_ubiquity_message stackoverflow wants me add sentences proper grammar. tried cat file, not emit far can tell. it's part of apple's ubiquity system (more commonly known icloud). programs support icloud can use communicate ubiquity daemon ( ubd ), , it's defined in environment programs use icloud can find & use it. more technically: file /system/library/launchagents/com.apple.ubd.plist tells user instance of launchd create socket file, , put reference in environment of processes launchd creates under name apple_ubiquity_message. launchd doesn't start ubd until connects & uses socket. i'm not particularly familiar icloud apis, don't think app developers access directly; instead use icloud apis , those use apple_ubiquity

c++ - Cuda Thrust memory management -

i wrote code below: unsigned int* addrarray = (unsigned int*)malloc(sizeof(unsigned int)*datasetrows); thrust::exclusive_scan(binarydataset,binarydataset+(sizeof(unsigned int)*datasetrows),addrarray); free(addrarray); binarydataset unsigned int* type , have no problems allocating, processing data in part of memory , freeing it. addrarray causes problems. aftter running program following error: *** glibc detected *** ./prog: free(): invalid next size (normal): 0x000000000180be10 *** , memory map. this code wont generate error when use cudafree(addrarray) instead, later cause segmentation fault or glibc malloc memory corruption problem. example running this: unsigned int* addrarray = (unsigned int*)malloc(sizeof(unsigned int)*datasetrows); thrust::exclusive_scan(binarydataset,binarydataset+(sizeof(unsigned int)*datasetrows),addrarray); const unsigned int compactarraysize = addrarray[datasetrows-1] - 1; printf("%u\n",compactarraysize) float* compactminor

Merge commits filtering by author - Git -

git rebase --interactive some_commit~ gives me list of commits some_commit till head . git log --author some_author --oneline some_commit.. gives me list of commits some_author some_commit till head . how rebase commits second list? deleting commits not some_author . update i found way, step missing mind: git cherry-pick commit1 commit2 commit3 ... how commit1 commit2 commit3 ... if output second command is: commit1 message1 commit2 message2 commit3 message3 ? as you've found, cherry-pick way this. can replace --oneline --pretty=%h in log command have list commit ids. you'll want add --reverse commits listed first last, rather recent oldest usual. can entire thing in 1 command with: git cherry-pick $(git log --pretty=%h --reverse --author some_author some_commit..)

database - mysql query to get sum and count -

i using following query now... select id, account_number, (select count(*) `member_tbl` t2 t2.referred_by = t1.account_number ) total_referred `member_tbl` t1; and provides following result... id - id of memenr account_number - account number of user total_referred - total number of members referred account_number but want more results following... total_reffered2 - total number of members they(all accounts referred account_number) referred total_reffered3 - total number of members referred members of total_reffered2 please check mysql fiddle and per mysql fiddle data , query must return following values... | id | account_number | referred_by1 | referred_by2 | referred_by3 +----+-----------------+---------------+--------------+------------- | 1 | ac203003 | 0 | 0 | 0 +----+-----------------+---------------+--------------+------------- | 2 | ac203004 | 1 | 1 | 0 +----+----

Java 8 Lambda function that throws exception? -

i know how create reference method has string parameter , returns int, it's: function<string, integer> however, doesn't work if function throws exception, it's defined as: integer mymethod(string s) throws ioexception how define reference? you'll need 1 of following. if it's code, define own functional interface declares checked exception @functionalinterface public interface checkedfunction<t, r> { r apply(t t) throws ioexception; } and use it void foo (checkedfunction f) { ... } otherwise, wrap integer mymethod(string s) in method doesn't declare checked exception: public integer mywrappedmethod(string s) { try { return mymethod(s); } catch(ioexception e) { throw new uncheckedioexception(e); } } and then function<string, integer> f = (string t) -> mywrappedmethod(t); or function<string, integer> f = (string t) -> { try { return myme

python - Django - Model field to be the sum of other fields -

i trying make 1 field on model (quantidadeimprimir) sum of other fields on same model, going collected through form. trying use property method, when try submit form error: "field 'quantidadeimprimir' doesn't have default value". doing wrong? here's code: model: quantidade_pmasc = models.integerfield() quantidade_mmasc = models.integerfield() quantidade_gmasc = models.integerfield() quantidade_ggmasc = models.integerfield() quantidade_xggmasc = models.integerfield() quantidade_pfem = models.integerfield() quantidade_mfem = models.integerfield() quantidade_gfem = models.integerfield() quantidade_ggfem = models.integerfield() quantidade_02inf = models.integerfield() quantidade_04inf = models.integerfield() quantidade_06inf = models.integerfield() quantidade_08inf = models.integerfield() quantidade_10inf = models.integerfield() quantidade_12inf = models.integerfield() quantidade_14inf = models.integerfield() def _quantidade_imprimir(self): "

How can I use ruby build tools in a php app and deploy to heroku? -

currently, heroku assumes app ruby app because has gemfile. want use compass/foundation in build process, , have gemfile things versioned in standard way. app static site, want heroku run on php stack (which works fine if remove gemfile). you can override default buildpack resolution this heroku config:set buildpack_url=https://github.com/heroku/heroku-buildpack-php see documentation on using custom buildpacks details.

cocoa - How to make NSTableView cells un-selectable, but still have NStextField in the cells editable -

i using view based nstableview. view has instance of nstextfield want selectable. rows of table view should not selectable(this done using delegate method - tableview:shouldselectrow: returns 'no'.) i able copy text textfield when make table rows selectable well. there way keep nstextfield selectable without making table rows selectable too? put code in awakefromnib method or ever applicable code. nstableview not selectable, text fields editable. [mytableview setselectionhighlightstyle:nstableviewselectionhighlightstylenone];

amd - Use PrismJS with RequireJS, even though it's not a dependency -

i'm trying use prismjs while not attaching strict dependency functions. ii needed render syntax highlighting on page but, unfortunately, full styling isn't being passed page. i did read this thread , confirmed prism attached window object, styling isn't showing on page. here's code ( prism.css concatenated other styles via sass): the html: <pre><code class="language-css"> git rm 'myfile.html' </code></pre>` the script tag: <script data-main="/js/config.js" src="/js/require.js"></script> config.js requirejs.config({ baseurl: "/js", deps: ["prism"], paths: { prism: "vendor/prism" }, shim: { "prism": { "exports": "prism" } } }); prism.js define("prism", ["prism"],function(prism) { return prism; //probably redundant }); i have feeling doing in prism.js what

multithreading - JAVA - External exe locking when called from launcher -

i have been trying use custom output stream display output executable on jtext area. the executable called button via try { process p = runtime.getruntime().exec("cgminer.exe" + " -o " + infos.address + ":" + infos.port + " -u " + infos.user + " -p " + infos.password); p.waitfor(); string line; bufferedreader error = new bufferedreader(new inputstreamreader(p.geterrorstream())); while((line = error.readline()) != null){ system.out.println(line); } error.close(); bufferedreader input = new bufferedreader(new inputstreamreader(p.getinputstream())); while((line=input.readline()) != null){ system.out.println(line); } input.close(); outputstream outputstream = p.getoutputstream(); printstream printstream = new printstream(outputstream);

Perl - Is this a bug with looks_like_number, or am I being a stupid person? -

this code: #!/usr/bin/perl -w use strict; use scalar::util qw(looks_like_number); sub what_the_fudge { $string = "foo 123 bar"; if ($string =~ /foo (.+) bar/) { if (looks_like_number($1)) { print "$1 looks number\n"; } else { print "$1 doesnt number\n"; } } } &what_the_fudge; &what_the_fudge; &what_the_fudge; displays this: 123 doesnt number 123 looks number 123 looks number why fail recognize number first time? =( baffles me. some information environment: os: osx 10.6.8 perl -e 'use scalar::util; print "$scalar::util::version\n"' --> 1.19 perl -v --> perl, v5.10.0 built darwin-thread-multi-2level (with 2 registered patches, see perl -v more detail) it's bug fixed in scalar::util 1.20. ("handle overloaded , tied values" in changes file.) the xs version of looks_like_number failed handle magical arguments proper

Isn't core.async contrary to Clojure principles? -

i have seen many clojure programmers enthusiastic new core.async library and, though seems interesting, having hard time seeing how conforms clojure principles, have these questions: it uses mutable state everywhere, function names suggest having exclamation mark, alt!, put!, >!, , others. if put or take value channel, channel modified inplace. isn't contrary clojure philosophy of preferring immutable data-structures, pure functions , on? or core.async made used mutable things not avoided @ all? since "go" macro (thus modifying code structure) , ensures "<!" used directly in go-block, not possible use "<!" inside function, this: (defn take-and-print [c] (println (<! c))) (def ch (chan 1)) (>!! ch 123) (go (take-and-print ch)) assert failed: <! used not in (go ...) block it seems me prevents simplicity , composability. why not problem? maybe consequence of previous 2 issues, lot of code core.async uses lower-level cons

Does Dreamweaver support Java? -

is possible program java in dreamweaver? figure plugin able instead of netbeans because working in dreamweaver better reason. edit: note, idea popped in head. wanted know if friendly question , find can helpful few people in future. dreamweaver not support java compilation. dreamweaver supports web related technologies such html, css , javascript

scoping - update a data frame and environment in R -

i not quite sure why data frame object not update d <- data.frame(titi=c(0)) (function(dataset) { dataset[["toto"]] <- 1; print(names(dataset)) #has "toto" , "titi" })(d) print(names(d)) # no has "toto", "titi" what going on here ? i have workaround in code capture variable , update captured <<- , i'd know mechanism. i aware of danger of mutation in general etc.. dont understand mechanism @ play here. edit although seems consensus language level feature, dont follow argument, if use close structure, data table, can mutate : d <- data.table(titi=c(0)) (function(dataset) { dataset[,toto:=1] print(names(dataset)) #"titi" "toto" })(d) print(names(d)) #"titi" "toto" what going on here? you haven't read the introduction r , not section on assignment within functions or section on writing own functions two pertinent quotes are note ord

json - EmberJS set active class for dynamic linkTo on menu when direct accessed -

i've been trying since last week, make active class work on dynamic links: <li>{{#linkto tag 'bw'}}black , white{{/linkto}}</li> <li>{{#linkto tag 'instax'}}instax{{/linkto}}</li> <li>{{#linkto tag 'digital'}}digital{{/linkto}}</li> i put code running here: http://jsbin.com/opuzop/1/edit if feel ok me great :d it's photo portfolio well. also, if try upload newer version of ember, stuff stop work, js created on app.generalview = ember.view.extend({ didinsertelement: function() { if(this.$() !== undefined){... it created load after view render, image resize , body resize too, , set horizontal, newer version work when accessed directly. also, don't json tumblr , stop working. i'm not sure, think has serialization of object, try adding in "app.tagroute" route: serialize: function(param) { return {tag: param.tag} }

directx - C# DX What is this param mean? -

i ran while using slimdx messagepump.run(form, () => { }); what () => { } do? the expression () => {} empty lambda expression. function messagepump.run defined as : public static void run( form form, mainloop mainloop ) mainloop defined as : public delegate void mainloop() so delegate not expects parameters. when pass () => {} method nothing like: public void mainloopimpl() { //empty method } now create mainloop instance: var mloop = new mainloop(mainloopimpl); //or alternative syntax mainloop mloop = mainloopimpl; //call run messagepump.run(form, mloop); details declaring, creating , using delegates (including lambda expression declaration way) explained in detail on this msdn page .

android - Pausing an enhanced for loop -

i using enhanced loop , switch statement trigger various asynctasks. how can pause each iteration of loop wait until given asynctask compeleted? trying spawn thread , wait / join / notify when each asynctask complete keep freezing ui. below code snippet... for (integer integer : sequence) { switch (integer) { case 1: // async process break; case 2: // async process break; case 3: // async process break; case 4: // async process break; default: break; } //need magic solution here... } loop not choice. add 'finish' callback after each asynctask(). create kind of chain of code. can save last added in chain can add new item in chain.

jquery infinite carousel viewport size relative to carousel image size -

i'd preface fact posting first time , totally noob web design , forum... i trying setup carousel gallery display images , i'm utilizing jquery infinite carousel script so. i've noticed images seem shorter viewport window though believe i've set dimensions same. i've done trial , error , believe it's css setting don't have correct, wouldn't surprised if i'm way off. as mentioned, i've never posted here before whatever you'd me post, try , in order beneficial feedback. i haven't modified of original js (jquery.infinite-carousel.js). have modified .css file downloaded easier me understand. thanks kind of help. #gallery{ width: 1200px; overflow:hidden; margin-left: auto; margin-right: auto; margin-top: 36px; border-width: 0 2px 0 2px; border-color: #666; border-style: solid; } #gallery ul{ position: relative; padding: 0; margin-top: 0; //<------- adding line fixed problem } #gallery li{ width: 1200px; height: 800px; float: l

mongoid3 - Array Creation array in mongodb -

portfolio class has array field named folders. when create using : db.portfolio.insert( folders: [ {"name"=>"folder 1", "stocks"=>[ {"name"=>"stock name", "id"=>"stock id1", "qty"=>2}, {"name"=>"stock name", "id"=>"stock id2", "qty"=>1} ]}, {"name"=>"folder 2", "stocks"=>[ {"name"=>"stock name", "id"=>"stock id3", "qty"=>2}, {"name"=>"stock name", "id"=>"stock id4", "qty"=>1} ]} ]) i got error "syntaxerror: missing ) after argument list (shell):1". guesses? this work: db.portfolio.insert({ folders: [ {"name"

forms - Passing php session variables non standard way -

i use following php code , html form pass "item_name" value downloading page. <?php session_start(); $_session['item_name']="item_name"; ?> ... <form action="download.php" method="post"> <input type="hidden" name="item_name" value="133076"> <input type="submit" value="download"> </form> i receive , use "item_name" value on downloading page this. <?php session_start(); $item_name=$_post["item_name"]; ?> all works fine, have following problem hope solve here. after initial click want come same html page this: <form action="" method="post"> then using javascript, generate link "download.php" , after able download file. problem time when i'm clicking newly generated link go "download.php" the $_session['item_name']="item_name"; is lost. how can preserv

variables - Python Mistake - Number of letters in name -

write program checks how long name is. program should take name input user. if name has 3 or fewer letters, program should work this: enter name: lin hi lin, have short name. if name has between 4 , 8 letters (inclusive), program should work this: enter name: jimmy hi jimmy, nice meet you. otherwise, if name has more 8 letters, program should work this: enter name: yaasmeena hi yaasmeena, have long name. here's attempt returns "hi xxxxxxx, have short name" regardless of length. name = input('enter name: ') if name.count('name') >= int(3): print ('hi', 'name', ',', 'nice meet you.') elif name.count('name') <= int(3): print ('hi', 'name', ',', 'you have short name.') elif name.count('name') > int(8): print ('hi', 'name', ',', 'you have long name.') you should use len(name) , don't need int(3) 3

php - How to receive ajax json data in a codeigniter controller -

on client side have : var postdata = { "id" : id, "message" : message }; console.log(postdata); $.ajax({ type: "post", url: "controller/function", data: postdata, success: function(){ alert(id + ' ' + message); } }); this appears working can see correct post parameters in chrome dev tools. in codeigniter controller have tried: echo 'postid' . $_post['id'].' '.$_post['message']; $postdata=$this->input->post('id'); var_dump($postdata); exit; i'm getting: message: undefined index: id message: undefined index: message boolean(false) the $_post array empty. how can fix this? thank help you may add datatype:'json' in ajax options $.ajax({ type: "post", url: "controller/function", data: postdata, datatype:'json', success: function(){ alert(id +

c# - Ninject: Is it possible to have parent object in SingletonScope and child in TransientScope? -

i have been racking brain on , off few weeks now... currenlty have this: a bunch of *service classes all of these depend on different *repository classes access database via ef to allow unit testing derivate of dbcontext injected repositories. (so can not use using dispose of contexts) to correctly dispose of ef contexts injected run dependency tree in inrequestscope() or in simple custom scope - inscope(c => new object()) on top level , in inparentscope() on other levels. both of these approaches create , dispose lot of objects during each request. in addition talking single page application 95% of queries (50 or so) executed during 2 requests inrequestscope() seems not idea. *service classes hold no state , insingletonscope() , minimize amount of object creation. the question is possible have parent *service , *repository classes in insingletonscope() , somehow inject ef dbcontext in scope return new instance each time accessed , honor idisposable

assembly - Copy and execute -

i'm writing simple bootloader custom kernel. has simple logic: bootloader loaded bios. copy 0x8000. load kernel disk 0x9000. jump 0x8000 , copy kernel 0x0 , set gdt. jump 0x0. here bootloader: .set dest, 0x8000 start: movw $0x3, %ax int $0x10 movw msg, %bp movw $0xa, %cx call print_msg //copy end of bootloader new place selfcopy: cld xor %ax, %ax movw %ax, %ds movl move_kernel, %esi movw %ax, %es movl dest, %edi movl (move_kernel_end-move_kernel), %ecx rep movsb //load kernel 0x9000 load_kernel: xor %dx, %dx xor %ah, %ah int $0x10 jc reboot xor %ax, %ax movw %ax, %ds movb $0x42, %ah movw dap, %si int $0x13 jc reboot jmp dest dap: .byte 0x10 .byte 0x0 .word 2048 //offset .word 9000 .word 0x0 .long 1 move_kernel: xor %ax, %ax movw %ax, %ds movl $0x9000, %esi movw %ax, %es movl $0x0, %edi movl (move_kernel_end-move_kernel), %ecx rep movsb lgdt gdtr