Posts

Showing posts from May, 2015

arrays - assembly program to sort in special way? help please? -

8086 assembly language program sorts array follows: smallest value in array should placed in first cell. second smallest value in last cell. third smallest value in second cell of array. fourth smallest value placed in before-last cell of array. • above procedure continues until array sorted. note in above-described sorting technique, large values in initial array end being placed @ middle part of array here code sorting in normal way : org 100h .model small .data table db 9,2,6,8,5,1 b db 6 dup(0) val1 db 5 nl db ' ','$' .code mov ax,@data mov ds,ax lea bx,table mov dl,val1 lbl1: lea bx,table mov cl,5 lbl2: mov al,[bx] mov dl,[bx+1] cmp al,dl jb lbl3 mov [bx],dl mov [bx+1],al lbl3:

Excel - Averege value in column when cells contains certain text but average without zeros -

i'm trying average row of number when cell in same row contains text "mobile" formula =averageif(a:a,"*mobile",b:b) don't value because zeros in column b. [column - website] blic - computer blic - mobile b92 - computer b92 - mobile politika - computer politika - mobile [column b - cost] $5.00 0 0 $13.00 $20.00 $17.00 average - computer $8.33 average - mobile $10.00 average - total $9.17 how exclude zeros? thanks, instead of =averageif() use more powerful =averageifs() can add more criteria: =averageifs(b:b, a:a,"*mobile",b:b, "<>0")

php - Issues wih the Wordpress API Customization -

i'm making first wordpress theme , i'm learning api customization. there's wrong code made. what's wrong? when load wp-admin page, it's shown blank. this php code //welcome message settings $wp_customize->add_setting( 'welcome_message' , array( 'default' => 'hi', )); $wp_customize->add_section( 'test_welcomemessage' , array( 'title' => __('welcome message','my_test'), 'description' => 'write own welcome message visitors' )); $wp_customize->add_control( 'welcome_message', array( 'label' => __( 'welcome messagee', 'mytheme' ), 'section' => 'test_welcomemessage', 'settings' => 'welcome_message' ))); } and html structure <div id="welcomecontainer"> <div class="welcomemessage

postgresql - fan out each row into multiple rows per keys in a JSON column -

i have table: create table user_stats (username varchar, metadata_by_topic json); insert user_stats values ('matt', '{"tech":["foo","bar"],"weather":"it sunny"}'); insert user_stats values ('fred', '{"tech":{"stuff":"etc"},"sports":"bruins won"}'); the top-level keys in metadata_by_topic strings (e.g. "tech", "weather"), values under them arbitrary json. i'd query maps these top-level keys own column, , json values different column, so: username | topic | metadata ----------------------------------- matt | tech | ["foo","bar"] matt | weather | "it sunny" fred | tech | {"stuff":"etc"} fred | sports | "bruins won" where username , topic both of type varchar , metadata of type json. this: select * json_each((

javascript - bootstrap table unable to load json objects -

my ajax script sends json objects browser table unable load json object. ajax script: $.ajax({ type : "post", url : "getlabels.jsp", data : "mailingid=" + selectedvalue, // poscodeselected success : function(data) { response = $.parsejson(data);// statement sends data succesfully browser }, error : function(response) { var responsetextobject = jquery.parsejson(response.responsetext); } }); this bootstrap table embedded jsp page. <table data-height="299" data-show-refresh="true" data-show-toggle="true" data-show-columns="true" data-search="true" data-select-item-name="toolbar1"> <thead> <tr> <th data-field="rownumber" >id</th> <th data-field="firstname" >first name</th> &

for loop - R comparing unequal vectors with inequality -

i have 2 single vector data frames of unequal length aa<-data.frame(c(2,12,35)) bb<-data.frame(c(1,2,3,4,5,6,7,15,22,36)) for each observation in aa want count number of instances bb less aa my result: bb<aa 1 1 2 7 3 9 i have been able 2 ways creating function , using apply, datasets large , let 1 run night without end. what have: fun1<-function(a,b){k<-colsums(b<a) k<-k*.000058242} system.time(replicate(5000,data.frame(apply(aa,1,fun1,b=bb)))) user system elapsed 3.813 0.011 3.883 secondly, fun2<-function(a,b){k<-length(which(b<a)) k<-k*.000058242} system.time(replicate(5000,data.frame(apply(aa,1,fun2,b=bb)))) user system elapsed 3.648 0.006 3.664 the second function faster in tests, let first run night on dataset bb>1.7m , aa>160k i found this post , , have tried using with() cannot seem work, tried loop without success. any or direc

osx - NSTextField in NSTableCellView - end editing on loss of focus -

i have view view-based nstableview (which has cell view single text field) , buttons , textfields outside tableview. 1 of buttons adds object datasource tableview, , after inserting row tableview, makes editable. if user enters text , pressed return key, receive - (bool)control:(nscontrol *)control textshouldendediting:(nstext *)fieldeditor delegate method fine, , can run validation , save value. delegate doesn't called if user selects of other buttons or textfields outside tableview. what's best way detect loss-of-focus on textfield inside nstablecellview, can run of validation code on tableview entry? if understand correctly want control:textshouldendediting: notification fire in following situation: you add new object array controller. the row in table representing object automatically selected. you programmatically select text field in relevant row editing. the user (i.e. without making edits in text field) gives focus control elsewhere in ui one

c++ - Method of Divided Differences -

i have problem in method of divided differences code. 2 problems follows: it working correctly if enter 1 or 2 data points, if enter 3 or more data points result wrong i want form of output : how many data points entered?: 5 enter x00: 1.0 enter y00: 0.7651977 enter x01: 1.3 enter y01: 0.6200860 enter x02: 1.6 enter y02: 0.4554022 enter x03: 1.9 enter y03: 0.2818186 enter x04: 2.2 enter y04: 0.1103623 interpolating polynomial is: p(x) = 0.7651977 - 0.4837057(x - 1.0) - 0.1087339(x - 1.0)(x - 1.3) + 0.0658784(x - 1.0)(x - 1.3)(x - 1.6) + 0.0018251(x - 1.0)(x - 1.3)(x - 1.6)(x - 1.9) press key continue... here code: #include <iostream> #include <vector> #include <stdexcept> using namespace std; double func(const std::vector< double > & a, const std::vector< double > & b, int i, int j){ if ((i < 0) || (j < 0) || (i >= a.size()) || (j >= b.size()) || (i < j)) { return 0; // ignore invalid argument

ios - Exception caused by custom cells: UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath: -

i got following exception: fatal exception: nsinternalinconsistencyexception uitableview datasource must return cell tableview:cellforrowatindexpath: my tableview has custom cells. code works. however, exception happened once. -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { // cell populate uitableviewcell* cell = [tableview dequeuereusablecellwithidentifier:@"appt"]; if (!cell) { // create new cell cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"appt"]; // populate nib uinib* nib = [uinib nibwithnibname:@"scheduledrowview" bundle:nil]; nsarray* views = [nib instantiatewithowner:nil options:nil]; uiview* parent = [views objectatindex:0]; cgrect rowrect = parent.frame; rowrect.size.width = tableview.frame.size.width; parent.frame = rowrect; cell.frame = ro

css - polymer core-animated-pages how to set background with scrollable content -

i using core-animated-pages. of the content on pages need scrolled. want set background color pages , want background color cover scrolled area , not current viewport. how accomplish this? more have: <core-animated-pages flex transitions="cross-fade-all"> <div>some small content</div> <div>some long text need scrolled</div> <div>another page</div> </core-animated-pages> so how style background color cover scrolled text? @jeff provides large part of answer in specifying relative on div. additionally used following css position element clear of title bar above , ensure background covers reminder of page. #instructions { background: #fff59d; min-height: calc(100vh - 200px); top:+30px; padding:10px; width:calc(100% - 24px); } the pixels subtracted % values , top:+ allow menu bar @ top , padding on body -- these need adjust depending on height of menu bar , padding. now wrap divs in paper-shadow find when

apache pig - Issues saving to Hive table from Pig -

i using hcatalog read , write data hive pig script follows: a = load 'customer' using org.apache.hcatalog.pig.hcatloader(); b = load 'address' using org.apache.hcatalog.pig.hcatloader(); c = join cmr_id,b cmr_id; store c 'cmr_address_join' using org.apache.hcatalog.pig.hcatstorer(); table definition customer is: cmr_id int name string address : addr_id int cmr_id int address string cmr_address_join : cmr_id int name string addr_id int address string when run this, pig throws following error: error org.apache.pig.tools.grunt.grunt - error 1115: column names should in lowercase. invalid name found: a::cmr_id i believe may be

Apache Camel Classloader for Websphere -

i using apache camel websphere. have had classloader issues. understand camel provides websphere classloader cannot find example in how use it. tried putting in apllicationcontext.xml file <bean id="websphereresolver" class="org.apache.camel.impl.webspherepackagescanclassresolver" /> got error caused by: java.lang.nosuchmethodexception: org.apache.camel.impl.webspherepackagescanclassresolver.<init>() what correct format? it turns out problem using old version of fasterxml defined in our pom.xml. once updated pom.xml use new version of fasterxml, problem went away. apachexml bean uses fasterxml if available, assumes using recent version.

sql - Display Months in Column Chart That have no Data -

i have ssrs column chart 2 category groups x-axis sort data based on year first, followed date. additionally have parameter on chart in end user can pick month in wish see data, , chart displays data relevant month.. trying have chart display columns months, if there no information available month (ideally, month display 0 there no data), opposed months have data based on filter. query have in dataset: select count(c.statecodename) codename, c.statecodename, datename(mm, c.expireson) month, datename(yyyy, c.expireson) year, datepart(yyyy, c.expireson) yearnum, datepart(m, c.expireson) monthnum table1 c (c.expireson not null) , (datename(mm, c.modifiedon) in (@reportparameter1)) group datename(mm, c.expireson), datename(yyyy, c.expireson), datepart(yyyy, c.expireson), datepart(m, c.expireson), c.statecodename union select count(d.statecodename) codename, d.sta

ios - xcode tabelview cellview not showing only if pressed once -

so have tabelview show in cell's json array , added cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; and have press cell show content ... - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath] ; cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier]; cell.textlabel.text = [thearray objectatindex:indexpath.row]; cell.backgroundcolor = [self colorwithhexstring:@"dbdcd7"]; cell.textlabel.textcolor = [self colorwithhexstring:@"d74032"]; cell.detailtextlabel.text = [thearray objectatindex:indexpath.row]; return cell; } here image of trying white cells not touched , gray ones touched http://oi57.ti

C++ Adding Elements to Array and Modifying Function to Pointer -

i'm still bit stuck on part on assignment. here prompt asking: now can modify loadmovies function create movielist object , add each of movie objects it. function loadmovies should return pointer movielist object. means need create movielist object dynamically , on heap. change main function , store returned movielist pointer in variable. test if works expected, can use printall function of movielist object. here code far: class movielist { public: movie* movies; int last_movie_index; int movies_size; int movie_count = 0; movielist(int size) { movies_size = size; movies = new movie[movies_size]; last_movie_index = -1; } ~movielist() { delete [] movies; } int length() { return movie_count; } bool isfull() { return movie_count == movies_size; } void add(movie const& m) { if (isfull()) { cout << "cannot add movie, list full" << endl; return; } ++last

python - Django allauth allowed urls -

i started django project using allauth, configured basic settings, without using 3rd party provider. i've created basic template profile page. working expected far, if go localhost:8000/accounts/profile can see page without log in before. i've tried in documentation how define page should require logged in haven't found anything. any thoughts? thanks! edit these allauth settings: #allauth config account_authentication_method = 'email' account_email_required = true account_unique_email = true account_username_required = false account_signup_form_class = 'picturesapp.forms.signupform' account_email_verification = 'none' one possible way want decorate view handling profile page woth 'login_required' decorator. example: from django.contrib.auth.decorators import login_required urlpatterns = patterns('', # profile url(r'^$', login_required(myprofiledetailview.as_view()), name="my_pr

c# - insert work item into tfs using tfs api -

i building web page insert tfs work items tfs using tfs api. i using credentials connect tfs server. each time creates tfs work item using tfs web page, creates work item under name ,since 1 connected tfs server. there way can create work item user logged web application , created work item ? i have access users name not users password protected void formview1_iteminserting(object sender, formviewinserteventargs e) { uri url = new uri("url"); networkcredential nc = new networkcredential(); tfsteamprojectcollection coll = new tfsteamprojectcollection(url, nc); coll.ensureauthenticated(); workitemstore workitemstore = coll.getservice<workitemstore>(); project teamproject = workitemstore.projects["abc"]; workitemtype workitemtype = teamproject.workitemtypes["issue"]; workitem wi = new workitem(workitemtype); w

javascript - Put HTML Divs Into PouchDB -

i want put html div (and contents) json object , save pouchdb database. my div looks this: <div class="easel"> <div class="square" style="background-color: white;"></div> <div class="square" style="background-color: white;"></div> <div class="square" style="background-color: rgb(85, 222, 25);"></div><div class="square" style="background-color: white;"></div> <div class="square" style="background-color: white;"></div> <div class="square" style="background-color: white;"></div> <div class="square" style="background-color: white;"></div> <div class="square" style="background-color: rgb(164, 101, 52);"></div><div class="square" style="background-color: white;">&

python - How to parse an ISO 8601-formatted date? -

i need parse rfc 3339 strings "2008-09-03t20:56:35.450686z" python's datetime type. i have found strptime in python standard library, not convenient. what best way this? the python-dateutil package can parse not rfc 3339 datetime strings 1 in question, other iso 8601 date , time strings don't comply rfc 3339 (such ones no utc offset, or ones represent date). >>> import dateutil.parser >>> dateutil.parser.parse('2008-09-03t20:56:35.450686z') # rfc 3339 format datetime.datetime(2008, 9, 3, 20, 56, 35, 450686, tzinfo=tzutc()) >>> dateutil.parser.parse('2008-09-03t20:56:35.450686') # iso 8601 extended format datetime.datetime(2008, 9, 3, 20, 56, 35, 450686) >>> dateutil.parser.parse('20080903t205635.450686') # iso 8601 basic format datetime.datetime(2008, 9, 3, 20, 56, 35, 450686) >>> dateutil.parser.parse('20080903') # iso 8601 basic format, date datetime.datetime(2008,

Close and open windows with tkinter -

i have main window, , button inside of one, open window, closed button. how possible once latter closed can not reopen it? attach code of 2 programs. first program from tkinter import * def funzbottocli():import nuovaprova root = tk() root.state('zoomed') root.title("gestionale") bottoncli = button(root, text=" apertura altra finestra ", fg=('red'), font=('arial',10,'bold'), relief='raised', command=funzbottocli).place(x=20, y=20) root.mainloop() #second program tkinter import * def funzbottocli():fine_cli_ins.destroy() fine_cli_ins = tk() fine_cli_ins.title("inserimento anagrafica clienti") fine_cli_ins.geometry('640x480+400+150') form1 = frame(fine_cli_ins, bg='red',width=640, height=50, relief='raised', border=3).pack() label1 = label(fine_cli_ins, text=(" inserimento clienti "), fg=('red'), bg=('gray'), font=('arial'

javascript - GWT: No file found for *cache.js -

i trying launch gwt web application , ran smoothly until openned in chrome. console says: dec 05, 2014 3:37:27 pm com.google.appengine.tools.development.localresourcefileservlet doget warning: no file found for: *.cache.js and app froze @ loading page, did not open up. had same problem before? how did resolve it? also when opened in firefox, browser says app needs (re)compiled. did clean/built , rerun same problem persisted.

javascript - simple modulo not returning list of values I expected -

i thought following list numbers 0 21 divisible 7, i.e. 7, 14, , 21. instead returns 22. why? for (var = 0; <= 21; i++) { if (i % 7 === 0); } console.log(i); btw, have no programming background , i'm struggling first language under belt. teeny tiny details doing me in. anyway, helping me see how placement of console.log affected result. because don't print in loop, final value of i.

HQL not working with H2 -

i implementing unit test using h2 embedded database. when insert entry in table, able retrieve entry using native sql query, not hql query. find primary key works through jpa entitymanager interface. using hibernate persistence provider. configuration: <bean id="hibernatejpavendoradapter" class="org.springframework.orm.jpa.vendor.hibernatejpavendoradapter" p:showsql="true" p:generateddl="false" p:databaseplatform="org.hibernate.dialect.h2dialect" /> <bean id="entitymanagerfactory" class="org.springframework.orm.jpa.localcontainerentitymanagerfactorybean" p:datasource-ref="datasource" p:jpavendoradapter-ref="hibernatejpavendoradapter" p:persistenceunitname="amgsadapter" p:packagestoscan="com.hcsc.amgs.adapter.domaindto"> <property name="jpaproperties"> <props> <prop key="hiber

javascript - How to send 2 select box dynamically generated values via ajax to get 3rd select box values -

i'm trying 3rd select box values according first 2 select box selection (dynamic values); jquery ajax code (it works airport select box) $("#airport").change(function() { var aid=$(this).val(); var datastring = 'aid='+ aid; $.ajax ({ type: "post", url: "booking/findcompany.php", data: datastring, cache: false, success: function(data) { $("#company").html(data); } }); }); <select name="site" id="site" class="site"> <option value="" selected="selected">select</option> <option value="1">site one</option> <option value="2">site two</option> <option value="3">site three</option> </select> <select name="airport" id="airport" class=&quo

amazon s3 - Setting metadata on S3 multipart upload -

i'd upload file s3 in parts, , set metadata on file. i'm using boto interact s3. i'm able set metadata single-operation uploads so: is there way set metadata multipart upload? i've tried this method of copying key change metadata, fails error: invalidrequest: specified copy source larger maximum allowable size copy source: <size> i've tried doing following: key = bucket.create_key(key_name) key.set_metadata('some-key', 'value') <multipart upload> ...but multipart upload overwrites metadata. i'm using code similar this multipart upload. faced such issue earlier today , discovered there no information on how right. code example on how solved issue provided below. $uploader = new multipartuploader($client, $source, [ 'bucket' => $bucketname, 'key' => $filename, 'before_initiate' => function (\aws\command $command) { $command['conte

java - HTTP request with range -

hey guys assignment consists in downloading video file local server using http requests, can part , want me download video segments, means requests partial (i not donwload whole file 1 request), problem i'm receveing whole file. doing wrong? significant part of code: socket = new socket(server, port); outputstream os = socket.getoutputstream(); os.write(("get /lifted-" + "160" + "p.dat http/1.0\r\n\r\n").getbytes()); os.write(("range: bytes="+integer.tostring(0)+"-"+integer.tostring((int) (bytedelay))).getbytes()); a sysoutprint of range request: range: bytes=0-1089889 the header of http response: last-modified: tue, 25 nov 2014 15:08:03 gmt connection: close date: fri, 05 dec 2014 21:12:31 gmt server: pygmy content-length: 54518444 (whole file) content-type: application/octet-stream hard say. 1 theory you're using http/1.0, predates range requests.

addclass - Jquery active class trouble -

i have example $('li').click(function() { $(this).siblings().removeclass('active'); $(this).addclass('active'); }); all great need thing. need class removes when click li active class again. so, replace line: $(this).addclass('active'); with this: $(this).toggleclass('active'); see: toggleclass

jquery - javascript read file object unknown id -

is possible use javascript file api read file object of unknown id? i use custom file upload form in code doesn't have input element. uses plupload.js api , can't determine how access contents of file object. for example if code had line 1, access contents of file object using code of line 2 input type="file" id="data" var finput = document.getelementbyid("data"); var f = finput.files[0]; i tried document.files[0] doesn't work. know similar? instead of document.files[0] , try document.queryselectorall('input[type="file"]')[0] . function demo(){ var inpts=document.queryselectorall('input[type="file"]'); alert(inpts[0].classname); } <input type="file" class="file_input_a"><br> <input type="file" class="file_input_b"><br> <input type="file" class="file_input_b"><br> &l

javascript - How to clear text area? -

i have problem of clearing out of text area in application. app has 2 methods of getting specific data format: searching online database , using javascript library. first method: user types chemical name in text field , presses "search" button. if requested compound in database, proper format displayed in text area. second method: if name not found in database, user can use js library generate proper format displayed in same text area. if user uses database first, text area contains generated data database can replaced data generated js library if user decides use it. problem if text area has data generated js library cannot replaced data database when first method used. don't know how clear text area containing data (generated js library) before inserting data database. sorry if still sounds confusing. here javascript code: <script> var sketcher = new chemdoodle.sketchercanvas('sketcher', 400, 300, {useservices:true}); var mol = sketcher.

arrays - C# Efficiently store large int data -

evening all, i'm in predicament can't decide/know of best method storing "simple" large amounts of int datatypes. now @ moment using flattened array int[] thedata = new int[size * size]; , because storing 1 layer i'm needing @ least 3 layers. initial through process either use a: dictionary<uint, int[]> thenewdata = new dictionary<uint, int[]>(); (the key layer) but i've not had experience dictionaries believe cause problems accessing data via array index in flat array thedata[x + y * width] = ... or simply: int[,] thenewdata = new int[layercount, size * size]; the above 1 makes me feel dirty. i triple original flat array size , apply offset next layer... anyway i've got take account ridiculously large maps, width x hight 1,000 x 1,000 (tiles) that's 1,000,000 tiles stored int 's somewhere (i think...) . data access needs fast i've go deal updating potentially entire " active " layer. if please &

java - how do you write arraylist to a binary file -

how write arraylist binary file? lets have arraylist called people i trying write binary file using writelisttobinary method my method: public void writelisttobinary (arraylist<person> inlist) throws ioexception in main method: arraylist<person> people = new arraylist<person>(); writelisttobinary(people); i think trying serialize arraylist . implement serializable class, then: fileoutputstream fos = new fileoutputstream(filetosaveto); objectoutputstream out = new objectoutputstream(fos); out.writeobject(people) also take @ http://www.tutorialspoint.com/java/java_serialization.htm

sprite kit - wait action not working -

i have ball start moving impulse want wait 3 seconds before doing so. put code thinking it's not working. //add sprite scene [self addchild:ball]; skaction *wait = [skaction waitforduration:3]; [self runaction:wait]; //create vector cgvector myvector = cgvectormake(10, 25); //apply vector ballphysics body [ball.physicsbody applyimpulse:myvector]; wait applies other actions. if want apply impulse after wait need add block action. once have wait action, , applyimpulse action put these 1 sequence. make sense? //add sprite scene [self addchild:ball]; skaction *wait = [skaction waitforduration:3]; skaction *applyimpulse = [skaction runblock:^{ //create vector cgvector myvector = cgvectormake(10, 25); //apply vector ballphysics body [ball.physicsbody applyimpulse:myvector]; }]; [self runaction:[skaction sequence:@[ wait, applyimpulse ]]];

Wordpress to app (android and ios) -

is possible transfer entire site phone app? have website on wordpress. it's responsive . , want create app display website. , work in regular browser website , social networks (i'm taking feeds , comments them). suggestions or tutorials. thanks there many plugins offer looking for. mobiloud , apppresser 2 come mind.

Unable to use python logger remotely using socket, but works on localhost -

i using logging utility on local network log data 1 python script another. server , client scripts works on same machine, not work different machine. the client script snippet, running on ip "192.168.1.9" is- import logging, logging.handlers rootlogger = logging.getlogger('') rootlogger.setlevel(logging.debug) sockethandler = logging.handlers.sockethandler('192.168.1.10', 50005) the server script snippet, running on ip "192.168.1.10" locally - def __init__(self, host='localhost', port=50005, handler=logrecordstreamhandler): socketserver.threadingtcpserver.__init__(self, (host, port), handler) when run this, both client , server unresponsive, if no message ever sent. my iptables empty (default), , there nothing except simple switch between 2 machines on network. can remotely use mysql fine. basic tcp socket connection @ random open port worked fine. going wrong here? logger code above, or entirely different networking reas

jquery - Lightbox plugin not working with PhoneGap images -

i using phonegap camera plugin , adding image page each picture selected. issue having is, when try implement lightbox on images, not desired results. if use same exact code on image not added via phonegap plugin, works perfectly. difference in code between 2 images src attribute. below code each: normal image: <a class="photo" href="img/server.png"><img src="server.png" alt="server" /></a> phonegap selected image: <a class="photo" href="file:///storage/emulated/0/android/data/com.hdl.inspector/cache/1417822999785.jpg"> <img src="file:///storage/emulated/0/android/data/com.hdl.inspector/cache/1417822999785.jpg" alt="" /> </a> i discovered issue related photos being added after page load, rather having image path. initializing 'magnific popup' on page load following script $('.photo').magnificpopup({ type: 'image',

Parse.com JavaScript SDK - How can I refresh the cached user object? -

the cached parse user object in local storage updated on login or signup. i'd refresh when app loads make sure modifications in sync. how can that? according this thread parse.com forums archive , there should method parse.user.current().refresh() that, in latest version of js sdk method doesn't seem exist. thanks! appreciated! fetch model server parse.user.current().fetch() https://parse.com/docs/js/api/symbols/parse.object.html#fetch

sql - MySQL BEFORE UPDATE TRIGGER giving ERROR -

i've been working on trigger mysql couple hours now, , can't figure out what's wrong. here table structure: create table if not exists `rentalvideo` ( `orderid` int(11) not null, `videobarcode` int(11) not null, `rentalreturned` tinyint(1) not null default '0', primary key (`orderid`,`videobarcode`), key `rentalvideo_videobarcode_fk` (`videobarcode`) ) here's sample data: insert `rentalvideo` (`orderid`, `videobarcode`, `rentalreturned`) values (1, 223823, 0), (1, 447956, 0), (3, 705481, 0), (4, 988908, 0), (5, 143375, 0); here's trigger that's not working: create trigger `rent_five_videos_max` before insert on `bollywoo_video`.`rentalvideo` each row begin -- variable declarations declare vrentedvideos int; declare vcustomer int; -- trigger code select rentalorder.custid rentalorder rentalorder.orderid = new.orderid vcustomer; select count(*) rentalorder, rentalvideo rentalor

assets - How to add pngs from svg to XCode project with a shell script? -

is there way update assets of project tools/scripts external xcode? i draw icons in inkscape. i've discovered simple script this: #!/bin/sh tail=$(basename "$1") name="${tail%.*}" /applications/inkscape.app/contents/resources/bin/inkscape -d 135 --export-png ${name}@3x.png ${name}.svg /applications/inkscape.app/contents/resources/bin/inkscape -d 90 --export-png ${name}@2x.png ${name}.svg /applications/inkscape.app/contents/resources/bin/inkscape -d 45 --export-png ${name}.png ${name}.svg i can auto generate 3 different pngs appropriate name @ resolutions. easier point-n-click interactive route. what love do, add end of script automatically inject 3 pngs assets of xcode project. don't know how/where xcode manages those. full script the full script, derived @matthias 's answer (my svg directory sits sibling project directory)... #!/bin/sh tail=$(basename "$1") name="${tail%.*}" projectname=myvalve target=../${p

In my Ruby Code, Why does my variable inside a string produce a new line? -

ok first day learning , trying create basic questionnaire ruby. for example, code: print "what name? " name = gets puts "hello #{name}, welcome." print "what year born in?" year = 2014 year1 = gets.chomp.to_i year2 = year-year1 puts "ok. if born in #{year1}, #{year2} years old." now if input "joe" name , "1989" birthdate, give me following lines... hello joe , welcome. ok. if born in 1989, 25 years old. i'm confused what's different 2 strings. you've got right idea way you're processing year user inputs. when type "joe" @ prompt, results in string value "joe\n" getting assigned name variable. strip newlines off end of string, use chomp method. change line name = gets.chomp . you might want explicitly convert input string. if user ends input control-d, gets return nil instead of empty string, , you'll nomethoderror when call chomp on it. final

c# Retrieve multiple XML child nodes -

i've managed link single xelement program though i'm not having luck other 2 have in place, i've tried using; ienumerable query = booking in doc.descendants("booking") though i've haven't had luck placing values list box. here's code function: private void btnimport_click(object sender, eventargs e) { openfiledialog open = new openfiledialog(); open.checkfileexists = true; open.initialdirectory = "@c:\\"; open.filter = "xml files (*.xml)|*.xml|all files(*.*)|*.*"; open.multiselect = false; if (open.showdialog() == dialogresult.ok) { try { xdocument doc = xdocument.load(open.filename); //grabs customer elements var query = booking in doc.descendants("booking") select new { //customer elements customerid =

weblogic - Coherence web and load balancing -

we had 2 managed servers sitting behind citrix netscaler loadabalncer sticky session enabled, request forwarded same managed server. now configured coherence*web cluster 2 managed servers , citrix netscaler load balancer sitting in front. how call coherence cluster loadbalancer without calling managed servers? there ip address coherence cluster need call netscaler or how call cluster without calling individual servers? thanks lot. you keep same config had before load-balancing web or application servers. coherence*web makes sure data in sessions shared between servers (even if add , remove servers dynamically!), , not lost if 1 server dies.

linux - How to use select with awk in bash script? -

i have write bash script university, text says: write bash script allows root user, list of users of machine. selecting user, using select, required indicate directory (indicate absolute path). @ point in output have shown list of files folder owned user, ranked in ascending order according size of file. to check if user root used: if[ "$(id -u)" = 0 ]; to list of users of machine thinking of using awk: awk -f':' '{ print$1}' /etc/passwd how can use select awk? there way without using awk? thank in advance here way use awk in select statement, need finish rest homework (for example, sort result) #!/usr/bin/env bash select user in $(awk -f ":" '{print $1}' /etc/passwd ) read -p "input absolute directory: " path find $path -type f -user "$user" -ls done

jquery - Flexslider and Masonry - imagesLoaded issue -

i'm trying include flexslider gallery in masonry jquery layout. however, cannot masonry to recognize correct height of flexslider. know doing wrong imagesloaded script. i have imagesloaded linked , have tried every combination of loading order. how flexslider , masonry work together? in advance! right now, have following script loaded in document ready function: var $container = $('#masonry'); $container.imagesloaded( function() { $container.masonry({ itemselector: '.item', gutter: 25 }); }); $('.multislide').flexslider( { slideshow : true, animation : 'slide', pauseonhover: true, animationspeed : 400, smoothheight : true, directionnav: true, controlnav: false, prevtext : '<span class="fa fa-caret-left"></span>', nexttext : &

How to Merge Lines from 2 Text File without creating a Line Break in Batch Command -

i looking code merge 2 text files without creating line break. currently using code. @echo off setlocal enabledelayedexpansion set fd1=\folderpath1\ set fd2=\folderpath2\ set mrgfiles=\outputfolder\ pushd "%fd1%" /f "tokens=1* delims=" %%a in ('dir /b /a-d "!fd1!"') ( if exist "!fd2!\%%a" ( type "%%~fa">"!mrgfiles!\%%a" echo.>>"!mrgfiles!\%%a" type "!fd2!\%%a">>"!mrgfiles!\%%a" ) ) popd my setup this folder 1 has 100 files in it. each file has 1 line example: line 1 folder 2 has 100 files in it. each file has 1 line. example: line the code above manage merge files , output nicely, second line on new line break. but need newly merged lines in single line. i tried remove code echo.>>"!mrgfiles!\%%a" merges both lines without space. how can batch merge lines into line 1 line line 2 line b sorry bad expla

vb.net - MDI menu shortcut not working while other Form active -

my project have mdi form , 's have menu many shortcut shortcut work fine while 's focus when open form shortcut stop working because mdi form not active how can send keyboard press mdi form trigger menu shortcut this how open child window frmchild.owner = me frmchild.show() i make key press , key down events static , public , them in key press ,key down in child form 's work , sent keyboard input mdi form menu shortcut never trigger. frmmdi public shared sub frmmdi_keydown(sender object, e keyeventargs) handles me.keydown end sub frmchild private sub frmchild_keydown(sender object, e keyeventargs) handles me.keydown frmmdi.frmmdi_keydown(sender, e) end sub thanks. you don't need call in child keydown handler mdiparent keydown handler. menu shortcut of parent work without this. reason it's not working because should have frmchild.mdiparent = me instead of frmchild.owner = me

.htaccess - URL redirections issue -

i rewriting url rules in htaccess, , use sefurl (seo friendly url's). there 1 issue, when going link page generate seo friendly url's if going in write direct file name on there, want redirect on same url' for example, on page got generated url link of http://www.exampleskey.com/myfirsthtpage using htaccess point servers myfirsthtpage.php file now if wrote url http://www.exampleskey.com/myfirsthtpage.php show me same url, if 1 write above url 1 should redirect http://www.exampleskey.com/myfirsthtpage htaccess. 1 me do. i tried 'rewritecond' not getting proper results. you can use code in document_root/.htaccess file: rewriteengine on rewritebase / # externally redirect /dir/file.php /dir/file rewritecond %{the_request} \s/+(.*?/)?(?:index)?(.*?)\.php[\s?] [nc] rewriterule ^ /%1%2 [r=302,l,ne] # internally forward /dir/file /dir/file.php rewritecond %{request_filename} !-d rewritecond %{document_root}/$1\.php -f [nc] rewriterule ^(.+?

java - @Async is not working in REST class -

i working on webservice project built using spring. configuration done using annotation. there 1 method sends push notification. there many notifications send, causes delay in response. so, apply @async annotation "sendpushnotification" method. but, still no improvement in response. have gone through of blogs , stackoverflow find solution. but, no success. have applied following annotation service class. @component @configuration @enableaspectjautoproxy @enableasync method async called. @post @path("/sampleservice") @consumes(mediatype.application_form_urlencoded) public response sampleservice(@formparam ...) { ... list<user> commentors = <other method fetch commentors>; sendpushnotification(commentors); ... } my async method. @async private void sendpushnotification(list<user> commentors) { if (commentors != null) { (user user : commentors) { try { int numnewcomments = ps.getcom

javascript - Code completion in RubyMine/Intellj IDEA for coffeescript global variables -

i trying separate coffeescript code several files. created global object share code between files(see below). unfortunately rubymine, using not understand such approach , not provide code completion. there workaround that? code // --- global.js --- // define root namespace if (typeof _ === "undefined") { var _ = {}; } # --- utils.coffee --- # sprockets requires #= require global class _.myexception # --- somecode.coffee --- #= require utils class someclass f: -> throw new _.myexception

java - Why do I get a message that my array is empty even after initializing it? -

this part of project i'm working on, when try insert elements array geneids error: java.lang.arrayindexoutofboundsexception: 0 i have initialized array couple of lines before, why can't insert elements it? else if (line.startswith("!dataset_table_begin")) { line = bufferedreader.readline(); string[] array = line.split("\t"); dataset.sampleids = arrays.copyofrange(array, 2, array.length); dataset.geneids = new string[(dataset.genesnumber)]; dataset.genesymbols = new string[(dataset.genesnumber)]; dataset.datamatrix = new float[dataset.genesnumber][dataset.samplesnumber]; int count = 0; while ((line = bufferedreader.readline()) != "!dataset_table_end") { string[] arry = line.split("\t"); system.out.println(arry[0]); dataset.geneids[count] = arry[0]; dataset.genesymbols[count] = arry[1]; (int = 2; < dataset.samplesnumber; i++) { dataset.datamatr

ios - Put UISearchBar in the middlel of navagation bar, no table view is shown when typing -

i set uisearchbar view controller's titleview. when type in uisearchbar, no table view shown.but before set uisearchbar view controller's titleview, works well. - (void)initsearchbar { self.searchbar=[[uisearchbar alloc] initwithframe:cgrectmake(0, 0, 200, 30)]; self.searchbar.barstyle = uibarstyleblack; self.searchbar.translucent = yes; self.searchbar.delegate = self; self.searchbar.placeholder = @"搜索"; self.searchbar.keyboardtype = uikeyboardtypedefault; self.navigationitem.titleview=self.searchbar; } - (void)initsearchdisplay { self.displaycontroller = [[uisearchdisplaycontroller alloc] initwithsearchbar:self.searchbar contentscontroller:self]; self.displaycontroller.delegate = self; self.displaycontroller.searchresultsdatasource = self; self.displaycontroller.searchresultsdelegate = self; } when use uisearchdisplaycontroller that's time uisearchdisplaycontroller call own

stdin - default file source for <> in perl -

i want read data <> operator. it reads data stdin or files specified script's args but, if no stdin presented, nor file specified, want read data default file path; so, should my $file = ''; if ($argc) { open $file, '<default.txt'; } while (<$file>) # if no args should <> { do_all; } the <> operator reads list of input file names @argv . thus, 1 way set default input file name check if @argv empty, , if so, push default file name onto it: push @argv, "default.txt" unless @argv; i'm not sure mean "no stdin presented", if mean want script read foo.txt instead of default.txt if invoked e.g.: perl script.pl < foo.txt or: cat foo.txt | perl script.pl then checking whether stdin reading terminal or not, using -t file test . if stdin not tty, pipe or file, , should try read it: push @argv, "default.txt" unless @argv or !-t stdin;

c# - Bluetooth communication from PC to mobile phone, use laptop speaker and mic during voice call -

i using 32feet.net library connecting bluetooth mobile phone. have discovered devices, paired device. have made call using @ command of bluetooth dial 32feet.net , c# i want use speaker , mic of laptop during voice call going on mobile phone. my c# code dialing call bluetoothendpoint bep = new bluetoothendpoint(phone.deviceaddress,bluetoothservice.handsfree); cli = new bluetoothclient(); cli.connect(bep); peerstream = cli.getstream(); peerstream = listofdevices.cli.getstream(); string dialcmd4 = "atd"+txtdialer.text+";\r\n"; byte[] dcb = system.text.encoding.ascii.getbytes(dialcmd4); listofdevices.peerstream.write(dcb, 0, dcb.length); byte[] sres = new byte[200]; peerstream.read(sres, 0, 199); how can use speaker , mic of laptop communication on call?