Tuesday, 15 September 2015

xsl fo - xsl-fo table - text align right - numbers not quite right-justified - a bit wonky -



xsl fo - xsl-fo table - text align right - numbers not quite right-justified - a bit wonky -

having bit of problem doing table numbers - seems right justification bit wonky.

when fo renders this, seems right justification of invoice number (ie 2311678) tiny bit left, , of vat number bit much right.

i had table positioned top right of page in test, , right border of vat number tiny bit left.

<xsl:template name="testlayout"> <fo:table width="59mm"> <fo:table-column column-width="23mm"/> <fo:table-column column-width="20mm"/> <fo:table-column column-width="25mm"/> <fo:table-body> <fo:table-row> <fo:table-cell number-columns-spanned="3"> <fo:block font-weight="bold">details</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block>our ref:</fo:block> </fo:table-cell> <fo:table-cell number-columns-spanned="2"> <fo:block text-align="right"> e/2004/001234 </fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block>policy no:</fo:block> </fo:table-cell> <fo:table-cell number-columns-spanned="2"> <fo:block text-align="right"> gb0012345678 </fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block>invoice date:</fo:block> </fo:table-cell> <fo:table-cell number-columns-spanned="2"> <fo:block text-align="right"> 17th june, 2014 </fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block>invoice no:</fo:block> </fo:table-cell> <fo:table-cell number-columns-spanned="2"> <fo:block text-align="right"> 2311678 </fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block>due date:</fo:block> </fo:table-cell> <fo:table-cell number-columns-spanned="2"> <fo:block text-align="right"> 17th july, 2014 </fo:block> </fo:table-cell> </fo:table-row> <!-- vat details --> <fo:table-row> <fo:table-cell number-columns-spanned="2"> <fo:block>vat registration no:</fo:block> </fo:table-cell> <fo:table-cell text-align="right"> <fo:block>119 1699 59</fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> </xsl:template>

xsl-fo

jquery - Receiving an AJAX response in Node.js local server -



jquery - Receiving an AJAX response in Node.js local server -

i succesfully posting ajax post request mongodb.

however cannot seem grasp how receive response. scoured info , got impression has same-origin policy when running local server.

i trying log code sent via ajax in console.

ps: finish beginner in node.js.

here code in users.js file

router.post('/adduser', function(req, res) { var db = req.db; db.collection('userlist').insert(req.body, function(err, result){ res.send( (err === null) ? { msg: '',code:'1234' } : { msg: err } ); }); });

and ajax phone call in global.js file

$.ajax({ type: 'post', data: newuser, url: '/users/adduser', datatype: 'json' }).done(function( response ) { // check successful (blank) response if (response.msg === '') { console.log(response.code); // clear form inputs $('#adduser fieldset input').val(''); // update table populatetable(); } else { // if goes wrong, alert error message our service returned alert('error: ' + response.msg); }

jquery ajax node.js mongodb

file sharing - Why does directory vanish when I do SSHFS? How to setup SSHFS share on Max OSX 10.9? -



file sharing - Why does directory vanish when I do SSHFS? How to setup SSHFS share on Max OSX 10.9? -

i'm running max osx 10.9.3 , i'm trying setup sshfs file-share between macbook pro , remote file system. however, when seek it, doesn't work.

strangely enough, makes target directory disappear. has else seen happen? bug?

first see can ssh target machine:

% ssh remoteuser@xxx.xxx.xxx.xxx # <--- ssh remote scheme works! see below. remoteuser@xxx.xxx.xxx.xxx % ls -altr remotedir total 8 drwxr-xr-x 26 remoteuser remoteuser 4096 jun 22 01:00 .. drwxrwxrwx 2 remoteuser remoteuser 4096 jun 22 01:08 . remoteuser@xxx.xxx.xxx.xxx % exit % # <--- logged out of remote scheme

next, create directory locally , verify created:

% pwd /mnt % ls total 0 drwxr-xr-x 31 root admin 1122 jun 18 18:34 ../ drwxr-xr-x 2 root admin 68 jun 23 08:11 ./ % sudo mkdir share1 % ls drwxr-xr-x 31 root admin 1122 jun 18 18:34 ../ drwxr-xr-x 4 root admin 136 jun 23 08:50 ./ drwxr-xr-x 2 root admin 68 jun 23 08:50 share/

now seek setup sshfs share:

% sudo sshfs remoteuser@xxx.xxx.xxx.xxx:remotedir /mnt/share1 remoteuser@xxx.xxx.xxx.xxx's password: %

ok. seems have worked. no errors. let's see share created, shall we?

% ls ls: share1: no such file or directory total 0 drwxr-xr-x 31 root admin 1122 jun 18 18:34 ../ drwxr-xr-x 3 root admin 102 jun 23 08:12 ./

what? not file sharing not working, share1 directory seems have vanished! (although file scheme seems know missing, weird).

where did /mnt/share1 go , how setup sshfs?

sshfs doesn't come os x afaik, should mention how installed it. i'm guessing sshfs designed used fstab or mount rather called directly. seek like:

mount -t sshfs remoteuser@xxx.xxx.xxx.xxx:remotedir /mnt/share1

osx file-sharing sshfs

doxywizard - Generate Source Code for specific file using Doxygen -



doxywizard - Generate Source Code for specific file using Doxygen -

setting source_browser = true show source code files.

is possible show source of specific file? or enable \ref or equivalent using source_browser = false or remove source code specifics files if source_browser = true or equivalent

it possible using \include , \verbinclude.

/** * \verbinclude example.cs * \include example.cs * */ public class illustration { }

doxygen doxywizard doxygen-wizard doxygen-addtogroup

google maps api v3 - waypoints not returned in response object -



google maps api v3 - waypoints not returned in response object -

this question exact duplicate of:

google maps route generation waypoints 1 reply

i have next code, send requestobj 1 waypoint. result show me path 2 legs , 0 waypoints. want maintain waypoints. doing wrong ?

var requestobj = { origin: new google.maps.latlng(sn['lat'],sn['lng']), destination: new google.maps.latlng(en['lat'],en['lng']), travelmode: google.maps.directionstravelmode.driving, waypoints: new google.maps.latlng(45.00334,-73.00228), optimizewaypoints: true }; directionsservice.route(requestobj, function(response, status) { if (status == google.maps.directionsstatus.ok) { //process data. no way points found in : //directionsdisplay.directions.routes[0].legs[0].via_waypoints.length }});

see examples in the documentation

a waypoint consists of next fields:

location (required) specifies address of waypoint. stopover (optional) indicates whether waypoint actual stop on route (true) or instead preference route through indicated location (false). stopovers true default.

from api reference:

waypoints | array. | array of intermediate waypoints. directions calculated origin destination way of each waypoint in array. maximum allowed waypoints 8, plus origin, , destination. maps api business customers allowed 23 waypoints, plus origin, , destination. waypoints > not supported transit directions. optional.

you aren't passing in valid array of waypoints. see below:

var requestobj = { origin: new google.maps.latlng(sn['lat'],sn['lng']), destination: new google.maps.latlng(en['lat'],en['lng']), travelmode: google.maps.directionstravelmode.driving, waypoints: [{location:new google.maps.latlng(45.00334,-73.00228)}], optimizewaypoints: true }; directionsservice.route(requestobj, function(response, status) { if (status == google.maps.directionsstatus.ok) { //process data. no way points found in : //directionsdisplay.directions.routes[0].legs[0].via_waypoints.length }});

working fiddle

google-maps-api-3

linux - multi cpu core gzip a big file -



linux - multi cpu core gzip a big file -

how can utilize cpu cores in server(has 4 cores) linux debian on openvz gzipping faster one big file?

i trying utilize these commands can not set pieces together

get number of cores cores=$(grep -c '^processor' /proc/cpuinfo)

this split big file in more split -b100 file.big

this utilize gzip command multiple core find /source -type f -print0 | xargs -0 -n 1 -p $cores gzip --best

i don't know if best way optimize gzip process of big files..

use pigz, parallel gzip implementation.

unlike parallel gzip, pigz produces single gzip stream.

linux compression gzip cpu-cores

How do I call a JavaScript function that uses jQuery? -



How do I call a JavaScript function that uses jQuery? -

this question has reply here:

how execute jquery code [closed] 2 answers

i found function:

function squarifyme(element) { squareitup() window.onresize = function(element) { squareitup(); } function squareitup() { $(element).height($(element).width()); } }

with call:

$(document).ready(function() { squarifyme('.myelement'); });

but don't know how add together webpage... i've done bunch of times can't work.

the function named squarifyme() uses jquery.

this means first thing have import jquery.

the easiest way utilize hosted library.

to utilize google's hosted version of jquery, add together html page:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

alternatively, download jquery , include yourself.

. . .

now explain sec piece of code:

$(document).ready(function() { squarifyme('.myelement'); });

the first line says "execute next code when page ready."

you can learn more reading documentation $(document).ready().

. . .

now explain next piece of code:

squarifyme('.myelement'); function squareitup() { $(element).height($(element).width()); }

the first line above invokes function squarifyme() string parameter when document ready.

inside squarifyme() function squareitup() invoked.

it next (piece piece):

$('.myelement')

this code selects elements in document have css class myelement.

all such elements returned set, manipulated chained jquery code follows.

you can learn more selecting dom elements class here.

let's rewrite line of code clarity:

$(element).height($(element).width());

we'll rewrite this:

var $s = $(element); $s.height($s.width());

now $s equals set of dom elements have css class myelement.

in sec half of line, get width of each element in $s this:

$s.width()

you can learn more reading documentatino jquery.width().

we set height of element equal width this:

$s.height($s.width());

this create every element class myelement square.

. . .

now explain lastly piece of code:

window.onresize = function(element) { squareitup(); }

this code registers event handler window.onresize.

in other words, causes squareitup() invoked whenever user resizes browser window.

so... every time resize browser, every dom element class myelement become square.

you can learn more reading documentation window.onresize.

javascript jquery

Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of attributes in the string + Mahout -



Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of attributes in the string + Mahout -

i trying create file descriptor using command:

$ mahout_home/core/target/mahout-core--job.jar org.apache.mahout.classifier.df.tools.describe -p testdata/kddtrain+.arff -f testdata/kddtrain+.info -d n 3 c 2 n c 4 n c 8 n 2 c 19 n l

from link: https://mahout.apache.org/users/classification/partial-implementation.html on info file whatever file take , alter number of attributes string n 3 c 2 n c 4 n c 8 n 2 c 19 n l .

i next exception:

exception in thread "main" java.lang.illegalargumentexception: wrong number of attributes in string

please help!

there couple of reasons might error that...

wrong descriptor: putting sake of completeness. must have checked 1 out. have given wrong descriptor data. re-check number , type of columns , give them correctly descriptor. bad separator: re-check delimiter used in data. might create trouble. may info have has wrongly placed delimiter in records. create sure of that. special characters: in few experiments, have noticed mahout not enjoy if there special characters, or info consists of characters of language other english language (unless of course, tweak around code). create sure have way of handling them, , should go.

anyways these fighting can create descriptor of data. atb.

mahout

Flex / adobe air error collection service -



Flex / adobe air error collection service -

i have adobe air .exe application randomly crashes without clear reason of cause.

i investigating ways in run service integrated app when crashes works in same way windows error dialog(send error log).

ideally log collect scheme info such event log, cpu , ram state, running processes etc

does know of that?

closest thing have found airbrake

thanks

you should uncaughterrorevent, allow hear thrown errors unhandled. can send info service (google analytics, maybe). there 2 problems this:

you don't have access much scheme info in flash/air, limited info supplied capabilities , system class. this can supplemented ane provides more info (i don't have on-hand, though have seen few in past) it not work if error occurs lower air runtime. if goes wrong in ane or in air itself, won't see error, crash.

alternatively, utilize crashlytics ane (mobile only, sorry) freshplanet seems handle lot improve (this hard crashes only, believe, , won't provide info air app itself, since lower level that).

documentation:

uncaughterrorevent system capabilities

flex error-handling air error-logging error-reporting

MySQL Select all items IS NOT NULL -



MySQL Select all items IS NOT NULL -

i have next structure:

//extra item1 item2 item3 1 2 null

with query everything:

selet * extra;

i homecoming results don't have null , don't want manually type each field these added @ time:

select * e e.sid = s.id , * not null

this fails.

if dont know names of columns . have this

show columns

you can utilize php array of columns got result . , can concat columns :

concat(<your list of columns>) not null

concat here returns null if of arguments null.

mysql

json - Converting str to dict in python -



json - Converting str to dict in python -

i got process's output using subprocess.popen() :

{ about: 'rrdtool xport json output', meta: { start: 1401778440, step: 60, end: 1401778440, legend: [ 'rta_min', 'rta_max', 'rta_average' ] }, data: [ [ null, null, null ], [ null, null, null ], [ null, null, null ], [ null, null, null ], [ null, null, null ], [ null, null, null ] ] }

it doesn't seem valid json me. have used ast.literal_eval() , json.loads(), no luck. can help me in right direction ? in advance.

indeed, older versions of rddtool export ecma-script, not json. according this debian bug report upgrading 1.4.8 should give proper json. see project changelog:

json output of xport json compilant keys beingness quoted now.

if cannot upgrade, have 2 options here; either effort reformat apply quoting object key identifiers, or utilize parser that's more lenient , parses ecma-script object notation.

the latter can done external demjson library:

>>> import demjson >>> demjson.decode('''\ ... { about: 'rrdtool xport json output', ... meta: { ... start: 1401778440, ... step: 60, ... end: 1401778440, ... legend: [ ... 'rta_min', ... 'rta_max', ... 'rta_average' ... ] ... }, ... data: [ ... [ null, null, null ], ... [ null, null, null ], ... [ null, null, null ], ... [ null, null, null ], ... [ null, null, null ], ... [ null, null, null ] ... ] ... }''') {u'about': u'rrdtool xport json output', u'meta': {u'start': 1401778440, u'step': 60, u'end': 1401778440, u'legend': [u'rta_min', u'rta_max', u'rta_average']}, u'data': [[none, none, none], [none, none, none], [none, none, none], [none, none, none], [none, none, none], [none, none, none]]}

repairing can done using regular expression; going assume identifiers on new line or straight after opening { curly brace. single quotes in list have changed double quotes; work if there no embedded single quotes in values too:

import re import json yourtext = re.sub(r'(?:^|(?<={))\s*(\w+)(?=:)', r' "\1"', yourtext, flags=re.m) yourtext = re.sub(r"'", r'"', yourtext) info = json.loads(yourtext)

python json dictionary rrdtool

entity framework - Cannot remove reference to EF version 6 in build -



entity framework - Cannot remove reference to EF version 6 in build -

i using tfs 2010 , vs 2012.

i failed in effort upgrade mvc4 mvc5. thought rolled project ok in tfs builds fail because references ef version 6 have not been removed.

as far can tell have removed ef v6 everywhere in code. in build have next message;

unified primary reference "entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089". using version instead of original version "4.4.0.0" in "c:\builds\3\solutiona\solutiona- test\sources\projectb\projectb\bin\debug\projectb.dll" because autounify 'true'. resolved file path "c:\builds\3\solutiona\solutiona - test\sources\mvc4\solutiona\solutiona.model\lib\entityframework.dll". reference found @ search path location "{candidateassemblyfiles}".

so "autounify true" mean?

decided create proper reply our comments. think initial problem out of sync dll, packages folder. re-installed ef 5 fresh still having packages issues.

this appears nuget setup. article same error latest build error. build cannot find entity framework .

in particular article accepted reply sounds similar issues you're having. http://msmvps.com/blogs/rfennell/archive/2011/10/17/using-nuget-and-tfs-build-2010.aspx point works locally, not in build process. allow me know if issues seems different.

entity-framework tfs msbuild

android - invalid key hash the key hash does not match any stored key hash -



android - invalid key hash the key hash does not match any stored key hash -

i have created app on facebook. have added keyhash , app running fine when came today , seek run 1 time again gives me error.

this sec time happens. previsouly when error removed app , add together 1 time again , starts working 1 time again , offcourse can't 1 time again , again.

one more thing, key hash mentioned in error not same added in app , if go app setting key hash right there.

delete app , seek create new hash key next method!

android facebook

apache - redirect from specific request -



apache - redirect from specific request -

i have this:

rewritecond %{query_string} ^something=true$ rewriterule ^$ http://www.a123dress.com/ [r=301,l]

i want redirect (*) request have "?something=true" to

http://www.a123dress.com/

it works for:

http://www.a123dress.com/?something=true

i want rewrite example:

http://www.a123dress.com/test/?something=true

to:

http://www.a123dress.com/test/

so cutting off ?something=true above in first example

your regex ^$ allowing home page / redirected. alter rule to:

rewritecond %{query_string} ^something=true$ [nc] rewriterule ^ %{request_uri}? [r=301,l,ne]

apache .htaccess mod-rewrite redirect rewrite

php - Should a switch statement be used this way? -



php - Should a switch statement be used this way? -

is acceptable utilize switch way of supporting multiple file formats, or bad practice?

like (untested):

<?php // load file switch ($data_format) { case 'xml': $openfile = simplexml_load_file($filename . '.xml'); break; case 'json': $openfile = json_decode(file_get_contents($filename . '.json')); break; } // stuff // save file switch ($data_format) { case 'xml': $openfile->asxml($filename . '.xml'); break; case 'json': file_put_contents($filename . '.json', json_encode($openfile, json_pretty_print)); break; } ?>

it depends on style of coding. if want work object oriented against idea. in case you'd utilize like:

class="lang-php prettyprint-override">$file = $repository->open($filename, $data_format); // stuff $file->save();

of course of study $repository->open() needs homecoming object different save method depending on info format.

however if not working object oriented old procedural style cannot see wrong utilize of switch statement.

php switch-statement

css - Problems with 'floating' UL -



css - Problems with 'floating' UL -

.menu li { float: left; color: #fff; font-weight: bold; } .menu li { display: block; height: 20px; min-width: 110px; text-decoration: none; border-radius: 3px; padding: 4px; padding-left: 6px; padding-right: 6px; margin-left: 25px; margin-right: 25px; } .menu li ul { display: none; max-width: 110px; padding: 4px; margin-left: 25px; margin-right: 25px; list-style: none !important; list-style-image: none !important; } .menu li a:hover { background-color: rgba(0, 88, 153, 0.8); } .menu li:hover ul { display: block; padding: 0; margin-top: 9px; list-style: none !important; list-style-image: none !important; } .menu li:hover ul { display: block; background-color: rgba(0, 88, 153, 0.8); width: 110px; border-radius: 3px; padding-top: 6px; padding: 4px; padding-left: 6px; padding-right: 6px; text-align: left; margin: 0; margin-bottom: 5px;

above here code i'm using, want ul float above everything, tried 'fixed' , 'absolute' disappears, tried alter 'margin-left' 'inherit' didn't work either. want ul float beneath parent li.

jsfiddle

you need position submenu absolutely after first having positioned parent li relative

html (corrected) (with @malcom container

<div class="container"> <div class="menu"> <ul> <li><a href="#">home</a> </li> <li><a href="#">sub</a> <ul> <li><a href="#">sub1</a> </li> <li><a href="#">sub2</a> </li> <li><a href="#">sub3</a> </li> </ul> </li> </ul> </div> </div> can see, text moves when hover 'sub'

css (clipped relevant parts)

.menu li { float: left; color: #fff; font-weight: bold; position: relative; /* */ } .menu li ul { position: absolute; /* */ display: none; max-width: 110px; padding: 4px; margin-left: 25px; margin-right: 25px; list-style: none !important; list-style-image: none !important;

}

jsfiddle demo

css

want to add one more column in my Sql server query -



want to add one more column in my Sql server query -

i using query result

select t.accode,t.acname, sum(t.debit)as debit, sum(t.credit) credit transactions t inner bring together accounts on a.code = t.accode a.typecode = 5 , t.date between '2014-05-01' , '2014-05-15' grouping t.accode,t.acname

i getting result query

accode acname debit credit 1 umer 200 300

now want add together previos balance column in result. sample query is

sum(debit)-sum(credit) previousbalance transaction date < '2014-05-01'

and result this

accode acname previousbalance debit credit 1 umer 50 200 300

can 1 please tell me how ? shall thankful you.

you can insert subquery in select statement this:

select t.accode,t.acname, sum(t.debit)as debit, sum(t.credit) credit , (select sum(t2.debit) - sum(t2.credit) transactions t2 inner bring together accounts a2 on t2.accode = a2.code a2.code = t.accode , t2.date < '2014-05-01') prevbalance transactions t inner bring together accounts on a.code = t.accode a.typecode = 5 , t.date between '2014-05-01' , '2014-05-15' grouping t.accode,t.acname

you might need grouping in subquery, not sure that.

sql sql-server sql-server-2012

javascript - Map the Json Array values -



javascript - Map the Json Array values -

trying map 2 array values. 1 array values coming local json file , other array values coming service or backend.

local json:

var localjsonarray = { "records": { "cat1": [{ "id": 1234, "label": "a" }, { "id": 2345, "label": "b" }], "cat2": { "id": 12345, "label": "c" } } }

backend array values:

i storing value coming backend as:

var backendarray =[0: "1234", 1: "3456", 2:"4567"];

js:

$.each( localjsonarray, function( key, value ) { var index = $.inarray( value, backendarray ); if( index != -1 ) { console.log( index ); } });

now how map id of local json id of backend json. if value matches loop should break else should value.

you can't create array var backendarray =[0: "1234", 1: "3456", 2:"4567"];

so way ... follow code above:

var localjsonarray = { "records": { "cat1": [{ "id": 1234, "label": "a" }, { "id": 2345, "label": "b" }], "cat2": { "id": 12345, "label": "c" } } }; var backendarray =["1234", "3456", "4567"]; $.each( localjsonarray['records'], function( a,b,c ) { if(!(b.length == undefined)){ for(var = 0;i < b.length; i++) { var index = $.inarray( b[i].id.tostring(), backendarray ); if( index != -1 ) { console.log( index ); } } } else{ var index = $.inarray( b.id.tostring(), backendarray ); if( index != -1 ) { console.log( index ); } } });

hope help!!! :)

javascript arrays json loops

Python: RuntimeError: maximum recursion depth exceeded -



Python: RuntimeError: maximum recursion depth exceeded -

i trying read through lines of text file split , pull strings between # signs. when run code getting error

runtimeerror: maximum recursion depth exceeded

here code below, help appreciated. thanks!

#function def parameterpull(line): if line.count('#') > 0: temp = eachline.split('#',1)[1] temp2 = temp.split('#',1)[0] temp3 = temp.split('#',1)[1] #write these scripts file parameterfile.write('\n'+temp2+'\n') #check multiple instance on same line if temp3.count('#') > 0: parameterpull(temp3) #make replacements eachline in resultfile: parameterpull(eachline) parameterfile.close()

you need line instead of eachline in function body. made quick test sample resultfile (several lines of # x # y # z #) , no error occurred after making change.

python recursion runtime-error

java - How to get the default ResourceBundle regardless of current default Locale -



java - How to get the default ResourceBundle regardless of current default Locale -

i have 3 resource files in class path:

labels.properties:

language = default

labels_en.properties:

language = english language

labels_fr.properties:

language = french

is there way resourcebundle object loads labels.properties no matter default locale is?

resourcebundle.getbundle("labels") returns 1 corresponding current default locale (as expected).

the way can find set default locale non-existing locale, may break other modules.

thank you!

locale.setdefault( locale.english); assert.assertequals( "english", resourcebundle.getbundle( "labels").getstring( "language")); locale.setdefault( locale.french); assert.assertequals( "french", resourcebundle.getbundle( "labels").getstring( "language")); assert.assertequals( "french", resourcebundle.getbundle( "labels", new locale( "do-not-exist")).getstring( "language")); locale.setdefault( new locale( "do-not-exist")); assert.assertequals( "default", resourcebundle.getbundle( "labels").getstring( "language"));

you can pass in resourcebundle.control which, regardless of requested locale, searches root resourcebundle:

resourcebundle rootonly = resourcebundle.getbundle("labels", new resourcebundle.control() { @override public list<locale> getcandidatelocales(string name, locale locale) { homecoming collections.singletonlist(locale.root); } });

java internationalization locale resourcebundle

jquery - Ajax call failing to consume the WCF restful service -



jquery - Ajax call failing to consume the WCF restful service -

i have wcf restful service exposes login method outside world defined below, validates given user credentials db (login table) & returns result in json format

c# code:

[operationcontract] [webget(requestformat = webmessageformat.json, responseformat = webmessageformat.json, bodystyle = webmessagebodystyle.wrapped, uritemplate = "login/{suserid}/{password}")] list<parkinglotrestwcfservice> login(string suserid, string password);

definition of same

public list<parkinglotrestwcfservice> login(string suserid, string password) { parkinglotrestwcfservice login = null; list<parkinglotrestwcfservice> arrlist = new list<parkinglotrestwcfservice>(); string json = ""; seek { string _connectionstring = "data source=lm;initial catalog=parkinglotdb;integrated security=true"; string _sql1 = "select * [logindetails] empid = " + suserid + " , pwd = '" + password + "'"; sqlconnection _connection = new sqlconnection(_connectionstring); sqlcommand _command = new sqlcommand(_sql1, _connection); _connection.open(); sqldatareader reader = _command.executereader(); if (reader.hasrows) { reader.close(); string _sql2 = "exec [dbo].[loginverify]"; sqlcommand _command2 = new sqlcommand(_sql2, _connection); sqldatareader reader2 = _command2.executereader(); reader2.read(); login = new parkinglotrestwcfservice(); login.status = "valid"; login.empid = reader2["empid"].tostring(); login.empname = reader2["name"].tostring(); login.secflag = reader2["secflag"].tostring(); arrlist.add(login); reader2.close(); //javascriptserializer ser = new javascriptserializer(); //json = ser.serialize(arrlist.toarray()); weboperationcontext.current.outgoingresponse.contenttype = "application/json; charset=utf-8"; weboperationcontext.current.outgoingresponse.headers.add("access-control-allow-origin", "*"); weboperationcontext.current.outgoingresponse.headers.add("access-control-allow-methods", "get"); weboperationcontext.current.outgoingresponse.headers.add("access-control-allow-headers", "content-type, accept"); } else { reader.close(); login.status = "invalid"; login.empid = string.empty; login.empname = string.empty; login.secflag = string.empty; arrlist.add(login); } _connection.close(); } grab (exception ex) { throw ex; } homecoming arrlist; }

jquery ajax code:

$('#signin').on('click',function(){ var userid=$('#userid').val(); var pass=$('#password').val(); var surl='http://localhost/parkinglotrestwcfservice.svc/login/'+userid+'/'+pass; $.ajax({ url: surl, type:"get", contenttype: 'application/json; charset=utf-8', datatype:"jsonp", jsonp:'jsonp', crossdomain:true, success: function (data, textstatus, jqxhr) { //process json response alert("success:"+retdata); }, error:function (result, sts, err) { alert("inside error block"); alert(err+":"+sts+":"+result); }, complete: function (jqxhr, textstatus) { alert("completed"); } }); });

so problem whenever create ajax phone call command goes error block, though can see actual json info in response section under net tab in firebug console.the error message within error block alerted error: jquery111108245764932074613_1403187289975 not called:parsererror:[object object].

i firebug console error message

syntaxerror: missing ; before statement {"loginresult":[{"empid":"300","empname":"user1","logintime":null,"logo -------------^

here json response returned wcf service

json response: {"loginresult":[{"empid":"300","empname":"user1","logintime":null,"logouttime":null,"secflag":"a","slotno":null,"status":"valid","vechicleno":null,"vechicletype":null}]}

note:

if nail url passed jquery straight browser returning me json info without error, same not working jquery ajax call i verified json response @ http://jsonlint.com/ , valid json

any quick help much appreciated guys :)

web.config

<configuration> <system.web> <compilation debug="true" targetframework="4.0"> <authentication mode="none"> </authentication></compilation></system.web> <system.webserver> <modules runallmanagedmodulesforallrequests="true"> </modules></system.webserver> <system.servicemodel> <servicehostingenvironment **aspnetcompatibilityenabled**="true"> <standardendpoints> <webscriptendpoint> <standardendpoint **crossdomainscriptaccessenabled**="true" name=""> </standardendpoint></webscriptendpoint> </standardendpoints> </servicehostingenvironment></system.servicemodel> </configuration>

jquery ajax json wcf restful-url

Tokenizing XML output using Java DOM parser - multiple child node values -



Tokenizing XML output using Java DOM parser - multiple child node values -

in expressions tab in eclipse, able see next output

\nmilk product, cultured\ncow milk\ncheese farm\n

by calling

eelement.getelementsbytagname("xmltag").item(0).gettextcontent());

how tokenize string using \n using indexof such can have separate string values ie:

string dairy1 = "milk product, cultured"; string dairy2 = "cow milk" string dairy3 = "cheese farm"

the convenient way should be

string[] toks = eelement.getelementsbytagname("xmltag").item(0).gettextcontent().split( "\n" );

the empty element [0] must skipped if \n @ beginning.

java xml dom domparser

how to share big photo of link in facebook and google plus -



how to share big photo of link in facebook and google plus -

i have photo gallery site

how share big image of facebook

current share : !

i love page of site homedsgn :

https://www.facebook.com/homedsgn?ref=br_tf

my problem nice solved ^_^

i alter name property

<meta name="og:image" content="http://www.sooran.com/public/images/upload/6208/">

good code :

<meta property="og:image" content="http://www.sooran.com/public/images/upload/6208/">

for solve problem in google plus pls see link ^_^:

http://webmasters.stackexchange.com/questions/25581/how-does-google-plus-select-an-image-from-a-shared-link

facebook

java - Unit testing a method that uses reflection -



java - Unit testing a method that uses reflection -

i trying unit test java methods one:

public boolean isint (object object){ homecoming object.getclass().equals(integer.class); }

this extremely simple illustration lets go it.

the question is: how can unit test (with junit) method without writing test each primitive type in java world? maybe concolic unit testing (jcute) answer?

please leave ideas, create test thorough possible less coding possible.

edit: goal of unit test check method returning right result type different integer, without having define set of tests checking types 1 one. when said primitives meant native types jdk (string, float, double, list, map, ...)

there limited list of primitive types: byte, short, int, long, boolean, char. each primitive has corresponding wrapper. that's it. so, easy write test each primitive type.

btw code cannot work primitieves because not objects, cannot phone call isint(123).

if want write shorter tests can write like:

@test public void isint() { asserttrue(obj.isint(new integer(1))); } @test public void isnotint() { (object obj : new object[] {new short(1), new boolean(true), new long(1), new chaeracter('a')}) { assertfalse(obj.isint(obj)); } }

junit supportes parametrized tests. sounds overkill such simple case.

java unit-testing reflection junit

css - Double div "container body-content" tag doesn't align correctly in Bootstrap 3.0 -



css - Double div "container body-content" tag doesn't align correctly in Bootstrap 3.0 -

why using twice <div class="container body-content"> tag, got wrong alignment on right side of page? text goes beyond right border.

here live version of page:

edit: http://www.bootply.com/l22kmzfgrt

here html, thanks.

<div class="container body-content"> <div class="row"> <div class="col-md-4" > <h2>lorem ipsum dolor sit down amet</h2> <p>lorem ipsum dolor sit down amet, cetero veritus mei ne, omnium propriae mel eu.</p> <p><a href="#" class="btn btn-primary btn-large">learn more</a></p> </div> </div> </div> <div class="container body-content" style="position: absolute; top:400px"> <div class="row"> <div class="col-md-4"> <p>lorem ipsum dolor sit down amet, cetero veritus mei ne, omnium propriae mel eu. eos putant signiferumque id, id mea nulla ceteros, nonumy graeco everti his. eam corrumpit consequat id. in nec audire accusamus, cu velit denique aliquando. ne nulla oratio feugiat ius, usu ut tibique intellegam.</p> </div> <div class="col-md-4"> <p>lorem ipsum dolor sit down amet, cetero veritus mei ne, omnium propriae mel eu. eos putant signiferumque id, id mea nulla ceteros, nonumy graeco everti his. eam corrumpit consequat id. in nec audire accusamus, cu velit denique aliquando. ne nulla oratio feugiat ius, usu ut tibique intellegam.</p> </div> <div class="col-md-4"> <p>lorem ipsum dolor sit down amet, cetero veritus mei ne, omnium propriae mel eu. eos putant signiferumque id, id mea nulla ceteros, nonumy graeco everti his. eam corrumpit consequat id. in nec audire accusamus, cu velit denique aliquando. ne nulla oratio feugiat ius, usu ut tibique intellegam.</p> </div> </div> </div>

the problem sort of positioning relative , solved using great answer: position absolute relative parent

css twitter-bootstrap twitter-bootstrap-3

c# - Map Json to Dictionary -



c# - Map Json to Dictionary -

i trying map json dictionary. before had dictionary key of type 'long' . after realizing mapping happen key needs of type 'string or 'object'.

now type definition in c# :

public class styleitemcreatecommand { public long styleid { get; set; } public dictionary<string, string> selecteditemtocolormap { get; set; } }

and json generating this:

{"styleid":"1710","selecteditemtocolormap":{"1391":"583","21531":"7733"}}

but still somehow not beingness mapped. using asp.net mvc controllers service, beingness consumed jquery client.

mvc method signature following:

[httppost] public actionresult create(styleitemcreatecommand command) { }

the dictionary object null. help appreciated. thanks.

now after searching around web found out asp.net mvc not gonna implicitly. found reply : [http://stackoverflow.com/a/15220050/756722]

c# jquery asp.net-mvc json

html - Remove parent margin for a responsive image in Bootstrap -



html - Remove parent margin for a responsive image in Bootstrap -

by using bootstrap, designed page follows:

now, i'd to:

remove left , right margins only image (that uses .img-resposive class); keep image responsive, increasing width according .jumbotron size.

to clear, desired result shown below:

how can that?

regards, v.

use negative margins on wrapper image :

.img-responsive-parent { margin: 0 -60px; }

and html :

<div class="img-responsive-parent"> <img class="img-responsive" /> </div>

html css twitter-bootstrap

Change formatting on paragraphs, with perl -



Change formatting on paragraphs, with perl -

i have number of paragraphs have returns @ end of line. not want returns @ end of lines, allow layout programme take care of that. remove returns, , replace them spaces.

the issue want returns in between paragraphs. so, if there more 1 homecoming in row (2, 3, etc) maintain 2 returns.

this allow there paragraphs, 1 blank line between then, other formatting lines removed. allow layout programme worry line breaks, , not have breaks determined set number of characters, now.

i utilize perl accomplish change, open other methods.

example text:

this test. test. test. test.

would become:

this test. test. test. test.

can done easily?

i came solution , wanted explain regex matching.

matt@mattpc ~/perl/testing/8 $ cat input.txt test. test. test. test. test. test. matt@mattpc ~/perl/testing/8 $ perl -e '$/ = undef; $_ = <>; s/(?<!\n)\n(?!\n)/ /g; s/\n{2,}/\n\n/g; print' input.txt test. test. test. test. test. test.

i wrote perl programme , mashed one-liner. this.

# first 2 lines read in whole file $/ = undef; $_ = <>; # regex replaces every `\n` space # if not preceded or followed `\n` s/(?<!\n)\n(?!\n)/ /g; # replaces every 2 or more \n 2 \n s/\n{2,}/\n\n/g; # print $_ print; perl -p -i -e 's/(\w+|\s+)[\r\n]/$1 /g' abc.txt

part of problem here matching. (\w+|\s+) matches 1 of more word characters, same [a-za-z0-9_], or 1 or more whitespace characters, same [\t\n\f\r ].

this wouldn't match input, since aren't matching periods, , no line consists of white space or characters (even blank lines need 2 whitespace characters match it, since have [\r\n] @ end). plus, neither match period.

perl

php - How to calculate star rating? -



php - How to calculate star rating? -

i have 1 product , want calculate 5 star rating on basic , dislike

for illustration product have

like = 200 // means 200 user product dislike =10 // means 10 user dislike particular product

here's simple php function:

<?php function calculatestarrating($likes, $dislikes){ $maxnumberofstars = 5; // define maximum number of stars possible. $totalrating = $likes + $dislikes; // calculate total number of ratings. $likepercentagestars = ($likes / $totalrating) * $maxnumberofstars; homecoming $likepercentagestars; } ?>

to phone call function:

<?php $likecount = 190; $dislikecount =10; $calculatedrating = calculatestarrating($likecount, $dislikecount); ?>

to utilize calculated value in javascript:

<script> var rating = <?php echo $calculatedrating; ?>; alert(rating); // testing purposes. </script>

these started.

php jquery rating

animation - wpf visual state manager with condition -



animation - wpf visual state manager with condition -

i tring style itemcontainerstyle of listbox changing mouseover , selected state .

with that

<visualstate x:name="mouseover"> <storyboard> <coloranimationusingkeyframes storyboard.targetproperty="(panel.background).(solidcolorbrush.color)" storyboard.targetname="border"> <easingcolorkeyframe keytime="0" value="#48ff5643"/> </coloranimationusingkeyframes> </storyboard> </visualstate> <visualstategroup x:name="selectionstates"> <visualstate x:name="unselected"/> <visualstate x:name="selected"> <storyboard> <coloranimationusingkeyframes storyboard.targetproperty="(panel.background).(solidcolorbrush.color)" storyboard.targetname="border"> <easingcolorkeyframe keytime="0" value="#ffff5643"/> </coloranimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="selectedunfocused"/> </visualstategroup> come in code here

the problem if have item selected , mouse on it's state alter mouseoverstate , want avoid that

i have tried controltemplate multitriggers like

<multitrigger.conditions> <condition property="isselected" value="false" /> <condition property="ismouseover" value="false" /> </multitrigger.conditions>

but did not work , , there not ismouseleave property

hopefully explain problem , help welcome

thanks , day !

it's much easier changing listboxitem.background property using trigger , systemcolors. seek instead:

<listbox itemssource="{binding days}"> <listbox.itemcontainerstyle> <style targettype="{x:type listboxitem}"> <style.resources> <solidcolorbrush x:key="{x:static systemcolors.highlightbrushkey}" color="#ffff5643" /> <solidcolorbrush x:key="{x:static systemcolors.controlbrushkey}" color="#ffff5643" /> <solidcolorbrush x:key="{x:static systemcolors.highlighttextbrushkey}" color="black" /> </style.resources> <style.triggers> <trigger property="ismouseover" value="true"> <setter property="background" value="#48ff5643" /> </trigger> </style.triggers> </style> </listbox.itemcontainerstyle> </listbox>

i have feeling these systemcolors might not work on either windows 8 or .net 4.5, .net 4 , windows 7. allow me know if wanted.

update >>>

the problem mouseleave, there no such property on eventtriggers

perhaps should investigate trigger class further?:

<trigger property="ismouseover" value="true"> <trigger.enteractions> <!--performed mouseenter event--> </trigger.enteractions> <trigger.exitactions> <!--performed mouseleave event--> </trigger.exitactions> </trigger>

wpf animation expression-blend

c++ - Most vexing parse: why doesn't A a(()); work? -



c++ - Most vexing parse: why doesn't A a(()); work? -

among many things stack overflow has taught me known "most vexing parse", classically demonstrated line such as

a a(b()); //declares function

while this, most, intuitively appears declaration of object a of type a, taking temporary b object constructor parameter, it's declaration of function a returning a, taking pointer function returns b , takes no parameters. line

a a(); //declares function

also falls under same category, since instead of object, declares function. now, in first case, usual workaround issue add together set of brackets/parenthesis around b(), compiler interpret declaration of object

a a((b())); //declares object

however, in sec case, doing same leads compile error

a a(()); //compile error

my question is, why? yes i'm aware right 'workaround' alter a a;, i'm curious know () compiler in first illustration doesn't work when reapplying in sec example. a a((b())); workaround specific exception written standard?

there no enlightened answer, it's because it's not defined valid syntax c++ language... so, definition of language.

if have look within valid. example:

((0));//compiles

to larn more how languages defined, , how compilers work, should larn formal language theory or more context free grammars (cfg) , related material finite state machines. if interested in though wikipedia pages won't enough, you'll have book.

c++

css - Indented Sass syntax not working with node-sass and gulp-sass -



css - Indented Sass syntax not working with node-sass and gulp-sass -

libsass 2.0 brought indented syntax libsass users, far i've been unable create work node-sass , gulp-sass. have of latest versions:

node-sass: 0.93 gulp-sass: 0.7.2 gulp: 3.8.2

this setup compiles .scss files , .sass files using bracket syntax not compile indented syntax. has compiled indented syntax node-sass , gulp?

my gulpfile.js

var gulp = require('gulp'); var sass = require('gulp-sass'); gulp.task('sass', function() { homecoming gulp.src('./sites/all/themes/nsfvb/sass/screen.sass') .pipe(sass({ includepaths: require('node-neat').includepaths, errlogtoconsole: true } )) .pipe(gulp.dest('./sites/all/themes/nsfvb/css')); }); gulp.task('watch', function() { gulp.watch('./sites/all/themes/nsfvb/sass/*.sass', ['sass']); }); gulp.task('default', ['sass', 'watch']);

error when running default task

error: invalid top-level expression

updated answer:

if want utilize indented syntax (.sass) top level file, utilize sass({indentedsyntax: true}).

sass({indentedsyntax: true}) outdated answer

answer found here: https://github.com/dlmanning/gulp-sass/issues/55#issuecomment-50882250

with default settings compiling sass files doesn't work. there workaround. if pass sourcecomments: 'normal' parameter compilation work. reason there unusual status alter how file handled: https://github.com/dlmanning/gulp-sass/blob/master/index.js#l23-l27

code illustration found here: https://github.com/chrisdl/gulp-libsass-example/blob/master/gulpfile.js

var gulp = require('gulp'); var sass = require('gulp-sass'); // run "> gulp sass" in terminal. gulp.task('sass', function () { gulp.src('./sass/main.sass') .pipe(sass({sourcecomments: 'normal'})) .pipe(gulp.dest('./css')); }); notice

if run issues using snippet take @ next quote , issue.

using workaround result in changes file content before in gulp pipeline (e.g. before plugins) beingness discarded - jmm

https://github.com/dlmanning/gulp-sass/issues/158

css node.js sass gulp

pydev - Some beginner error I don't understand in python -



pydev - Some beginner error I don't understand in python -

so here's code, copied character character codecademy, , tried altering it, same error. i'm aware codecademy utilising python 2, differences wouldn't big basic "%s" wouldn't work!

from datetime import datetime = datetime.now() print ("%s + %s + %s") % (now.year, now.month, now.day)

and error message:

traceback (most recent phone call last): file "c:\users\sunil\desktop\beginning programming\java\workspace\helain\src\packag\__init__.py", line 5, in <module> print ("%s + %s + %s") % (now.year, now.month, now.day) typeerror: unsupported operand type(s) %: 'nonetype' , 'tuple'

what error making?

in python 3, print function, code calls print("%s + %s + %s") , applies % result of call, none.

try print ("%s + %s + %s" % (now.year, now.month, now.day))

python pydev

php - dropzone.js how to send me mail after upload is completed -



php - dropzone.js how to send me mail after upload is completed -

i've added dropzone.js script site , got working. want email when uploads in dropzone. don't know how in php.

my html:

<form action="dropzone/upload.php" class="dropzone" id="myawesomedropzone"></form>

my upload.php

<?php $ds = directory_separator; $storefolder = 'uploads'; $digits = ''; $amountofdigits = 4; $numbers = range(0,9); shuffle($numbers); for($i = 0;$i < $amountofdigits;$i++) $digits .= $numbers[$i]; if (!empty($_files)) { $tempfile = $_files['file']['tmp_name']; $targetpath = dirname( __file__ ) . $ds . $storefolder . $ds; $targetfile = $targetpath . time() . '-' . $digits . '-' . $_files['file']['name']; move_uploaded_file($tempfile,$targetfile); } ?>

the code above sends files folder want them timestamp no file ever override existing file. when done want email know uploaded file. how can accomplished.

the mailingscript want use:

$message = "bunch of html"; $headers = "mime-version: 1.0\r\n"; $headers.= "content-type: text/html; charset=iso-8859-1\r\n"; $headers.= "from: examle <info@example.com>\r\n"; $subject = "example"; $to = "me@mydomain.com"; mail($to, $subject, $message, $headers)

when changed

move_uploaded_file($tempfile,$targetfile);

into:

if(move_uploaded_file($tempfile,$targetfile) { //my mailingcode here }

it worked wanted.

php dropzone.js

security - Configuring java policy file with Wildfly 8.1 -



security - Configuring java policy file with Wildfly 8.1 -

when running application in wildfly 8.1, i'm getting accesscontrolexception:

caused by: java.security.accesscontrolexception: access denied ("java.util.propertypermission" "uka.karmi.usedistributedthreads" "read") @ java.security.accesscontrolcontext.checkpermission(accesscontrolcontext.java:457 [rt.jar:1.8.0_05] @ java.security.accesscontroller.checkpermission(accesscontroller.java:884) [rt.jar:1.8.0_05] @ java.lang.securitymanager.checkpermission(securitymanager.java:549) [rt.jar:1.8.0_05] @ java.lang.securitymanager.checkpropertyaccess(securitymanager.java:1294) [rt.jar:1.8.0_05] @ java.lang.system.getproperty(system.java:714) [rt.jar:1.8.0_05]

i'm running wildfly server vm argument:

-djava.security.policy=/opt/misc/test.policy

where test.policy looks like:

grant { permission java.security.allpermission; };

i tried modifying test.policy:

grant { permission java.security.allpermission; permission java.util.propertypermission "uka.karmi.usedistributedthreads", "read"; };

but still same error.

the preferred way defining deployment permissions in wildfly meta-inf/permissions.xml (or vendor specific meta-inf/jboss-permissions.xml) file, comming java ee 7.

the problem is, wildfly seems have an issue (wfly-3651) it.

the permissions.xml file in case like:

class="lang-xml prettyprint-override"><?xml version="1.0" encoding="utf-8"?> <permissions xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/permissions_7.xsd" version="7"> <permission> <class-name>java.util.propertypermission</class-name> <name>uka.karmi.usedistributedthreads</name> <actions>read</actions> </permission> </permissions>

java security wildfly

usb - What is the Difference Between NCM and MBIM? -



usb - What is the Difference Between NCM and MBIM? -

now working ncm , mbim protocol.in observation mbim latest of ncm.i need know difference between ncm , mbim performance level,packet format,speed , etc...can help me regarding this?

ncm standard targets ethernet capable devices in usb layer. mbim standard targets mobile broadband modems (e.g. 2g/3g/4g ones) in usb layer. regarding packet format, ncm utilize 802.3 (i.e ip packets ethernet headers), while mbim utilize raw ip packets (i.e. ip packets without ethernet headers).

usb protocols

java - Change the origin of the JScrollpane -



java - Change the origin of the JScrollpane -

i have jscrollpanel implemented correctly . want able draw graph in scrolloable area . jscrollpanel produced has origin (x=0,y=0) in top left corner .

how can alter origin becomes bottom left corner of jscrollpane ?in other words co-ordinate values should increment , right.

i need because origin style corresponds landscape mode in want graph visualized . went through jcomponent doucmentation . not sure api utilize .

you not able alter coordinates of origin of jscrollpane located. in of swing origin defined top left. have manually right y values.

this simple int outputy = jscrollpanelobject.getheight() - inputy;

this flips y values making appear if increasing , right.

edit: in case can grab graphics2d object phone call rotate on it. in cases graphics object handed downwards paint method can casted graphics2d. believe want rotate -90 degrees or -math.pi/2

java swing jscrollpane jcomponent

excel vba - Subscript out of range for setting worksheet -



excel vba - Subscript out of range for setting worksheet -

this code takes row current (data) worksheet, checks see if worksheet exists given name of info row , creates new worksheet based on template if not. then, paste relevant info first blank row in our destination worksheet.

the issue having line 'set destws = sheets(name)', getting "subscript out of range" error. tried multiple fixes , looking @ other solutions , not find solution. error occurs regardless of whether new sheet created or not.

sub pastedata() dim dataws worksheet: set dataws = activesheet dim destws worksheet dim current worksheet dim datarow integer dim destrow integer dim name string dim newsheet boolean 'assumes current worksheet dataws datarow = 5 30 if isempty(dataws.cells(datarow, 3)) = false 'we found our destination sheet , name name = dataws.range("c" & datarow).value each current in worksheets if current.name = name newsheet = true next if newsheet = true create_supplier_sheet activesheet.name = name end if set destws = sheets(name) 'finds next blank row destrow = 5 34 if isempty(destws.cells(destrow, 3)) = false 'found destws.range("c" & destrow).value = dataws.range("d" & datarow).value destws.range("d" & destrow).value = dataws.range("e" & datarow).value destws.range("f" & destrow).value = dataws.range("f" & datarow).value destws.range("g" & destrow).value = dataws.range("g" & datarow).value if dataws.range("d" & datarow + 1).value not dataws.range("d" & datarow).value goto lastline end if next destrow end if next datarow lastline: end sub

this module creates sheet based on template:

sub create_name_sheet() sheets("template").copy before:=sheets(1) range("c5:g34").clearcontents range("c2:g2").clearcontents end sub

excel-vba

jquery - Sliding home page conent -



jquery - Sliding home page conent -

i'm wanting create sliding carousel similar 1 used here: http://www.oki-ni.com/

any ideas on how go doing it?

kind regards.

it depends on how want go doing this, javascript/jquery typically how done.

there tons of jquery slider downloads out there, google it. here example.

http://www.basic-slider.com/

if you'd follow tutorial , create own instead of downloading one:

http://designmodo.com/image-slider-jquery-css3/

jquery slider carousel

c# - Entity Framework and adding POCOs without adding child objects -



c# - Entity Framework and adding POCOs without adding child objects -

so perhaps i'm addressing problem wrong way, wanted sentiment fine people on stackoverflow how more correctly this.

i've got programme has retrieve info repository around entity framework 6.0 code-first context, work on info contained , adds new record database.

anyway, here's simplified @ class i'm retrieving ef through repository:

public class product { public int id { get;set; } public virtual productcategory category { get;set; } public string name { get;set; } }

i build processedproduct next definition , pass in retrieved product baseproduct:

public class processedproduct { public int id { get;set; } public virtual product baseproduct { get;set; } }

i utilize repository layer saw on ef lesson on pluralsight , have purposed here. i've added relevant bits below:

public class mycontext : basecontext<mycontext>, imycontext { //lots of idbsets each context public void setmodified(object entity) { entry(entity).state = entitystate.modified; } public void setadd(object entity) { entry(entity).state = entitystate.added; } } public class myrepository : imyrepository { private readonly imycontext _context; public myrepository(iunitofwork uow) { _context = uow.context imycontext; } public processedproduct findprocessedproduct(int id) { homecoming _context.processedproducts.find(id); } public productcategory findcategory(int id) { homecoming _context.categories.find(id); } public int addprocessedproductwithoutproduct(processedproduct newrecord) { newrecord.product = null; save(); homecoming newrecord.id; } public int updateprocessedproductwithproductbutwithoutchildproperties(int processedproductid, int productid) { var processedproduct = findprocessedproduct(processedproductid); processedproduct.baseproduct = findproduct(productid); processedproduct.baseproduct.category = null; _context.setmodified(product); save(); homecoming processedproduct.id; } public int updateproductchildren(int processedproductid, int categoryid) { var processedproduct = findprocessedproduct(processedproductid); var category = findcategory(categoryid); processedproduct.baseproduct.category = category; _context.setmodified(product); save(); homecoming processedproduct.id; } }

and finally, here's portion pulls together:

try { //create processed product without product instance var processedproductid = repo.addprocessedproductwithoutproduct(finishedproduct); //now, update processed product record product. way, don't create //duplicate product. processedproductid = repo.updateprocessedproductwithproductbutwithoutchildproperties(processedproductid, product.id); //finally, update category processedproductid = repo.updateproductchildren(processedproductid, product.category.id); //done! }

when effort insert processedproduct ef, correctly creates processedproduct record, creates new product , new category row. i've tried manually changing alter tracking each object processedproduct 'added' , others either 'modified' or 'unchanged', foreign key reference exceptions thrown entity framework.

my "fix" break number of different calls:

i create new processedproduct record, assign product value null. i query processedproduct record id, query appropriate product id , assign product newly retrieved processedproduct record. however, have null out category property or else add together new duplicate category record. save , processedproduct record modified. finally, query processedproduct 1 time more productcategory , assign productcategory category property of processedproduct.baseproduct. can save 1 time more , i've created records need without making of duplicates.

however, approach seems quite convoluted since wanted save new parent record , not create duplicate kid records. there improve way go doing i'm missing? thanks!

edit: , guess larger question have complex object whole bunch of these kid complex objects. what's easiest way create new parent without having go through entire graph of kid objects update parent them 1 layer @ time?

i highly recommend not setting product & category navigation properties when editing. saw when add together graph of processed product (with product & category attached) ef context, it's marking in graph added , inserts on everything. pattern recommend (and nikolai suggested in comment, up-vote comment did :)) include fk ids in entity , set values, not navigations. e.g. newrecord.productid=theproductidvalue.

i've had many people cry "but foreign keys? ewwww! create classes dirty , impure!" after see how much easier code things without tangling navigations in these scenarios, have come "okay, worth it!"

btw if talking ef in enterprise course, have whole module dealing problem...it's called bout graphs in disconnected scenarios. :)

c# entity-framework

python - Pandas rolling apply with variable window length -



python - Pandas rolling apply with variable window length -

i have series values indexed timestamps. these timestamps irregularly spaced , calculate rolling mean (say) on lastly n seconds, n constant. unfortunately, resampling @ regular intervals before calculating rolling quantity not alternative - rolling quantity has calculated on entire dataset.

is there way in pandas?

python pandas

bit manipulation - MySQL bit inversion, how to only negate the fist x bits? -



bit manipulation - MySQL bit inversion, how to only negate the fist x bits? -

i using bitwise operators in mysql. have column of 6 bits. when used bit negation operator "~" 64 bt integer returned. means have number of leading 1's don't want.

how negate lastly 6 bits (the rightmost 6 bits)?

you can utilize xor 1 bits set each bit want negate.

in case, xor 0b00111111, or 0x3f.

mysql bit-manipulation

How to handle get and post requests with a single line in routes.rb in rails 4 -



How to handle get and post requests with a single line in routes.rb in rails 4 -

how handle , post requests in single line.

i have 1 definition(test) in controller(accounts). definition can called either request or post request. define in single line in routes.rb file.

now doing like,

resources :accounts do

collection 'test' post 'test' end

end

which worst case. if have more definitions in controller need mention 2 time each , every definition.

please provide me solution.

you should utilize get, post, put, patch , delete methods constrain route particular verb. can utilize match method :via alternative match multiple verbs @ once:

match 'photos', to: 'photos#show', via: [:get, :post]

you can match verbs particular route using via: :all:

match 'photos', to: 'photos#show', via: :all

for example:

match '/list' => 'products#products_list', :as => 'products_list' , via: [:get, :post]

reference

ruby-on-rails

AngularJS ng-repeat with filter on two array keys -



AngularJS ng-repeat with filter on two array keys -

i'm using ng-repeat display array, , using filter. array has many keys, , able apply filter 1 specific key:

ng-repeat="project in projects = (list | filter: { name: filter }) | orderby: 'name'"

but when describe filter, should display array entries string filter found either in name or description.

any suggestions?

solved

http://plnkr.co/edit/scupyt?p=preview

you'll need create search filter in $scope controller:

$scope.searchfilter = function (project) { var keyword = new regexp($scope.filter, 'i'); homecoming !$scope.filter || keyword.test(project.name) || keyword.test(project.description); };

and alter ng-repeat to:

ng-repeat="project in projects | filter: searchfilter) | orderby: 'name'"

you may need add together list in - not come across before.

angularjs ng-repeat

automated tests - Calabash Android: is there a way to carry information across multiple feature files? -



automated tests - Calabash Android: is there a way to carry information across multiple feature files? -

is there way can calabash retain info across feature files?

in order carry info between scenarios, utilize @@class_variables.

you can utilize ruby's global variables, e.g.

to set: $var = value

to get: $var

android automated-tests bdd calabash

Javascript Scope and this.Variable -



Javascript Scope and this.Variable -

so have javascript next (pseudo) structure. how set this.last_updated variable of parent function showupdates function, without referencing name assignment (my_main_function).

var my_main_function = new main() function main() { this.last_updated; function showupdates(data){ //set this.last_updated= // stuff } this.updatemain(){ $.ajax({ url:"/my_url/" type:"post", datatype:"json", data: {'last_updated':this.last_updated }, success : function(data) { showupdates(data)}, error : function(xhr,errmsg,err) { alert(xhr.status + ": " + xhr.responsetext); }, }); } }

updated code base of operations 1 comments:

there 2 way of creating objects.

if need create object multiple time this:

var yourdefintinon = function() { }; yourdefintinon.prototype.foo = function() { }; obj1 = new yourdefintinon(); obj2 = new yourdefintinon(); obj1.foo();

if need 1 time in code can that:

var obj = { }; obj.foo = function() { }; foo();

so need main 1 time code this: using function.prototype.bind (and polyfill older browsers) bind showupdates obj.

var main = { last_updated : null }; function showupdates(data){ this.last_updated = data.update_time; } main.updatemain = function () { //<< bind showupdates `this` , save bound function in local variabel showupdates var showupdates = showupdates.bind(this); $.ajax({ url:"/my_url/" type:"post", datatype:"json", data: {'last_updated':last_updated }, success : showupdates, //<< uses showupdates variable not function error : function(xhr,errmsg,err) { alert(xhr.status + ": " + xhr.responsetext); }, }); };

as don't want create showupdates accessible others wrap whole block function immediatly called:

var main = (function() { var main = { last_updated : null }; function showupdates(data){ this.last_updated = data.update_time; } main.updatemain = function () { var showupdates = showupdates.bind(this); $.ajax({ url:"/my_url/" type:"post", datatype:"json", data: {'last_updated':last_updated }, success : showupdates, error : function(xhr,errmsg,err) { alert(xhr.status + ": " + xhr.responsetext); }, }); }; homecoming main; }());

javascript scope

php - why does deleted record still get returned using eloquent model? -



php - why does deleted record still get returned using eloquent model? -

i'm new laravel, , first framework i'm learning in language, anyway, deleted records using :

public function getforcelogout() { $input = input::all(); $e = $input['email']; echo $e; db::select(db::raw("delete active_users email = '$e'")); }

but query executed through eloquent model returns object anyway, though has been been deleted (checked table in phpmyadmin)

public static function isloggedin() { $email = auth::user()->email; //$user = activeuser::where("email",$email); <== returns object $user = db::select(db::raw("select * active_users email = '$email'")); // <== works fine if ($user) { homecoming true; } else { auth::logout(); homecoming false; } }

why happening? doesn't eloquent model query database , works on cached records or similar?

edit: yes, pointed out, returns querybuilder object! mistake.

you doing this:

$user = activeuser::where("email",$email);

which returns querybuilder, querybuilders used laravel prepare queries while you're constructing them through eloquent model.

if want result database, should do:

$user = activeuser::where("email",$email)->first();

which should homecoming query result, or null if record doesn't exist.

php laravel laravel-4 eloquent

regex - Translate perl split to python split -



regex - Translate perl split to python split -

in perl:

split(/(?<=[kr])/,$mystring)

splits mystring after every k or r via 2 concepts "split between every character" (=empty string) + "lookbehind". sequence aaakbbbbr becomes (aaak,bbbbr).

whats counterpart in python? cant find way because empty string not split between characters!

do need around? regular look should [^kr]*[kr]:

in [1]: import re # import regex library in [2]: s = "aaakbbbbr" # define input string in [3]: re.findall(r'[^kr]*[kr]', s) # find matches in string out[3]: ['aaak', 'bbbbr']

regexplanation:

[^kr] # ^ in character classes negation match character except k/r * # quantifier used match 0 or more of previous look [kr] # simple character class matching k/r

in words: match 0 or more characters not k/r followed k/r.

you might want utilize + quantifier match @ to the lowest degree 1 or more instead of * cases like:

in [1]: import re in [2]: s = "kaaakbbbbr" in [3]: re.findall(r'[^kr]*[kr]', s) out[3]: ['k', 'aaak', 'bbbbr'] in [4]: re.findall(r'[^kr]+[kr]', s) out[4]: ['aaak', 'bbbbr']

to create trailing [kr] optional can utilize ?:

in [5]: s = 'aaakbbbbraaa' in [6]: re.findall(r'[^kr]+[kr]?', s) out[6]: ['aaak', 'bbbbr', 'aaa']

python regex perl

asp.net mvc - Log Requests from some Link -



asp.net mvc - Log Requests from some Link -

how can log requests going on link? need store requests headers, verb (get or post etc.), request info , request body. it's must separate application fiddler.

desc: have web application. makes search. want log info of search request using application can log requests site (in case web app). how create it? create research solution find many examples user can create module or filter must included in web application. case me not allowed.

if have command of both sides, can whatever want..

maybe link action first acts tracker:

public actionresult track() { //get whatever info want here //request.headers, request.requesttype ect //track info in database or whatever savesomedata(); //get original url post variable, or querystring, set var redirecturl = request["redirect"]; homecoming redirect(redirecturl); }

then alter links illustration link http://google.com, alter http://mywebsite.com/mycontroller/track?url=http://google.com

another possible way create proxy, , monitor info goes through it.

need improve thought of need though help out more.

asp.net-mvc logging request response

java - Polling HTTP endpoint followed by jersey REST WS does not work in Mule 3.5 -



java - Polling HTTP endpoint followed by jersey REST WS does not work in Mule 3.5 -

i have requirement need poll rest service , proxy response web service on rest web service.

i using mule 3.5 , flow looks below.

i below exception rest service beingness invoked

******************************************************************************** message : failed invoke jerseyresourcescomponent{testflow.component.1106552446}. component caused exception is: jerseyresourcescomponent{testflow.component.1106552446}. message payload of type: string code : mule_error--2 -------------------------------------------------------------------------------- exception stack is: 1. null (java.lang.nullpointerexception) org.mule.module.jersey.jerseyresourcescomponent:192 (null) 2. failed invoke jerseyresourcescomponent{testflow.component.1106552446}. component caused exception is: jerseyresourcescomponent{testflow.component.1106552446}. message payload of type: string (org.mule.component.componentexception) org.mule.component.abstractcomponent:144 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/component/componentexception.html) -------------------------------------------------------------------------------- root exception stack trace: java.lang.nullpointerexception @ org.mule.module.jersey.jerseyresourcescomponent.getbaseuri(jerseyresourcescomponent.java:192) @ org.mule.module.jersey.jerseyresourcescomponent.doinvoke(jerseyresourcescomponent.java:146) @ org.mule.component.abstractcomponent.invokeinternal(abstractcomponent.java:122) + 3 more (set debug level logging or '-dmule.verbose.exceptions=true' everything) ********************************************************************************

after debugging figured out because mule expects mulemessage inbound property contextpath populated in case null.

in jerseyresourcescomponent line 117 returned null , hence line 195 throws npe.

i wanted know if kind of requirement/pattern invalid or kind of limitation in way mule handling messaging infrastructure ?

the flow xml in case want inspect it.

<flow name="testflow" doc:name="testflow"> <poll doc:name="poll"> <fixed-frequency-scheduler frequency="10" timeunit="seconds" startdelay="10"/> <http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8080" doc:name="order generator" method="get" contenttype="application/json" path="order"/> </poll> <object-to-string-transformer doc:name="object string"/> <jersey:resources doc:name="tax calculator"> <component class="org.nthdimenzion.taxcalculator"/> </jersey:resources> <logger level="info" doc:name="logger"/> </flow>

ps : work around got utilize java/spring component instead of rest ws , phone call rest ws java component.

java web-services mule

java - JAX-RS (Jersey 2) - authorization using JSR 250 annotations -



java - JAX-RS (Jersey 2) - authorization using JSR 250 annotations -

intro

jersey: 2.9

this part of jersey documentation describes how provide authorization rest services. there 2 ways that:

standard servlet way, using configuration in web.xml much improve solution using jsr 250 annotations

the first approach works fine, cannot create sec work.

case 1 (using web.xml):

this illustration works. informational purpose. if want jump sec one, not work.

resource simple:

class="lang-java prettyprint-override">@path("/helloworld") public class helloworldresource { @get @produces(mediatype.text_plain) public string sayhelloworld(){ homecoming "hello world!!!"; } }

security configuration placed in web.xml file, looks that:

class="lang-xml prettyprint-override"><web-app ...> <servlet> <servlet-name>javax.ws.rs.core.application</servlet-name> </servlet> <servlet-mapping> <servlet-name>javax.ws.rs.core.application</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping> <!-- security --> <security-constraint> <web-resource-collection> <url-pattern>/rest/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>boss</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>basic</auth-method> <realm-name>defaultrealm</realm-name> </login-config> </web-app>

this illustration works fine. when seek access http://{myhost}:8080/{war_name}/rest/helloworld have provide username , password. means realm , configuration in database fine. there no need show here.

case 2 (jsr 250 annotations):

this illustration not work. resource same in first example, annotations added:

class="lang-java prettyprint-override">@path("/helloworld") @permitall public class helloworldresource { @rolesallowed("boss") @get @produces(mediatype.text_plain) public string sayhelloworld(){ homecoming "hello world!!!"; } }

as see, 2 annotations added. same security policy in first example, defined using annotations insted of web.xml.

now web.xml looks that:

class="lang-xml prettyprint-override"><?xml version="1.0" encoding="utf-8"?> <web-app ...> <login-config> <auth-method>basic</auth-method> <realm-name>defaultrealm</realm-name> </login-config> </web-app>

in add-on new class added (like described in documentation):

class="lang-java prettyprint-override">@applicationpath("rest") public class myapplication extends resourceconfig { public myapplication() { super(helloworldresource.class); register(rolesalloweddynamicfeature.class); } }

this class important. see required rolesalloweddynamicfeature registered. 2 main steps: - adding annotations resource - registering rolesalloweddynamicfeature done.

problem:

second illustration not work. popup provide username , password never shows up. every time response 403 forbidden. not problem realm , database configuration since configuration works fine first example.

so question is: wrong sec implementation?

tnaks in advance.

instead of resourceconfig sub-class, seek add together web.xml block

<init-param> <param-name>com.sun.jersey.spi.container.resourcefilters</param-name> <param-value>com.sun.jersey.api.container.filter.rolesallowedresourcfilterfactory</param-value> </init-param>

java security rest jax-rs jersey-2.0

c# Microsoft.Office.Interop.Word.Document to Stream -



c# Microsoft.Office.Interop.Word.Document to Stream -

i have active document :

microsoft.office.interop.word.document document = globals.thisaddin.application.activedocument;

how can convert stream?

or better, how send active document rest web service?

thanks

which rest-service? if it's sharepoint or i'm used calling saveas function follows:

microsoft.office.interop.word.document document = globals.thisaddin.application.activedocument; document.saveas("https://www.contoso.sharepoint.com/documents/document1.docx");

edit: p.s. can serialize stream. found reply here

public static memorystream serializetostream(object o) { memorystream stream = new memorystream(); iformatter formatter = new binaryformatter(); formatter.serialize(stream, o); homecoming stream; } public static object deserializefromstream(memorystream stream) { iformatter formatter = new binaryformatter(); stream.seek(0, seekorigin.begin); object o = formatter.deserialize(stream); homecoming o; }

c# ms-word add-in

sql - Database Mail not sending -



sql - Database Mail not sending -

i'm trying send email using databasemail on sql server 2008; can see emails sitting in msdb.dbo.sysmail_unsentitems

but sit down there , no error messages. i've checked , have rights utilize databasemail using following:

exec msdb.sys.sp_helprolemember 'databasemailuserrole';

and tried running

exec msdb.dbo.sysmail_help_queue_sp @queue_type = 'mail';

which shows length number of emails i've tried send, status showing inactive.

am missing else?

sql sql-server

ios - Should I recreate the EAGL context when handling an handleScreenDidConnectNotification? -



ios - Should I recreate the EAGL context when handling an handleScreenDidConnectNotification? -

i attempting handle handlescreendid(dis)connectnotification's in ios. problem have error of gl_invalid_framebuffer_operation non-specific glfunctions() in application 2 frames after handling handlescreendidconnectnotification.

i deleting , recreating framebuffers , renderbuffers (because resolution changing) notification. not eaglcontext.

my question is: need release/delete eaglcontext* when handling notification , guess delete recreate of gl resources?

ios opengl-es eaglcontext

user interface - How to add additional .ui files in Qt VS Add-in -



user interface - How to add additional .ui files in Qt VS Add-in -

i have created qt application project in visual studio. generates 1 .ui file main window. if want add together window?

if utilize visual studio 2013 , qt 5, right click project in solution explorer , select add -> class... launch add class dialog.

you can create qt5guiclass new window in dialog.

user-interface visual-studio-2013 qt5 qt-vs-addin

arrays - Java, How to split elements of a list? -



arrays - Java, How to split elements of a list? -

i'm trying split individual elements of string[] array. array looks

{"0 1 0 1", "0 0 1 1", "1 1 0 1",...}.

i want split each element regex " ", single space. if that, create 1 element "0 1 0 1" 4 elements "0", "1", "0", , "1"? here code adds elements list (reading text file rows of 4 digit numbers separated spaces) part using "split" method not working. not having impact on array produced. name of string[] array "splitted".

int j=0; string thisline = null; while(((thisline=readthrough.readline()) != null) && j<3){ splitted[j]= thisline; splitted[j].split(" "); j++; }

the split() method doesn't modify string in-place, have to assign returned string[] something. if want process values, seek this:

string[] array = {"0 1 0 1", "0 0 1 1", "1 1 0 1"}; list<string> reply = new arraylist<string>(); (string str : array) (string s : str.split(" ")) answer.add(s);

after loop runs, answer contain next string values:

[0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1]

optionally, if need output result array of strings can this:

string[] output = answer.toarray(new string[answer.size()]);

java arrays

php - Hide / Remove "Create" button on DetailView of sugarcrm -



php - Hide / Remove "Create" button on DetailView of sugarcrm -

in 1 of sugar custom module, don't need "edit" , "create" buttons on detailview. have removed "edit" button, using next code in view.detail.php file.

unset($this->dv->defs['templatemeta']['form']['buttons'][0]); unset($this->dv->defs['templatemeta']['form']['buttons'][1]); unset($this->dv->defs['templatemeta']['form']['buttons'][2]); unset($this->dv->defs['templatemeta']['form']['buttons'][3]);

now want rid of "create" button detailview. have search didn't useful. how can accomplish this?

just find detailviewdefs.php of module , re-create them custom/modules/{yourmodulenamehere}/matadata/ , remove button dont want have buttons array: (here detailviewdefs of module meetings example)

$viewdefs ['yourmodulenamehere'] = array ( 'detailview' => array ( 'templatemeta' => array ( 'form' => array ( 'buttons' => array ( 0 => 'edit', 1 => 'duplicate', 2 => 'delete', 3 => array ( 'customcode' => '{if $fields.status.value != "held"} <input type="hidden" name="issaveandnew" value="false"> <input type="hidden" name="status" value=""> <input type="hidden" name="issavefromdetailview" value="true"> <input title="{$app.lbl_close_and_create_button_title}" accesskey="{$app.lbl_close_and_create_button_key}" class="button" onclick="this.form.status.value=\'held\'; this.form.action.value=\'save\';this.form.return_module.value=\'meetings\';this.form.isduplicate.value=true;this.form.issaveandnew.value=true;this.form.return_action.value=\'editview\'; this.form.isduplicate.value=true;this.form.return_id.value=\'{$fields.id.value}\';" name="button" value="{$app.lbl_close_and_create_button_title}" type="submit">{/if}', ), 4 => array ( 'customcode' => '{if $fields.status.value != "held"} <input type="hidden" name="issave" value="false"> <input title="{$app.lbl_close_button_title}" accesskey="{$app.lbl_close_button_key}" class="button" onclick="this.form.status.value=\'held\'; this.form.action.value=\'save\';this.form.return_module.value=\'meetings\';this.form.issave.value=true;this.form.return_action.value=\'detailview\'; this.form.return_id.value=\'{$fields.id.value}\'" name="button1" value="{$app.lbl_close_button_title}" type="submit">{/if}', ), ), ), 'maxcolumns' => '2', 'widths' => file goes on........

php sugarcrm

ios - How to reduce the MPMediaPickerController loading time? -



ios - How to reduce the MPMediaPickerController loading time? -

in project using mpmediapickercontroller pick file device music library. using next piece of code displaying media picker.

mpmediapickercontroller *mediapicker = [[mpmediapickercontroller alloc] initwithmediatypes:mpmediatypemusic]; mediapicker.delegate = self; mediapicker.prompt = @"select personal message"; [self presentviewcontroller:mediapicker animated:no completion:nil];

everything working fine,but mediapickercontroller taking couple of seconds (2 3 sec) showing music library. there way cut down loading time of mpmediapickercontroller. delay after clicking upload button realy bad user experience.

there's nil can do. if there lot of music, takes time survey of , prepare controller, , that's there it. no different delay first time user tries utilize music app. might able cut down amount of material shown turning off showsclouditems, might not help.

the best can seek cover delay psychologically, i.e. giving user see, such spinning activity indicator, until in place. have not tried mpmediapickercontroller, (i've done own home-built music library exploration interface, has same delay issues).

ios mpmediapickercontroller

ios - Moving object after creation -



ios - Moving object after creation -

i trying move uiimageview object after created, seem having problems accomplishing this. actual creation of image working fine. code have far:

//spawning random objects -(ibaction)spawn{ spawn = [nstimer scheduledtimerwithtimeinterval:1.0f target:self selector:@selector(spawnmechanism) userinfo:nil repeats:yes]; } -(ibaction)spawnmove{ spawnmove = [nstimer scheduledtimerwithtimeinterval:1.0f target:self selector:@selector(spawnmovemechanism) userinfo:nil repeats:yes]; } -(uiimageview *)spawnmovemechanism:(uiimageview *)spawngood{ spawngood.center =cgpointmake(spawngood.center.x, spawngood.center.y+100); nslog(@"spawnmovemechanism accomplished"); homecoming spawngood; } -(void)spawnmechanism{ timesincelastspawn++; if(timesincelastspawn >= 3) { if( arc4random() % 10 < 7 ){ uiimageview *spawngood; spawngood=[[uiimageview alloc]initwithframe:cgrectmake(arc4random() % 700, 50, 70,70)]; uiimage *image; image=[uiimage imagenamed:@"friendly-01"]; [spawngood setimage:image]; [self.view addsubview:spawngood]; nslog(@"spawngood spawned"); [self spawnmovemechanism]; } } }

is able suggest solution this? in advance

ios objective-c

java - Remove items from a TreeViewer based on the suffix of the string(List items) -



java - Remove items from a TreeViewer based on the suffix of the string(List items) -

i have treeviewer , list within treeviewer containing list of items(string), illustration :

subtask 1 1 \\first item in treeviewer

subtask 2 one

subtask 3 one

subtask 4 two

subtask 4 three

i want remove items treeviewer suffix "one" , leave rest of items. how iterate on items , remove items name ends string "one"?

sample code :

treeviewer treeviewer = new treeviewer(movercomposite, swt.border | swt.multi); treeviewer.setcontentprovider(new treecontentprovider()); treeviewer.setlabelprovider(new labelprovider()); griddata griddata = new griddata(swt.default, swt.fill, false, true); griddata.widthhint = 215; treeviewer.getcontrol().setlayoutdata(griddata); list listitems = new arraylist(); listitems.addall(getitems()); //this line want iterate through list , remove list items names end string "one". treeviewer.setinput(listitems);

someone please help me here @ earliest, please.

before setting tree viewer's input want iterate on list , remove items name ends string "one" (items suffix "one")? after removing items list set treeviewer's input.

is there way remove items name ends string "one"? how do this? i'm stuck here please please suggest how proceed?

thanks in advance.

assuming getitems() gives me list of item object,

list<item> listitems = new arraylist<item>(); foreach(item item : getitems()){ if(!item.getname().endswith("one")){ listitems.add(item); } } treeviewer.setinput(listitems);

java list swt jface treeviewer