Posts

Showing posts from July, 2014

Prettify / Beautify HTML in Perl -

i have html output sitting in variable prettify / beautify struggling make sense out of results of web searches. most of options have found such perltidy (not sure correct option) appear assume html in file in case, has been put in perl script , stored in variable , wanted fix removing excess line breaks , indenting , saving variable before sending output. looking along lines of $output= someperlmodule::prettify($html); which can jut add exiting script. a bonus if can remove orphaned end tags. basically, have end tags such without start tags , while browsers seem able deal this, nice strip these out. is there such module? html::tidy that: #!/usr/bin/perl use strict; use warnings; use html::tidy; $str = '<div><p>text<h2>heading</h2>'; $tidy = 'html::tidy'->new; print $tidy->clean($str); output <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <meta name="gen

java - How to do this without using Files? -

i have following code : connection.response captcharesponse = jsoup.connect(captcha_url) .timeout(3000) .cookies(cookies) .useragent("mozilla/5.0") .method(method.get) .ignorecontenttype(true) .execute(); cookies.putall(captcharesponse.cookies()); // writing captcha image file fileoutputstream filewriter = new fileoutputstream(new file(captcha_filename)); filewriter.write(captcharesponse.bodyasbytes()); filewriter.close(); showimage(captcha_filename,"captcha"); showimage function: public void showimage(string filename,string title) throws ioexception { imageicon icon = new imageicon(imageio.read(new file(filename))); jframe frame = new jframe(title); jlabel imagelabel = new jlabel(); imagelabel.seticon(icon); frame.add(imagelabel); frame.setsize(100,100); frame.setlocationrelativeto

c++ - Is f(++i, ++i) undefined? -

i seem recall in c++11, made changes sequencing behaviour , i++ , ++i have different sequencing requirements. is f(++i, ++i) still undefined behaviour? difference between f(i++, i++) , f(++i, ++i) ? it's undefined behaviour unless i class type. c++11 1.9/15: except noted, evaluations of operands of individual operators , of subexpressions of individual expressions unsequenced. followed note clarify apply function arguments: [ note: value computations , side effects associated different argument expressions unsequenced. —end note ] your code modifies same object twice without sequencing, same paragraph: if side effect on scalar object unsequenced relative either side effect on same scalar object or value computation using value of same scalar object, the behavior undefined . if i class type, ++ call function, , function calls sequenced respect each other. modifications of scalar objects indeterminately sequenced; there's no undefin

JavaFX disable button -

i'm writing program in netbeans javafx view has several buttons in bad buttons(like bombs minesweeper), i'm trying freeze program when bad button pushed don't find how it thanks! there various solutions problem. 2 among them ignoring action event or disabling buttons this: public class buttonaction extends application { final booleanproperty buttonactionproperty = new simplebooleanproperty(); public static void main(string[] args) { application.launch(args); } @override public void start(stage primarystage) { flowpane root = new flowpane(); checkbox checkbox = new checkbox( "enabled"); checkbox.setselected(true); // solution 1: check if action allowed , process or not buttonactionproperty.bind( checkbox.selectedproperty()); button button = new button( "click me"); button.setonaction(e -> { if( buttonactionproperty.get()) {

python - Unable to import a local project to another local one by absolute path: -

i have 2 projects in the different directories , 1 of them want import one. say, project want import has this: /path123/my_project/main_folder/file1.py /path123/my_project/main_folder/file2.py /path123/my_project/main_folder/file3.py here's did in 2nd project: import sys sys.path.append('/path123/my_project/main_folder') # it's indeed inserted import main_folder.file1 # error - not found main_folder import file1 # error - not found import my_project.main_folder.file1 # error - not found after appended path second python file want use in first python file directly import module filename without extension. example import file1 every location in sys.path looked file file1.py import. say have main python program in /prog1/main.py , want import file /prog2/lib/want_to_import.py in main.py should like import sys sys.path.append('/prog2/lib') import want_to_import

sql - How to calculate the Num_Key_Cols for a Non-Clustered Index with included columns in it? -

i'm trying estimate index size using information provided @ msdn website . let consider table "table1" 3 columns in it. columns listed below, id int, not null marks int, not null submitdate date, not null initially, have created clustered primary key on id column , planned create non-clustered index "id" "index key column" as, "marks" , "submitdate" columns used "included columns" in index. based on above plan, trying estimate non-clustered index key size before creating it. while going through msdn site , have lot of confusions clarified. there 4 steps estimate nonclustered index key size , at first step, 1.2 , 1.3 explains about, how calculate num_key_cols, fixed_key_size, num_variable_key_cols , max_var_key_size . @ 1.2 , 1.3, should calculate based on index key type, have clustered index key or not , have included columns or not; seems confusing. can me based on info have provided sample table (t

java - Generics to prevent Parent class to be as accepted type -

i have situation in have create generic method can accept list of child objects not parent class objects. say have class classa {} which getting extended by class classb extends classa {} class classc extends classa {} executemethod(list</* either classb or classc not classa */>) can achieve using generics? i'm not sure why can't allow list<? extends classa> try: <t extends classa> void executemethod(list<? extends t>); //not sure if work worth try. or public interface classx {} public class classa { void executemethod(list<? extends classx); } public classb extends classa implements classx {} public classc extends classa implements classx {}

c++ - Visible files in the "Projects" View of the Qt Creator IDE if using the CMake build system -

introduction i using integrated development environment (ide) qt creator v3.3.1 , build system cmake v3.2.1 develop in c++ programming language. currently implementing own custom build "framework", can use same cmake modules in each of projects. framework supports generation of source files corba , protocol buffers interface design language (idl) files, example. @ moment implementing support qt framework v5. the directory structure of projects follows (using convention on configuration ): ├── cmake # must contain source files of custom "cmake" │ # framework (usually shared directory). ├── config # may contain configuration files application. ├── doc # may contain documentation files. │   └── example # may contain .cc files example executables. ├── form # may contain "qt framework" .ui files. ├── idl # may contain corba .idl files. ├── include

unity3d - Unity C# Script Moving a character 2D -

i'm trying make script control character. want character move distance right while alternating left arrow , right arrow inputs. ideally when start game, press right arrow - character moves right 10px, press left arrow - character moves right , pattern continues on alternating , never allowing 2 of same inputs after eachother eg: left arrow left arrow or right arrow right arrow. ended going this, :d using unityengine; using system.collections; public class playercontroller : monobehaviour { public float movespeed; public float jumpheight; private keycode lasthitkey; void start() { } void update() { if(input.getkeydown (keycode.space)) { getcomponent<rigidbody2d>().velocity = new vector2(0, jumpheight); } if(input.getkeydown (keycode.d)) { if(lasthitkey == keycode.d) { }else { getcomponent<rigidbody2d>().

ms word - Powershell msword table format cell text -

using powershell able add text in table cell this, want format cell text. table.cell(1, 1).range.text = "list vitem1 vitem2" eg. want bold , align center "list" string. apply ordered item style item1 , iteam2 string. how can using powershell? edit: found code in c#, not able make work in powershell. https://social.msdn.microsoft.com/forums/vstudio/en-us/4d7fa718-29d7-4b71-848e-11d7aafac5b7/multiple-format-into-one-cell-of-table-in-word-2007-using-c?forum=worddev //boldrange_1 "green", boldrange_2 "inch". word.range boldrange_1 = table.cell(1, 2).range;//assign whole cell range boldrange, adjust setrange method. boldrange_1.setrange(table.cell(1, 2).range.start, table.cell(1, 2).range.words[1].end); boldrange_1.bold= 1; word.range boldrange_2 = table.cell(2, 2).range; boldrange_2.setrange(table.cell(2, 2).range.words[4].end, table.cell(2, 2).range.words[5].end);

c++ - bitwise flags get set arbitrarily -

i've been studying c++ (and programming matter) week, question may lack understanding of fundamental programming principles, here goes nothing: unsigned int bitflags() { unsigned char option1 = 0x01; // hex 0000 0001 unsigned char option2 = 0x02; // hex 0000 0010 unsigned char option3 = 0x04; // hex 0000 0100 unsigned char option4 = 0x08; // hex 0000 1000 unsigned char option5 = 0x10; // hex 0001 0000 unsigned char option6 = 0x20; // hex 0010 0000 unsigned char option7 = 0x40; // hex 0100 0000 unsigned char option8 = 0x80; // hex 1000 0000 unsigned char myflags; // byte-size value hold combination of above 8 options myflags |= option1|option2|option3; if (myflags&option8) return 1; else return 0; } int main() { std::cout << bitflags() << "\n"; return 0; } so, set 3 flags (option1, option2, option3). now, flag query works expected (returns 1 options 1/2/3, , 0 rest) up-until option7/8. though option7/8 not set, function returns 1.

google maps - Why do I receive OVER_QUERY_LIMIT answer of my first request? -

i'm using following code coordinates of city, based on request made android app server.: function getgpslocation($reqlocation) { $url = "http://maps.googleapis.com/maps/api/geocode/json?address=" . $reqlocation . "&sensor=false"; $attempt = 0; $this->log($url, 'debug' ); $location = [ 'lat' => 0.0, 'lng' => 0.0 ]; while ($attempt < 3) { $timeout = 5; $ch = curl_init($url); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_connecttimeout, $timeout); $content = curl_exec($ch); $resulthttpcode = curl_getinfo($ch, curlinfo_http_code); curl_close($ch); if ($resulthttpcode == '200') { $result = json_decode($content); if ($result->status == 'over_query_limit') { $this->log($result->st

php - Cannot load or save configuration -

i cannot load phpmyadmin message. i've tried creating config folder , config.inc.php file. when ĺog on localhost/phpmyadmin/setup/ still gives me message. error message: "cannot load or save configuration please create web server writable folder config in phpmyadmin top level directory described in documentation. otherwise able download or display it." i have given www/html folder full rights. how fix this? thanks in advance! i have had similar issue on ubuntu 16.04. made research , in end found resolution of issue. maybe case solution else. background: security reasons have non privileged user , group apache:apache ( sudo groupadd apache | useradd -g apache apache ). preset directives ( user apache; group apache ) in /etc/apache2/apache2.conf . user apache:apache owns apache2 main directory ( sudo chown -r apache:apache /etc/apache2 ) , other files, example: sudo chown -r apache:apache/etc/phpmyadmin/htpasswd.setup in manual: http://docs.phpm

css - Auto hide scrolling content sidebar on touch devices -

so, problem when have scrolled element, scrollbar on touch/mobile devices doesn't hide automatically when didn't scroll content. it's stays visible. but, have say, don't know if it's problem css .touch .scrollable rules or it's because i'm testing in device emulator in chrome (i don't have me right actual mobile device on test it). if can take @ code: http://jsfiddle.net/om4xmwnh/ , tell if/what wrong appreciate help. thanks! :) by using css cannot auto hide scrolling content sidebar on touch devices we have use mordernize js

c# - Drawing 2D polygons in openGL -

i'm using duocode try , draw 2d polygons in webgl. wrote specific shaders purpose take 2d-vertices , z position other data: <!-- fragment shader program --> <script id="shader-fs" type="x-shader/x-fragment"> varying highp vec2 vtexturecoord; uniform highp vec3 ucolor; uniform sampler2d usampler; uniform int usamplercount; void main(void) { highp vec4 texcolor =vec4(ucolor, 1.0); if(usamplercount > 0) texcolor = texture2d(usampler, vtexturecoord); gl_fragcolor = vec4(1.0, 1.0, 1.0, 1.0); } </script> <!-- vertex shader program --> <script id="shader-vs" type="x-shader/x-vertex"> attribute highp vec2 avertexposition; attribute highp vec2 atexturecoord; uniform highp vec2 uposition; uniform highp float uzlayer; varying highp vec2 vtexturecoord; void main(void) { gl_position = vec4(uposition + avertexposition, uzlayer, 1.0); vte

vaadin - BeanFieldGroup create nested entities -

@entity public class document { @onetomany(mappedby="paper", cascade={cascadetype.persist, cascadetype.merge, cascadetype.refresh}) private set<documentauthor> authors; } @entity public class documentauthor { @column(name="order") @notnull private integer order; @manytoone(optional=true, cascade={cascadetype.persist, cascadetype.merge, cascadetype.refresh}) @joincolumn(name="account", columndefinition = "integer") private account account; @manytoone(optional=false, cascade={cascadetype.persist, cascadetype.merge, cascadetype.refresh}) @joincolumn(name="document", columndefinition = "integer") private document document; } @entity public class account { @onetomany(mappedby="account", cascade={cascadetype.persist, cascadetype.merge, cascadetype.refresh}) private set<documentauthor> papers; } above entities want use beanfieldgroup. if edit/create do

ruby - undefined local variable or method `int' for Request:Class(rails) -

i facing problem when ever open form "service_create" throws error saying "undefined local variable or method". not know doing wrong please tell me problem(i new rails). service_request <%= link_to("back" , {:action => '#'}) %> <%= form_for(:request , :url => {:action => 'service_request_create'}) |f| %> <div class="field"> <%= f.label :corresponding_user_from %><br> <%= f.text_field :corresponding_user_from %> </div> <div class="field"> <%= f.label :product_service_location %><br> <%= f.text_field :product_service_location %> </div> <div class="field"> <%= f.label :title %><br> <%= f.text_field :title %> </div> <div class="field"> <%= f.label :description %><br> <%= f.text_field :description %> </div>

python - Stripping timestamp from Json int -

in third-party script, it's meant spit out json me decode instead prepends timestamp: 2015-03-28t16:32:41.875199+00:00 {"1": {"power (kw)": "0.301", "energy imported (kwh)": "62.281"...}} all of in 1 big integer. i've tried split based on space/whitespace contained before first curly bracket can not it. i'd appreciate pointers - i'm aware questions here basic, , apparently i'm going blocked unless improve, please don't shoot me asking simple one! updated 31/3/2015 @alex. i realise may seem impossible assure returns datatype of int. may not believe it, you'll have to, , check guy's code here . i've used call script: get_power=os.system("python /fetch_neurio.py --ip 172.16.0.8 --format json --type sensor") thedata = get_power print type(thedata) if find unbelievable @ code of fetch_neurio yourself. if you're struggling cretin me, no worries. came here ask help. thanks

java - Why won't my method returns divide properly? -

so i'm having trouble printresults method in testcandidate class. seems run expected, except column displaying percent of total votes each candidate received. reason, operation printing 0's. (for record, when use word "operation," i'm referring list[i].getvotes / gettotal(list) operation. clarify). i've tried various combinations of parenthesizing list[i].getvotes method , gettotal(list) method no avail. i've tried performing operation outside of print statement , printing variable operation have been assigned to. the strange thing is, when take either list[i].getvotes or gettotal(list) out , leave one, both print fine. not , can't figure out why. so, in summary, why won't list[i].getvotes / gettotal(list) divide properly? (please not try question asks for, i'd learn , fix own mistakes , best optimize code as possible cannot past 1 whatever reason). thank you! here's candidate class: public class candidate {

http - HSTS bypass with sslstrip+ & dns2proxy -

i trying understand how bypass hsts protection. i've read tools leonardonve ( https://github.com/leonardonve/sslstrip2 , https://github.com/leonardonve/dns2proxy ). quite don't it. if client requesting first time server, work anytime, because sslstrip strip strict-transport-security: header field. we're in old case original sslstrip. if not ... ? happens ? client know should interact server using https, automatically try connect server https, no ? in case, mitm useless ... >< looking @ code, kinda sslstrip2 change domain name of ressources needed client, client not have use hsts since these ressources not on same domain (is true?). client send dns request dns2proxy tool intercept , sends ip address real domain name.at end, client http ressources should have done in https manner. example : server response, client have download mail.google.com. attacker change gmail.google.com, it's not same (sub) domain. client dns request domain, dns2proxy answer re

java - Convert String to Date error -

this question has answer here: java - unparseable date 2 answers i try convert string date format, following does't work. string stringdate = "fri mar 27 17:14:27 eet 2015"; dateformat format = new simpledateformat("eee mmm dd hh:mm:ss zzz yyyy"); try { date newdate = format.parse(stringdate); } catch (parseexception e) { e.printstacktrace(); } the output java.text.parseexception: unparseable date: "fri mar 27 17:14:27 eet 2015" simpledateformat locale-sensitive, default locale may reason why exception thrown. try setting locale us. dateformat format = new simpledateformat("eee mmm dd hh:mm:ss zzz yyyy", locale.us);

android ndk - How to use make trace option from ndk -

****this question invoking make trace option ndk-build********* i trying trace through make file, , error. understanding ndk shell, calls make. should able invoke make switches; , can of them. trace option not work:-( please see output below; doing wrong pelase? @madscientist - downloaded , intalled version 4.0. still see same error. can run on system, , post command use? think may triggering switch out of order or something. if can see working instance, can fine tune command there. also; had @ link posted make-4.0 updates; debug listed there too. sooo not sure why or how debug working 3.81; maybe earlier version of it. not sure why debug works not trace. think ndk issue. did issue make directly, , not see trace working; don't see error prompted me post question. complaint used ":" , "::". going put ndk tag on post , hope ndk expertise chime in. appreciate help. sansari@ubuntu:~/androidstudioprojects/thirdndk/app/src/main$ make -version gnu make 4.0 bu

linux - Display single row by specifying line number? -

i want display content of file. way wanted is, when specify line number, should show row. example content in file named "file" follows: /home/john /home/mathew /home/alexander /home/testuser /home/hellouser i want display single row @ time giving line number, if specify 3, should show following row. /home/alexander i know way possible head , tail using -n flag, display entire rows upto line number specify, follows. head -n3 file /home/john /home/mathew /home/alexander i don't want that, want display " /home/alexander " when choose line number 3. how possible? with head , tail can following: head -3 file | tail -1

x86 64 - Porting x86_64 Assembly to AArch64 -

i'm trying convert existing inline x86_64 assembly aarch64 compatible version. encountering following errors upon compilation: /tmp/ccsvqf1i.s:72547: error: operand 1 should integer register -- `str [0x4,x1],#0x43e00000' /tmp/ccsvqf1i.s:72548: error: operand 1 should integer register -- `str [20,x1],2' the x86_64 code below if original , aarch64 code attempt @ porting it. x86_64 assembly: __asm__( "incq (%0)\n\t" "jno 0f\n\t" "movl $0x0, (%0)\n\t" "movl $0x43e00000, 0x4(%0)\n\t" "movb %1, %c2(%0)\n" "0:" : : "r"(&op1->value), "n"(is_double), "n"(zval_offsetof_type) : "cc"); a

Exclude files from Android Studio lint spell checker -

the android studio lint spell checker flags hex codes words in files better off unchecked, such values/colors.xml , build/intermediates/dex-cache/cache.xml . how tell lint not spell check folders or files? had same problem colors.xml i couldn't find way disable check file, rid of spellcheck on hex codes. click analyze->inspect code . choose whole project , click ok. the inspection tool window open results. you should able see problematic hex codes under spelling->typo . right click 1 of them , choose exclude . did trick me. hth

sql - Oracle Problems with Composite Keys -

bit confusing question here: trying create composite fk composite pk. i'll show tables in question i'm having problems with; create table weapons ( weapon_id varchar(10) not null, weapon_name varchar(30), range_in_meters int, maximum_number_of_uses int, damage_factor int, cost int, primary key(weapon_id)); create table weaponinventory ( inventory_id varchar(30) not null, weaponinventory_id varchar(10) not null, weapon_id varchar(10) references weapons(weapon_id) not null, primary key(inventory_id, weaponinventory_id)); create table avatars ( avatar_id varchar(10) not null, avatar_name varchar(30), ava_dob date, age varchar(30), gender varchar(30), strength_indicated int, hoard int, avatar_level varchar(30), skill varchar(30), original_owner varchar(30), family_id varchar(10) not null, species_id varchar(10) not null, inventory_id varchar(30) not null, weapon_id varchar(10) not null, player_id varchar(10) not null, primary key (avatar_id), foreign key (inventory_id, weap

c++ - Expected ';' before 'currentNode' -

here code void llinsertafter(list* mylist, node *insnode, std::string *tostore) { node node; node.value = *tostore; if(llsize(mylist) == 0) { (mylist -> head) = &node; (mylist -> tail) = &node; } else { node currentnode = *(mylist -> head); while(currentnode.value != (insnode -> value)) { currentnode = *(currentnode.next); } if(currentnode.next == null) { currentnode.next = &node; } else { node.next = currentnode.next; currentnode.next = &node; } } } here error message llist.cpp:73:8: error: expected ‘;’ before ‘aa’ node aa = *(mylist -> head); i can't see why error happen. the problem here: node node; after that, name node refers local variable, not type. since it's class type, refer class node or struct node thereafter; better option might use di

swift - What's the difference between if nil != optional … and if let _ = optional … -

i need test if expression returns optional nil . seems no-brainer, here code. if nil != self?.checklists.itempassingtest({ $0 === note.object }) { … } which, reason, looks unpleasant eye. if let item = self?.checklists.itempassingtest({ $0 === note.object }) { … } looks better me, don't need item, need know if 1 returned. so, used following. if let _ = self?.checklists.itempassingtest({ $0 === note.object }) { … } am missing subtle here? think if nil != optional … , if let _ = optional … equivalent here. update address concerns in answers i don't see difference between nil != var , var != nil , although use var != nil . in case, pushing != nil after block gets boolean compare of block mixed in boolean compare of if. the use of wildcard pattern should not surprising or uncommon. used in tuples (x, _) = (10, 20) , for-in loops for _ in 1...5 , case statements case (_, 0): , , more (note: these examples taken swift programming language).

css - Doing animation with ng-show without ngAnimate -

i want wipe-in animation ng-show. basically, want achieve simple animation shown in plunkr here. i know ngshow has hook ng-animate since angular 1.3. however, situation bit complicated. have carousel extend using angular ui carousel bootstrap. bootstrap has bug chrome, nganimate needs disabled elements under carousel tag. need animation element under carousel, if include nganimate, carousel won't work in chrome -- described in github issue tracker here as workaround, thinking animation using traditional css bootstrap ng-show inside carousel. did research have no luck far. possible? , try before? much! you can use ng-class directive instead of ng-show , ng-hide conditionally add class element should wipe-in, invoking desired transition, giving same effect , omitting entirely nganimate module. here's plunker showing implementation.

Converting text stored in Excel cell to a formula in VBA -

i'm not sure if possible i've been told co-workers can't because of nature of strings versus formulas. take string: '"=" & valrange.offset(0,0).address with range declared in vba routine , convert formula. in routine have following code: sub getrange() dim strsource string dim homerange range dim valrange range set valrange = range("k1") set homerange = range("e6") strsouce = homerange.value strsource = replace(strsource, """", "") range("e7") = strsource end sub as can see i've tried stripping characters not seem work (i understand code strip quotes wanted use example. thoughts on converting formula appreciated. matt let's valrange defined cell a1. in cell a2, have row offset value (say 0), , in cell a3 have column offset value (say 2). in cell a4, enter =address(row(offset(a1,a2,a3)), column(offset(a1,a2,a3))) you'll $c$1 in cell a4 value. so, 2 offsets

ios - Saving a file to .DocumentDirectory using Alamofire -

i'm trying download , save file documents directory. i've done locally on client without problem, when use same path in alamofire, series of errors. this download component: func downloadfileatindex(index: int) { alamofire.download(.get, "\(serverurl)/user/\(userid)/project/\(arrayofprojectids[index])/deliverable", { (temporaryurl, response) in let destinationfolder: string = nssearchpathfordirectoriesindomains(.documentdirectory, .userdomainmask, true)[0] string let filepath: nsurl = nsurl.fileurlwithpath("\(destinationfolder)/\(arrayofprojectids[index])/myfile.png")! return filepath }) } the response is: the operation couldn’t completed. (cocoa error 4.) the error is: the operation couldn’t completed. no such file or directory. i know directory doesn't exist yet, want create it, , doesn't seem issue when saving locally. insight appreciated. your directory not exist. need create nsfilemanage

android - send push notifications to a specific channel -

assuming subscribed more 1 channel, how can send message specific channel? i used lines: push.setmessage(msg); push.sendinbackground(); i tried use line push.setchannel(specific channel); didn't work.... but it's not enough since sends message channels. you have set channel push to. public void pushdata(string channel, string message) { parsepush push = new parsepush(); push.setchannel(channel); push.setmessage(message); push.sendinbackground(); }

javascript - setInterval(): How to stop then start itself again? -

in if statement, want interval clear , call object function of again restart interval. is such thing possible? i tried way, i'm getting unexpected behavior. can see log keeps on logging every 200ms. while should have stopped since interval stopped , restarted , condition wouldn't evaluate true anymore. datetime.prototype = { start: function () { var self = this; sendajaxrequest(this.timeurl, function () { var previoustime = new date().gettime(); this.tickintervalid = setinterval(function tick() { var currenttime = new date().gettime(); if ((currenttime - previoustime) < 0) { console.log('you changed time backwards. restarting.'); self.stop(); // <-- stopping self.start(); // <-- call same method running return; } self.dateelement.innerhtml = new date();

xss - WordPress + Disqus + refused executing inline script -

i've loaded disquss on wordpress website, running on https. problem while comments shown @ bottom of webpage, white (and since background of page white, not visible). if open inspector in chrome, following error printed console tab. refused execute inline script because violates following content security policy directive: "script-src https://*.twitter.com:* https://api.adsnative.com/v1/ad.json *.adsafeprotected.com *.google-analytics.com https://glitter-services.disqus.com https://*.services.disqus.com:* disqus.com http://*.twitter.com:* a.disquscdn.com api.taboola.com referrer.disqus.com *.scorecardresearch.com *.moatads.com https://admin.appnext.com/offerwallapi.aspx 'unsafe-eval' https://mobile.adnxs.com/mob *.services.disqus.com:*". either 'unsafe- inline' keyword, hash ('sha256-...'), or nonce ('nonce-...') required enable inline execution. this happens because of popup blocker extension in chrome, enable content

java - soap web service response very slow -

i generated soap web service and when try consume service have problem it takes many time response ( more 4 minutes ) i try test code : import javax.jws.webmethod; import javax.jws.webservice; import javax.jws.soap.soapbinding; import javax.jws.soap.soapbinding.style; @webservice @soapbinding(style = style.rpc) public interface balance { @webmethod string getvalue(); } this java class import javax.jws.webservice; @webservice(endpointinterface = "com.dq.test.web.manager.impl.balance") public class balanceimp implements balance{ @override public string getvalue() { // todo auto-generated method stub return "test"; } } to publish web service used code : endpoint.publish(" http://192.168.1.13:8080/ws/testsoap ", new balanceimp()); this code of wsdl : <!-- published jax-ws ri @ http://jax-ws.dev.java.net. ri's version jax-ws ri 2.1.6 in jdk 6. --> <!-- generated jax-ws ri @ http:

c++ - C# Pointer: error CS0254: The right hand side of a fixed statement assignment may not be a cast expression -

i have c++ server , trying make c# client. in c++, send packet make this: pmessage *msg = (pmessage*)&buf[0]; msg->id = pid_login; sendto(sserver, buf, sizeof(buf), 0, (sockaddr*)&from, fromlen); in c# trying this: unsafe { try { byte[] rawdata = new byte[marshal.sizeof(typeof(pmessage))]; fixed (pmessage* p = (pmessage*)&rawdata[0]) { // p->id = 1001; } udpclient.send(rawdata, rawdata.length); ; } catch (exception ex) { messagebox.show(ex.tostring()); } } the compiler show error: error cs0254: right hand side of fixed statement assignment may not cast expression. c#: [structlayout(layoutkind.sequential, pack = 1)] unsafe struct pmessage { public fixed byte msg[256]; public int id; public int size; } c++: struct pmessage { char msg[256]; unsigned int id; unsigned int size; }; you can't this, bec