Posts

Showing posts from August, 2014

javascript - Wordpress ajax and extra php scripts -

i have simple form building wordpress site , cant seem figure out doing wrong. using ajax call separate php script generic function.php script(i called wpplugin.php) handle form data cant seem figure out if javascript file or url ajax not triggering. so have 3 files, have /wpplugin.php , /upload.php /code/upload.js. to add js file use code in wpplugin.php: add_action( 'wp_enqueue_scripts', 'all_enqueue_scripts' ); function all_enqueue_scripts() { wp_enqueue_script( 'uploadjs', plugins_url( '/code/upload.js', __file__), array('jquery'), '1.0', true ); } and ajax js script follows: $("#uploadform").on('submit',(function(e) { e.preventdefault(); $.ajax({ url: "upload.php", type: "post", data: new formdata(this), contenttype: false, cache: false, processdata:false, success: function(data)

xamarin - Delay a single method for snake game c# -

i using swingame develop snake game. method moveforward handles movement of snake. problem have unable delay particular method snake moving @ constant slow speed. here codes in main: using system; using swingamesdk; using system.threading.tasks; namespace mygame { public class gamemain { public static void main () { //open game window swingame.opengraphicswindow ("gamemain", 800, 600); swingame.showswingamesplashscreen (); snake snake = new snake (); //run game loop while (false == swingame.windowcloserequested ()) { //fetch next batch of ui interaction swingame.processevents (); //clear screen , draw framerate swingame.clearscreen (color.white); swingame.drawframerate (0, 0); // has go after clearscreen , not before refreshscreen snake.draw (); task.delay (1000).continuewith (t => snake.moveforw

sql - MySQL assign user-defined variable in where clause -

the 1st query sql converted to: select name,(@num) test 1 in select clause, (@num : @num + 1) return 1, mean last query sql equal to: select name,(@num) test 1 <= 1 ? if yes, why 2nd query return first record? if no, (@num := @num + 1) in where clause? why @num in 3rd query 4 ? create table test ( id int(1), name varchar(10) ); insert test (id, name) values (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'); set @num := 0; select name, @num test (@num := 1) <= 1; -- return records. set @num := 0; select name, @num test (@num := @num + 1) <= 1; -- return first record. set @num := 0; select name, @num test (@num := @num + 1) <= 1 order name; -- return 1 record, name = a, @num = 4 case 1st query: the first query resolves following equivalent query: set @num := 0; select name, @num test (@num := 1) <= 1; v set @num := 0; select name, @num test 1 <= 1; v set @num := 0; select

jquery - import owl.carousel from webpack -

i new f2e world. created web application using create-react-app. ( https://github.com/facebookincubator/create-react-app ) i wanted import owl.carousel projects, followed guide of npm ( https://www.npmjs.com/package/owl.carousel ) ,which of syntax is: import $ 'jquery'; import 'imports?jquery=jquery!owl.carousel'; but debugger console indicated error : unexpected '!' in 'imports?jquery=jquery!owl.carousel'. not use import syntax configure webpack loaders import/no-webpack-loader-syntax i tried syntax: import owlcarousel 'owl.carousel' and error be: uncaught typeerror: cannot read property 'fn' of undefined could me figure out happened? thanks. update: webpack loader settings: loaders: [ // process js babel. { test: /\.(js|jsx)$/, include: paths.appsrc, loader: 'babel-loader', query: { cachedirectory: findcachedir({ name: 'react-scripts' }) } },

javascript - Angular 2 CLI - 3rd party JS plugins lazy loading -

https://github.com/ocombe/oclazyload i have used angular 1, there alternative plugins work angular 2? want include 3rd party javascript plugins on demand (lazy-load), angular 2 project. far no success. i'm working on angular cli . have tried include in angular-cli.json file, including jquery seems work. think global load. "styles": [ "styles.css", "../node_modules/bootstrap/dist/css/bootstrap.css" ], "scripts": [ "../node_modules/jquery/dist/jquery.js" ], let's want page wow.js plugin in page. should call component wow.js initiated inside it, wow.js file included dynamically. how that? thanks you add assets wow.js file in angular-cli.json configuration file. "assets": [ "pathtoyourplugin/wow.js" ], then component add script tag import library. <script src="/wow.js"></script>

eclipse - Wrap mechanism of TextLayout -

i have custom roundedrectangle figure (org.eclipse.draw2d) contains label textlayout. discovered different mechanism in way text wrapped depending on size. example, in same circumstances (same figure width), text: "onetextexample --e(506,774,944)" will wrapped as: "onetextexample --e(506,774,944)" but when have big number of lines, lets 200 lines same text "onetextexample --e(506,774,944)", each line wrapped as: onetextexample --e (506,774,944) onetextexample --e (506,774,944) onetextexample --e (506,774,944) .. does know different behavior comes , if able somehow control wrapping mechanism used? use in similar circumstances styledtext (org.eclipse.swt.custom) doesn't show difference in wrapping, no matter how many lines of text there are.

php - Insert values into mysql with foreign key constraints -

Image
i have 2 tables : 'spen_recipe' , 'spen_recipe_type' shown below i want insert values spen_recipe , spen_recipe_type simultaneously based on pk , fk constraints. please suggest me query. this have tried: insert spen_recipe (`user_id`,`recipe_name`,`recipe_title`,`recipe_type`,`cooking_time`,`preparation_time`,`serving_to`,`recipe_desc`,`recipe_photo`,`created_at`,`modified_at`,`published_at`) values ('2','recipe2','title2',(select `recipe_type_id` spen_recipe_type),'20','30','4','desc1','image1','2016-11-05 11:21:43','2016-11-05 11:22:43','2016-11-05 11:21:43'); but need suggestion on how proceed after select recipe_type_id spen_recipe_type, cause both table has null values in columns, both empty. should spen_recipe_type or spen_recipe first inserted?

PHP fopen() can't create or update log file (ubuntu) -

i give chmod 777 logs folder doesn't work ... have create log file day day . doesn't create file ... why ? <?php $server = $_server['remote_addr']; $today = date("d-m-y"); $timest = date("d-m-y h:i:s"); $file = "logs/" . $today . ".txt"; $succ = $_session['logged']; if (file_exists($file)) { $add = file_get_contents($file); $add . = "\nserver : " . $server . "\t username : " . $username . "\t timestamp : " . $timest . "\t success : " . $succ; file_put_contents($file, $add); } else { $fc = fopen($file, "w") or die("unable open file"); $txt = "\nserver : " . $server . "\t username : " . $username . "\t timestamp : " . $timest . "\t success : " . $succ; fwrite($fc, $txt); fclose($fc); } ?>

ios - error occured in Alamofire librarys request.swift file - "Ambiguous use of Task" after updating to xcode 8.1 -

Image
i have updated xcode xcode 8.1 before upgradation working fine after upgradation have converted swift 2.3 swift 3.0 , added updated alamofire library. giving error in request.swift file of alamofire. in case used used 'import alamofire'. comment import out, build, uncomment import. retry compiling.

Slow docker container -

i using dockerfile containers provided newscoop , containers appear slow me ( https://github.com/sourcefabric/newscoop ). not believe mysql image causing problem, instead seems mounted cache , log folders ones blame. there lot read/writes happening files mounted, , this, believe, slows down whole thing. is there way force specific folder not mounted? or there obvious cause of slowdown? those lines blame: newscoop: build: ../ command: newscoop ports: - "80:80" volumes: - ../newscoop:/var/www/newscoop

selenium - Child 2960 ###!!! ABORT: Aborting on channel error -

when running selenium 2.53.1 on win7pro machine, error below. found bug in firefox. using version 49.0.2, did not expect error because resolved . how can resolve this? option #1: remembered installed older version (48.0.2). removed versions of ff , installed latest version. unfortunatly did not solve issue. option #2: when changed url, acceptance env instead of test, able enter values , process testcases. might ssl certificates??? note: reputation not enough ask question here had ask in new one. also if more info needed, add it. 2016-11-08 11:22:07,316 - info nl.spp.browsercontroller - configuring firefox 2016-11-08 11:22:07,434 - info nl.spp.browsercontroller - starting firefox 1478600528072 geckodriver info listening on 127.0.0.1:44190 1478600528098 mozprofile::profile info using profile path c:\users\ad529~1.dia\appdata\local\temp\rust_mozprofile.wou06xtrmvik 1478600528101 geckodriver::marionette info starting browser c:\program files (x

multithreading - How to execute parallel instances of a program with different parameters in Python? -

i have program takes long time finish, want execute 50 different parameters. simplify let consider following example: parameters = {0: "001001", 1: "010001", 2: etc...} # 50 params parameter in parameters: perform_the_calculation (parameters[parameter]) the problem perform_the_calculation() takes long each parameter, (about 30 minutes each), if performed parallel excution, prety faster (5 parameters can done @ 45 minutes). did changing parametrs manually , run several instances of program in parallel (i use pycharm). my question is: is there method run parallel calculations automatically? note: have read multiprocessing , understood can used distribute processing on processor cores am right? noticed here processor cores working simultaneously, affraid multiprocessing may not useful me ( please correct if wrong ). thanks in advance helps.

c# - WPF TreeView does not pick up templates, calls ToString() instead -

this question has answer here: how bind datatemplate datatype interface? 1 answer i have in xaml: <treeview datacontext="{binding source={staticresource locator}}" itemssource="{binding sometree.toplevelitems}"> <treeview.resources> <datatemplate datatype="{x:type vm:ileaf}"> <checkbox content="{binding name}" isthreestate="false" ischecked="{binding isenabled, mode=twoway, updatesourcetrigger=propertychanged}" /> </datatemplate> <hierarchicaldatatemplate datatype="{x:type vm:igroup}" itemssource="{binding children}"> <checkbox content="{binding name}" isthreestate="true" ischecked="{binding isenabled, mode=twoway, updatesourcetrigger=propertychanged}" /> &

node.js - Node auto reload code on https -

i'm looking tool can auto reload node.js code can run on https local development. both forever , nodemon can reload code can't run on https. to generate self-signed certificate, run following in shell: openssl genrsa -out key.pem openssl req -new -key key.pem -out csr.pem openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem rm csr.pem this should leave 2 files, cert.pem (the certificate) , key.pem (the private key). need ssl connection. set quick hello world example (the biggest difference between https , http options parameter): var https = require('https'); var fs = require('fs'); var options = { key: fs.readfilesync('key.pem'), cert: fs.readfilesync('cert.pem') }; var = https.createserver(options, function (req, res) { res.writehead(200); res.end("hello world\n"); }).listen(8000); node pro tip: note fs.readfilesync - unlike fs.readfile, fs.readfilesync block entire process unti

Understanding java compilation and inheritance -

Image
i'm reading jmh samples , i'm @ section inheritance . here remark made: because we know type hierarchy during compilation , possible during same compilation session. is, mixing in subclass extending benchmark class after jmh compilation have no effect. i haven't thought of aspect of compilation , doesn't seem quite clear me. use class::getsuperclass though. example: @benchmark public abstract class mybenchmark{ public void mb(){ dosome(); } public abstract dosome(); } i thought when compiling class jhm uses annotation processor benchmark generation. , if try compile subclass say public class myconcretebenchmark extends mybenchmark { @override public void dosome(){ //do } } it has no effect because annotation processor has nothing process. jhm comes before compiling (analyze , generate). preprocessor or precompiler. therefore jmh can not see inheritance tree , not possible see inherited annot

java - How to fix a javafx.fxml.LoadException? -

i'm trying make javafx login window, , followed tutorial, gives me strange bug... src/main/java/scripter/nukkit/playertool/mainapplication.java package scripter.nukkit.playertool; import javafx.application.application; import javafx.application.platform; import javafx.event.actionevent; import javafx.event.eventhandler; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.layout.stackpane; import javafx.scene.parent; import javafx.stage.stage; import javafx.fxml.*; @suppresswarnings("restriction") public class mainapplication extends application { @override public void start(stage primarystage) throws exception { parent root = fxmlloader.load(getclass().getclassloader().getresource("mainapplication.fxml")); scene scene = new scene(root, 300, 275); primarystage.settitle("fxml welcome"); primarystage.setscene(scene); primarystage.show(); } } src/main/java/scr

angular - PrimeNG dropdown hidden by dialog -

Image
i have angular2 app using primeng components. i want dropdown inside dialog box. however, when have implemented this, dropdown cut off limit of dialog box shown in screenshot below. want display above dialog , have options visible. it small dialog , not want create large 1 there lots of empty unused space. my html code below: <p-dialog header="repack" [(visible)]="display" showeffect="fade" minheight="200"> <div class="row col-md-12" align="center"> <button pbutton (click)="viewrepack()" label="view repack"></button> </div> <div class="row col-md-12"><strong>edit table assignment: </strong></div> <p-dropdown [options]="tables" [(ngmodel)]="selectedtable" [style]="{width: '100%'}"></p-dropdown> <button pbutton label="save" (click)="save(

php - search users using user name and user meta in wordpress -

i saving wordpress user below: $user_data = array( 'id' => '', 'user_pass' => '', 'user_login' => $user_name, 'user_email' => $trainer_email, 'first_name' => $first_name, 'last_name' => $last_name, 'role' => 'trainer' ); $random_password = wp_generate_password(8,false); $user_id = wp_insert_user( $user_data ); update_user_meta( $user_id, 'course_registered',$course_registered ); wp_set_password($random_password, $user_id); presently using 'wp_user_query' method following arguments: $args = array( 'role' => 'trainer', 'orderby' => 'display_name', 'posts_per_page' => '3', 'paged' =&

string - Android, retrieve additional information about a resource -

i doing instrumented unit tests check resources requirements, there no duplicate texts, or pictures used once. i not want hardcode list of strings or pictures. i know how retrieve drawable or string resources , id or key name, missing important information like: is string translatable? how translatable="false" flag? is drawable file? (or drawable injected android starting "abc_") in files comes string from? (strings.xml or custom name) if have clue please tell me :) thanks! @runwith(androidjunit4.class) public class resourcestest { @test public void duplicatedtexts() throws exception { final class<r.string> c = r.string.class; final field[] fields = c.getdeclaredfields(); (field field : fields) { int resid = field.getint(field); // string resource id string keyname = field.getname(); // string key name // how skip non translatable strings? if (!istranslat

ios - Failed to chmod user/Library/Developer/CoreSimulator/Devices NO Such File Or directory -

Image
when try run app in iphone 6 simulator, getting following error. using xcode 8.1 can 1 please me understand issue i had issue, run every time deleted app simulator, when tried run second time error show. i managed solve resetting ios simulator: simulator -> reset content , settings...

mysql - counting of rows with group by -

seat_num service_key source_id destination_id 1 19229 0 60 1 19229 240 600 2 19229 0 240 3 19229 0 600 my table data above. want result below count service_key source_id destination_id 3 19229 0 60 2 19229 240 600 2 19229 0 240 3 19229 0 600 the logic behind count of seat nums should fall between range of source , destination. issue here 0 600 source , destination counting 4 should 3 because same seat num (1) used twice. please let me know how result required. try : select service_key,source_id,destination_id,count(seat_num) tablename seat_num between source_id , destination_id group seat_num having count(seat_num) > 0;

javascript - facebook social plug-in not showing up when added dynamically -

i adding facebook social plug in webpage when manually add : <div class="fb-comments" data-href="http://website.com/z" data-width="700" data-numposts="7" data-colorscheme="light"></div> it works , , when javascript code add , doesn't any ideas ? the js sdk goes through document once when initialized, such elements parse social plugins. if want parse content add document later, need call fb.xfbml.parse() . https://developers.facebook.com/docs/reference/javascript/fb.xfbml.parse/

android - My custom CursorAdapter does not display the items -

i using custom cursoradapter , have values in db problem values not displaying in custom listview . searched in not find answer. by debugging found out 2 methods in cursor adapter bindview() , newview() not executing constructor executing.i not sure happening overall. question why listview items not getting displayed ? here code , posting relevant code if there additional code needed please comment edit accordingly. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //a listview object notesview = (listview)findviewbyid(r.id.listview); //an object of sqliteopenhelper class dbhelper = new databasehelper(this); //cursor object passcursor = dbhelper.fetchallnotes(); // custom cursor adapter class object datacursor = new customcursor(this,passcursor); notesview.setadapter(datacursor); notesview.setonitemclicklistener(this); bar = (toolba

ios - Error: Use of undeclared identifier NSOpenPanel in Xcode -

i'm getting following error: use of undeclared identifier nsopenpanel nsopenpanel *panel = [nsopenpanel openpanel]; [panel setcanchoosefiles:no]; [panel setcanchoosedirectories:yes]; [panel setallowsmultipleselection:yes]; // yes if more 1 dir allowed nsinteger clicked = [panel runmodal]; if (clicked == nsfilehandlingpanelokbutton) { (nsurl *url in [panel urls]) { // url here. } } nsopenpanel not available in ios , under macos ( cocoa ). you can not let user browse file system under ios . can browse file types though, using apples public api. instance can let user choose images using uiimagepickercontroller

How to implement shell "ls -v" in java -

for example, run ls -v /tmp/chk get: ar1 ar20 ar100 pr1 pr20 pr100 but when use following groovy code: new file("/tmp/chk").listfiles().sort().each { println it.name } the result is: ar1 ar100 ar20 pr1 pr100 pr20 how implement ls -v algorithm same order in java or groovy you should @ process builder. built kind of thing. processbuilder processbuilder = new processbuilder("bash", "", "ls -v"); process p = pb.start(); bufferedreader reader = new bufferedreader(new inputstreamreader(p.getinputstream())); string readline; list<string> files = new arraylist<string>(); while ((readline = reader.readline()) != null) { files.add(readline); }

jsf - Conversion Error setting value for 'null Converter' -

i have problems understanding how use selection in jsf 2 pojo/entity effectively. example, i'm trying select warehouse entity via below dropdown: <h:selectonemenu value="#{bean.selectedwarehouse}"> <f:selectitem itemlabel="choose 1 .." itemvalue="#{null}" /> <f:selectitems value="#{bean.availablewarehouses}" /> </h:selectonemenu> and below managed bean: @named @viewscoped public class bean { private warehouse selectedwarehouse; private list<selectitem> availablewarehouses; // ... @postconstruct public void init() { // ... availablewarehouses = new arraylist<>(); (warehouse warehouse : warehouseservice.listall()) { availablewarehouses.add(new selectitem(warehouse, warehouse.getname())); } } // ... } notice use whole warehouse entity value of selectitem . when submit form, fails following faces message:

python - Extracting large files with zipfile -

i'm trying extract zip file of 1.23 gb zipfile library. gives following error: compression type 9 (deflate64) here's code: zip_ref = zipfile.zipfile(filepath, 'r') zip_ref.extractall(newpath) it gives error while trying extract contents. is there way unzip large zip files python? this happens because compression method not implemented in zipfile module. some discussion issue here: https://bugs.python.org/issue14313 the fix raise notimplementederror instead of adding support compression method. suggested solutions: if possible, recompress file using standard deflate method. use subprocess module invoke system unzip command, asssuming installed on os (if supports compression method, i'm not sure. know 7-zip supports method.).

openstack - Getting error as world dumping while installing devstack -

Image
i getting error keystone. says world dumping , installation stops. have tried update upgrade , added floating ip, etc., gave user sudo privileges, still getting error. please error.

python - create sequences for prefix span issue -

i trying create list containing sequences in order call prefixspan algorithm. need list in form: [ [["a", "b"], ["c"]], [["b", "c"], ["d"]], [["c", "d"], ["e"]]] where 1st 2 letters of nested list rule/sequence , single letter consequence. i have data of form: [[u'a', u'b', u'c', u'd', u'e', u'f', ], [u'a', u'b',...]] applying data following logic: a1 =[] in range(len(list2)): a2 = list2[i] j in range(len(a2)-2): a1.append([a2[j],a2[j+1]]) a1.append([a2[j+2]]) and result of has following form: [[[u'a', u'b'], [u'c'], [u'd', u'e'], [u'f'], [u'g', u'h'],...]] so can't create nested 2 1 tuple sequence. i'd list comprehension. created following code

css - Scaling website for widescreens -

im in process of finishing off first site, on 13inch macbook looks along mobile devices. have set media queries responsive side of things , seems working well. main issue on wide screens such imacs , 27" imacs stretches use full width of screen should guess have set things in percentages. wondered best way site better on wider screens, should use media query zooms in when device width above 1500px? or better off putting wrapper round whole body kicks in on larger device screens? thanks a first step put whole thing (or content section) wrapper div define .content_wrapper { width: 100%; /* full width on screens 1440px */ max-width: 1440px; /* content width limited 1440 on large screens */ margin: 0 auto; /* centers container on screens above 1440 */ }

c# - Synchronized message queue -

i have system set of operations need done, each operation has type , entity. operations each entity can done independently, within entity order of types matter. operations on type can start when operations of previous type have finished. operations take data database, process it, store results in database again. how can achieve effect (preferably within .net world) assuming amount of operations require use of many machines in parallel? p.s. right using service bus, each message operation-entity-type combination. not meet needs @ since order not enforced , it's not clear when operation connected message has finished. edit: need find logical way of processing operations in right order keeping (which can be) parallel. example: need 3 types of operations (t1-t3) 2 entities (e1, e2). there can many operations having same type , entity. -- entity 1 [t1, e1][t1, e1][t1, e1][t1, e1] - 4 operations type 1, entity 1 [t2, e1][t2, e1] - 2 ops, type 2, entity 1 [t3, e1] - 1 operat

scala - Auto detect column types in OpenCSV -

i'm reading file opencsv way (in scala): val reader = new csvreader(new filereader("somefile.txt")) (row <- reader.readall) { println("col(0): " + row(0) + " col(1)" + row(1) ) } since file provided user, don't know format, need know each column type (number, string, etc.). possible opencsv ? if not, there library can auto detect column types?

javascript - onclick doesn't work properly with bootstrap -

i tried use onclick event bootstrap radio-buttons names , attributes how didn't go well. some of radio-buttons triggered event didn't name or class ("undefined") , didn't respond @ all. <div class="thecontainer"> <input type="radio" class="myclass" name="options" id="option1" onclick="updateodid()" autocomplete="off" > radio 1 <input type="radio" class="myclass" name="options" id="option2" onclick="updateodid()" autocomplete="off"> radio 2 <input type="radio" class="myclass" name="options" id="option3" onclick="updateodid()" autocomplete="off"> radio 3 <input type="hidden" class="findme" value="found me!"> <div class="btn-group" data-toggle="buttons"> <label class=

asp.net - .Net Changing page locations in Visual Studio Solution Exp -

Image
i have .net web project. want organize solution explorer , pages. because there 4 type of users , there many pages. want create folders , keep of files in them. i've moved page files folders app not work. should do? you need change page title @ beginning of web page accordingly. used inherits="myproject.mywebpage" inherits="myproject.myfolder.mywebpage" also, aspx files have mypage.aspx.designer.cs file underneath , namespace namespace mypage{ should namespace myfolder.mypage{ that's why code behind has red lines because can't verify aspx page via designer file.

reactjs - What would be the type of `React.createClass` in Haskell? -

i reading this , wonder type of react.createclass / reactclass , reactcomponent in haskell ? i trying understand concepts in react, hence question. my guess this: type reactclass<tprops> = (tprops) => reactcomponent<tprops>; would translate haskell like: data reactclass tprops = data reactclass ( tprops -> reactcomponent tprops ) and type reactcomponent<tprops> = { props : tprops, render : () => reactelement }; this translate haskell as: data reactcomponent tprops = reactcomponent tprops reactelement but unsure. could please correct me if wrong ?

oracle - select rows and generate a new column based on condition SQL -

i have following table in oracle company rate period 1a 10 sep-16 1b 20 sep-15 1c 30 oct-16 1d 40 sep-16 1a 50 oct-16 2b 50 sep-15 1c 60 oct-14 i want select rows , add value based on conditions. result similar following: company rate period currency 1a 50 oct-16 usd 1c 30 oct-16 aed in previous table, selecting companies 1a, 1c period ='oct-16'. , need add column "currency" each company 1a=usd, 1c=aed what did is: select company, period , rate table_test period='oct-16' , company='1a' or period='oct-16' , company='1c'; i managed companies failed @ currency column. possible using sql command? please help. yes possible using case condition: select company,rate,period,(case when company='1a' 'usd' when company='1c' 'aed&

How does the formset work in django? -

i want display single form 2 times use formset. display form twice. how use formset validation? here code def add_result(request): if request.method == 'post': articleformset = formset_factory(resultform, extra=2) form=articleformset(request.post) if form.is_valid(): team=team.objects.all() return httpresponseredirect('/success/') else: team=team.objects.all() articleformset = formset_factory(resultform, extra=2) variables = requestcontext(request, {'articleformset': articleformset}) return render_to_response('add_result.html',variables,)

How to define a local function in Constructor.prototype in Javascript -

hi guys facing difficulty in 1 of scenario in m not able define local function in manager.prototype. please find below detail.. i have constructor function employee. function employee(id){ this.id = id; } employee.prototype.getid = function(){ return this.id; } var mark = new employee(123); again have manager constructor function manager(managerof){ this.managerof = managerof; } manager.prototype = object.create(employee.prototype); manager.prototype.getmanagerof = function(){ return this.managerof; } var john = new manager(mark); now want define function calcsalary() accessible getmanagerof() method & not outside . [john.calcsalary() should not work] you hide self executing function. var manager = (function() { function calcsalary() {} function manager(managerof){ this.managerof = managerof; } manager.prototype = object.create(employee.prototype); manager.prototype.getmanagerof = function(){ // call calcsalary

node.js - browser sync reloading injecting works, but reloads after -

it seems there im missing - im trying css injection working on project. the server proxy works file watcher injection works, page reloads half second after... im on mac osx 10.11.6 (15g1108) node v4.1.1 here gulpfile: var gulp = require('gulp'); var browsersync = require('browser-sync').create(); var reload = browsersync.reload; var sass = require('gulp-sass'); var plumber = require('gulp-plumber'); var notify = require("gulp-notify"); var src = { scss: 'assets/scss/**', css: 'assets/css/', html: 'app/*.html' }; gulp.task('serve', ['sass'], function() { browsersync.init({ proxy: "intouch.local", open: false, reloadonrestart: false, injectchanges: true, }); gulp.watch(src.scss, ['sass']); }); gulp.task('sass', function() { var onerror = function(err) { notify.onerror({ title: "gulp", su

java - NullPointerException and NullReferenceException -

what difference between nullpointerexception , nullreferenceexception? nullpointerexception - java exception thrown when application attempts use null in case object required. nullreferenceexception - exception thrown when there attempt reference (or use) null or uninitialized object. there no 'nullreferenceexception' in java. java has equivalent class 'nullpointerexception'.

python - How to read a file from the last read position? -

i have 3,000,000,000 line text file. use command below open with open("/data/tmp/tbl_show_follow.txt") infile: but need kill python scripts stop reading file, , next time need read last position read. current solution using counter_i remember position , print log every 100,000 lines 20161108 21:19 last position : 100000 20161108 22:34 last position : 200000 20161108 23:34 last position : 300000 ....... 20161408 23:34 last position : 200000000 and run python scripts again, need change condition count_i = 0 open("/data/tmp/tbl_show_follow.txt") infile: line in infile: if count_i > 300000: sth ... but if last position 200,000,000 , stop python script, next time need read file beginning , count 1 200,000,000. think stupid that, how begin 200,000,000th line? there method remember last position read file? you can use file.tell() file’s current position (measured in bytes) , file.seek() set it. file.tell() fil

Paypal IPN wrong currency in return response -

Image
i'm using paypal ipn , express payments on website. when ever decides pay in gbp selects ipn account , when selects euros selects express payments method. this works 100% of time me in testing. however ipn response comes paypal currency euro , not gbp they paying less in euros in gbp , loosing money. is currency changed when customer arrives on paypal website? basically show intent gbp on website, change euro on pro hosted solution? does happen? how can stop it? here pics: sends gbp: returns euros: there not same transaction higlights problem. thanks , advise.

javascript - How is structured clone algorithm different from deep copy -

there's mdn article states that: the structured clone algorithm new algorithm defined html5 specification serializing complex javascript objects. it's more capable json so, believe means it's more capable cloning in way: json.parse(json.stringify(obj)) suggested in this thread . json way has many drawbacks not supporting circular references, dropping not supported json spec, functions, , representing date object strings. i thought structured clone algorithm deep copy algorithm implemented many libraries. however, it's listed on same page words: if want deep copy of object (that is, recursive copy of nested properties, walking prototype chain), must use approach. following possible example. so i'm confused , don't know structured algorithm or how it's different deep copy. help? don't want read spec, maybe libraries implemented it, can read source code.

javascript - Creating new html tags (elements) -

this question has answer here: is there way create own html tag in html5? 17 answers so can use javascript crate new html elements, right? but if write in html code: sea{width: 100px; height: 100px; background: blue; color: red;} <sea>this sea tag</sea> it make font color red , background blue dimensions aren't working... possible javascript or not? like new html5 elements (header, footer, section...) there possible way create own names elements or not? so can use javascript crate new html elements, right? no. can create new elements, , put them html document, aren't html. don't come semantics. don't have default styling (including audio styling screen readers). don't that. it make font color red , background blue dimensions aren't working... possible javascript or not? javascript irrelevant. you'

sql - Access 2010 input second returned value into query result -

i building query looks contract number in second table of there multiple results. want instead of returning second row want below contract no | result 1 | result 2 | result 3 rather than contract no | result 1 contract no | result 2 contract no | result 3 how this? the concatrelated vb not viable option within business work.

tsql - SQL where clause with one parameter to check either int or string field -

i have stored procedure: alter procedure [dbo].[getclassinfo](@classid int) begin select [usergroupid] ,[gname] ,[accesscode] [dbo].[usergroup] usergroupid = @classid or accesscode = @classid end now, want parameter i'm sending check either usergroupid number or accesscode string. which solution painless check both cases using 1 parameter? you can't have none integer values in parameter have changed varchar. alter procedure [dbo].[getclassinfo] ( @classid varchar(50) ) begin if isnumeric(@classid + '.0e0') = 1 begin declare @classidint int = convert(int , @classid); select [usergroupid] , [gname] , [accesscode] [dbo].[usergroup] @classidint = [usergroupid]; end; if isnumeric(@classid + '.0e0') = 0 begin select [usergroupid]

c# - How to get full summary from atom feed from gmail -

im geting summary not full summarry of bady of mail, please tell how it my coding: //logging in gmail server data objclient.credentials = new system.net.networkcredential("xxx@gmail.com", "password"); //reading data , converting string response = encoding.utf8.getstring(objclient.downloaddata(@"https://mail.google.com/mail/feed/atom")); response = response.replace( @"<feed version=""0.3"" xmlns=""http://purl.org/atom/ns#"">", @"<feed>"); //loading xml can information doc2.loadxml(response); //nr of emails string nr = doc2.selectsinglenode(@"/feed/fullcount").innertext; //reading title , summary every email foreach (xmlnode node in doc2.selectnodes(@"/feed/entry")) { title = node.selectsingle

php - Wordpress: show the name of the blog in the browser -

i change display in browser. when @ front page of website, name of blog written in browser. if leave front page , switch page, name of current page shown in browser. fix name of blog every single page. couldn't find title-tag in functions.php nor find title in header.php. have idea problem is? know mean? thank much. greetings, pradhana

server - Any workaround for Firebase exception NoClassDefFoundError: LLRBNode$NodeVisitor -

after having switch firebase admin 4.0.0 sdk, on server. know way can switch old server-sdk dependency, or way work round exception? i've reported fb in meantime, server running again... @ moment seem totally stuck. java.lang.noclassdeffounderror: com/google/firebase/database/collection/llrbnode$nodevisitor @ com.google.firebase.database.snapshot.priorityutilities.nullpriority(priorityutilities.java:13) @ com.google.firebase.database.snapshot.nodeutilities.nodefromjson(nodeutilities.java:12) @ com.google.firebase.database.core.repo.updateinfo(repo.java:540) @ com.google.firebase.database.core.repo.onserverinfoupdate(repo.java:494) @ com.google.firebase.database.core.repo.ondisconnect(repo.java:485) @ com.google.firebase.database.connection.persistentconnectionimpl.ondisconnect(persistentconnectionimpl.java:409) @ com.google.firebase.database.connection.connection.close(connection.java:82) @ com.google.firebase.database.connection.connection.onreset(connection.

html - Should A WordPress Post Thumbnail Have role="presentation" in it? -

i writing theme new site , want friendly can assistive technologies. such, wondering including role="presentation" in display of call of post thumbnail. the html generated php looks follows: <figure class="featured-image"> <a href="{permalink}"> <img src="{featured image}" alt="{description}"> </a> </figure> should include role="presentation" and, if so, should go in <figure> element? if @ w3 specification roles: [role="presentation"] negates implicit 'heading' role semantics not affect contents. <h1 role="presentation"> sample content </h1> there no implicit role span, contents <span> sample content </span> this role declaration redundant. <span role="presentation"> sample content </span> in cases, element contents exposed accessibility apis without implied role semantics. s