Posts

Showing posts from May, 2014

ajax - Reading JSON values in servlet -

i posting jquery ajax post servlet , data in form of json string. not sure whether data getting posted or not. also, want verify login , password fetching json object. heres code snippet: <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript" src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script> <script type="text/javascript"> function doajax(){ var fullname=$("#fullname").val; var mobileno=$("#mobileno").val; $.ajax({ url: 'dvsds', type: 'post', datatype: 'json', data:{ "mobileno":mobileno, "fullname":fullname}, error:function(){ alert("error occured!!!"); }, success:function(data){ alert(data.message); } }); } </sc

mysql - Json_encode generate null value while try to connect two database -

i have use utf8_unicode_ci collation field of 2 database.for english language , number fine thai language not showed.it show null.i try many way still.but if remove $dbh2 work need both <?php $timezone = "asia/bangkok"; if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone); $dbh1 = mysql_connect('localhost','user1','pass1', true); $dbh2 = mysql_connect('localhost','user2','pass2', true); mysql_query("set names 'utf8"); mysql_select_db('db1', $dbh1); mysql_select_db('db2', $dbh2); $name=$_get['name']; $data=array(); $search=mysql_query("select * `users` `uname` = '".$name."'",$dbh2); while($a=mysql_fetch_assoc($search)) { $data[]=$a['total_point']; } $find=mysql_query("select * `item` order `item_id` desc",$dbh1); while($r=mysql_fetch_assoc($find))

Does eclipse support xml comment description like Visual Studio? -

i'm trying switch project visual studio eclipse. in visual studio comment functions , parameters xml comments. these comments shown in code completion. /// <summary> /// function hotkey.deinstallkey() deinstalls single hotkey. function uses ascii character identify key has deinstalled. function works local , global hotkeys. /// </summary> /// @cond visual_param /// <param name="key">the hotkeytag.</param> /// @endcond /// @param[in] key hotkeytag. void deinstallkey(int key); does eclipse support well, or how have change comments achieve same functionality?

Is there a YouTube API that can give me structured metadata about a video? -

using youtube api, how can fetch structured data video? instance, given video movie trailer, how can find movie title or topic in structured format, , other interesting metadata such celebrities featured or director? yes. v3 api allows do via videos/list . here's example api call using trailer dark knight rises: get https://www.googleapis.com/youtube/v3/videos?part=topicdetails&id=g8evye9tuyk&fields=items%2ftopicdetails%2ftopicids&key= {your_api_key} (to developer key, follow instructions in our video tutorial ). that sets: topic: topicdetails id: g8evye9tuyk fields: items/topicdetails/topicids in response body, get: { "items": [ { "topicdetails": { "topicids": [ "/m/0bpm4yw", "/m/01d5g", "/m/0btpm6", "/m/0184dt", "/m/02vxn" ] } } ] } these correspond freebase mids, can lookup using freebase api . instance, first respons

Javascript - export a JQuery dataTable to Excel problems -

i have following code: <a id="dlink" style="display:none;"></a> <input type="button" onclick="tabletoexcel('cereritable', 'tabel date', 'myfile.xls')" value="export excel"> <script language="javascript"> var tabletoexcel = (function() { var uri = 'data:application/vnd.ms-excel;charset=utf-8;base64,' , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" ' + 'xmlns="http://www.w3.org/tr/rec-html40"><head>' + '<!--[if gte mso 9]>' + '<xsl:template name="styles">' + '<style>' + 'table {' + 'mso-displayed-decimal-separator:"\,";' + 'mso-displayed-thousand-separator:" ";' + '}' + '@page

Create XML File With Dynamic Sub Elements Level In C# -

there tree view in c# project contains dynamic level of categories , products belong 1 category application create parent category single level of sub category so need create xml file multiple sub categories code : private void createxmlfile(object sender, eventargs e) { try { list<prg.createxml.category> categories = service.category.instance.findall(); list<prg.createxml.product> products = service.product.instance.findall(); string filename = "category.xml"; string filepath = directory.getcurrentdirectory() + "\\data\\" + filename; if (file.exists(filepath)) file.delete(filepath); xmltextwriter writer = new xmltextwriter(filepath, system.text.encoding.utf8); writer.writestartdocument(true); writer.formatting = formatting.indented; writer.indentation = 3; writer.writestartelement(&qu

javascript - Refresh parent window after submitting a form in a IFrame in jQuery -

i know how can refresh/reload parent window iframe on submit without closing frame using javascript / jquery. parent window contains display table , button opens iframe. iframe contains form on submit saves data in table displayed on parent window. @ present data not displayed until refresh page manually. please suggest me method so. this scenario main window has buttton called form , on clicking iframe opens , iframe has form on submit saves data, this data displayed in table on main window. but when submit data saved not displayed. i want method main window refreshed / reloaded without having close iframe , refreshing manually please suggest solution problem ...don't offer other method.. this thing not possible parent window cannot refreshed keeping open i-frame

php - How to check if mysql is connected to android on eclipse -

i trying fetch data mysql database , populate on listview. i getting ip address of system this string link_url = "192.168.19.6"; now in wamp server have file called /product_api/getdataproduct.php"; i want file called in eclipse doing this link_url = referensi.link+"/product_api/getdataproduct.php"; please right way of connecting android mysql , how know if file calling on eclipse connected mysql database. this getdataoriduct.php file <?php include("koneksi.php"); $q = mysql_query('select * produk'); $v = '{"info" : ['; while($r=mysql_fetch_array($q)) { $ob = array("<br>","<b>","</b>"); if(strlen($v)<12) { $v .= '{"id_produk" : "'.$r['id_produk'].'", "nama_produk" : "'.$r['nama_produk'].'", "harga" : "'.$r[

java - Spring Data JPA ClassCastException: Integer cannot be cast to Long -

in spring data application ran similar problem described here classcastexception: integer cannot cast long, while trying iterate on entity ids this entity: @table(name = "users") public class user extends baseentity implements serializable { private static final long serialversionuid = 5088960286161030648l; @id @sequencegenerator(name = "users_id_seq", sequencename = "users_id_seq", allocationsize = 1) @generatedvalue(strategy = generationtype.auto, generator = "users_id_seq") private long id; ... } and spring data repository method: @query(value = "select u.user_id users u u.game_id =:gameid", nativequery = true) list<long> getgameids(@param("gameid") long gameid); which going return list of long type after execution returns list of integer , application fails java.lang.classcastexception: java.lang.integer cannot cast java.lang.long how tell spring data or jpa return list of long

php - Datatables remove backslash(\) characters from data -

Image
this codes use datatables jquery plugin send data via ajax server: $('#alllessonattachmentstable').datatable({ processing: true, serverside: true, "bsort": false, "responsive": true, ajax: { url: 'http://lms.dev/admin/getfileslist', data: function (d) { d.id = '8', d.type = 'app\lesson' } }, columns: [ {data: 'checkbox', name: 'checkbox', "width": "20px"}, {data: 'picture', name: 'picture', 'classname': 'text-center'} ] }); as see, type parameter sent server contain \ (backslash) character. when retrieve in laravel back-end backslash character removed. what problem , why removed? javascript has \ escape character. might need use \\ escape it. change code to: d.type = 'app\\lesson' in console itself, can see how javascript treats \ , \\ :

sorting - PHP sort object with usort based on two values -

i'm trying sort object array based on minimal sum . working, want add usort function comparison, prefer object, have 1 value true. objects: object(basket)[33] public 'products' => array (size=2) 0 => object(product)[13] public 'name' => string 'name one' (length=8) public 'price' => float 0.75 public 'exist' => boolean true 1 => object(product)[7] public 'name' => string 'name two' (length=8) public 'price' => float 2.39 public 'exist' => boolean true public 'sum' => float 3.14 object(basket)[34] public 'products' => array (size=2) 0 => object(product)[19] public 'name' => string 'name one' (length=8) public 'price

How to read multiple specific lines from a txt file (python) -

the question: i trying have program read multiple, specific lines text file. have gotten stage able program read multiple lines have add them , when printed have '[],[]' around them. here current code: import time time.sleep(3) one=1 while one==1: = open("solution.txt","r").readlines() line = a[1].split() line2 = a[0].split() print(line+line2) one=0 time.sleep(3) exit() side note i understand there similar questions although they're complicated. i'd simple answer. using python 3.5 , not noob nor proffessional. thank help! if want read lines file can use loop so: lines = [] line in enumerate(open("solution.txt", "r")): lines.append(line) this create tuple containing line number (starting @ zero) , contents of line, every line in file. add each line number , line tuple list called lines. if want specific lines (eg. line 5 or line 7) can use loop go through contents of lines.

INFORMATICA LOADING ERROR -

i newbie informatica. using informatica 9.1.0 , oracle 11g source , target database. tried create 1 table in target database , tried load data source target. table getting created in target database. , created mapping , workflow valid , start work flow gave me following error. message code rr_4036 message error connecting database [ arun ora-00900: invalid sql statement database driver error... function name : executedirect sql stmt : arun oracle fatal error database driver error... function name : executedirect oracle fatal error ]. please me solutions. i got solution this. previously while creating remote connection in relational connection editor session, in code page option chose " utf-8 encoding of unicode ". changed " ms windows latin 1 (ansi) superset of latin1 " , restarted workflow succeeded. the following video link shows how create relational connection session. http://www.youtube.com/watch?v=om2d-ihfruw

java - Android - Fragment 2 Displaying back the main fragment with Activity -

from main fragment opened videoplayerfragment, in videoplayerfragment when press button should go parent fragment. collectiondemoactivity{ class launchpadsectionfragment extends listfragments{ public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); string fragmaingroups = "maingroups"; fragment fragment1 = new videoplayerfragment(); fragmenttransaction transaction = getchildfragmentmanager().begintransaction(); transaction.replace(r.id.contentfragment, fragment1, fragmaingroups ); transaction.addtobackstack(fragmaingroups); transaction.commit(); } } } external class videoplayerfragment.java class videoplayerfragment extends listfragment{ @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) {

go - Buffer issue cannot use <type> as type io.Reader in argument to http.NewRequest golang -

i having issue when passing string in http.newrequest in golang body param. the error got : cannot use req.body (type string) type io.reader in argument http.newrequest: string not implement io.reader (missing read method) similarly there other use cases buffer required input instead of particular type or array of it. eg, byte[] when input required buffer. what did error mean , ways of solving , understanding golang trying enforce. edit: line having issue , did not find references. http.newrequest(req.method, req.url, req.body) http.newrequest(req.method, req.url, strings.newreader(req.body)) solves issue. planning add answer (as fyi type of question) this error means http.newrequest method take io.reader interface body argument: func newrequest(method, urlstr string, body io.reader) (*request, error) it done way can pass file, connection server, response else request easily. the "problem" string doesn't implement

c# - WPF Window is not set to null when closing it -

i'm developing plugin opens mainwindow application. i'm using c# , wpf. public class startrir : iexternalcommand { private static mainwindow mainwindow; public result execute( externalcommanddata commanddata, ref string message, elementset elements) { if (mainwindow != null) { mainwindow.focus(); return result.succeeded; } else { mainwindow = new mainwindow(commanddata); mainwindow.show(); return result.succeeded; } } } this code executed when call external application, goal avoid multiple mainwindow to open simultaneously. but if close window, can't open anymore. mean closing window not set null? have override closing event or there way? i'm using manager class cases this. keeps track of registered window types , subscribes closed event. public class singlewindowtypehelper { public singlewindowt

ios - Interface builder constraint error -

Image
a picture tells thousand words, here's image of uitableviewcell constraints. i have view pinned edges of content view, , inside there's view fixed width , height, pinned bottom , top of superview. trying center x axis of view superview. running on device looks okay, interface builder throwing error on outer view, saying needs constraints y position or height. can somehow bypass in interface builder? or missing fundamental self-sizing table cells? i sizing table cells with: func tableview(tableview: uitableview, heightforrowatindexpath indexpath: nsindexpath) -> cgfloat { return uitableviewautomaticdimension } func tableview(tableview: uitableview, estimatedheightforrowatindexpath indexpath: nsindexpath) -> cgfloat { return uitableviewautomaticdimension } don't worry. have done right. warning ambiguity raised due 2 different heights of tableviewcell. height 20 arising due constraints. height provided (or default height i.e. 44) in siz

Solr 6 and carrot2 integration -

i'm trying use carrot2 solr 6 installation, when calling query is: java.lang.noclassdeffounderror: com/carrotsearch/hppc/objecthashset 06:04:55 solr.1 | @ org.carrot2.text.preprocessing.preprocessingcontext.<init>(preprocessingcontext.java:53) 06:04:55 solr.1 | @ org.carrot2.text.preprocessing.pipeline.completepreprocessingpipeline.preprocess(completepreprocessingpipeline.java:65) 06:04:55 solr.1 | @ org.carrot2.clustering.lingo.lingoclusteringalgorithm.cluster(lingoclusteringalgorithm.java:191) 06:04:55 solr.1 | @ org.carrot2.clustering.lingo.lingoclusteringalgorithm.access$000(lingoclusteringalgorithm.java:63) 06:04:55 solr.1 | @ org.carrot2.clustering.lingo.lingoclusteringalgorithm$1.process(lingoclusteringalgorithm.java:177) i've tried downloading recent carrot2 , adding: <lib dir=".../carrot2-workbench-3.12.0/plugins/" regex=".*\.jar" /> where com.carrotsearch.hppc jar is, didn't change anything.

php - cannot display error messages below form fields -

i want display error messages below respective fields , success message below form. im able success message im not getting error messages displayed fields emply. below code:- contact.html <!doctype html> <html> <head> <link rel="stylesheet" media="screen" href="styles.css" > <script type="text/javascript" src="my.js"></script> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ $('#submit').click(function(e){ e.preventdefault(); $.post("send.php", $("#mycontactform").serialize(), function(response) { $('#success').html(response); //$('#success').hide('slow'); }); return false; }); }); </script> <script type="text/javascript"> function validateroleform() { var name = document.getelementbyid('name').value;

Bootstrap - open modal after postback only after button click c# -

i have implemented modal popup on site capture email addresses. once user clicks submit button form submitted. calling modal again after page.ispostback works fine. however, want display after user clicks particular submit button. on master page, if goes 'contact us' page , submits question on postback modal reappears don't want. literally want appear after postback submit form on modal. any ideas how can around this? thanks rob to display modal after user clicks submit button, should put modal 's display logic in button's submit event. take logic out of page_load 's ispostback , , put @ end of button 's onclick event protected void button_click(object sender, eventargs e) { // work... // show modal }

conceptual - difference between these two return statements in php -

we wondering best way return empty null no result in php, use this function dothis($a){ if($a == 0){ return ''; }else{ // complex mysql return $result; } one more way of doing function dothis($a){ if($a == 0){ return null; }else{ // complex mysql return $result; } now compare this if(dothis(5)){ // } or if(!is_null(dothis(5)){ // } i wondering best approach doing ? there problem in function dothis near if($a = 0){ . == used compare. = used assign value.

scala - Spark 1.5 MlLib LDA - getting topic distribusions for new documents -

not duplicate of this because i'm asking input is, not function call, see below i followed this guide create lda model in spark 1.5. saw in this question topic distribution of new document need use localldamodel's topicdistributions function takes rdd[(long, vector)]. should new document vector term-count vector? type of vector lda trained with. code compiles , runs i'd know if intended use of topicdistributions function import org.apache.spark.rdd._ import org.apache.spark.mllib.clustering.{lda, distributedldamodel, localldamodel} import org.apache.spark.mllib.linalg.{vector, vectors} import scala.collection.mutable val input = seq("this document","this document","these training, not tests", "here final file (document)") val corpus: rdd[array[string]] = sc.parallelize(input.map{ doc => doc.split("\\s") }) val termcounts: array[(string, long)] = corpus.flatmap(_.map(_ -> 1l)).reducebykey(_ + _).colle

extracting data from multidimensional array via PHP and store in text file -

i extract data following json arrays, variable use create text file array ( [0] => array ( [0] => 0 [1] => ) [1] => array ( [0] => 0 [1] => 123: ) [2] => array ( [0] => 0 [1] => ticket ) [3] => array ( [0] => 0 [1] => ------------------------------------------------ ) [4] => array ( [0] => 1 [1] => user 1 ) [5] => array ( [0] => 1 [1] => info x ) [6] => array ( [0] => 0 [1] => ------------------------------------------------ ) [7] => array ( [0] => 0 [1] => text 1 ) [8] => array ( [0] => 0

angularjs - Can't access service in controller -

so i'm trying retrieve token server i'm encountering error when trying call method in service. logincontroller.js: (function(){ angular.module('app') .controller('logincontroller', [ '$http', 'authservice', logincontroller ]); function logincontroller(authservice ) { var vm = this; vm.user = {}; vm.login = function () { console.log("logging in"); authservice.gettoken("admin", "admin") .then(function (data) { console.log(data); }, function (error) { //todo: error handling }) }; } })(); authservice.js: (function(){ 'use strict'; angular .module('app') .factory('authservice', ['$http', '$rootscope', 'rest_end_point', authservice

javascript - ZFComponent.Initialize is not a function -

i using eida (emirates identification authority) card reader read nationality card, once insert card , click on read card button giving error message on mozila. device driver installed, still getting same error java (tm) platform enable on browser note: tried read card in system, card reads , not giving error message, operation works successfully. this image shows error alert box after click on "read card" button issue solved !! just install jdk 32-bit version, tried jdk 1.6 32-bit.

ios - UITextView does not detect touch input -

i have app tab bar several tabs. inserted new tab simple uitextview . however, text view not seem respond touch inputs , not able edit it. stays static default text , nothing. nevermind. issue class returning "no" canbecomefirstresponder method. nightmare took me hours realize! anyway, time , , sorry posting such stupid problem!

c# - Integrating BOT with ASP.Net Application -

i have built bot using microsoft bot framework works fine, have tested bot emulator, want integrate asp.net application. tried figure out how web application couldnt find out tutorials understand how pass parameters. can give me tutorials explains this. the entire bot framework sdk open-source , on github. there plenty of examples of how in csharp/samples or node/examples directories. simple other web api call you'd make, it's httppost body being object server capable of deserializing.

php - Removing unwanted elements from table simple_html_dom -

i fetching page page style tags, table , other non vital content. i'm storing in transient, , fetching ajax $result_match = file_get_contents( 'www.example.com' ); set_transient( 'match_results_details', $result_match, 60 * 60 * 12 ); $match_results = get_transient( 'match_results_details' ); if ( $match_results != '') { $html = new simple_html_dom(); $html->load($match_results); $out = ''; $out .= '<div class="match_info_container">'; if (!empty($html) && is_object($html)) { foreach ($html->find('table') $table => $table_value) { $out .= preg_replace('/href="?([^">]+)"/', '', $table_value); } } $out .= '</div>'; wp_die ( $out ); } else { $no_match_info = esc_html__('no info available', 'kompisligan'); wp_die($no_match_info); } now table had anchors

tweetsharp - How to post Special charater tweet using asp.net API? -

i m using given below code post tweet on twitter. when upload on server special character (!,:,$ etc) tweets not published on twitter. code working fine in local system string key = ""; string secret = ""; string token=""; string tokensecret=""; try { string localfilename = httpcontext.current.server.mappath("../images/").tostring(); using (webclient client = new webclient()) { client.downloadfile(imagepath, localfilename); } var service = new tweetsharp.twitterservice(key, secret); service.authenticatewith(token, tokensecret); // tweet wtih image if (imagepath.length > 0) { using (var stream = new filestream(localfilename, filemode.open)) { var result = service.sendtweetwithmedia(new sendtweetwithmediaoptions {

python - Scatter Plot dictionary of dictionary -

i need scatter plot dictionary of dictionary. my data looks : {'+c': {1: 191, 2: 557}, '+b': none, '-b': none, '+d': none, '+n': {1: 1, 3: 1}, '+l': {1: 2819, 2: 1506}, '>l': none, '<c': {0: 2125}, '<b': none, '<l': {0: 2949, 1: 2062}} the outer keys x axis labels , inside keys y axis. inside keys' values annotations x,y. tried plotting data didn't graph looking for. i tried following ended having repetitions in x axis. for action, value in action_sequence.items(): if value: seq,count in value.items(): data["x"].append(action) data["y"].append(seq) data["label"].append(count) else: data["x"].append(action) data["y"].append(-1) data["label"].append(0) print(data) plt.figure(figsize=(10,8)) plt.title('

php - How to join two tables without duplicates? -

i have in table looks this: id_in | date_in -------|-------------------------- 1 | 2016-04-29 02:00:00 and out table looks this: id_out | date_out ----------|-------------------------- 1 | 2016-04-29 03:00:00 2 | 2016-04-29 04:00:00 3 | 2016-04-29 05:00:00 i want write query output looks this: id_in | date_in | id_out | date_out ------|---------------------------- |----------------------------|--------------------------- 1 | 2016-04-29 02:00:00 | 1 |2016-04-29 03:00:00 null | null | 2 |2016-04-29 04:00:00 null | null | 3 |2016-04-29 05:00:00 you can left join : select i.id_in, i.date_in, o.id_out, o.date_out outtable o left join intable on o.id_in = i.id_out;

javascript - How to refresh a div without reloading the entire page? -

i have div , want refresh content without reloading entire page. i tried many times many methods (ajax call, javascript, etc...), don't have did it. my div displays entire content of modelname.all , in particular div, can add new entities (thanks form) of model use. i display div rails partial view. currently, use when user submit form : $('#articlesdiv').html("<%= escape_javascript (render partial: 'articles') %>"); but seems partial view doesn't have up-to-date model. because before add new entity, see example 5 elements, , after add new entity, see again 5 elements. test purposes, use javascript alert displays modelname.all.count and alert displays 5 ! when @ database content (before alert), can see 6 elements ! , when refresh page manually, div displays 6 elements. code explain : the main view : <div id="articlesdiv"> <%= render(:partial => "articles") %> </div> _articl

Mindbody API Returning Invalid StartDates And EndDates -

this happed , mindbody started returning next class schedule date , instead of returning startdate , enddate of given class . like . [startdatetime] => 2016-05-09t17:15:00 [enddatetime] => 2016-05-09t18:15:00 this every classes function getclasses() . the mindbody api has quite lot of issues regards getclasses api call in experience (i used in project in mid-late 2015, perhaps things have changed since then...). here list of gotchas/issues found when trying details of class assist you: when make getclasses api request, if pass in classid only, startdatetime , enddatetime parameters seem ignored, meaning can't find class in future the api seems ignore time part of datetime, when make call, you'll list of classes held throughout day of datetime. times you'll each of classes timezoned classes, they'll incorrectly declare in utc format, rather actual timezone don't attempt add in specified datetime type parameter in api call pa

javascript - center a google map marker on jhipster application -

actually work in jhispter app, have implemented ng-map tag , marker tag show location , runs problem not able center point marker in middle of div , don't it i use center attribute in ng-map tag , nothing... <ng-map zoom="15" center="{{vm.terreno0101.latitud}},{{vm.terreno0101.longitud}}"> <marker position="{{vm.terreno0101.latitud}},{{vm.terreno0101.longitud}}" title="supplier location" centered="true"></marker> </ng-map>

c# - DownloadOperation.StartAsync() has slow start up time -

i'm using backgrounddownloader class in windows-store-app download files, , i'm wondering if i'm doing wrong since start time download long big files. code: util.debugwriteln("creating downloader"); backgrounddownloader downloader = new backgrounddownloader(); dwo = downloader.createdownload(new uri(request), destination); util.debugwriteln("downloadoperation created"); this call starts download , takes such long time: util.debugwriteln("starting download async"); await dwo.startasync().astask(progresscallback); log: 7/23/2013 1:13:20 pm: threadhandler.cs->downloadfile(): attempting download of file: /200mb.zip 7/23/2013 1:13:20 pm: util.cs->getstoragefile(): getting storage file for: 200mb.zip 7/23/2013 1:13:20 pm: synergica.cs->downloadfile(): creating downloader 7/23/2013 1:13:20 pm: synergica.cs->downloadfile(): downloadoperation created 7/23/2013 1:13:20 pm: threadhandler.cs->d

c++11 - Dynamic array inside of Class template -

i have want make template class vector , parameters should type , length of dynamic array thats in it. template < class type, int length > class vektor { public: int count; int currentpos; type* beginning = new type[count]; int lastatuse=0; vektor() { count = length; } void pushback(type a) { beginning[lastatuse]=a; lastatuse++; } void insert(type a, int position) { beginning[position] = a; } }; i tried test in main , getting error: error c2440: 'initializing' : cannot convert 'iterator_traits<_iter>::difference_type (__cdecl *)(_init,_init,const _ty &)' 'unsigned int' can me find i'm doing wrong ? here: type* beginning = new type[count]; ^ you have count , not count also, count not yet set when new executes, should move constructor here: vektor() { count = length; beginning = new type[count]; }

javascript - Use animation load bar with JS -

edit: see answer below. while waiting settimeout runout, thought idea add animation. css: .ws_addbutton {border:1px black solid;border-radius:28px;} .msg[data-status=topublish] .ws_addbutton {background-color:lightcoral;} .msg[data-status=published] .ws_addbutton {background-color:#7892c2; cursor:default;} @keyframes loas_bg { {background: linear-gradient(to right, initial 0%, transparent 100%);} {background: linear-gradient(to right, initial 0%, transparent 0%);} } *i used initial because don't know first color (blue or red) and js trigger (need run once): selectmsg.getelementsbyclassname('ws_addbutton')[0].style.animation = 'loas_bg '+ws_set_delay_basic+'s linear'; but dosen't work (the animation dosen't start)), , don't sure why. tried find information in google , here, without luck. <s>any idea how solve it?</s> edit: see answer below. after little more homework tried this: var ws_set_

About Use Of Storage Classes in C -

the following code displays error if storage class of parameters of function int *check(register int,register int); declared other storage class. i compiled code on code::blocks 10.05 ide gnu gcc compiler . reason behind error? compiler specific error or general one? code section begins here: int *check(register int, register int); int main() { int *c; c = check(10, 20); printf("%d\n", c); return 0; } int *check(register int i,register int j) { int *p = i; int *q = j; if(i >= 45) return (p); else return (q); } int *check(register int i,register int j) { int *p=i; int *q=j; if(i >= 45) return (p); else return (q); } while register storage class specifier allowed on parameter declaration, parameters i , j have int type while p , q of type int * . makes declaration of p , q invalid. you cannot change to: int *p=&i; int *q=&j; as & operator not allow have operand of register storage class. you can

gcc - How to build cmake-gui with a custom path to qt? -

i trying build cmake-gui custom path , failed on run: #/opt/dev-tools-4.9/cmake-gui /opt/dev-tools-4.9/cmake-gui: error while loading shared libraries: libqtgui.so.4: cannot open shared object file: no such file or directory so want cmake-gui started search qtx @ /opt/dev-tools-4.9 used system # strace -f ./cmake-gui execve("./cmake-gui", ["./cmake-gui"], [/* 24 vars */]) = 0 brk(0) = 0x13ca000 access("/etc/ld.so.nohwcap", f_ok) = -1 enoent (no such file or directory) mmap(null, 8192, prot_read|prot_write, map_private|map_anonymous, -1, 0) = 0x7fcfdff0b000 access("/etc/ld.so.preload", r_ok) = -1 enoent (no such file or directory) open("/etc/ld.so.cache", o_rdonly|o_cloexec) = 3 fstat(3, {st_mode=s_ifreg|0644, st_size=53974, ...}) = 0 mmap(null, 53974, prot_read, map_private, 3, 0) = 0x7fcfdfefd000 close(3) = 0 access("/etc/ld.so.nohwcap", f_ok

Downloading files from Dropbox using C# asp.net -

i want download files dropbox using dropbox.api. my current code is public static void download(listbox file) { file.items.clear(); using (var dbx = new dropboxclient("mytoken")) { using (var responses = dbx.files.downloadasync("/pakistan.txt")) { httpcontext.current.response.clear(); httpcontext.current.response.clearheaders(); httpcontext.current.response.clearcontent(); httpcontext.current.response.addheader("content-disposition", attachment; filename=" + responses.result.response.name); httpcontext.current.response.addheader("content-length", responses.result.response.size.tostring()); httpcontext.current.response.contenttype = "text/plain"; httpcontext.current.response.flush(); httpcontext.current.response.transmitfile(responses.result.response.name); httpcontext.c

java - every time I change my widget xml, I get runtime error in eclipse -

Image
i try edit android widget xml. everytime change 1 property (drawable, gravity...) the layout marked error build runs ok, application doesn't run. eclipse says there errors, see no in error window/problem/log-cat unexpected namespace prefix "xmlns" found tag linearlayout xmlns means xml namespace. i think attribute should on first element of xml file, , that's why error

java - JSON Unrecognized character escape ':' -

good day, i doing post of json property follows: {"db.url":"jdbc\:derby\:c\:\\users\\sasha\\unicentaopos-database;create\=true"} and getting exception: unrecognized character escape ':' (code 58)\n @ [source: java.io.stringreader@358b85c8; line: 1, column: 480] now, guess need replace \ \\ , whenever that: jsonstring = jsonstring.replaceall("\\", "\\\\"); i exception: exception in thread "awt-eventqueue-0" java.util.regex.patternsyntaxexception: unexpected internal error near index 1 \ ^ @ java.util.regex.pattern.error(pattern.java:1955) @ java.util.regex.pattern.compile(pattern.java:1702) @ java.util.regex.pattern.<init>(pattern.java:1351) @ java.util.regex.pattern.compile(pattern.java:1028) @ java.lang.string.replaceall(string.java:2223) @ com.openbravo.pos.forms.appconfig.convertconfigtojson(appconfig.java:332) @ com.openbravo.pos.forms.appconfig.load(appconfig.java:221)