Posts

Showing posts from August, 2010

c# - Intermittent ArgumentOutOfRangeException when using AlternativeFrame -

i'm using winrtxamltoolkit's alternativeframe in xamrin/mvvmcross windows 8.1 application support animations while doing page navigations. animations run fine first couple of transitions, intermittently application unhandledexception mid-animation -- the operation attempted access data outside valid range (exception hresult: 0x8000000b)" system.argumentoutofrangeexception: collection cannot work indices larger int32.maxvalue - 1 (0x7fffffff - 1). parameter name: index @ system.runtime.interopservices.windowsruntime.listtobindablevectoradapter.ensureindexint32(uint32 index, int32 listcapacity) @ system.runtime.interopservices.windowsruntime.listtobindablevectoradapter.getat(uint32 index) that's stack trace. same animation works several times throw error on future attempt. have ideas causing or ideas on how more information? the offending views unnecessarily ui heavy -- gridviews inside listviews when simple itemscon...

python - How do I get the client port number in a Django project? -

i using django build web server, other people connect me clients. need know clients' port number distinguish them. if browser opens 2 'tabs' of same link, i.e. 2 pages same link, have distinguish them. although know can use request.meta['remote_addr'] client's ip in django view function, realy not enough me. then studied tcp/ip basics , know in tcp/ip layer, every ip packet has ip header contains client's port number. how can access in django? additional info: i'm using python 2.6 , django 1.4 i know every tab of browser allocated random unique port access django web page port. -- see link ' the web server opens port 80, browser has different, randomly-assigned port. ' need distinguish them. intuitive thoughts use port number in ip packet. if have other suggestion, welcome. i have found the similar question here , not using apache now. , may hard me config maybe causing other more complex questions. might make simple question com...

java - Is it possible to mock classes in webapp running within embedded Tomcat? -

i able mock class used webapp in junit test running embedded tomcat. public interface foo { void bar(); } @runwith(jmockit.class) public class integrationtest { @test public void mockingfoo(@capturing final foo foo) throws servletexception, lifecycleexception { new expectations() {{ foo.bar(); result = new runtimeexception(); }}; final tomcat tomcat = new tomcat(); // myapp invoke foo instance tomcat.addwebapp("/myapp", "/path/to/myapp.war"); tomcat.start(); /* invoke webapp (via selenium, example) call foo::bar in webapp should throw runtime exception */ tomcat.stop(); } } what can done foo instances within webapp mocked via jmockit? update - 20150821 i don't yet know answer question. however, managed mock classes in webapp running within jetty .

python - Why doesn't the + operator work between multi single line strings? -

this question has answer here: is possible break long line multiple lines in python 6 answers i trying concatenate multi line string single line in python , it's giving me invalid syntax error. authheader = '<header></header>' reqbody = '<s:envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">' + authheader + '''<s:body xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <getsnapshoturi xmlns="http://www.onvif.org/ver10/media/wsdl"><profiletoken>quality_h264</profiletoken></getsnapshoturi> </s:body> </s:envelope> ''' no need use + operator concatenate strings ...

ios - Archive build with split pods across app and watchkit extension -

i have been unable cocoapods build deployable ios app requires different pods app , watchkit extension. have tried format suggested in thread: include pods in main target , not in watchkit extension but has numerous failures, including not finding headers. here's closest can get: source 'https://github.com/cocoapods/specs.git' link_with 'railtime-watchkit-extension' pod 'reachability' pod 'iginterfacedatatable' target :'railtime', :exclusive=>true pod 'asihttprequest', '~> 1.8.2' pod 'bpxluuidhandler', '~> 0.0.1' pod 'mbprogresshud', '~> 0.9' pod 'appirater', '~> 2.0.4' end this works fine simulator, fails when trying install on device. first error is: ld: library not found -lpods-railtime-watchkit-extension i'm using latest cocoapods right .37. no errors generated when performing pod install. any appreciated! ken ...

actionscript 3 - Volume control after loop as3 -

i have problem code. code works great 1 exception, if have pressed mute-button , animation loops, it's volume = 1. how can loop without going volume = 1? var mysound:sound = new sound(); var songurl:urlrequest = new urlrequest("lyd/jetpass.mp3"); var channel1:soundchannel = new soundchannel(); var volumeadjust:soundtransform = new soundtransform(); mute1.addeventlistener(mouseevent.click, mutelyd); volumeadjust.volume = 1; mysound.load(songurl); channel1.soundtransform = volumeadjust; channel1 = mysound.play(); function mutelyd(e:mouseevent):void { if(volumeadjust.volume == 1){ volumeadjust.volume = 0; } else { volumeadjust.volume = 1; } channel1.soundtransform = volumeadjust; } just found out code solves problem: var mysound:sound = new sound(); var songurl:urlrequest = new urlrequest("lyd/jetpass.mp3"); var channel1:soundchannel = new soundchannel(); mute1.addeventlistener(mouseevent.click, mutelyd); unmute1.addeventlistener(mousee...

Vagrant + Docker + Postgresql - Cannot connect from host -

i'm trying simulate our production setup locally using vagrant. in production, use docker container our postgresql database, running on centos6.5/redhat (not choice). so, locally, i've installed vagrant, created machine, got postgresql docker container , running on machine, ensured it's running connecting vm. cannot figure out how connect postgresql host (or vm). here vagrant file: vagrantfile_api_version = "2" vagrant.configure(vagrantfile_api_version) |config| config.vm.box = "chef/centos-6.5" config.vm.provision "shell" |s| s.inline = "ps aux | grep 'sshd:' | awk '{print $2}' | xargs kill" end config.vm.define "db" |db| db.vm.synced_folder "../db", "/vagrant/db" db.vm.synced_folder "../deploy", "/vagrant/deploy" db.vm.hostname = "dbserver" db.vm.network :private_network, ip: "192.168.50.4" db.vm.netw...

plot - R clustering- silhouette with observation labels -

Image
i hierarchical clustering cluster package in r. using silhouette function, can silhouette plot of cluster output given height (h) cut-off in dendrogram. # run hierarchical clustering if(!require("cluster")) { install.packages("cluster"); require("cluster") } tmp <- matrix(c( 0, 20, 20, 20, 40, 60, 60, 60, 100, 120, 120, 120, 20, 0, 30, 50, 60, 80, 40, 80, 120, 100, 140, 120, 20, 30, 0, 40, 60, 80, 80, 80, 120, 140, 140, 80, 20, 50, 40, 0, 60, 80, 80, 80, 120, 140, 140, 140, 40, 60, 60, 60, 0, 20, 20, 20, 60, 80, 80, 80, 60, 80, 80, 80, 20, 0, 20, 20, 40, 60, 60, 60, 60, 40, 80, 80, 20, 20, 0, 20, 60, 80, 80, 80, 60, 80, 80, 80, 20, 20, 20, 0, 60, 80, 80, 80, 100, 120, 120, 120, 60, 40, 60, 60, 0, 20, 20, 20, ...

objective c - How to send a Cocoa Lumberjack log file in email from within an OSX application -

i have been trying send cocoa lumberjack log file through email within mac osx application, using apple script. possible this? i have problem being able use applescript attachment out of correct folder, able create , send message fine without attachment. i noticed there entitlements accessing users downloads, pictures, movies, music folder aren't convenient store log files in. can latest log in objective-c, temporarily write accessible location (e.g. downloads) , attach email there via applescript? nsarray *logfilepathsarray=[[myfilelogger logfilemanager] sortedlogfilepaths]; nsstring *mylogfilepath=[logfilepathsarray firstobject]; // ... copy downloads folder url

sql - Oracle snapshot too old and DBLINK -

i getting ora-01555: snapshot old: rollback segment number 234 name "_syssmu234_1378897836$" too smal while selecting data using dblink in oracle database. select a,b localtab union select a,b rmottab@remotedb; is there way override error? have situation take data in periodical manner. you need close cursor when finished retrieving data. problem holding cursor open long. there tons of reasons that: - row-by-row processing on client side. take forever finish. (the database waiting deliver data client) hint. arraysize (fetchsize) set low. arraysize of 100-200 can speed things up. - there nice view hidden behind "rmotab" takes > 30 minutes return burning cpu (logical reads) basically, have these options: speed process. (end cursor (query) faster). bulk load. schedule process happen when no dml going on. materialized view (pre-load data (read-only)) increase undo.

html - Overflow-x not working on mobile device, even with wrapper class -

so have jquery animation in div-element. clouds moving left right out of screen , repeat. append them , animate this: $('#clouds').append("<div id='cloud1' class='cloud'><img src='/images/cloud1.png' ></div>"); function movecloud1() { var cloudwidth = $('#cloud1 img').width(); var winwidth = $(window).width(); var rand_y = 60 + (math.random() * 200); $('#cloud1').delay(500).css({left: -400, top: rand_y}); $('#cloud1').animate({ left: winwidth }, (20000+(rand_y*5)), "linear", function() { movecloud1(); }); } it coming in div's this: <div class="city_container"> <div id="clouds"></div> <div class='city'></div> <div class='sky'></div> </div> i noticed ability scroll horizontally appeared once clouds moving outside viewport on right, added ove...

c# - How to force Entity Framework to produce more efficient SQL code? -

we using ef 6.1. despite improvements v4, there need ef in decision on how generate sql more efficient. helps use linq in our case , specify joins. however, have case don't know how (besides circumventing ef completely): return db.testlets.include("testtasks.testquestions.testanswers") .include("testtasks.testquestions.testquestioncriteriongroups.testquestioncriterions") .include("testtasks.testquestions.question.answers") .where(x => x.testid == testid && x.shownon.hasvalue) .tolist(); this produces code inefficient. in fact should enough , best if ef produced this: select * testlet tl inner join testtask tt on tl.guid = tt.testletid inner join testquestion tq on tt.guid = tq.testtaskid inner join testanswer ta on tq.guid = ta.testquestionid left outer join testquestioncriteriongroup tqcg on tqcg.testquestionid = tq.guid left outer join testquestioncriterion tqc on tqcg.guid = tqc.testquestio...

java - JFrame not displaying properly -

i haven't done programming while, missing obvious here. i trying run following code, should create empty jframe , put in center of screen: public class maingui { // initilizes main jframe public void maingui() { jframe.setdefaultlookandfeeldecorated(true); jframe frame = new jframe("data deriver"); //frame.setcontentpane(makegui(frame)); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setsize(300,180); frame.setlocationrelativeto(null); frame.setresizable(true); frame.setvisible(true); } public static void main(string[] args) { new maingui(); } } however, when compile code (using jdk 8.0_45) , run it, nothing happens. no windows open, no errors thrown, literally nothing happens. compiles without error, code should work, nothing being displayed. i'm not sure wrong. you creating instance of maingui class, don't have explicit constructor, after program exits. you have call maingui() ...

javascript - How to create a blog on nodejs(with express.js)? -

guys. please, me. how create blog on nodejs namely on expressjs (with basic funct. - delete/add/remove posts , comments, standard auth) ? i did searched, and... find tutorials, not full. , blog need practic nodejs, test, , little dream :) you can checkout mean.js . fullstack javascript framework lets generate crud modules (articles blogs) , more.

Powershell > output on specific path -

i have make script in powershell : $msbuild = "$env:appdata\usbsave\usb.exe" $arguments = " -w " start-process $msbuild $arguments the script works, output file (out.txt), appears on desktop. how can save output file $env:appdata\usbsave\ ? i assume console prompt pointing desktop. simple solution change directory before calling process. $msbuilddir = "$env:appdata\usbsave" set-location $msbuilddir $msbuild = "$msbuilddir\usb.exe" $arguments = "all -w" start-process $msbuild $arguments i consider usb.exe have switches define output. more commonly associated virus seems utility. was going mention -workingdirectory start-process tony hinkle beat me it.

c# - Using same x:Name in usercontrols with MVVM Light -

i use mvvm light in wpf-application. have usercontrol. passes element elementname commandparameter command. <usercontrol> <i:interaction.triggers> <i:eventtrigger eventname="loaded"> <cmd:eventtocommand command="{binding loadcommand}" commandparameter="{binding elementname=image}"></cmd:eventtocommand> </i:eventtrigger> </i:interaction.triggers> <image name="image" /> </usercontrol> in mainview use usercontrols: <window> <l:mycontrol /> <l:mycontrol /> </window> viewmodel class mainviewmodel:viewmodelbase { public mainviewmodel() { loadcommand = new relaycommand<image>(onload); } private void onload(image image) { draw(image,bitmap); } } "draw" function writing on image usercontrol's parameters. cause images have same x:name, application draws on last im...

python - Proper way to consume data from RESTFUL API in django -

i'm trying learn django while have current solution i'm not sure if follows best practices in django. display information web api on website. let's api url follows: http://api.example.com/books?author=edwards&year=2009 thsis return list of books edwards written in year 2009. returned in following format: {'results': [ { 'title':'book 1', 'author':'edwards man', 'year':2009 }, { 'title':'book 2', 'author':'edwards man', 'year':2009} ] } currently consuming api in views file follows: class bookspage(generic.templateview): def get(self,request): r = requests.get('http://api.example.com/books?author=edwards&year=2009') books = r.json() books_list = {...

java - Fetching a JSON via JSP to JS -

i'm having trouble getting json string servlet, throu jsp page javascript , imported vakata/jstree. this how current code looks like. servlet: protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { system.out.println("du är nu doget marketdataservlet"); treebranchstringbuilder tbsb = new treebranchstringbuilder(); request.setattribute("marketgrouplistjsonstring", tbsb.gettreebranchstring(mm.getallmarketgroups(), im.getallitems())); request.getrequestdispatcher("/marketdata.jsp").forward(request, response); } jsp/html: <div id="market_tree_branches"> </div> <div id="hidden"><%= request.getattribute("marketgrouplistjsonstring") %></div> javascript: var marketnitemsstring = $("#hidden").text(); console.log(marketnitemsstring) $('#market_tree_branches').jstr...

php - regex to also match accented characters -

i have following php code: $search = "foo bar que"; $search_string = str_replace(" ", "|", $search); $text = "this foo text qué , other accented characters."; $text = preg_replace("/$search_string/i", "<b>$0</b>", $text); echo $text; obviously, "que" not match "qué". how can change that? there way make preg_replace ignore accents? the characters have match (spanish): á,Á,é,É,í,Í,ó,Ó,ú,Ú,ñ,Ñ i don't want replace accented characters before applying regex, because characters in text should stay same: "this foo text qué , other accented characters." and not "this foo text que , other accented characters." $search = str_replace( ['a','e','i','o','u','ñ'], ['[aá]','[eé]','[ií]','[oó]','[uú]','[nñ]'], $search) this , same upper case compl...

java - Is it possible to perform separate network thread within a same activity without wait? -

i performing 2 class extending asynctask , both have different functions because of second class first class lagging. want know is, there better solution code in such way both of operation perform task without making other operation wait? updated code first call in oncreate() new connection().execute(); // some task performed same class called public class connection extends asynctask { @override protected object doinbackground(object... arg0) { //some operation return value; } @override protected void onpostexecute(object o) { super.onpostexecute(o); string m = string.valueof(o); if (o != null) { someoperation } else { edittxt.settextcolor(color.red); edittxt.settext("no internet connection"); } } } similarly performing other class have. you can use asynctask.executeonexecutor thread_pool_executor , default executor serial_executor . ...

android - How to sum a varchar column? -

i tried following code irrelevant values on display. noticed because of varchar column tx_amount. how change code sum varchar column? string[] columns = {vivzhelper.uid, helper.tx_name, "sum("+helper.tx_amount+") "+helper.tx_amount, helper.tx_date }; cursor c = db.query(vivzhelper.tx_table, columns, helper.tx_id + "='" + name + "' , " + helper.tx_date + " between '" + datefrom.from_date + "' , '" + dateto.to_date + " ' ",null,helper.tx_name, null, null); use cast select cast('1.11' decimal) source: http://www.sqlite.org/lang_expr.html#castexpr example: create table test (`id` int, `productname` varchar(7), `amount` varchar(10)) ; insert test (`id`, `productname`, `amount`) values (1, 'foo', '1.1'), (2, 'bar', '1.1'), (3, 'baz', '1.1') ; select sum(cast(amount decimal)) test ; on ca...

javascript - Render def file independently in dot.js -

i including header.def file in index.dot using {{#def.header}} snippet , rendering index.dot file using following snippet. var dotjs = require('dot'); var dots = dotjs.process({ path: "./views"}); app.get('/',function(request, response){ response.send(dots.index()); }); what wish render header on separate url. like: app.get('/header',function(request, response){ response.send(dots.header()); // header.def not compiled dot.header function }); maybe can create .def file (for instance "onlyhead.dot") , include static header in 1 without else. send onlyhead.dot in same way do. you use template engine doing this: in main app: /* template = dot*/ var dot = require("dot").process({ path: (__dirname + "/views") }); // view engine setup using .dot files app.engine('dot', function(template, options, cb){ return cb(null, dot[path.parse(template).name](options)); }); then in views can...

Display logs of a server in ruby on rails -

i making web portal. need show logs of server on portal. logs stored in .txt file. file keeps on updating new logs , need show in real time.i using ruby on rails. please help. a smoother option updating page use rails 4 live streaming functionality, keep connection open , send data comes in. details nicely outlined here: http://www.sitepoint.com/streaming-with-rails-4/ you want text box on page connect via ajax after page load, , write output live streaming controller action html arrives.

javascript - After sorting initially with time and listing_url, why cant I do the same again? -

below code sorts field time , listing_url problem once sorting time , unable sort listing_url . also once if sort listing_url , cant sort again. feel there problem sessions got no idea do. can add session delete o unset function code ? tia template.listitem.helpers({ entry :function() { var selector={}; var options={ sort:{} }; var sort_by_time = session.get('sort_by_time'); var sort_by_listing = session.get('sort_by_listing'); console.log('sort_by_time:', sort_by_time); console.log('sort_by_listing:',sort_by_listing); session.unset('sort_by_listing'); if (sort_by_time) { options.sort[sort_by_time] = -1; }; session.unset('sort_by_time'); if (sort_by_listing) { options.sort[sort_by_listing] = 1; }; console.log('selector:',selector); console.log('options',options); var facebookposts=facebookpost.find(selector,options); return facebookposts; session } }) @mark leiber figured...

How to call another member function when operator overloading (C++) -

how use member function (in case, magnitude() ) within definition function overload of greater operator > ? operator should compare magnitudes of 2 objects of class vector2d magnitude() member. receive following: error c2662: 'double vector2d::magnitude(void)' : cannot convert 'this' >pointer 'const vector2d' 'vector2d &' #include <iostream> #include <math.h> #include <string> using namespace std; //*************************** class definition *************************** class vector2d { public: double i, j; vector2d(); // default constructor vector2d(double, double); // constructor initializing double magnitude(); // compute , return magnitude bool operator> (const vector2d& right); // greater }; //function definition...

html - Pure css selector for next visible siblings -

i have multiple td in tr . of tds visible , of hidden. want remove border first visible td . know using jquery can achieved easily. need pure css selector solution this. used adjacent(+) sibling , siblings (~), nothing helped me. please suggest possible solution. eg. need style first visible element after element class='test' jquery: ( jsfiddle ) $(document).ready(function(){ $('td:hidden:first').next().css( "background-color", "green" ); }); :hidden jquery extension hidden columns. :first first hidden element. next() gets following sibling of each element in set of matched elements.

sql - How to select the TOP 1 record per group (Partition) -

i've got table called tblroutes holds unique list of , routes (f = from; t = to): | fcity | fstate | tcity | tstate | |========|========|========|========| |new york| ny | miami | ca | |houston | tx |new york| ny | ... and have table called tblcarrierrates lists bunch of tiers , rates offered carriers travelling routes: | fcity | fstate | tcity | tstate | tier | rate | carrid | carrname | |========|========|========|========|======|======|========|=============| |new york| ny | miami | ca | 2 | $2.99| abcd | abracadabra | |new york| ny | miami | ca | 1 | $3.00| bump | bumpy rides | |houston | tx |new york| ny | 2 | $4.00| slow |slow carriers| |houston | tx |new york| ny | 2 | $4.01| abcd | abracadabra | ... for each unique route listed in tblroutes i'm looking 1 "best" offered tblcarrierrates . the criteria "the best" lowest tier , followed lowest rate . the resu...

javascript - AngularJS - ng-show not working as intended -

i'm trying hide <a> tags, , show them when i'm logged in, using isloggedin() function, <a> tag showing no matter what. html (pool-details.html) <header class="hero-unit" id="banner" ng-include="'components/header/header.html'"></header> <div ng-include="'components/navbar/navbar.html'"></div> <div class="container"> <hr> <div class="col-md-3 left-col-3"> <div ng-include="'../components/sidebar/sidebar.html'"></div> </div> <div class="col-md-5"> <div class="details-pic"> <img class="pool-details-pic" ng-src="{{ pool.picture }}"/> </div> </div> <div class="col-md-4"> <h3 class="details-name">{{ pool.name }}</h3> <p class...

javascript - Can I set a link of a Page On back butten of browser or android Device? -

i working in mobile application using intel xdk.by default android device or browser button take previous one, instead need redirect page according given url.how cane using javascript or there other method in intel xdk? you need capture backbutton event button. can find more button here -> http://cordova.apache.org/docs/en/4.0.0/cordova_events_events.md.html#backbutton

How can I tell selenium to start firefox with certain commandline options? -

i'm using custom firefox binary selenium dependant on specific commandline parameters. how can tell selenium use these parameters when executing firefox binary? oops, seems there method: firefoxbinary.addcommandlineoptions() that's answer...

How to run multiple scripts from a script in python -

i have 3 python scripts, script1, script2 , script3 in folder. want run script2 , script3 using script1. how can this? in script1 need import script2 , script3: at top of script1: import script2 import script3 to run function script2 example: script2.function() you may need add blank file called __init__.py in same directory scripts, python can see directory library.

android - TCP Socket on JAVA - Any byte >= 128 is received as 65533 -

i implementing server on android , using: while (!thread.currentthread().isinterrupted()) { try { int r; string response = ""; while ((r = input.read()) > 0) { ... } ... } i have 2 issues. if client sends me byte of value 0, not received server. the second issue is, if byte value 128 or more, keep receiving value of 65533 or binary value of 11111101. anyone knows how solve these issues. beginner in networking on java. i having same issue , i've found answer in this question: you're dealing binary data should using raw stream - don't turn reader, meant reading characters. you're receiving 65533 because that's integer used "unicode replacement character" used when value can't represented real unicode character. exact behaviour of current code depend on default character encoding on system - again isn't should rely on. my failing code (simplified): input...

php - Read-only access for Gmail IMAP to connect -

i connected read-only access in github repo- aroundzoho . how can achieve it? $inbox = imap_open(email_hostname,email_username,email_password) or die('cannot connect gmail: ' . imap_last_error()); $date = date("d m y", strtotime ( "-1 days" )); $emails = imap_search($inbox, "since \"$date\"", se_uid);

statusbar - Android disable status bar interaction -

is there way, on android keep status bar while disabling interaction can it, pulling down? want keep information bar gives, don't want users interact it. this method use. can unwrap method , place inside base activity instead. iirc, got stackoverflow well, didn't make note of i'm not sure original post is. what place transparent overlay on top bar intercepts touch events. it's worked fine me far, see how works you. you may need put line in androidmanifest: <uses-permission android:name="android.permission.system_alert_window" /> i have in project, can't remember if it's because of or else. if permission error, add in. windowmanager manager; customviewgroup lockview; public void lock(activity activity) { //lock top notification bar manager = ((windowmanager) activity.getapplicationcontext() .getsystemservice(context.window_service)); windowmanager.layoutparams topblockparams = new windowmanager.lay...

Adjust the height of a Dialog with custom layout in Android -

Image
i have dialog custom layout, working fine, except there big empty spaces @ top cannot remove. any suggestion how can remove empty space. here code: final dialog dialog = new dialog(conferencedetailsactivity.this); dialog.setcontentview(r.layout.l_custom_dialog_name); final customedittext nametext = (customedittext) dialog.findviewbyid(r.id.confnamefld); nametext.settext(mconferencedetails.getconferencename()); button button = (button) dialog.findviewbyid(r.id.dialogbuttonok); button.setonclicklistener(new onclicklistener() { public void onclick(view v) { final customedittext nametext = (customedittext) dialog.findviewbyid(r.id.confnamefld); string text = nametext.gettext().tostring(); dialog.dismiss(); } }); dialog.show(); my xml layout: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent...

meteor - Why does route to home changes after rendering a template? -

i getting started using iron:router package. these project files: router-example.js if (meteor.isclient) { //some code } if (meteor.isserver) { //some code } router.route('/', function(){ this.render('home'); }); router.route('/hello', function(){ this.render('hello'); }); router.route('/items', function(){ this.render('items'); }); router.route('/serveritem', function(){ var req = this.request; var res = this.response; res.end('hello server\n'); }, {where: 'server'}); router-example.html <body> <h1>welcome meteor!</h1> <ol> <li><a href="{{pathfor '/'}}">this routing doesn't work</a></li> <li><a href="{{pathfor 'hello'}}">hello template</a></li> <li><a href="{{pathfo...

css - set value for text shadow property using DOM in javascript -

i want give value text-shadow properties 1 one using dom in javascript. text-shadow: h-shadow v-shadow blur-radius color|none|initial|inherit; if(conf.hasownproperty('vshadow')) document.getelementbyid('p1').style.text.hshadow = 5px; if(conf.hasownproperty('hshadow')) document.getelementbyid('p1').style.text.vshadow = 5px; if(conf.hasownproperty('blurradius')) document.getelementbyid('p1').style.text.blurradius = 5px; if(conf.hasownproperty('shadowcolor')) document.getelementbyid('p1').style.text.color = red; i tried above code.but not work. there way using dom in javascript i dont know if dom objects hshadow, vshadow, blurradius exist correct code should document.getelementbyid('p').style.textshadow = "5px 5px 5px red"

cron - tell php to create a new object at certain moments in time, Cronjobs? -

i’m trying create application current knowledge prevents me building it, hope can me! scenario i’m creating sort of dairy application. moment user presses start button object created, user can later edit filling in report. now user allowed write 1 report every day, new object has added database @ 0:00 am, again can fill in. question how can tell php create new object @ moments in time? i thinking of doing this: a page shows when no objects created far. new object created when button “start journey pressed”. a page adds object when time 0:00 (*using cronjobs?) a page displays created days , allows user edit them. *so far solution i’ve found use cronjobs, i’m not familiar these. cronjobs right way go me , how can use them (i’m testing code on mamp)? or possible there solely php, , how? all appreciated! lvroy could possible (with restriction) generate object @ daily first use ? when user access panel, check there object (or not) day , if not create ob...

css - Sass: Extending nested selectors -

(i think should mention this, i've started using sass/scss) http://jsfiddle.net/driftingsteps/t6klncfm/ you can see how <strong> inheriting properties of global <a> properties nested <a> tag. a { color: #09f; text-decoration: none; &:hover { text-decoration: underline; opacity: 0.6; } } ul { font-size: 0.85em; { font-family: georgia, times, serif; font-style: italic; color: #0a3; } strong { @extend a; } } i have been going through http://sass-lang.com/ , know i'm missing something. doing wrong? there way inherit properties nested <a> only, without use of classes on either ul a , ul strong ? or there better way this? you use extend-only selector ( % ), , extend both ul a , ul strong that: a { color: #09f; text-decoration: none; &:hover { text-decoration: underline; opacity: 0.6; } } ul { font-siz...

imagemagick - Does anyone know how to convert to little endian .pfm file from ImageMagic? -

i'm looking method convert little endian.pfm file imagemagick. as know can pfm file this. convert input.bmp output.pfm this output file made big endian. want convert little endian. so there method convert little endian big endian on imagemagick? thanks endian can controlled -endian option. example. create 2x2 red pfm image little endian, , write hexdump . $ convert -size 2x2 xc:red -endian lsb pfm:- | hexdump 0000000 50 46 0a 32 20 32 0a 2d 31 2e 30 0a 00 00 80 3f 0000010 00 00 00 00 00 00 00 00 00 00 80 3f 00 00 00 00 0000020 00 00 00 00 00 00 80 3f 00 00 00 00 00 00 00 00 0000030 00 00 80 3f 00 00 00 00 00 00 00 00 000003c you can confirm little endian translating header. 50 46 0a 32 20 32 0a 2d 31 2e 30 0a 00 00 80 3f | | | | little endian -------| "-1.0" | | lsm data| repeat above big endian. $ convert -size 2x2 xc:red -endian msb pfm:- | hexdump 0000000 50 46 0a 32 20 32 0a ...

mysql - ckeditor storing datas php -

it's new me use richtext user has able insert pictures or change text. i'm using ckeditor i've trouble it. when user write rich text can write things using apostrophe , comas. i'll use example. let's imagine want write : it's quite difficult open picture, file blablabla the problem in inserting query looks insert tab (txt1,txt2) values ('value1','value2') if user uses comas or apostrophe richtext cannot correctly inserted. moreover, use longtext in mysql database store text. my questions : how store richtext written user what type should column in mysql database correctly store richtext able give back the problem have erreur sql !insert detail_article(id,problem,num,url,solving,description) values(16,'chrome : clearing datas',4,'',' \r\nchrome cache clearing : \r\n\r\n blablabala \r\n\r\n in 'windows explorer', fallowing statment....blablabla \r\n','...

html - Best way to extend a container in full screen -

i have researched bit , saw many examples how developers use technique full screen container , used are: .container { position: absolute; top: 0; right: 0; bottom: 0; left: 0; } and html, body{ height: 100%; margin: 0; } .container { min-height: 100%; margin: 0; } these used methods extend div in full screen when container child of body. if ask me, method using absolute position not idea because if put other elements inside can not relate because have absolute position. the method using html , body 100% seems little bit rudimentary. so, best way extend container?

java - MongoDB BSON size exceeded even when using GridFS -

i seeing error while saving documents in gridfs (mongodb version: 2.4.9) 2015-05-15 10:19:15,409 error [stderr] com.mongodb.mongointernalexception: dbobject of size 160038724 on max bson size 16777216 2015-05-15 10:19:15,409 error [stderr] @ com.mongodb.outmessage.putobject(outmessage.java:291) 2015-05-15 10:19:15,410 error [stderr] @ com.mongodb.outmessage.writeupdate(outmessage.java:175) 2015-05-15 10:19:15,410 error [stderr] @ com.mongodb.outmessage.update(outmessage.java:62) 2015-05-15 10:19:15,410 error [stderr] @ com.mongodb.dbapilayer$mycollection.update(dbapilayer.java:326) 2015-05-15 10:19:15,410 error [stderr] @ com.mongodb.dbcollection.update(dbcollection.java:160) 2015-05-15 10:19:15,410 error [stderr] @ com.mongodb.dbcollection.save(dbcollection.java:800) 2015-05-15 10:19:15,410 error [stderr] @ com.mongodb.dbcollection.save(dbcollection.java:768) 2015-05-15 10:19:15,410 error [stderr] @ com.mongodb.gridfs.gridfsfile.save(gridfsfile.java:54) 2015-05-15 10:19:...

pcap - How to get IP address from ICMP packets using jnetpcap -

i using jnetpcap analyze pcap files. know how addresses when encounter ip header if(packet.hasheader(ip)&&packet.hasheader(tcp)&&tcp.flags_syn()) { sip = packet.getheader(ip).source(); sourceip = org.jnetpcap.packet.format.formatutils.ip(sip); but don't know how address when have icmp header. tried this else if(packet.hasheader(icmp)) { sip=packet.getheader(icmp).source(); sourceip = org.jnetpcap.packet.format.formatutils.ip(sip); but apparently, isn't valid. ideas? thank in advance update: used if(packet.hasheader(ip, 1)) { sip=ip.source(); sourceip = org.jnetpcap.packet.format.formatutils.ip(sip);} but got error: exception in thread "main" java.lang.nullpointerexception @ diplomatiki.ex2.main(ex2.java:83) line 83 contains command: sip=packet.getheader(ip,1).source(); i tried hit mark's advice, , added system.out.println(packet.getstate().todebugstring()); ...

Unicode code to text SQL Server 2008 -

i have problem uinsg sql server 2008. i need write query selection , join of several tables. it's ok. 32000 rows. but there tables columns (logins , on) contain cells numbers 0041007600750074006f0076005200590073 or 00420072007500330065006e0073006b006100790062 , not text want be. it's unicode coded text. online converter converts text. the question how can decode these numbers in query text result. abcd.. instead of 0041007600750074006f0076005200590073 you might use convert decode string example: select convert(nvarchar, convert(varbinary, '0x' + '420072007500330065006e0073006b006100790062', 1)) remark: did remove first zero's of string...

python - How can I tidy up my install script keeping only what is used? -

we use pip installations , want clean packages used installed. acceptable strategy scan python files in python project using pycharm , removing packages have no used imports or possibly go wrong delete installation used? my install script following. --find-links=http://pypi.sys.kth.se/local/ # git support setuptools setuptools-git==1.0 django==1.6.2 django-autoslug==1.6.1 django-cas==kth-2.0.3 beautifulsoup==3.2.1 south==0.8.4 pillow==2.3.0 pysolr==2.0.15 django-haystack==1.2.7 django-pagination==1.0.7 whoosh==2.4.1 markdown2==2.1.0 suds==0.4 python-dateutil<2.0 # timezone information pytz<=2013d django-plainpasswordhasher==0.3 # infrastructure python-memcached==1.53 pymongo==2.7.1 # need this.. mysql-python==1.2.3c1 # icalendar support (deprecated , slow!) vobject==0.8.1c # icalendar support icalendar==3.5 # sane advanced http client (need support file upload etc) requests==1.2.1 # async task handling (for using simple db backend) # note imples amqplib, anyjso...

html - Dynamic properties name in PHP -

there object in php named $item , , in object have properties of title , title_cn, title_tw and create function auto generate properties based on language, coding this: <?= $item->title . set_lang(); ?> and function: function set_lang() { $ci =& get_instance(); $lang = $ci->session->userdata('site_lang'); if ($lang == "english") { return ""; } else if ($lang == "zh_tw") { return "_tw"; } else if ($lang == "zh_cn") { return "_cn"; } } however, name not generated correctly, $item->title append string of lang code, e.g. my title 1234_tw, titleabc_cn etc... how dynamic generate properties ? fo helping you should first concatenate $item->title onto set_lang() , place in variable. you can use variable call right property on obj. example $itemlangtitle = $item->title . set_lang(); echo $item->$itemlangtitle ...

asp.net mvc - Requesting to controller throws 500 Internal error when deployed to azure -

Image
i deploying web service on azure . in azure , have mysql db , have fed connection string web.config file. working fine in local environment. when deploy azure , controller don't work. here screenshots of local , remote working scenarios. have traced remote log file of request in screenshot. here log file of error (500) while surfing through internet, came across lot of solutions using identity, change authorization none , on. confused right been 2 days , still stuck in it. right guidance highly appreciated. i have found solution problem. problem simple. added reference of mysql.data.dll in project, forgot add inside bin folder (by checking copylocal= true ). after updated web.config file adding these markups in <system.web></system.web> tags. <dbproviderfactories> <remove invariant="mysql.data.mysqlclient" /> <add name="mysql data provider" invariant="mysql.data.mysqlclient" description=...

php - How can I call a function with a dynamic amount of arguments? -

i have array , need pass each element of array parameters function. say: $var = array("var2","var3","var4"); //pass each element new parameter function call_to_function ($var2, $var3, $var4); //however, if number of array element change can $var = array("var2","var3"); call_to_function ($var2,$var3); the problem here is, how build dynamic number of parameters , call function. use: php function mysqli_stmt::bind_param , takes multiple parameters. , need derive parameters arrray. is there way it? this should work you: first need create array references corresponding variables. can foreach loop below: foreach($var $v) { $bindvalues[] = &$$v; } after can use call_user_func_array() call function bind variables. here depends if use procedural or oop style: procedural: call_user_func_array("mysqli_stmt_bind_param", array_merge([$stmt, $types], $bindvalues)); oop: call_user_func_arr...

How to add custom cookies in browsermob proxy on java -

i writing automation test , capture network call made in background, using browsermob-proxy. in browsermob-proxy, want set cookie before making requests. how can it? below code:- string strfilepath = "data.har"; // start proxy proxyserver server = new proxyserver(4444); server.start(); server.setcaptureheaders(true); server.setcapturecontent(true); // selenium proxy object proxy proxy = server.seleniumproxy(); firefoxprofile profile = new firefoxprofile(); string useragent = "mozilla/5.0 (iphone; u; cpu iphone os 4_3_2 mac os x; en-us) applewebkit/533.17.9 (khtml, gecko) version/5.0.2 mobileweb/8h7 safari/6533.18.5"; profile.setpreference("general.useragent.override", useragent); // configure desired capability desiredcapabilities capabilities = desiredcapabilities.firefox(); capabilities.setcapability(capabilitytype.proxy, proxy); ...

angularjs - multiple nested views with their own router -

i building angular app nested views using ui-router. app has list of posts, each own nav menu change post's view. to simplify context, lets each nav menu can change theme of post attached to. post 1 content [light theme button] [dark theme button] -------------------------------------------- post 2 content [light theme button] [dark theme button] -------------------------------------------- * * * the problem facing when press button on 1 post's nav menu, posts change. want nav menu each post effect respective post. i total beginner angular , questions are: is problem want solve ui-router? (do want have router each post?) if is, how solve it? if not, can point me in right direction? any appreciated, whether link, explanation, code or comment. ps. in reality not changing theme, changing content on post completely. in future want implement more 2 options menu op...