Posts

Showing posts from June, 2015

c++ - How to move elements in doubly linked list? -

Image
i have custom list (doubly linked list , not std::list) implemented in code. requirement move element 1 left or right updating references. possible? class elem { elem *next; elem *prev; } ....... void move_element_left(elem *e) { if(e->prev()==null) return; //left ... return elem *left = e->prev(); left->next() = e->next(); e->prev() = left->prev(); if (left->next()) left->next()->prev() = left; if (e->prev()) e->prev()->next() = e; e->next() = left; left->prev() = e; } ....... int main() { elemlist ls; ... ... move_element_left(e); //e of type elem * ... } above code works except 2nd object in list want move left (or top most). (i.e. if list(obj5, obj9, obj11, obj12,..), moving obj9 first in list gives error) works designed ? following code in schema, shows works designed: void move_element_left(elem *e) { if(e-...

java - (SOLVED) WEKA API LibSVM ClassPath not found -

im trying use libsvm weka api. my system: win7 weka 3.7.12 libsvm 1.0.6 (installed via package manager) my code: import java.io.file; import java.util.random; import javax.swing.joptionpane; import weka.classifiers.evaluation; import weka.classifiers.functions.libsvm; import weka.core.instances; import weka.core.converters.converterutils.datasource; public class libsvmclassifier { // method build svm classifier given data file public static double buildmodel(file dataset){ // new instance of libsvm libsvm clssvm = new libsvm(); try { instances data = datasource.read(dataset.getabsolutepath()); // sets label feature data.setclassindex(data.numattributes()-1); string opts = "-s 0 -k 0 -d 3 -g 0.0 -r 0.0 -n 0.5 -m 40.0 -c 1.0 -e 0.0010 -p 0.1"; // set options algorithm clssvm.setoptions(weka.core.utils.splitoptions(opts)); evaluation eval = new evaluation(data); eval.crossvalidatem...

Laravel 5 : passing a Model parameter to the middleware -

i pass model parameter middleware. according link (laravel 5 middleware parameters) , can include parameter in handle() function : public function handle($request, closure $next, $model) { //perform actions } how pass in constructor of controller? isn't working : public function __construct(){ $model = new model(); $this->middleware('mycustommw', $model); } **note : ** important pass different models (ex. modelx, modely, modelz) first of make sure you're using laravel 5.1. middleware parameters weren't available in prior versions. now don't believe can pass instantiated object parameter middleware, (if need this) can pass model's class name , i.e. primary key if need specific instance. in middleware: public function handle($request, closure $next, $model, $id) { // instantiate model off of ioc , find specific 1 id $model = app($model)->find($id); // whatever need model return $next($request); }...

maven - Run testng methods across different tests in parallel -

i have more 1 test tags in testng.xml file running using maven. have set parallel attribute @ suite level methods , thread-count 5. problem facing tests executed sequentially , methods inside test cases executed in parallel. more clear, though there unused threads(selenium nodes in grid in case) available subsequent tests waits till methods in previous test executed. here testng.xml have used, <suite name="suite1" verbose="1" parallel="methods" thread-count="5" preserve-order="false"> <test name="login" > <classes> <class name="testsuite.testset1" /> </classes> </test> <test name="product search"> <classes> <class name="testsuite.testset2"/> </classes> </test> </suite> as have more 10 nodes available in selenium grid, behavior increases execution time considerably , defeats ...

Prevent injection attack form Redcarpet gem in rails -

i have text area allows user type in description of cars. it saved :text , when called, render via applicationhelper below: module applicationhelper def markdown(text) renderer = redcarpet::render::html @engine = redcarpet::markdown.new(renderer, hard_wrap: true, filter_html: true, autolink: true, no_intra_emphasis: true ) @engine.render(text) end end being paranoia, tried typing in in textarea. markdown. __nice.__ <%= @car %> <script> alert('damn'); </script> while <%= @car %> did not parse in ruby code, script indeed executed. in view: <%= markdown(@car.description).html_safe %> i wonder if right way handling redcarpet; mechanism prone attack, , how can prevent it? best

c# - Load rtf in bindable RichTexBox mvvm wpf -

i'm new mvvm , load rtf file in richtextbox using mvvm, text doesn't seem display in richtextbox. looks richtextbox pretty complex deal when trying place commands in viewmodel. i'm not sure go wrong. viewmodel flowdocument _script; public flowdocument script { { return _script; } set { _script = value; raisepropertychanged("script"); } } . . . private void loadscript() { openfile.initialdirectory = "c:\\"; if (openfile.showdialog() == true) { string originalfilename = system.io.path.getfullpath(openfile.filename); if (openfile.checkfileexists) { script = new flowdocument(); textrange range = new textrange(script.contentstart, script.contentend); filestream fstream = new filestream(originalfilename, system.io.filemode.openorcreate); range.load(fstream, dataformats.rtf); fstrea...

vb.net - WP10 TP Unable to get License Information 0xC03F7000 -

i'm testing in-app purchases on wp8.1 app as-is on win 10 tech preview (tried on device emulator same result) , facing following error while trying license information. exception: system.exception: exception hresult: 0xc03f7000 @ windows.applicationmodel.store.currentapp.get_licenseinformation() @ app.onlaunched(launchactivatedeventargs e) code: dim olicense licenseinformation olicense = currentapp.licenseinformation this working fine on wp8.1. when tried currentappsimulator .licenseinformation , different error. system.io.directorynotfoundexception: system cannot find path specified. (exception hresult: 0x80070003) @ windows.applicationmodel.store.currentappsimulator.get_licenseinformation() any help/pointer appreciated. this has been resolved release of windows 10. platform issue while in technical preview stage.

ios - UITableView with UITableViewCell containing UIImageView -

okay, able scroll outside borders of uiimageviews, need able scroll on top of views. uiimageview contains pan gestures, pinch gestures, , unsure if causing error. paste cell code below: func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { imageindex = indexpath.row var cell : xpanddraggablecell = tableview.dequeuereusablecellwithidentifier("xpanddraggablecell", forindexpath: indexpath) as! xpanddraggablecell cell.imgview.backgroundcolor = uicolor(red: 210, green: 211, blue: 213, alpha: 1.0) if (horizontal) { defaultx = defaultspacingx * imageindex; /* e.g 70 * 2 = 140 origin x. */ }else{ defaulty = defaultspacingy * imageindex; /* e.g 70 * 2 = 140 origin y. */ } cell.imgview.frame = cgrect(x: cell.imgview.frame.origin.x, y: cell.imgview.frame.origin.y, width: 75.0, height: 75.0) var cellwidth : cgfloat = cell.contentview.frame.width var cellheight : cgfloat = ...

asp.net - Why @Html.AntiForgeryToken() returns null? -

i have configured web asp.net mvc app in iis on our server. after app starts exception occurs such below: object reference not set instance of object. line 10: { line 11: <div class="form-horizontal"> line 12: @html.antiforgerytoken() <-- here i've checked machinekey (in web.config) of app in iis : <machinekey decryptionkey="autogenerate,isolateapps" validation="sha1" validationkey="autogenerate,isolateapps" /> i can't figure out problem! update: also, checked session,but it's not null. got session.sessionid in razor , got valid value ( hutqqygxwbvvwaerztvamf1n ).

oracle11g - Connecting Oracle to Microsoft SQL Server on 2 different servers -

i trying make connection between oracle , sql server insert values oracle sql server. have 2 questions hoping can help. there stored procedure created in oracle 11g database. joins few tables , pushes values table called my_table in sql server. the issue/question have: i've tried make connection between oracle , sql server using link: making connection oracle sql server - page 2 — databasejournal.com the instruction when oracle , sql server on same server. as case oracle on 1 server , sql server on another, struggling understand concept of setting listener , tbs. do have configuration on sql server? need create dns on sql server? when create dns in oracle server, connection sql server successful (port 1433) i'm not sure how alter listener , tns that. my oracle knowledge not advanced far i've managed point. hope can me resolve last bit of puzzle.

python - module not found (conditional imports) with py2app -

i have little problem py2app when build app, have error modules not found (conditional imports): * image (/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/py2app-0.9-py3.4.egg/py2app/recipes/pil/prescript.py) * java (platform) * java.lang (platform) i guess path problem python 3, i'm not sure ty help i guess build app this: python3 setup.py myapp and using py2app 0.9? if trying python3 setup.py myapp -a does work? using aliases seems work in cases, doesn't if want deploy app other machines. instead, explicitly tell py2app include packages: python3 setup.py myapp --packages=pil this include pil or pillow module. should work other modules, too.

asp.net - Connectionstring of netezza with .net framework VS 2013 -

i saw connectionstring of netezza odbc .net framework , make me confude example: driver={any odbc driver's name};odbckey1=somevalue;odbckey2=somevalue; please me explain what's odbc driver's name what's somevalue in odbckey1 , odbckey2 the detail of server information following data source=10.209.46.210:5480;user id=kbanke2e;password=1234;initial catalog=edw when connecting netezza in .net use instead "driver=netezzasql; server=10.209.46.210; port=5480; database=edw; persist security info=true; uid=kbanke2e; pwd=1234"

php - Symfony and PHPUnit: Exception thrown but not intercepted by setExpectedException -

i wrote test controller saves in database data passed form. i wrote following test method sure if form empty exception thrown: public function testregisternewmerchantexceptionnodatasubmitted() { $client = static::createclient(); $crawler = $client->request('get', '/getstarted'); $form = $crawler->selectbutton('getstarted[submit]')->form(); $form['getstarted[email]'] = ''; $this->setexpectedexception('domainexception'); $client->submit($form); $this->assertequals(500, $client->getresponse()->getstatuscode()); //dump($client->getresponse());die; } the method i'm testing following: public function endaction(request $request) { $form = $this->createform(new getstartedtype()); $form->handlerequest($request); if ($form->isvalid()) { // data form $data = $form->getdata(); } else { throw new \domainexception('n...

ember.js - How to stop Ember.Handlebars.Utils.escapeExpression escaping apostrophes -

i'm new ember, i'm on v1.12 , struggling following problem. i'm making template helper the helper takes bodies of tweets , html anchors around hashtags , usernames. the paradigm i'm following is: use ember.handlebars.utils.escapeexpression(value); escape input text do logic use ember.handlebars.safestring(value); however, 1. seems escape apostrophes. means sentences pass escaped characters. how can avoid whilst making sure i'm not introducing potential vulnerabilities? edit: example code export default ember.handlebars.makeboundhelper(function(value){ // make sure we're safe kids. value = ember.handlebars.utils.escapeexpression(value); value = addurls(value); return new ember.handlebars.safestring(value); }); where addurls is function uses regex find , replace hashtags or usernames. example, if given #emberjs foo return <a href="blah">#emberjs</a> foo . the result of above helper function displayed in em...

do not let git merge delete a file -

say have branch , b. in there file being deleted. being merged b , want have existing in b after merge. easiest way this? if (for whatever reason) --no-commit really isn't working you, go ahead , merge. then, git checkout head~ path/to/file . then, commit --amend . amend merge commit have deleted file in branch b before merge.

c# - Generate const strings at compile time for switch cases -

we have in legacy code base on .net 4.5 (important) static class defines many const string values of object types (means values of x.gettype().tostring() ) usage in switch statements. this bad because refactorings break switch statements , places used vast can't change it. know other solutions if write now, but: is there way - without changes switch statements - define const strings of types pickup compile time type since have information need @ compile time. i know switch statements compiled @ compile time lookup table , not evaluate expression in cases, there way define const value once @ compile time? thing can think of dynamically generate code before build. there other solution? c# 6 introducing feature solve exact problem, the nameof expression . using system; public class program { public static void main() { test(new foo()); test(new bar()); } private static void test(object x) { switch(x.gettype().tostring...

svn - What's the meaning of git's snapshot of a file? -

Image
i'm reading git basics git thinks of data more set of snapshots of miniature filesystem i not understanding meaning of snapshot of git. git store entire file content in each snapshot/version? example, version 1 #include <stdio.h> int main() { printf("hello, world"); return 0; } in version 2 added line file. #include <stdio.h> int main() { printf("hello, world"); printf("hello, git"); return 0; } will git store entire content rather store difference( printf("hello, git") ) between these 2 versions svn etc? if is, what's point? will git store entire content rather store difference(printf("hello, git")) between these 2 versions svn etc? git stores the entire contents of file . takes no space when file didn't change. read brilliant answer git pack file format: are git's pack files deltas rather snapshots? about sha1 files (and o...

c# - IGenericRepository<T> - Cannot resolve symbol where -

i'm following tutorial on unit of work pattern , code won't compile because doesn't recognise in interface signature , doesn't recognise type t. using system; using system.collections.generic; using system.linq; using system.linq.expressions; using system.text; using system.threading.tasks; namespace datalayer.repository { public interface igenericrepository<t> : t : class { iqueryable<t> asqueryable(); ienumerable<t> getall(); ienumerable<t> find(expression<func<t, bool>> predicate); t single(expression<func<t, bool>> predicate); t singleordefault(expression<func<t, bool>> predicate); t first(expression<func<t, bool>> predicate); t getbyid(int id); void add(t entity); void delete(t entity); void attach(t entity); } } can see i'm missing? please remove : , this: public interface igenericrepository<t> t : class

Accessing parent level using Data::Visitor::Callback (Perl) -

this long-shot, there perl developers out there know data::visitor::callback? i have complex data structure traversing. each time find hash has 'total' key, need build url. have of data need create these urls of data comes higher in structure. i don't think can access levels above , makes impossible build urls. realised needed data higher structure. if can't make data::visitor::callback work me, means rolling own traversal code - pain. data traversing converted following json (the "count" keys renamed "total" part of conversion process): [ { "field": "field_name", "value": "a", "count": 647, "pivot": [ { "field": "field_name", "value": "b", "count": 618, "pivot": [ ...

Windows python multiprocessing - need to pass shared variable to worker -

according this: python multiprocess diff between windows , linux unlike unix, global variables need explicitly propogated. hence, hoping send multiprocessing queue in updated, seems give pickling errors: global level_data_global, max_level_global, items_global, count_global, domain_global, items_global, count_global, max_level_global, mulitprocess_global, queue_global # threadpool if mulitprocess_global: pool = pool(processes=mp.cpu_count()) in range(0,mulitprocess_global): pool.apply_async(worker, args=(str(i),queue_global)) on windows, passing in queue_global variable causes pickling error. there no other way workers access shared resource if not. globals don't work in windows

node.js - Broadcasting event error in Laravel 5.1 using Redis -

i've started use laravel 5.1 , pretty awesome, wanted play around new 'broadcasting event' feature using nodejs server , redis driver following guide here: http://blog.nedex.io/laravel-5-1-broadcasting-events-using-redis-driver-socket-io/ . when fire event implements shouldbroadcast interface receive error: "error while reading line server. [tcp://127.0.0.1:4365]" 4365 - port server running on (listening in port). have idea why happend? i tried use redis directly: $redis = redis::connection(); $redis->publish('test-channel', 'msg'); got same result, "error while reading line server. [tcp://127.0.0.1:4365]". socket.js: var app = require('express')(); var http = require('http').server(app); var io = require('socket.io')(http); var redis = require('ioredis'); var redis = new redis(); redis.subscribe('test-channel', function(err, count) { }); redis.on('message', function(ch...

python built in reducebykey -

is there built-in reducebykey functionality in python? if not, how can imitate functionality? for example, if i'm doing simple word count: >>> x=[('a', 1), ('a', 1), ('b', 1), ('c', 1)] >>> reduce(lambda a,b:a+b, x) ('a', 1, 'a', 1, 'b', 1, 'c', 1) what wanted have return [('a',2), ('b',1), ('c',1)]. reduce() function ended iterating through tuples together, , didn't combine keys. way around this? you can use ordereddict . preserve order also. from collections import ordereddict result = ordereddict() item in x: result[item[0]] = result.get(item[0], 0) + item[1] result [('a', 2), ('b', 1), ('c', 1)] here, iterating on dictionary. key item[0] in result ordereddict. if found, add item[1] 1 in our case value present there. else, take default value 0 , add item[1] (this happen when element encountered first time). ...

How to fasten up MATLAB function 'mscohere' -

is there hack how fasten matlab funcion mscohere? i'm computing coherence between each 2 of 26 large vectors. takes lots of time. i'm using piece of code every pair of vectors. coherencematrix{i,j} = mscohere(double(data.ch(indexes(i)).data),double(data.ch(indexes(j)).data),window,noverlap) ; i don't know hack improve mscohere, if need multiple calls mscohere, parallel computing toolbox speed process. following code runs 2.5x faster (4.7 s vs 11.8s) when use 4 workers parfor vs regular for loop: rng default r = randn(16384,26); h = fir1(30,0.2,rectwin(31)); h1 = ones(1,10)/sqrt(10); tic cxy_outer=cell(size(r,2),1); parfor =1:size(r,2) cxy_inner=cell(size(r,2),1); j= 1:size(r,2) if i<j x=filter(h1,1,r(:,i)); y=filter(h,1,filter(h1,1,r(:,j))); cxy_inner{j}=mscohere(x,y,hanning(1024),512,1024); end end cxy_outer{i}=cxy_inner; end toc edit: save output results, parfor has rules on ho...

jquery - Can't access data access layer on a wcf web service -

i calling web service using jquery ajax. getting internal server error. [webget(responseformat=webmessageformat.json)] [operationcontract] public list<brandmodel> dowork(int brandid) { // here receive generic list of brandmodel calling static method fillmodels. list<brandmodel> models = da.supportdata.fillmodels(brandid); return models; } i've tried omit statement calling data access layer , return generic list created within dowork method , worked.

javascript - Autocomplete Codeigniter with modal bootstrap not work -

i don't know why , how solve problem. i'm using codeigniter, , want create autocomplete form on modal bootstrap. first, let me show model. function getbarangajax($keyword){ $this->db->order_by('barang_id', 'desc'); $this->db->like('barang_kode', $keyword); return $this->db->get('barang')->result_array(); } this controller. public function getkodebarangajax(){ $keyword = $this->input->post('keyword'); $data = $this->model_app->getbarangajax($keyword); echo json_encode($data); } this view of modal. <div class="modal fade" id="modaladdtransaction" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button ...

Use a PHP file to Symfony -

i have php file connected elasticsearch, indexing documents. my elasticindex.php file: **class elasticindex{ function elasticfun(){ require 'vendor/autoload.php'; $client = new elasticsearch\client(); $feed = 'http://blaasd.zasdp.tv/xml'; $xml = simplexml_load_file($feed); foreach ($xml-> ....... ......}** now problem working on symfony framework, in beginning of php file have address namespace, like: **namespace mybundle\controller** that why unable use following 2 lines in controller class: require 'vendor/autoload.php'; $client = new elasticsearch\client(); so have created new php file (elasticindex.php)and writen code elasticsearch indexing. how can call function elasticfun() elasticindex class controller class. not using namespace in elasticindex class, not address anywhere in symfony project. how can call elasticfun() function not addressed anywhere controller class? i have try use global namesp...

Reading and printing strings in C -

i want scan , print 2 strings 1 after in loop.but cannot it.only 1 string gets scanned , printed if use loop.if try print without loop 2 "gets()" work properly. #include <stdio.h> int main() { int t,i,j; char name1[100]; char name2[100]; scanf("%d",&t); for(i=0; i<t; i++) { printf("case %d: ",i+1); //scanf("%[^\n]s",name1); gets(name1); /*for(j=0; j<strlen(name1); j++) { printf("%c",name1[j]); }*/ puts(name1); //scanf("%[^\n]s",name2); gets(name2); /*for(j=0; j<strlen(name2); j++) { printf("%c",name2[j]); }*/ puts(name2); } } here go. use fflush(stdin) . take 2 inputs , print them 1 after another. #include<stdio.h> int main() { int t,i,j; char name1[100]; char name2[100]; scanf("%d",&t); for(i=0; i<t; i++) { printf("case %d: ",i+1); fflush(stdin); gets(name1); ...

authentication - Icecast different logins for same mountpoint -

hello stackoverflow users, have icecast 2 server few mountpoints. now have 1 mountpoint guests. every guest has same user:pass login, whitch set in icecast config. is possible create new user:pass login guest @ runtime? think mysql database possible, found nothing icecast. here little example. guest ask me, if stream session on icecast stream. create new user:pass guest mountpoint, send credentials guest , can stream. don't need restart hole icecast server make new user:pass combi work. offload source authentication authentication back-end of choice. relevant documentation: http://icecast.org/docs/icecast-2.4.1/auth.html#source-auth also note don't need restart icecast configuration changes take effect. simple sighup make reread , apply configuration. (not supported on windows until 2.5 gets released)

c# - Deadlock when calling async methods on Windows Phone 8 -

my problem following: on ui thread have button event, call service method: private async void refreshobjectsbutton_click(object sender, eventargs e) { var objectservice = new objectservice(); var objects = await objectservice.getobjects(userinfo.token); } the service method is: public class objectservice : serviceclientbase, iobjectservice { public async task<observablecollection<objectviewmodel>> getobjects(string token) { var response = await getasync<observablecollection<hookviewmodel>>("uri_address", token); return response; } } and getasync method implemented in serviceclientbase: public async task<t> getasync<t>(string uri, string token) { using (var client = createclient()) { try { httpresponsemessage response = new httpresponsemessage(); response = await client.getasync(uri); t retval = default(t); if (response...

ruby on rails 3 - Hide label in certain resolution with simple_form -

Image
i have wrapper in simple_forms config.wrappers :styled_horizontal_boolean3, tag: 'div', class: 'form-group', error_class: 'has-error' |b| b.use :html5 b.optional :readonly b.use :label, class: 'hidden-sm hidden-xs col-md-3 control-label' b.wrapper tag: 'div', class: 'col-md-9 checkbox-margin' |wr| wr.wrapper tag: 'div', class: 'styled checkbox' |ba| ba.use :label_span_input, class: 'col-md-9', span_class: 'left' end wr.use :error, wrap_with: { tag: 'span', class: 'help-block' } wr.use :hint, wrap_with: { tag: 'span', class: 'help-block' } end end this hide control-label @ lower resolutions, great, see screenshot: but need find way hide label of checkbox @ larger resolutions, otherwise it's rendered twice, see screenshot: edit: html generated simple_form <label class="boolean optional checkbox" for="tim...

omnet++ - Calculating end-to-end delay for SimpleServerApp in Veins-LTE -

i'm trying calculate end-to-end delay simpleserverapp in veins-lte , i'm unable results, when open result file statistics related delay 0 or nan. i looked in tic-toc tutorial , tried that, way didn't statistics: on module: delayvector.record(delay); delayhist.collect(delay); and when calling finish(): delayhist.recordas("delayfinish"); where simtime_t delay; coutvector delayvector; clonghistogram delayhist; then tried copy procedure other statistic recording, think can't used in case, because want send long: on ned file: @signal[delay](type="long"); @statistic[delay](title="delay"; source="delay"; record=vector, stats, histogram); on module: emit(delay,delay); //where first delay signal , second one, value. that's calculate delay: on sending module: msg->setsendingtime(); on receiving module: simtime_t delay = simtime() - msg->getsendingtime(); i'd appreciate help! ...

Jquery DataTable date filter not working in client side -

i using jquery datatable in mvc application. want filter data in datatable using date-range. when page loads getting data db. need implement date range filter in 1 column of datatable in client side. have tried below coding date not getting filtered. html table: <table border="0" cellspacing="5" cellpadding="5"> <tbody> <tr> <td>from date:</td> <td><input type="text" id="min" name="min"></td> </tr> <tr> <td>to date:</td> <td><input type="text" id="max" name="max"></td> </tr> </tbody> </table> <table id="billing"> <thead> <tr> <th>select</th> <th>company name</th> <th>amount</th> ...

email - fopen multiple files to send mail with mail() php -

i have problems send mail multiple files mail() php. until now, send first file, need please. give code: html: <form action="colabora.php" method="post" enctype="multipart/form-data"> [...] <div id="adjuntos"> <input type="file" name="archivos[]" class="form-control"/> </div> [...] php: [...] if (isset ($_files["archivos"])) { $tot = count($_files["archivos"]["name"]); ($i = 0; $i < $tot; $i++){ $_name=$_files["archivos"]["name"][$i]; $_type=$_files["archivos"]["type"][$i]; $_size=$_files["archivos"]["size"][$i]; $_temp=$_files["archivos"]["tmp_name"][$i]; //files exists if(strcmp($_name, "")){ $fp = fopen($_temp, "rb"); $file = fread($fp, $_size); $file = chunk_split(base64_encode($file)); ...

android - Move the Floating Action Button along with the swiped tab -

let me brief idea , i'm aiming achieve, idea have swipe tab 3 tabs in , each tab screen being represented seperate fragment class. did using "it.neokree:materialtabs:0.11" library , working well. created floating action button (fab) using "com.oguzdev:circularfloatingactionmenu:1.0.2" library. now what i'm trying achieve fix fab fragment in center tab , when swipe screen go previous or next tab fab should slide out along tab fragment in , should slide in along center tab screen when swipe it . i have worked on till , i'm able hide view in other fragments , show again in center fragment overriding setuservisiblehint() method in each fragment class this. @override public void setuservisiblehint(boolean isvisibletouser) { super.setuservisiblehint(isvisibletouser); if (isvisibletouser) { view tempview = getactivity().findviewbyid(r.id.myfab); tempview.setvisibility(view.invisible); } } but problem want fab slide out ,...

Server side to upload file through jQuery Ajax -

i trying upload blob, unable figure out server side code same. kindly explain how server act , provide appropriate code. working orbit server (lua based). however, code in language helpful. in current code, alert "start" displayed , nothing happens. nothing happens, neither on server or client. alerts "end" , "saved" not displayed. var fd = new formdata(); fd.append("filedata",blob); alert("start"); $.ajax({ type: "get", url: "convert", data: fd }).done(function(o) { alert('saved'); }); alert("end");

python - Import Error in django forms -

my django project file structure myproject |--newsletter |--__init__.py |--admin.py |--forms.py |--models.py |--tests.py |--urls.py |--views.py |--myproject |--settings.py |--urls.py |--wsgi.py |--db.sqlite3 |--manage.py code in models.py from django.db import models class signup(models.model): email = models.emailfield() first_name = models.charfield(max_length=120) last_name = models.charfield(max_length=120, blank=true) subscribtion_type_choices = ( ('w', 'weekly'), ('m', 'monthly'), ('y', 'yearly') ) subscribtion_type = models.charfield(max_length=1, choices=subscribtion_type_choices) def __str__(self): return self.first_name code in admin.py from django.contrib import admin newsletter.forms import signupform newsletter.m...

bluetooth - import external data to ONE simulator -

i want convert tracefile.txt standard format using imported trace file 1 simulator. have 3 "txt" file(unical dataset downloaded crawdad site: www.crawdad.org ), bluetooth contact file containing 2 nodeid , timestamps below: 1 2 1390923561864- 1 2 1390925003119- 1 9 1391095406320- 1 9 1391096487223- 2 1 1391522133001- 2 1 1391526148381- 2 1 1391527769767- 2 1 1391529571307- .... the second file contains friendships between nodes (if 2 nodes friends =1 else =0), , third file :"interests", weighted adjacency matrix,although, know can have graphviz report result in 1 simulator, possible use report imported data in 1 simulator? if yes, how can ? step 1: process dataset wirte script ( awk , python , or else) convert dataset meet one's requirement, i.e., each line time conn node_i node_j up/down , instance: 21574 conn 1 40 21687 conn 1 40 down step 2: import 1 simulator configure settings file, main items foll...

lotus domino - NotesDocument.save() causing loss of rich text formatting -

i have following code in lotusscript agent removes attachments notesdocuments. notesdocument.save() causes loss of rich text formatting (font, color). there way retain formatting? sub removeattachments_v2(doc notesdocument) dim session notessession dim rtitem variant dim filename string dim ans variant set session = new notessession dim richstyle notesrichtextstyle set richstyle = session.createrichtextstyle richstyle.notescolor = color_blue if doc.hasembedded set rtitem = doc.getfirstitem("body") if (rtitem.type = richtext) forall object in rtitem.embeddedobjects if (object.type = embed_attachment) filename = object.source call object.remove call rtitem.addnewline( 2 ) call rtitem.appendstyle(richstyle) call rtitem.appendtext( "attachemnt removed: " & filename ) ...

Bootstrap font sizing for mobile, tablets and PCs -

i writing small game using bootstrap , want font size remain proportionally consistent on phone, tablet , pc. <h1>points: {{points}}</h1> the trouble above smaller on higher level resolutions , wrecks layout have designed game. how solve issue? as suggested @ckuijjer, vw unit works well. resize window, font size resized in proportion size of window. @media { h1 { font-size: 6vw;} h2 { font-size: 5vw;} h3 { font-size: 4vw;} h4 { font-size: 3vw;} h5 { font-size: 2vw;} h6 { font-size: 1vw;} }

btle - polymer databinding performence -

i trying make app reads data device on btle , displays data in streaming graph. want use of polymer. nice shield complexity of btle. have html tag btle displays btle icon , double click connect device. ones connected want (notify)data connect graph. when @ examples of polymer data binding binds slow data sources input field. question can done (2kb/sec) polymer or slow , should keep data out of polymer ? performance of data-binding has how many bindings there are, , expense of whatever side-effects trigger, not data-size or transfer speeds. generally measured in seconds slower kind of throughput worry in polymer.

c# - Database Driven Dependant Dynamic DropDownList on ASP.NET -

i have 2 drop down list follows in addproduct.aspx <asp:dropdownlist id="ddlbrand" runat="server"></asp:dropdownlist> <asp:dropdownlist id="ddlsubbrand" runat="server"></asp:dropdownlist> at code behind file have used these codes brand drop down list database driven ddlbrand.datasource = brandmanager.getallbrand(); ddlbrand.datatextfield = "brandname"; ddlbrand.datavaluefield = "brandid"; ddlbrand.databind(); listitem item = new listitem(); item.value = "0"; item.text = "--select brand--"; ddlbrand.items.insert(0, item); im trying subbrand drop down list dynamic , change according selected in brand drop down list. both drop down lists next each other , i'm not sure how value of selected brand selected. i'm planning parse in selected value data base using statement in class retr...

c# - Why do local variables require initialization, but fields do not? -

if create bool within class, bool check , defaults false. when create same bool within method, bool check (instead of within class), error "use of unassigned local variable check". why? yuval , david's answers correct; summing up: use of unassigned local variable bug, , can detected compiler @ low cost. use of unassigned field or array element less bug, , harder detect condition in compiler. therefore compiler makes no attempt detect use of uninitialized variable fields, , instead relies upon initialization default value in order make program behavior deterministic. a commenter david's answer asks why impossible detect use of unassigned field via static analysis; point want expand upon in answer. first off, variable, local or otherwise, in practice impossible determine exactly whether variable assigned or unassigned. consider: bool x; if (m()) x = true; console.writeline(x); the question "is x assigned?" equivalent "does m()...

Syntax error on print with Python 3 -

this question has answer here: what “syntaxerror: missing parentheses in call 'print'” mean in python? 3 answers why receive syntax error when printing string in python 3? >>> print "hello world" file "<stdin>", line 1 print "hello world" ^ syntaxerror: invalid syntax in python 3, print became function . means need include parenthesis mentioned below: print("hello world")