Posts

Showing posts from July, 2015

javascript - Google Chrome Extensions: How to include jQuery in programmatically injected content script? -

i'm injecting content script background page when user clicks browser action button, so: chrome.browseraction.onclicked.addlistener(function (tab) { chrome.tabs.executescript(null, { file: "content.js" }); }); so how can access jquery inside content.js ? don't see way inject simultaneously. what about: chrome.tabs.executescript(null, { file: "jquery.js" }, function() { chrome.tabs.executescript(null, { file: "content.js" }); }); you can download "jquery.js" here: http://jquery.com/download/

android - FloatingActionButton with animated icon -

Image
i trying create floatingactionbutton icon : https://github.com/jd-alexander/likebutton as can see, button animated , not 2 different buttons changed. here actual basic floatingactionbutton, static icon : <android.support.design.widget.floatingactionbutton android:layout_height="wrap_content" android:layout_width="wrap_content" app:layout_anchor="@id/appbar" app:layout_anchorgravity="bottom|right|end" android:src="@drawable/ic_favorite_border_white_24dp" android:layout_margin="@dimen/fab_margin" android:clickable="true"/> i not want change icon, make animation when click on it. here button need, in case not included in floatingactionbutton : <com.like.likebutton android:id="@+id/like_button" android:layout_height="32dp" android:layout_width="32dp" app:icon_type="heart" app:circle_start_color="@color/re

security - How to keep QR code secure? -

as our restaurant management system, customer scan qr code take order. qr code keeps info of restaurant id , table id. however, how can make sure customer scan qr code inside restaurant, not outside restaurant , take useless order maliciously?

javascript - React.js: loading JSON data with Fetch API and props from object array -

totally new react.js , after going through tutorial , reading docs, i'm still struggling bit using js fetch load data json file setting properties array of objects. i'm not i'm accessing dom properties correctly in event handler. must missing rather straightforward. for reference, here's code rest of project , here's it's supposed like. eta: had no idea docs babel browser deprecated decided use straight javascript es5 syntax instead of jsx. code updated below, it's still not rendering markup. var canvasanimation = react.createclass({ getinitialstate: function() { return {data: []}; }, loaddata: function() { /* fetch("data.json") .then(function(response) { return response.json .then(function(json){ this.setstate({data: json}); }.bind(this)) }.bind(this))

css change hover size depending on header length -

enter image description here hello im new this. have created webpage links running horizontally across page. when hover on each title has background colour. hover size fixed size. want know how can hover automatically adjust depending on link length. /* change link color #272727 on hover */ li a:hover { background-color:#272727; max-width:200px; } thanks help it looks me "max-width: 200px;" css property isn't required. try: li a:hover { background-color:#272727; } without specifying explicit max width, link elements size width of parent li. when set background colour on hover, entire word highlighted, without overflow. but if provide fiddle confirm, that'd helpful!

javascript - Animate a circle being drawn using Paper.js -

i'm trying animate circle being drawn using paper.js. as circle tool quick access instantiating path constructed via moveto/arcto etc, there no arguments support start , end angles (for open pie chart-like circles). what looking way animate circle being drawn it's first point angle of choice @ radius. the actual canvas specification allows explicit startangle , endangle specified. if case within paper.js achieve looking for. however, within paper.js have yet come across method of replicating such control. created in fabric.js worked fabric's implementation of circle shape used same attributes arc command in specification. does know of way can achieved can animate endangle? here's conversion function accepts html5 canvas arc arguments , returns from, through, to arguments needed paper.js arc. function canvasarctopaperarc(cx,cy,radius,startangle,endangle,strokecolor){ var startx=cx+radius*math.cos(startangle); var starty=cy+radius*math.si

javascript - Firebase authentication issue using AngularJS/AngularFire -

this question has answer here: angularfire 2 error: specified authentication provider not enabled firebase 1 answer i getting error response firebase when trying make registration form register user. using angularjs , angularfire. the error is: the specified authentication provider not enabled firebase. here form: register.html <form name="registrationform" ng-submit="register()" novalidate> <div class="form-group"> <label for="exampleinputemail1">first name</label> <input type="text" ng-model="user.firstname" ng-required="true" class="form-control form-control2" id="exampleinputemail1" placeholder="first name"> </div> <div class="form-group"> <label for="exampleinputemail1"

java - Please explain gettersetter_method from this method -

i have 1 small program related getter , setter concept, i'm getting null value reason don't understand. here code, need pass multiple strings in single object: public class simple { public object getmethod(){ getter s=new getter(); string app="apple"; s.setapp(app); string ble="blue"; s.setgrp(ble); string re="grape"; s.setgrp(re); return s; } } here getter method: public class getter { string app; string org; string grp; string mn; public string getapp() { return app; } public void setapp(string app) { this.app = app; } public string getorg() { return org; } public void setorg(string org) { this.org = org; } public string getgrp() { return grp; } public void setgrp(string grp) { this.grp = grp; } } and here test class: public cl

php - date_create_from_format is returning wrong day -

i facing issue date_create_from_format php. here code: date_default_timezone_set('asia/kathmandu'); $date = date_create_from_format('d/m/y h:ia', '28/05/2016 15:24pm'); echo date('d/m/y h:ia',$date->gettimestamp()); //returns 29/05/2016 03:24am i trying change 24 hour time 12 hour. working.thanks. you must create date 1 type. use pm-am or 24h format . otherwise 15:43 pm = 12:43 pm + 3 hour. try this: $date = date_create_from_format('d/m/y h:i', '28/05/2016 15:24'); update if not control input data, can use crutch: $date = date_create_from_format('d/m/y h:i', substr('28/05/2016 15:24pm', 0, -2));

php - dynamic page is not working -

i have created controller named index , want develop dynamic controllers big hurdle creating page name again , again decided create have confusion though how developing pages have placed option in admin panel users can create pages though big issue unable retrive pages. controller public function index($page = 7) { //$page = 7 7 default page set home $page_data = $this->get_data->alldata('pages', $page); $data['title'] = $page_data->row()->pagetitle; $class = explode("/", $page_data->row()->template); $data['body_class'] = $class[1]; $this->load->view('includes/header.php', $data); if($class[1] == 'home') { $this->load->view('templates/slider'); } $this->load->view('templates/navigation.php'); $page_content = $page_data->row()->template; $th

activerecord - CodeIgniter: Returning data as an object vs array -

there functions return data either object: $query = $this->db->query("your query"); if ($query->num_rows() > 0) { foreach ($query->result() $row) { echo $row->title; echo $row->name; echo $row->body; } } or array: $query = $this->db->query("your query"); foreach ($query->result_array() $row) { echo $row['title']; echo $row['name']; echo $row['body']; } i've returned data arrays, when case returning "object" preferable? performance. array better object. http://www.spearheadsoftwares.com/tutorials/php-performance-benchmarking/50-mysql-fetch-assoc-vs-mysql-fetch-array-vs-mysql-fetch-object

annotations - How to annotate a code block in Java -

is possible annotate block of code? e.g. cycle or curly brackets? if so, how? first.java package an; import an.forcycle; class first { public static void main(string[] args) { first f = new first(); } public first () { @forcycle { // error: illegal start of type { int k; } @forcycle (int = 0; < 5; i++) { // similar error (illegal start...) system.out.println(i); } } } forcycle.java package an; import java.lang.annotation.documented; import java.lang.annotation.elementtype; import java.lang.annotation.retention; import java.lang.annotation.retentionpolicy; import java.lang.annotation.target; @retention(retentionpolicy.source) public @interface forcycle {} according http://www.javacodegeeks.com/2012/11/java-annotations-tutorial-with-custom-annotation.html @target – indicates kinds of program element annotation type applicable. possible values type, method, const

Java: Get two arrays and if length of one is smaller than the length of the other, replace missing values with 1 -

hi question is: if array1 smaller array2 replace missing values number 1, array1 missing values can multiplied array2 if number 1? here idea of how 1 go it... correct syntax? best way go it? public addmissingnumber(int[] array1, int[] array2){ (int 1 = array1.length; > 0; i--) for(int j = array2.length; j > 0; j--){ if(array1[i] < array2[j]) { array1[i].[j] = 1; /*what want here empty position of array1[i] equivalent position of array2[j] contains number should become number 1. how can done?* } } } here original exam question, second part i'm having trouble with: write method called add takes 2 arrays v, w of type double parameters. method should return new array of double formed adding corresponding elements of input arrays. say, element of output array should equal v[i]+w[i]. if lengths of v , w different, output array should have length maximum of (v.length, w.length). missing elements of shorter array should assumed 1 in calculation

react jsx - Typescript, JSX: render component, passed as argument -

i want write function, renders react component, passed argument function. want handle both component , statelesscomponent types. how that: function rendercomponent(component: react.componentclass<any> | react.statelesscomponent<any>) { return <component />; } i got compilation error: error ts2604: jsx element type 'component' not have construct or call signatures. what doing wrong? in example rendercomponent function getting instance of component , not class/ctor. should be: function rendercomponent(componentclass: { new (): react.componentclass<any> | react.statelesscomponent<any> }) { return <componentclass />; }

inheritance - Java implementation of this - calling a Parent class method to utilizing Child class data member -

this question regarding implementation decision of super , this in java. consider, parent class contains variable name , method getname() public class parent { protected string name = "parent"; protected string getname(){ return this.name; } } and child class inherits parent class has own name variable public class child extends parent { protected string name = "child"; protected void printnames() { system.out.println("parent: " + super.getname()); system.out.println("child: " + this.getname()); } public static void main(string[] args) { child c = new child(); c.printnames(); } } output: parent: parent child: parent from output, can see that: when method getname() invoked child class super context, returns "parent", when invoked this context, again returns "parent" if method present in parent class, data members same acces

python - Edit multiple objects with Get() function Django -

i want edit 2 forms in django. form 'motel' , 'images'. in app, users can upload multiple images 'motel' model. , now, editing images 'get()' function giving me, multipleobjectsreturned get() returned more 1 motelimages -- returned 4! models class motel(models.model): user= models.foreignkey(user) title= models.charfield(max_length=120) body= models.textfield() #other fields class motelimages(models.model): motel= models.foreignkey(motel, default=none, related_name='images') image= models.imagefield(upload_to='company', verbose_name= 'image') class motelimagesform(forms.modelform): image= forms.imagefield(label='image',) def __init__(self, *args, **kwargs): super(motelimagesform,self).__init__(*args, **kwargs) self.fields['image'].widget= forms.fileinput(attrs={'name':'image', 'm

appcelerator - Titanium CLI alloy execution location -

i wrote small hack enable writing titanium apps typescript ( https://github.com/developer82/ti.typescript ). involves editing sdk alloy compiler script. as can tell i've written script located @ /users/your_username/.appcelerator/install/sdk_version/package/node_modules/alloy/alloy/commands/compile/index.js when run project titanium studio works great. when try run command line using ti build -p ios i'm getting error this project requires typescript hack in titnaium sdk - validation wrote hack applied compiler. the reason running command line, cli looking alloy in /usr/local/bin/alloy - learned following output: [info] executing alloy compile: /usr/local/bin/node /usr/local/bin/alloy compile /users/ophir/documents/appcelerator_studio_workspace/my_project/app --config platform=ios,version=0,simtype=none,devicefamily=universal,deploytype=development,target=simulator why different location? why cli doesn't work appcelerator studio? how can make work appc stud

readfile - Trying to read formatted file in C -

i'm trying read formatted file in c sample line of file: surname;name;minutes'seconds''one-hundredths of second i wrote code: while(!feof(fp)) { fscanf(fp,"%[^;]s",surname); fscanf(fp,"%c",&c); fscanf(fp,"%[^;]s",name); fscanf(fp,"%c",&c); fscanf(fp,"%d'%d''%d",&min,&sec,&sec_cent); fscanf(fp,"\n"); } it works name , surname strings, doesn't extract time minutes'seconds''one-hundredths of second , don't know why can me? there couple of things may want change in code: always check return value of scanf (or fscanf ) see if data read. don't use feof() control loop . you don't need extract '\n' scanf, unless going use getline() afterwards. you don't need s too, format specifier, should prevent buffer overflows limiting number of chars read each field. you can use modifier %*c ski

javascript - moment.js add month but bad format -

i'm using moment.js manipulate dates. have value stored in field, value et add 1 month. here code: var mydate = $('#crueventmodal #rdvstartdate').val(); alert('date get:' + mydate); // get: 25-05-2016 mydate = moment(mydate).format("dd-mm-yyyy"); alert('date transformed:' + mydate); // get: nan-nan-0nan var new_date = moment(mydate, "dd-mm-yyyy").add('months', 1); alert('end date: ' + new_date); // get: -62164630800000 but result: 25-06-2016 help please? format used format momentjs date, not specify how parse it. if want parse string date specific format, should use moment(string, format) . have at documentation here . var mydate = "25-05-2016"; console.log('date get: ' + mydate); mydate = moment(mydate, "dd-mm-yyyy"); console.log('date transformed: ' + mydate); var new_date = moment(mydate, "dd-mm-yyyy").add(1, 'months'); // 'months

c# - WCF or ASP.NET 5 WEB API to create service for simple social network? -

i beginner in .net, , write simple social network. better: wcf or asp.net 5 web api create service? , problem: how make two-way communication between service , client (when user1 sends message user2, user2's message box has change)? far know, in wcf callbackcontract can used, , how in web api? i grateful answer :) i recommend wcf's inbuilt capability if want 2 way communication. but scenario have given talking end users , not clients, today want send message user 2, tommorrow user3,user4 , on. so if want collect input 1 of end user through whatever means prefer , broadcast set of users should user signalr.

How do you implement bower in AWS Lambda? -

total noob here. how implement bower in aws lambda? i'm trying have aws lambda run bower install i'm not sure how upload bower aws lambda. have tried googling tutorials , pre built lambda functions , have not found related bower. you have deploy package either s3 or lambda dependencies packaged together. cannot install dependencies lambda itself. here link might if want deploy machine lambda using npm: https://medium.com/@slyfirefox/micro-services-with-aws-lambda-and-api-gateway-part-1-f11aaaa5bdef#.6bk44snwm .

java - Filewriter-Printwriter not working with jar on linux -

i have pieace of code: calendar ca=calendar.getinstance(); filewriter fw = new filewriter("locations_elapsed time iterations.txt", true); printwriter pw = new printwriter(fw); ca.settime(new date()); a++; pw.write("user " + + " " + ca.get(calendar.millisecond)); pw.println(); pw.close(); it works fine when run netbeans (ofcourse). want execute on server away machine works linux, make jar file this. the problem is not writing anything. ideas? thanks! i can't comment yet: can give little more detail happens when launch jar? how launch it? file calling stored? @ first glance think don't have exception handling , cannot see file hasn't been found or on like. way, suggest (for testing purposes) use files.write

python - Accessing values of a dictionary in a list using lambda -

i'm newbie python. i've multiple dictionaries inside list , want analysis based on values. reason i'm using lambda because function not expected. i'm showing 2 dictionaries reference, output gives me multiple dictionaries @ times. statistics = [{"ip_dst": "10.0.0.1", "ip_proto": "icmp", "ip_src": "10.0.0.3", "bytes": 1380, "port_dst": 0, "packets": 30, "port_src": 0}, {"ip_dst": "10.0.0.3", "ip_proto": "icmp", "ip_src": "10.0.0.1", "bytes": 1564, "port_dst": 0, "packets": 34, "port_src": 0}] packets = filter(lambda x: x[0]["packets"], statistics) ip_src = filter(lambda x: x[0]["ip_src"], statistics) ip_proto = filter(lambda x: x[0]["ip_proto"], statistics) when i'm using print statement,

broadcastreceiver - android BootCompletedReceiver not fire -

i have android application config on manifest : <receiver android:name="ir.hamgam.fion.ec.mobile.services.bootcompletedreceiver"> <intent-filter> <action android:name="android.intent.action.boot_completed"/> </intent-filter> </receiver> and in receiver have : public class bootcompletedreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { if (intent.getaction().equals(intent.action_boot_completed)) { log.w("boot_broadcast_poc", "starting service..."); apkupdatereceiver.setalarm(context); datareceiver.setalarm(context); notificationupdatereceiver.setalarm(context); } } } when application starts , boot completed not fire inside method onreceive,give me hint please. please below, works fine. put toast inside receiver notified receiver call

angularjs - How to launch url in a modal? -

i trying launch modal has url in when user clicks button. i have these: mymodal.html: <div class="modal-header"> title 1 </div> <div class="modal-body"> <iframe id="iframe" ng-src="{{my_url}}"> </div> in js: $scope.clickbutton = function(){ var modal = $uibmodal.open({ templateurl: 'mymodal.html' controller: 'myctrl', }); }) in myctrl: .... $scope.my_url = 'http://myotherproject/project/index.html'; .... i want url launched modal shows. iframe approach works wondering if there more elegant way this. help! depending on trying achieve here, if want display html own styles, can use $sce.trustashtml , ng-bind-html directive. if want custom styles inside , js, iframe safer solution. angular.module('app', []); angular .module('app') .controller('example', function ($sce) { const somehtml

android - Loading an image of a website that contains redirects -

i doing small app fun while playing around uis , several other things in android studio. tried load image based on url code: httpurlconnection connection = (httpurlconnection) url.openconnection(); connection.setallowuserinteraction(false); connection.setrequestmethod("get"); connection.connect(); inputstream input = connection.getinputstream(); bitmap mybitmap = bitmapfactory.decodestream(input); however throw filenotfoundexception urls. guessing due webpage checking client conditions. 1 example image: https://kissanime.to/content/mobile/images/logo.png works fine when loading via webbrowser though. not own page, not know causing issues. there way debug/solve this? //edit: seems website returns 503 statuscode when using httpurlconnection //edit 2: after inspecting response message seems webpage contains type of javascript loads image after 5 second delay

Python dictionary, how to keep keys/values in same order as declared? -

new python , had question dictionaries. have dictionary declared in particular order , want keep in order time. keys/values can't kept in order based on value, want in order declared it. so if have dictionary: d = {'ac':33, 'gw':20, 'ap':102, 'za':321, 'bs':10} it isn't in order if view or iterate through it, there way make sure python keep explicit order declared keys/values in? using python 2.6 from collections import ordereddict ordereddict((word, true) word in words) contains ordereddict([('he', true), ('will', true), ('be', true), ('the', true), ('winner', true)]) if values true (or other immutable object), can use: ordereddict.fromkeys(words, true)

ruby on rails - Accessing a HABTM join table in the view -

i working on creating shopping lists in app , struggling understand methods of using join table return desired attributes of inventory_item in views. want return these attributes of inventory_item in lists - :price, :vendor, :name, :details, :brand. have these relevant models: what best practice working join table in view? can suggest simple console testing familiarize myself practice? in advance! class inventoryitem < activerecord::base belongs_to :item, :foreign_key => :item_id belongs_to :vendor has_and_belongs_to_many :shopping_lists end class item < activerecord::base has_many :inventory_items has_many :vendors, through: :inventory_items end class shoppinglist < activerecord::base has_and_belongs_to_many :inventory_items belongs_to :user end class vendor < activerecord::base has_many :inventory_items has_many :items, through: :inventory_items has_many :shopping_list_items end class user < acti

c# - Using DataAnnotations with Regular Expressions to not Match -

is possible dataannotation s , regular expressions filter entry in text box ? i.e. trigger invalid response when word "apt" in string ? yes can using negative look-arounds, this: public class mymodel { [regularexpression(@"^((?!apt).)*$", errormessage = "you can not have that")] public string myvalue { get; set; } } here reference question these types of regular expressions. regular expression match string not containing word?

gruntjs - Simple Grunt copy command not working -

i know there obvious i'm missing can't see it. have grunt copy file i'm running. copy: { dev: { files: [ { expand: true, src: [ "../index.html", "../views/**", "../scripts/**", "../styles/**", "../data/**", "../images/**" ], dest: "../../iphone/www/" } ] } } everytime run files go ../../iphone folder instead of ../../iphone/www folder. don't understand why it's copying 1 level when i'm saying copy www folder. again know i'm missing trivial , small, can't see it. in advance. edit: found interesting. if add arbitrary folder after www (i.e. ../../iphone/www/assets) correctly copy www fol

angular - Firebase 3 - Ionic 2 - .on('value' , snapshot => { this...} this is null -

when try retrieve data using firebase 3 sdk web, "this" showing null. idea why might occur ? this.mainapp = firebase.initializeapp(config); fbget(path){ return this.mainapp.database().ref(path); } ... getuser(){ this.appdata.fbget('users/'+user.uid).on('value', function(snapshot) { var objuser = snapshot.val(); //the following statement throwing exception cause 'this' null this.events.publish('user:update', objuser); }); } thank you you're not using arrow function fbget , this not bound component/provider. getuser(){ this.appdata.fbget('users/'+user.uid).on('value', (snapshot) => { const objuser = snapshot.val(); // bound component using fat arrow => this.events.publish('user:update', objuser); }); } the above solution work if this.events property on same component/provider.

python - While Loops Only Iterates Correctly Once -

i working on python script brute force deobfuscate malicious java script have been finding in security events. long story short @ 1 point in process obfuscating script redirects payload xor. here how going this. python: #!/usr/bin/python import os import subprocess perl = "perl -pe 's/([;\}\{])/$" userinput = input("") tail = (r"\n/g'") def deobbrute(): count = 0 while (count < 101): return(str(userinput)+str(perl)+str(count)+str(tail)) count = count + 1 output = subprocess.popen(deobbrute(), shell=true).wait results = 0 while (results < 101): print(output) results = results + 1 the user input feeding it: cat elsepagexoffset | elsepagexoffest text file storing obfuscate js in. it iterates once unless obfuscating xor^1 me no good. error message other iterations: <bound method popen.wait of <subprocess.popen object @ 0x7fb65c6c9128>> if metho

ruby - How do I compare dates in Rails? -

i'm trying compare dates in rails. created method: def compare_dates = time.now.utc.to_date if == next_appointment_date return "today" else return "not today" end end when call method in view, received "no today", if now date , next_appointment_date equals. there helper method in rails datetime#today? rewrite method to: def compare_dates if next_appointment_date.today? "today" else "not today" end end

c# - Why do the references for my Form1 object and my instantiated class Guess not exist in the current context? -

i'm new windows forms , i'm having trouble making program work form1 reference 'form' spits out error: "the name 'form' not exists in current context" every use of , reference variable 'guess' instantiates guess class giving me error: "the type or namespace name 'guess' not found (are missing using directive or assembly reference?)" every use. i'm sure i'm making simple mistake can't figure out. in advance. guess class using system; namespace guessinggame { public class guess { private int guess; private int guesscount; private random r = new random(); private int number; public int guess { get; set; } public int guesscount { get; set; } public int number { get; set; } public guess() { this.guesscount = 0; number = r.next(0, 101); } public guess(int num) { this.guess = num; this.guesscount++; number = r.next(0, 101)

php - How can I create a shared-secret voucher code system between 2 independent servers? -

given workflow: server a user authenticates. user purchases randomly generated unique voucher code using shared secret use application on on server b. server b user authenticates. user inputs voucher code. server b validates code legitimate using shared secret server b grants access application. i need way in php implement functions generatevouchercode , validatevouchercode shown below: server a $voucher = generatevouchercode("somesharedsecret"); server b $isvalid = validatevouchercode($userinputtedcode, "somesharedsecret"); if($isvalid) { // allow access application } validating legitimacy through shared secret hmacs for. can generate hmac in php through hash_hmac . workflow be: server generates one-use code (in manner want) , calculates hmac. pair of code + hmac given user voucher code. user presents voucher server b. server b isolates one-use code voucher , independently calculates hmac using shared secret. if ca

java - Jackson binary serialization for custom class -

i trying serialize class using jackson in binary format , struggling after trying number of different alternatives. hoping can help. my custom class looks like: package com.common; import java.io.fileinputstream; import java.io.ioexception; import java.io.inputstream; import java.util.list import org.apache.jena.rdf.model.model; import org.apache.jena.rdf.model.rdfnode; import org.apache.jena.rdf.model.statement; import org.apache.jena.util.filemanager; import org.apache.jena.util.iterator.extendediterator; import com.fasterxml.jackson.annotation.jsoncreator; import com.fasterxml.jackson.databind.jsonnode; import com.fasterxml.jackson.databind.objectmapper; import com.fasterxml.jackson.databind.node.arraynode; import com.quick.rdfmain; import com.quick.exim.importer; import com.quick.exim.sqejsontordfimporter; import com.quick.trans.rdfformulatosparqltranslator; /** * reasoning request, request r

c# - Hold down button unity3d -

i trying build button changes game speed when being pressed , changes when stops being pressed. to make wrote functions: public void onpointerdown() { mousedown = true; background1.sprite = on; time.timescale = 2; } public void onpointerup() { time.timescale = 1; mousedown = false; background1.sprite = off; } they connected button. when button pressed game speed changes, never changes (it should happen when stop holding button). know how fix this?

Gojs rendering diagram in memory and converting into svg -

we have requirement users selects different checkboxes , based on checkbox diagram downloaded svg files. my plan data based on ids checked in checkbox, render the gojs diagram in memory , convert respective svg calling makesvg. will above plan work? when drawing in memory different events trigger documentchange, intiallayout complete? yes, work, either on client side or on server side. for demonstration of former, see http://gojs.net/latest/samples/flowchart.html . for demonstration of latter, see http://gojs.net/latest/intro/serversideimages.html , although generates image rather svg. call makesvg instead , not use img element @ all.

jquery - enable anchor in twitter bootstrap modal -

i have bootstrap modal works perfect. the header/body/footer of modal filled right data. inside modal body have content links other pages, reason ”like” disabled. i guess bootstrap applies event.preventdefault(); links inside modal body, or similar. is there way re-enable them? html: <div class="modal show fadein static-modal" id="singlepagebox" data-show="true" data-backdrop="true" data-toggle="modal"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h2 id="mymodallabel">dummy header</h2> </div> <div class="modal-body"> <p>lorem ipsum <a href="http://google.com" target="_blank" class="ext_link">it popularised</a> in.</p>

c - Dynamic Memory Allocation with pointer arrays -

i trying learn c tutorials on web, , came simple code try , understand memory allocation on pointers , arrays. the code compiles , runs flawlessly if size <= 2, if size > 2 gives segmentation error. can please shed light on how properly? thank you. #include <stdio.h> #include <stdlib.h> int main () { int i, size; printf("quantos registos pretende inserir? "); scanf("%d",&size); getc(stdin); typedef struct { char nome[81]; int idade; char cargo[81]; } dados; dados *data[(size-1)]; data[(size-1)] = (dados *)malloc(sizeof(dados)); for(i=0;i<size;i++) { printf("\ninsira os dados funcionário: "); printf("\n\n\tnome: "); gets(data[i]->nome); printf("\n\tidade: "); scanf("%d",&data[i]->idade); getc(stdin); printf("\n\tcargo: "); gets(data[i]->cargo); file *fdados; if(!(fdados = fopen("dados.txt","

Executing Azure SQL DML statements from Azure ML -

is possible run azure sql dml statements (update or delete) azure machine learning studio. please help! currently no. there no odbc driver in container. if provide more details want delete maybe can offer workaround. but update db... use execute python send event event hub(in service bus). connect event hub via stream analytics. there can set azure sql db output port update row. let me know if need more details step.

Internet Permission Error in Android -

i made simple currency converter application android. taking latest currency rates internet, need give permission connect internet manifest file. i added line manifest file before <uses-permission android:name="android.permission.internet" /> i created apk file of application , installed phone. android version of phone 4.4.2 , when wifi open gives error. when wifi closed application opened can't take xml data. installed apk file phone of friend , anroid version of phone 6.0. works in phone without problem. i added lines manifest file <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.access_wifi_state" /> <uses-permission android:name="android.permission.change_wifi_state" /> <uses-permission android:name="android.permission.change_network_state" /> <uses-permission android:name="android.permission.access_n

html - How to make html5 "week" input type start on sunday -

<input type="week" /> shows highlighted starting week monday. there way make show sunday start of week prevent confusion? i don't believe possible @ time. can find spec "week" input type here: http://www.w3.org/tr/html-markup/input.week.html there no mention of specifying start day.

web services - encoding of query string parameters in IE10 -

Image
i got request customer wants able type query string of web service parameters in ie10 address bar , service results. parameters include string in hebrew, like: http://mywebsite.com/service.asmx/foo?param1=123&param2=מחרוזתבעברית it looks me that ie10, unlike other (normal) browsers, won't encode query string parameters - every non-ansi character goes after ? mark turned '3f' byte, though encode goes before ? mark - url itself. for example, if try reach url (the parameter imaginary, url not, , have no connection site) http://www.shlomo.co.il/pageshe/sales/רכב-למכירה.asp?param=פאראם and in wireshark bytes send server, shows me you can see substitute hebrew part of url urlencoded string, substitutes hebrew parameters ?????, '3f's. the same string in chrome encoded in it's entirety: get http://www.shlomo.co.il/pageshe/sales/%d7%a8%d7%9b%d7%91-%d7%9c%d7%9e%d7%9b%d7%99%d7%a8%d7%94.asp?param=%d7%a4%d7%90%d7%a8%d7%90%d7%9d http/1.1 i tried o

html - Best way to attach icon left to a text -

i'm bad css, using bootstrap & set icon before , i'd create "blog" talking bets , have add type of sport chose use icons in list screenshot here so tried can see it's not good, list supposed make 1 line, not 2, icon should @ left i tried deal ":before" didn't succeed, i'd way it, me change dynamically icon php (by updating list) what best way make ? flexbox way align things these days. might started: ul {list-style:none;} li {display:flex;align-items: center;} img {margin-right:10px;} <ul> <li><img src="http://placekitten.com/49/51" /> john doe</li> <li><img src="http://placekitten.com/50/50" /> peter rabbit</li> </ul> references: https://css-tricks.com/snippets/css/a-guide-to-flexbox/ https://philipwalton.github.io/solved-by-flexbox/demos/vertical-centering/

ruby on rails - Best Practice for DB Migrations that Affect Many Tables -

say have database of 50 tables. making change wording of 1 of columns relationship affects 20 of tables. how set migration? see @ least 3 possibilities a separate migration change on every table a single migration of them changing initial declaration of creation of tables. i'm quite confident 3 worst approach because cannot migrate have rebuild entire schema. i'm stuck between 1 , 2. 2 best approach because creating 1 migration 1 change happens affect lot of tables. i'm leaning towards. on other hand, feels messy. any resources on appreciated well. thanks it makes more sense go option 2. say take option 1 , x separate migrations. you'll end x migrations mess database's integrity, you'll have run them (or rollback them if want undo changes). if changes need made together, makes sense put them in same file

c# - What are the benefits of reducing references? -

this question has answer here: why remove unused using directives in c#? 10 answers what difference between : using system; using system.collections; using system.collections.generic; using system.linq; using system.text; and using system; using system.collections.generic; does affect performance when adding "too much" references ? big applications, there difference removing useless references ? i mean, if use "using system" seems enough cover of requirements, why should specific adding specific references under system reference? thanks it's matter of code readability. yes, maybe right while you're writing code, know aren't using system.linq , presence doesn't bother you. after all, 1 day might use it, right? but day else going reading , maintaining code, or will, long enough afterwards you've forgotten c

c++ - Cryptic template template parameter error -

i'm trying create function gets keys std::map or std::unordered_map . use simple overload, first i'd love know what's wrong code. template<typename k, typename v, template<typename, typename> class tcontainer> std::vector<k> getkeys(const tcontainer<k, v>& mmap) { std::vector<k> result; for(const auto& itr(std::begin(mmap)); itr != std::end(mmap); ++itr) result.push_back(itr->first); return result; } when calling std::unordered_map , specifying all template typenames manually, clang++ 3.4 says: template template argument has different template parameters corresponding template template parameter. the problem std::map , std::unordered_map not in fact templates 2 parameters. are: namespace std { template <class key, class t, class compare = less<key>, class allocator = allocator<pair<const key, t>>> class map; template <class key, class t,

html5 canvas - page.evaluate not working but page.exeute_script showing results -

i have been using phantomjs render canvas element on page using threejs. earlier building page myself, did not gave option of adding background image through system url. after started using localhost url, did not worked when used page.evaluate(); surprise when use ruby/watir browser selenium same operation using execute_script method, works. want know doing differenty implement in phantomjs script instead of having watir/selenium etc. thanks in advance.

mysqli - Connection failed: Access denied for user ''username'@'localhost' (using password: YES) -

i trying connect mysql on server gives following error. user created , granted privileges. its working on local machine not after deploying server. also mysql_connect function works mysqli () gives access denied mentioned below. also tried adding port. any please. help appreciated. thanks, warning: mysqli::mysqli(): (hy000/1045): access denied user ''usernam'@'localhost' (using password: yes) in /home/domainname/public_html/autopublish/test.php on line 8 connection failed: access denied user ''username'@'localhost' (using password: yes) <?php $servername = "localhost"; $username = "'xxxxx"; $password = "xxxxx"; $dbname = "xxxxx"; // create connection $conn = new mysqli($servername, $username, $password); **//line 8** // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } els

html - JavaScript document.getElementsByName() argument to match input name as array -

i using php generate form questions: <form action="formaction.php" method="post" name="form"> <?php ($j=0;$j<$no_of_ques;$j++) switch ($qtype[$j]) { case shorttext: echo " <textarea name='qno[$j]'></textarea>"; break; case checkbox: for($l=0;$l<$no_of_choices;$l++) { echo "<input type='checkbox' name='qno[$j]' value='$choices[$l]'>$choices[$l]"; } break; } ?> <a href='#' class='submit button'onclick='myfunction()'>submit</a> <script> function myfunction(){ if (document.getelementsbyname("qno").checked) document.forms['form'].submit(); } </script> this incorrect.i using styled anchor submit form js. how must use js validate if each question has been answered? give them same classname , access them via getelementsbycl