Posts

Showing posts from August, 2014

javascript - Gruntfile.js not updating to the directory files -

i keep getting error: get http://localhost:9000/scripts/controllers/about.js localhost/:80 http://localhost:9000/scripts/controllers/main.js localhost/:79 http://localhost:9000/scripts/controllers/ayat.js when renamed controllers main.controller.js , whatever.controller.js for reason, index.html file not being updated other files, when rename without dot in middle. my gruntfile: // generated on 2014-11-15 using generator-angular 0.10.0 'use strict'; // # globbing // performance reasons we're matching 1 level down: // 'test/spec/{,*/}*.js' // use if want recursively match subfolders: // 'test/spec/**/*.js' module.exports = function (grunt) { // load grunt tasks automatically require('load-grunt-tasks')(grunt); // time how long tasks take. can when optimizing build times require('time-grunt')(grunt); // configurable paths application var appconfig = { app: require('./bower.json').apppath || 'a

asynchronous - rxjava - Combine onerror and timout handling -

i start want achieve. i want call method returns observabe. i not know if called method handles exceptions , timeouts i want combine observables in call (merge/zip etc) if 1 method fails, want answers methods succeeded - don't want break flow. in case of exception, capable of handling , continuing flow, when try add timeoutmanagement fail. here code public static void main(string[] args) { createobservables(false, true); // stalls timeout zip(); } private static void createobservables(final boolean throwexception, final boolean stall) { obs1 = observable.just(1); obs1 = obs1.map(new func1<integer, integer>() { @override public integer call(integer integer) { int = 0; if (throwexception) getobj().equals(""); if (stall) zzz(10); return ++integer; } }); obs2 = observable.just(111); } pr

c# - Retrieving drop down list items from list of controls -

i attempting retrieve listitemcollection list of controls. list contains many controls of different types - dropdownlist , label , textbox . i retrieve listitem dropdownlist controls contained in original list of controls. my thought process far has been extract of dropdownlist controls new list, , iterate though pull out each listitem - however, every dropdownlist control coming 0 items controlcollection clist = pnlcontent.controls; list<dropdownlist> ddllist = new list<dropdownlist>(); foreach (control c in clist) { if (c.gettype() == new dropdownlist().gettype()) { ddllist.add((dropdownlist)c); } } listitemcollection itemcollection = new listitemcollection(); foreach (dropdownlist ddl in ddllist) { foreach(listitem li in ddl.items) { itemcollection.add(li); } } i'm sure wrong (and massively inefficient) way of doing this. appreciated. this do: public ienumerable<listitem> getlistitems(con

multidimensional array - Passing C# List to X++ -

in c# project in microsoft dynamics ax 2012 aot have method returns list , wanted refer method in x++ code. my initial thought should easy. like: list xppprojectlist = csharpgetprojectlist.getstringlist(); . however, didn't worked. after extensive research on internet found out, use system.collections.arraylist instead of list , time works, single dimension collections. x++ code that's supposed consume c# collection: public void getprojectlist() { csharpgetprojectlist = new ps2010service.csharpgetprojectlist(); projectlist = csharpgetprojectlist.getstringlist(); length = projectlist.get_count(); (i = 0; < length; i++) { info(projectlist.get_item(i)); } } c# method returning list<t> works : public static list<string> getstringlist() { list<string> list = new list<string>(); list.add("one"); list.add("two"); list.add("three"); return list; } c# meth

android - Which one is better option for maintaining application or activities? -

which 1 better option application or activities? a. baseactivity class , [or] b.singleton class. in application of activities same actions show toasts, maintaining sessions, static variables,show edittext errors, http request/response, etc., i'm extends baseactivity in activities needed. you're on right path, baseclass preferred because of thing mentioned (manipulating toasts , edittext functions) require context work with. singleton class need context passed every method call - baseclass not (since technically context itself).

websocket - Why Spring SendToUser does not work -

i followed instruction spring send response particular user, not broadcast message instead.but in end, no response message can sent back. this js code: var stompclient = null; function setconnected(connected) { document.getelementbyid('connect').disabled = connected; document.getelementbyid('disconnect').disabled = !connected; document.getelementbyid('conversationdiv').style.visibility = connected ? 'visible': 'hidden'; document.getelementbyid('response').innerhtml = ''; } function connect() { var socket = new sockjs('reqsample'); stompclient = stomp.over(socket); stompclient.connect({}, function(frame) { setconnected(true); console.log('connected: ' + frame); stompclient.subscribe('user/queue/resp', function(resp) { var body = json.parse(resp.body); showresp('cmid:' + body.cmid + ',reqname:' + b

jquery - Not able to use cloudfront URL with flexpaper -

i using flexpaper classic trial version accepts swf files display documents in rails web application. i have content available on s3 within private distibution, can accessible using cloudfront signed urls. when provide url flexplayer, example : http://d2qpwcrmsdq67g.cloudfront.net/172/ebooks/1357d6f7c32e68f27caf63b84085bd22.swf?expires=1416463422&signature=signature&key-pair-id=key-pair-id $('#documentviewer').flexpaperviewer( { config : { swffile : "http://d2qpwcrmsdq67g.cloudfront.net/172/ebooks/1357d6f7c32e68f27caf63b84085bd22.swf?expires=1416463422&signature=signature&key-pair-id=key-pair-id", scale : 0.6, zoomtransition : 'easeout', zoomtime : 0.5, zoominterval : 0.1, fitpageonload : false, fitwidthonload : false, printenabled : false, fullscreenasmaxwindow : false, progressiveloading : true,

c# - Launch an application on on the server machine through Process.Start() on button click -

i've c# asp.net webapp hosted, should start internetexplorer process on server on button click client side browser. protected void button1_click(object sender, eventargs e) { process.start("iexplore.exe", "www.google.com"); } unfortunately not working out fine me. when debug this, works. please me achieve this. thanks, /aravind i assume don't want start ie , obvious security issues aside; suggest take @ these two: running process on server via asp.net/c# on iis , process.start permissions problem

how to center vertically text with adding/updating only css code and very small html code update -

i have html code generated wordpress plugin , want center vertically text on right.i cannot change html code because it's generated plugin (i have check if im allowed modify soruce code). in html code div tag can swapped or modified in way. but idea if text can center vertically updating existing css class definitions , changing starting , ending divs in html code? jsfiddle demo html code: <div> <a class="tptn_link" rel="bookmark" href="http://localhost/wordpress/?p=30"> <img class="tptn_thumb" border="1" style="max-width:100px;max-height:100px;" title="post taxtips" alt="post taxtips" src="http://localhost/wordpress/wp-content/plugins/top-10/timthum…2ftaxhug%2fimages%2ffeatured-taxtips.png&w=60&h=60&zc=1&q=75"></img> </a> <span class="tptn_after_thumb"> <a class="tptn_link" rel=&

java - Automatic cache refresh with Guava -

forum ( how automatically refresh cache using google guava? ), learn guava. wanted ask information above topic ( how automatically refresh cache using google guava? ) can't write comments questions because reputation low. consequently, have create new topic. thank understanding. seeing code, loadingcache<k, v> cache = cachebuilder.newbuilder() .refreshafterwrite(15, timeunit.minutes) .maximumsize(100) .build(new mycacheloader()); if 1 entry loaded value @ least 1 time, above code sufficient reload automatically every 15 minutes value associated key ? of course, mentioned frank, "i override cachebuilder.reload(k, v) method in mycacheloader performs asynchronously." or have code add ? if yes, ? thank much ps: jb, javadoc perfect level in english low. in fact, overridden reload of cacheloader see if real reload has performed key, , if yes, realize real reload key; otherwise not make real reload of cache key. and, in second case

can i create string.xml file dynamically in android? -

this question has answer here: change value of r.string programmatically 7 answers i want implement "settings" section in application, , want when user selects whatever, 1 of strings string.xml change value according user selection. possible @ all? ideas on how implement it? you can't create strings.xml dynamically. but can following: create stringmanager.java hashmap strings. store user defined values in map key / value pairs. key original string strings.xml public string getstring(int key) { *check if string in map *if not in map: return key's value, (eg.: getresources().getstring(resid)), user happy *if key present return user defined value } //call settings section setstring(int key, string value) { // key string defined in strings.xml, value user defined value. } you have implement kind of save/load methods make changes pe

Why does a clojure future block the main thread? -

i have trivial lein project -main contains future: (def f (future 42)) (defn -main [& args] (println @f)) when run lein run prints 42 not return. i don't understand why not return ? how lein run return ? your question twofold: why lein not return? lein hangs because thread pool backs clojure futures not use daemon threads have explicitly shut down. if change code following, should work: (def f (future 42)) (defn -main [& args] (println @f) (shutdown-agents)) futures block main thread the line (println @f) can potentially block main thread when "derefing" f if future hasn't finished job yet. this limitation of clojure futures can addressed using core.async or rxclojure . i've been working on alternative implementation of futures clojure plan open source , addresses these issues.

ios - circular Profile picture using Quartzcore framework -

i want make set image uiimageview circularly. my uiimageview width , height 150 , image want set 50 x 50 below code have tried: self.profileimageview.layer.cornerradius = self.profileimageview.frame.size.width / 2; self.profileimageview.layer.borderwidth = 3.0f; self.profileimageview.layer.bordercolor = [uicolor whitecolor].cgcolor; self.profileimageview.clipstobounds = yes; by using above code getting blurred image. any ideas or suggestions? ok want scale image use code.. - (uiimage *)imagewithimage:(uiimage *)image scaledtosize:(cgsize)newsize { uigraphicsbeginimagecontextwithoptions(newsize, no, 0.0); [image drawinrect:cgrectmake(0, 0, newsize.width, newsize.height)]; uiimage *newimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return newimage;} and wherever set image this.. self.profileimageview=[self imagewithimage:self.profileimageview.image scaledtosize:cgsizemake(50, 50)]; i hope you..

SCSS Nesting with pseudoelements Sass -

i learning nested concept scss. run problem using pseudoelement in combination of compound selectors. i have create scss snippet: &[data-tag="foo"]::before{ content: "foo"; &[class]{ content: "foo-class"; } } the output css file looks this: body[data-tag="foo"]::before { content: "foo"; } /* class selector appends after before declaration */ body[data-tag="foo"]::before[class] { content: "foo-class"; } now have wrong before element, because class-attribute after before-element declared. output of this: <body class="notice" data-tag="foo"/> is foo, not foo-class. i have tried set parent selector after class attribtue in scss file, throws error. set before-element after class attribute, ignored compiler. is there way achieve nesting? it looks you'll need split selectors bit: &[data-tag="foo&quo

java - ${} variables not showing - Spring MVC -

i´m have maven project spring mvc, spring security , spring social. when put message in jsp, show ${message} instace of message. i have jstl library. my jsp: <%@ page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!doctype html> <html> <head> <meta charset="utf-8"> </head> <body> <script> var m = '${message}'; alert(m); </script> ${pagecontext.request.contextpath} <c:out value="${message}"></c:out> <br /><br /> ${message} <br /><br /> ${currentuserconnection.profileurl} <br /><br /> </body> </html> my controller: @controller public class logincontroller { @requestmapping(value = "/signup**") public modela

collections - No random access method for Java Set -

i wonder why there no random access method get(object) map in java set . in current implementation iterating whole collection seems unnecessary overhead. > boolean contains(object o) returns true if set contains specified element. (from https://docs.oracle.com/javase/7/docs/api/java/util/set.html )

python - postgresql drop unique constraint after changing the class definition in django -

i had created table model class in django: class a(models.model): code = models.charfield(unique=true,max_length=2) name = models.charfield(max_length=20) later after adding data, changed model definition remove unique constraint as class a(models.model): code = models.charfield(max_length=2) name = models.charfield(max_length=20) in postgresql using psql dropped constraint as: alter table drop constraint "unique_a_code_key"; now after 2 days, still not able add existing code value thru' django admin form. how can remove constraint not see #d+ a; in postgres have reloaded django app, working fine. problem app started in screen few days back. after stopping application in screen , restarting, shows running in port. killed process , restarted application. well! working fine!

Importing CSV to excel incorrectly (dot and comma issue) -

i have csv (tab delimited) file want import. in 1 column there numbers decimal part should separated comma. if there number 50,59459 when imported shown 5059459,00000. although, when in csv file number 20.08998 imported fine. what might problem not reading comma separated decimals correctly? for importing using macro found on page: http://sitestory.dk/excel_vba/csv-file-import.htm your regional settings us. if have csv file showing ,s disregard them. story local being set true vba pick delimiter symbol regional settings. need change decimal symbol in regional settings before import files european style decimal separators. (or change in vba after having done test on data)

matlab - How to get co-ordinates of a contour of a binary image? -

this question has answer here: matlab - find contour of binary bit map? 3 answers i have binary image , want extract co-ordinates of contour of binary image.the built in contour() functions resulted in double values, instead want array i.e. series of (x,y) of contour.it ok if co ordinates in polar (x+iy) form. can me please ? you can contour mask eroding mask simple small structure element (disk/square) con = bw & ~imerode( bw, [0 1 0; 1 1 1; 0 1 0] ); figure; imshow( con ); title('contour mask'); [cy cx] = find(con); %// coordinates of contour pixels coming think it, there several (related) functions tracing boundaries of binary masks in image processing toolbox. have tried bwtraceboundary or bwboundaries ?

ios8 - Load uncompressed collada file using iOS Scene Kit -

i need load collada file downloaded on ios, intend use scene kit it. reading documentation found out xcode compresses collada files on compilation time, , scene kit can load compressed files. after research ran article author able find scripts xcode uses , compress files using them. problem i'm not being able run them on server. so question is: there other way load collada files using scene kit? or there somewhere can find algorithm compression myself? if can't upload compressed files on server , cannot convert them on fly on server, i'm afraid have manually parse collada files , instantiate scenekit objects yourself.

c# - Regex extremely slow when close matching -

i attempting fix regex searches html elements attributes named "langtoken" other permutations such "langtoken_title". if search langtoken using word boundary returns results ~1,750,000 character string in around 0.2 seconds if omit word boundary capture langtoken_title attributes spikes around 95 seconds. the regex had was <([^>\s]+) [^>]*langtoken([^>]*?(\\*)?/>|.*?<(\\*)?/\1>) so far attempts have changed to <([^>\s]+) [^>]*langtoken(?:\b|_)(?:[^>]*/>|.*?</\1>) i should note in string being searched (an html document) there 1431 occurrences of elements langtoken attribute , 5 of langtoken_title attribute. believe near match causing issue not sure. this first foray regex , appreciated in creating more efficient expression.

http - Best way to send content in PERL POST Request? -

i sending perl post request on https . during sending request need send 2 things in content 1 authorization token , other command need executed on server side. what should approach send these 2 things content? should be:- $request->content($token) $request->content($command) or should my @content =($token,$command) $request->content(\@content) the module using lwp::useragent , in creating http::request type object my $request = http::request->new(post => "<url>"); , in object sending content. there single content (request body) post request. call of content replaces defined content. please have @ documentation lwp::useragent::post defines how send post data multiple values. also, might useful if understand how forms in html work, both on client (browser) , on server side. because if know server side expects in detail can create proper request.

ios - How to show a view created inside the custom tableview cell by swiping the row? -

i have created iphone app has custom tableview cell , created view in cellforrowatindexpath . now, when swiping the cell in uitable view created should displayed in particular cell , other cell contents should remained same. my code follows: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { rkcardcell *cell = [self.tableview dequeuereusablecellwithidentifier:@"rkcardcell"]; // configure cell... if (cell == nil) { cell = [[rkcardcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"rkcardcell"]; } uiswipegesturerecognizer *swipegesture = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(swipemethod:)]; swipegesture.direction = uiswipegesturerecognizerdirectionleft; [cell addgesturerecognizer:swipegesture]; uiview *view = [[uiview alloc] initwithframe:cgrectmake(-320.0, 8.0, 300, 180)]; [view setbackgroundcolor:[uicolor greencolor]]; cell.profileimage.image =

Mongodb count() of internal array -

i have following mongodb collection db.students: /* 0 */ { "id" : "0000", "name" : "john" "subjects" : [ { "professor" : "smith", "day" : "monday" }, { "professor" : "smith", "day" : "tuesday" } ] } /* 1 */ { "id" : "0001", "name" : "mike" "subjects" : [ { "professor" : "smith", "day" : "monday" } ] } i want find number of subjects given student. have query: db.students.find({'id':'0000'}) that return student document. how find count 'subjects'? doable in simple query? if query return 1 element : db.students.find({'id':'0000'})[0].subjects.length; for multiple elements in cursor : db.

python - On what port Pyrax connects to rackspace cloud containers? -

i using pyrax transferring media files rackspace cloud files. since implemented user authentication using samba in our office pyrax fails connect cloud containers on development machine. want know on port pyrax connect rackspace cloud containers can ask samba server allow pyrax on port. all of rackspace apis accessed on port 443 pyrax.

java - Sending a request from one WSDL to another WSDL -

Image
i want know possible send request 1 wsdl wsdl. if yes, how do that? the flow : i want expose wsdl using switchyard wsdl-1 might have 100 parameters, create, get, delete , set request. want xslt take request wsdl-1 , pick few parameters , ignore other remaining parameter. picked parameters in xslt, want send request other wsdl wsdl-2 perform task. i not sure how do , need guidance . please let me if question not clear end. edit : adding exact flow architecture looking for. want know how communication wsdl country 1 , sim wsdl. i want know whether possible or not (communication between 2 wsdls). please let know if need more explanation. you may try link below, provids detailed expalianation on above questions : https://developer.jboss.org/message/910909#910909

unity3d - Can I submit a ios Build Which is developed using Unity -

i developing small 3d game using unity free trial version , can submit ios build developed using unity free trial version? yes can. check unity faq http://unity3d.com/unity/faq can sell games , make money free version of unity? yes can create , sell game free version of unity, without paying royalties or revenue share. however, free version of unity may not licensed commercial entity annual gross revenues (based on fiscal year) in excess of us$100,000, or educational, non-profit or government entity annual budget of on us$100,000. please aware feature set of free version not intended production of professional games , interactive content. lastly, games made our pro trial licenses may not distributed nor used commercial purposes.

ruby on rails - Unknown error when nginx is starting? -

when started , configtest nginx . got unknown error below sudo service nginx configtest nginx: configuration file /opt/nginx/conf/nginx.conf syntax ok nginx: [alert] unable start phusion passenger watchdog because encountered following error during startup: unable start phusion passenger helper agent: seems have crashed during startup unknown reason, exit code 1 (-1: unknown error) my configuration file looks #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { passenger_root /home/sarath/.rvm/gems/ruby-2.1.0/gems/passenger-4.0.53; passenger_ruby /home/sarath/.rvm/gems/ruby-2.1.0/wrappers/ruby; include mime.types; default_type application/octet-stream; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; gzip on; gzip_vary o

java - how to know maven compiler version ?is this same as maven installation i.e-apache-maven-3.1.1 -

in pom.xml <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>2.3.2</version> <configuration> <source>${jdk.version}</source> <target>${jdk.version}</target> </configuration> </plugin> should version no?,i mean version no? is same i.e mvn installation . see http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#source although values not explicitly defined, follows convention of major java releases - 1.5, 1.6, 1.7, 1.8, etc.

actionscript 3 - Getting connection status with as3 ( like weak, string etc... ) -

i need client check if user connection server strong or weak or etc, searched lot , think using urlloader may answer: i need ping network flash or actionscript is there better way or should it? the thing using urlloader tell if device has connection server or not. there no in between, seem desire. additionally, if requested server down or slow (and flash times out), app think has no connection internet @ all. if using adobe air, suggest looking air native extension (commonly abbreviated ane) this. freshplanet has 1 called "ane-network-info" provides way ios , android apps read if have network connection or not, though no way signal strength. searching , find one, @ least ios and/or android. if isn't air app, there's not can do. suggest treat other website. if connection drops or weak, that's problem of client, not yours. if request server fails, alert them. beyond that, don't think there else can do.

java - HexDumpProxyFrontendHandler & HexDumpProxyBackendHandler -

how can modify status code hexdumpproxyfrontendhandler or hexdumpproxybackendhandler class? becase want change 302 status 200. if dont want write own decoder use httpresponsedecoder , httpobject aggregator infront of backendhandler , modify response states

java - Session not working on GAE server, only locally -

i have google app engine (java) project i'm trying use sessions. in appengine-web.xml file have <sessions-enabled>true</sessions-enabled> . have userendpoint class has api method called "login". if user that's trying login app legit create session inside method: httpsession session = req.getsession(); session.setattribute("userid", new longbean(user.getid().longvalue())); the longbean object serializable , looks like: public class longbean implements serializable { private static final long serialversionuid = 8041280664162299553l; private long longvalue; public longbean(long longvalue) { this.longvalue = longvalue; } public long getlongvalue() { return longvalue; } public void setlongvalue(long longvalue) { this.longvalue = longvalue; } } . now, have api method in endpoint called insertscore. there check if session not null , has correct "userid" attribute. sign

user interface - How to reset Eclipse Luna theme to "none" -

Image
after installing luna had no theme set resulted in following ui: needless say, look. :) when playing settings changed ui theme , can't back. combo box u can set theme doesn't allow empty selection. now stuck old theme. help! exporting current workspace settings revealed entries containing following string: org.eclipse.e4.ui.css.theme.e4_default6.1 apparently native name of "windows 7 classic" theme in eclipse. searching workspaces .metadata folder revealed 12 occurences (i recommend editplus or notepad++ this). after deleting got clean "null" theme look. now happy again. :)

html - Placeholder asterisk not showing in FF 33.1 -

i found snippet of code: <input type="text" placeholder="e-mail" class="email"/> ::-webkit-input-placeholder:after { content: '*'; } :-moz-placeholder:after { /* firefox 18- */ content: '*'; } ::-moz-placeholder:after { /* firefox 19+ */ content: '*'; } :-ms-input-placeholder:after { content: '*'; } although says ff 19+, when tested on ff 33.1 (my current version) asterisk not displayed. i validating form , need have asterisk in required inputs. thanks

visual studio 2013 - Setting post-build event commands? -

Image
is possible set post-build in vs2013 , multi-device hybrid apps ctp3? want able copy output apk different location. you can use msbuild post build event copy apk bin\android\debug custom location. can add postbuildevent project file execute copy command or can run task copy apk 1 location another. <itemdefinitiongroup> <postbuildevent> <command>copy source_apk_location target_apk_location</command> <message>making copy of apk</message> </postbuildevent> </itemdefinitiongroup> to edit project file go solution explorer, under project node contextmenu click unload project --> edit *.jsproj , after making changes reload project.

php - Yii2 CRUD url issue -

my yii2 app based on advanced template. created crud model named news in backend side. now when try open /localhost/backend/web/index.php?r=news getting unable resolve request news. not found (#404) unable resolve request "news". here structure: backend models news controllers newscontroller views news index _form _search create update view the url /localhost/backend/web/index.php?r=news what doing wrong? try /localhost/backend/web/index.php?r=news case sensitive.

javascript - how to enable row count to automatically reorder in html -

so let added row 1 2 3 4 5 if delete row 2 3 , how make current row become 1 4 5 1 2 3 , add new row start 4 instead of 6. following example of current code this fiddle, somehow add row didnt work in fiddle working @ site http://jsfiddle.net/q0kcnk6r/ </script> //$('btnaddd').click(function(){ var count =0; function add(){ $("#tbldata tbody").append( "<tr>"+ "<td ><input type='text' size ='2' value ='"+ ++count +"' /></td>"+ "<td><input type='text' size ='43'/></td>"+ "<td><input type='text' size ='4'/></td>"+ "<td><img src='img/disk.jpg' class='btnsave'><img src='img/delete.png' class='btndelete'/></td>"+ "</tr>

php - MySQL insert multiple records and reference them in another table -

i make inquiry generic possible, don't want specifics rather learn accepted approach problem. i have data, structured this: $data => array ( [0] => array ( [field_index] => 2 [comment] => damage of object 1 [image] => array ( [url] => /path/to/file/my_image.jpg [fname] => my_image.jpg [fsize] => 77005 ) ), [1] ... [2] ... ) i trying insert in 2 tables files , records , image data stored in first , record data reference image id stored in second. the way can loop through items , run insert queries 1 one, so: foreach($data $item){ // insert image files table // insert_id // insert item data records (use insert_id of image reference) } my question is: a) ok run insert queries one-by-one opposed inserting multiple rows in single query? b) there alternative m

ToString conversion in the C# LINQ query -

i having (most trivial problem) strings comparison in c# i running linq query var result = q in table q.valuedate.tostring() == "12/11/2014 12:00:00 am" select q; and empty response however, when try foreach (var in table) { console.writeline(i.valuedate.tostring()); } i 12/11/2014 12:00:00 12/11/2014 12:00:00 12/11/2014 12:00:00 12/11/2014 12:00:00 what doing wrong here? i wouldn't sacrifice type safety of date converting string - possibly happening tostring() being converted *char type via cast / convert in db, results in different format. here's how it: var checkdatetime = new datetime(2014, 11, 12); var result = q in table q.valuedate == checkdatetime select q;

gcc - C - Using shared library -

i have made makefile creating shared library of 2 c code files (i used gcc). makefile creating runnable main c file. need know how tell main c file use shared library - because need use functions contained in code files in shared library. help. #include header file containing declaration of function(s) want use in main file. link shared library using -l/path/to/libraries abc.c -l<yourlib> . [assuming libary name lib<yourlib>.so ] note: can find reads here .

lisp - Creating a keyword symbol -

i'm trying create macro takes keyword parameters and, if parameter defined, add entries list. splitting following code should illustrate need. (defun add-if-not-null (var lst) (if (not (null var)) (append (cons (***) (cons ver '())) lst))) the 3 asterisks show part i'm trying figure out. takes symbol name , turns keyword representation. e.g. width converts :width (let ((width 100)) (add-if-not-null (width '()))) should return (:width 100) i'm using cl-who create svg representation , want set attributes width , height if specified parameters macro wraps document. the name of package keyword . symbols created (if necessary) , put package using intern . cl-user 11 > (intern (symbol-name 'width) "keyword") :width a macro: cl-user 29 > (defmacro add-if-not-null (var list) (check-type var symbol) `(when var (push (list ,(intern (symbol-name var) "keyword&quo

sql server - Sql serverrRecursive query for BOM not showing child parts -

i have 3 tables: so_items sales orders - socte lists parts have live sales orders components - links part it's component part ( can several layers deep ). cr lists parts , it's components using recursion. wo works orders - wocte lists parts have active sales orders , respective work order. the problem have is: i have sales order part 100831 made 100831-u. have works order number 10 100831 , 11 100831-u. the result of query is: part wo 100831 10 100831-u 11 which correct. but be part wo 100831 10 100831 11 i want part sales order listed , components works orders. have tried using variables can't seem right. any appreciated i have created sql fiddle http://sqlfiddle.com/#!3/c77a5/1 the current output is: | part | wo | |-----------|----| | 100831 | 10 | | 100831-u | 11 | | 106061 | 12 | | 43567 | 15 | | r106061-1 | 13 | | r106061-1 | 14 | and trying parts in so_items (sales orders) wo_no (work order numbers) in it

mysql - Ruby/Rails updating existing records with duplicate's data -

i have app has monitors development of skills, has many training_programs , each training_program has many participants. the user every month can add either participants individually or upload through excel. have situation people uploading spreadsheet amended each week, duplicating participants within system. one of fields times_trained , , expecting each time participant added if exists sum attributes together. training_program.participants.first => { id: 33, name: "rob", id: 123456789, times_trained: 3, amount_spent: 65000 } so if want add participant.new(name: "rob", id: 123456789, times_trained: 2, amount_spent: 25) rather adding new participant, should update existing one. if want find rob again can participant.find(33) => { id: 33, name: "rob", id: 123456789, times_trained: 5, amount_spent: 65025} we use id unique optional identifier, if don't have id assume new. there baked rails can use this? what planning on d

click - video.js: autoclick on play button (to get around iOS autoplay limitation) -

i want have video.js element autoplay on page load. works fine in (computer) webbrowser 'autoplay: true' setting. but on ios autoplay features globally disabled apple itself. i trying work around having browser automaticly click play button when page loaded. every autoclick solution found on here did not work. neither on computer nor in ios. is there way have autoclick on video.js element? unfortunately no. apple has blocked every possibility of doing i'm aware of. it's meant protect iphone users expensive mobile data plans downloading video data didn't intend to. nice if autoplay still work when user on wifi, or if there user setting allow autoplay, there's nothing yet.

java - Regex pattern for special condition -

input field hold alphabets, space, numbers, defined following regex [a-za-z ]{1,150} need include parenthesis , hyphen in above regex. kindly advise. the tricky item hyphen: must not come between characters, because has special interpretation. put in first or in last position, this: [a-za-z0-9 ()-]{1,150} i added 0-9 because said want allow digits well. hyphen can anywhere in input note position of hyphen in regex character class (the construct enclosed in square brackets) has nothing position of hyphen in text being matched. order of characters inside character class not significant, except 2 cases when character has special interpretation: hyphen - between 2 characters defines range, , ^ @ beginning defines negation.

c# - config change not reflected -

i have few hyperlinks values assigned in code behind. assignment happens in page_init event. but values picked web.config. i changed values in web.config not being reflected in hyperlink. i have done app pool recycle, iis reset , cleared temporary asp.net files. need suggestions resolve this. edit: posting code requested: this.hyperlink1.navigateurl = system.configuration.configurationmanager.appsettings["footer.link1.url"]; this done in method silentlogin_prerender in turn called in oninit event this.prerender += new system.eventhandler(this.silentlogin_prerender);

python - Google search api or alternatives -

i wish use input keyword, , analyse search result google. nevertheless says web search api deprecated 4 years ago here https://developers.google.com/web-search/docs/ is there proper way can query google results using program , not treated spam querying? or if there other search engines provided such api service? you can scrape google search results apps script , store results in google sheet. since sheet can published in json, search results can fed other programs.

android - Material Design Ripple/Stay Solid Animation -

is there anyway create animation once ripples stay solid color when contextual actionbar activated? i able sucessfully using ripple animation combined statelistdrawable, example below: ripple.xml <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/colorprimary"> <item android:id="@android:id/mask" android:drawable="@android:color/white" /> <item android:drawable="@drawable/background_selector"/> </ripple> background_selector.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_activated="true" android:drawable="@color/colorprimarydark"/> </selector>

php - preg_split regex lookback for multiple matches -

the goal of regex split on unicode whitespace, excluding newline , ensure that newline character appended previous non unicode whitespace character. seeing work, single whitespace characters before \n. using current regex: $data = "the\nquick\n brown fox jumped \nover lazy dog."; $tokenized = preg_split("~(?<=\n)|\p{z}+(?!\n)~u", $data, -1, preg_split_offset_capture); current result (i have added \n "\n" character present): array ( [0] => array ( [0] => the\n [1] => 0 ) [1] => array ( [0] => quick\n [1] => 4 ) [2] => array ( [0] => [1] => 10 ) [3] => array ( [0] => brown [1] => 11 ) [4] => array ( [0] => fox [1] => 17 ) [5] => array (

iis - IISConfig.exe arguments for custom action in Microsoft Release Management -

after creating application pool in iis(8.0) using release management 2013 update 4, need customize predefined action. set load user profile in advanced application pool settings true instead of false. assumed use -loaduserprofile argument in release management. apparently arguments not similar parameter names in iis. release rejected , log file showed: error: loaduserprofile : unknown option . release management using iisconfig.exe execute arguments. knowing that, unable find list of arguments or "options" can used iisconfig.exe. glad know how solve problem. not in specific case in general. find details of iis tool here: https://msdn.microsoft.com/library/vs/alm/release/overview scroll iis deployment agent. there not seem way change load user profile. can write own tool accomplish (and share here :))

PHP: MySql Update Statement by displaying information first -

i want update info mysql database through displaying first. used textarea display information updated database. viewupdate.php <?php $host="localhost"; $user_name="root"; $database_name="5r"; $db=mysql_connect($host, $user_name,''); if (mysql_error() > "") echo mysql_error() . "<br>"; mysql_select_db($database_name, $db); if (mysql_error() > "") echo mysql_error() . "<br>"; $query = "select * tblmain no=1"; $result = mysql_query($query); while($row = mysql_fetch_array($result,mysql_assoc)) { echo '<form method="post" action="updatemain.php"> <table border=0> <tr> <td><font face="times new roman" color="463d01" size=3> title: <br> <textarea rows=2 cols=30 na

mongodb - How can I merge many documents into a single document and move to another collection? -

i have following situation: 50 documents in 1 collection want move 1 document day: {data:data,data:data} day: {data:data,data:data} this data should become: week:[day,day,day..] this 1 time job. want in command line or robomongo. since can't see exact document structure, i'll try give simple solution should work no matter structure documents have. basically want iterate on each of documents in source collection , generate array of values. week_array = [] db.source_col.find({}).foreach( function( doc ){ week_array.push( doc ); } ); you have array containing documents source_collection. have construct new document , insert array @ correct attribute: var week_doc = { "week": week_array }; now insert target collection: db.target_col.insert( week_doc );

r - The ways to construct columns associated with interaction terms in data frame -

i have data frame 6 columns, dat<-data.frame(x1,x2,x3,x4,x5,x6) right now, need build 2 columns associated interaction terms, x1*x2 , x3*x4*x5 how in r. there special consideration when of them, such x2 categorical? i guess function model.matrix want. for instance, can fit linear model including variables , interaction terms you're interested in , extract model matrix fitted object model.matrix(lm(drat ~ mpg * cyl + disp * hp * wt, data = mtcars)) factors need explicitly coded factors, find example below mtcars$cyl <- factor(mtcars$cyl) model.matrix(lm(drat ~ mpg * cyl + disp * hp * wt, data = mtcars)) the default kind of contrasts used factors treatment coding. can change sum coding (or other codings: ?contr.sum ) using command below contrasts(mtcars$cyl) <- contr.sum

.htaccess - redirect directory to domain htaccess without changing domain url -

i have site sub.domain1.com but access following url: domain2.com/folder here .htaccess file in domain2.com rewriteengine on rewritebase / rewriterule ^folder/(.*) http://sub.domain1.com/$1 [l,r=301] this redirection works wouldn't change url sub.domain1.com i want display content of sub.domain1.com using url domain2.com/folder without changing url. thanks in advance

SQL DB2 - Select query based on a column value unique to another column -

i have table following fields: id | attribute_id 200 3 200 4 200 6 200 7 201 6 202 2 202 6 203 6 204 2 204 4 204 6 i want result this: id | attribute_id 201 6 203 6 basically, need write query has 'id' associated 'attribute_id' = 6 , not 'attribute_id' = 1,2,3. column value unique column value, if makes sense. i using db2. below attempt, sure doing wrong way. select qa.id, qa.attribute_id question_attributes qa where( (qa.id,qa.attribute_id) in (values (qa.id,4),(qa.id,6),(qa.id,7)) , (qa.id,qa.attribute_id) not in (values (qa.id,1),(qa.id,2),(qa.id,3)) ) thanks suggestions. you can approach aggregation , having clause: select qa.id question_attributes group qa.id having min(attribute_id) = 6 , max(attribute_id) = 6;

javascript - Part of ajax responseText -

can please tell me how obtain part ajax responsetext? example: <div id="first">text1<div> <div id="second">i want use text<div> <div id="third">text 3<div> i thought passing responsetext div, , accessing document.getelementbyid('id'), thing there better ways.

How to restrict file system access in PHP? -

someone knows trick have php script self-restrict access file system ( fopen , file_get_contents etc.)? such calls should blocked except handful of selected file names (log file, access /tmp , similar). this not security thing , rather means of forcing development team not access file system directly (and detect spots in existing code, case). want see exception in case (which gets caught , reported), content of such files must accessed other means. i thinking implementing own streamwrapper file:// protocol, apparently there no way extend built-in filewrapper class. option #1 you can use open_basedir php.ini directive limit directories app has access too. directories can semicolon separated can list directories want app access including /tmp folder. the caveat affects things include, require. option #2 you rename them using rename_function or runkit_function_rename , wrap renamed versions own logic. quote documentation: renames orig_name new_

composer php - Is it safe to commit compiled.php file for Laravel? -

i understand laravel developers have ignored in .gitignore file, ignored composer.lock file think bad form. question safe commit , push compiled.php production? it depends on deployment process , of include in compiled.php file. if add composer.lock in version manager, run composer install when deploy , add nothing in config/compile.php , yes quite safe. but gain ? have put in composer.json : "scripts": { "post-install-cmd": [ "php artisan clear-compiled", "php artisan optimize" ], "post-update-cmd": [ "php artisan clear-compiled", "php artisan optimize" ] }, and compiled.php file generated in each deployment. avoid kind of problem if in project decide run composer update somewhere. as package manager, composer managing dependencies. if commit compiled.php file, bypass composer , use compiled.php rustic package manager...

javascript - why browser rerenders when I'm inside function paused on debugger -

i'm debugging code. put debugger function removes items array: if (matchfound) { debugger vm.spots.splice(indextodelete, 1); } i'm using knockout , vm.spots observablearray, whenever changes knockout renders new array. weird as passed line removes item can seen chrome rerendering changes (removing item) while i'm still in debug mode - code paused. how possible if browser job when code not being executed?

c++ - moving std::function into another std::function does not invoke move constructor on captured variables -

i have class a prints out message when constructed/copied/moved class { public: a(std::string s) :s_(s) { std::cout << "a constructed\n"; } ~a() { std::cout << "a destructed\n"; } a(const a& a) :s_(a.s_) { std::cout << "a copy constructed\n"; } a(a&& a) :s_(std::move(a.s_)) { std::cout << "a moved\n"; } std::string s_; }; in main , construct instance of a , capture in lambda value, copy lambda std::function , , move std::function std::function int main() { a("hello "); std::function<void()> f = [a]{ std::cout << a.s_; }; std::function<void()> g(std::move(f)); } this prints out following a constructed copy constructed copy constructed destructed destructed destructed why move constructor of a not invoked? shouldn't last step of moving f g ha

xslt - XML table to LaTeX -

Image
suppose have xml table of form <table> <tr> <td>first name:</td> <td>bill gates</td> </tr> <tr> <td rowspan="2">telephone:</td> <td>555 77 854</td> </tr> <tr> <td>555 77 855</td> </tr> </table> that wish convert latex using xslt (i stole example elsewhere). result want is \documentclass{memoir} \usepackage{multirow} \begin{document} \begin{tabular}{*{10}{c}} first name & bill gates &\\ \multirow{2}{*}{telephone:} & 555 77 854 &\\ & 555 77 855 & \end{tabular} \end{document} for part, there fair one-to-one-correspondence between 2 table formats. works quite part: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="text" omit-xml-declaration="yes" encoding="utf-8"/> <xsl:template matc