Posts

Showing posts from March, 2014

php - Error getting Images into Listview from server using Json -

i not getting listview images server...it gives me launcher images not image server... here submenu activity: public class submenu extends activity { // declare variables jsonobject jsonobject; jsonarray jsonarray; listview listview; listviewadapter adapter; progressdialog mprogressdialog; arraylist<hashmap<string, string>> arraylist; static string rank = "id"; static string country = "name"; static string flag = "image"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // view listview_main.xml setcontentview(r.layout.activity_sub_menu); // execute downloadjson asynctask new downloadjson().execute(); } // downloadjson asynctask private class downloadjson extends asynctask<void, void, void> { // @override // protected void onpreexecute() { // super.onpre

node.js - node js mongoose find by deeply nested documents -

in node js mongoose need search article description in following schema levels. how can possible mongoose. have tried using $elemmatch , not working. schema level follows. var articleschema = new schema({ name: { type: string, required: true }, displayname: { type: string }, description: { type: string }, }); mongoose.model('article', articleschema); var subchapterschema = new schema({ name: {type: string, required: true}, displayname: {type: string}, articles:[articleschema], }); mongoose.model('subchapter', subchapterschema); var chapterschema = new schema({ name: {type: string, required: true }, displayname: {type: string }, subchapters: [subchapterschema], }); mongoose.model('chapter', chapterschema); var agreementschema = new schema({ name: {type: string, required: true }, displayname: {type: string }, chapters: [chapterschema], }); mongoose.model('agreement', agreementschema);

php - How to receive values from server request (s2s)? -

i'm trying receive values s2s (postback) pixel, means server requests link www.example.com/?cid=xxxx & want save cid values mysql database. i've tried run code on browser , work fine, when used receive s2s pixel doesn't. i think problem i'm using request, might wrong thing when it's server server. difference between page called client, , when called server? <?php $servername = "localhost"; $username = "xxxx"; $password = "xxxx"; $dbname = "xxxx"; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } // set values insert date_default_timezone_set('asia/jerusalem'); $cid= $_request['cid']; $year= date('y'); $month= date('m'); $day= date('d'); $hour= date('g'); $mediumid= substr($cid, 0, 1); $publisherid= substr($cid,

Django is running on private ip instead of the public one, is it problematic? -

i configured server , before installing gunicorn + nginx wanted try django runserver. so, have public ip , private one. front (simple index.html + react) correctly deserving public ip, django pass private 1 when start ./manage.py runserver 0.0.0.0:8080 when try: ./manage.py runserver public.i.p:8080 have error: error: ip address can't assigned to. is normal? you cannot assign public ip this. when running "python manage.py runserver 0.0.0.0:80", means django server accept connections sources. eg., if public ip of server 52.24.33.24 , run django server using "python manage.py runserver 0.0.0.0:80", typing 52.24.33.24 in browser should take django site.

dojo - I want JAWS to tell the user what kind of node they are in while navigating the dijit.Tree -

we have dijit.tree indicates node type using icon. icon unique indicator tells person node "book" or "dvd" or "magazine" example. dijit renders icon background image in css know screen readers not see. i tried overriding gettooltip method provide tooltip saying "book" or "dvd". adds "title" attribute "dijittreerow". if mouse on node, see text. not ever focused on when user moves down 1 node next. when navigating tree, , down arrows traverse nodes. span visible text focused on , string read. can see dotted line focus hear jaws in basic of examples: https://dojotoolkit.org/reference-guide/1.10/dijit/tree.html what have not been able figure out how create indicator screen reader pick on read "book" alongside "the great gatsby". does have tips on how made dijit widget accessible screen reader when images indicator should heard blind user? the tree supports html labels, via

jquery - Javascript Sleep for x seconds -

on website have javascript function ajax call account's information opens modal can see , edit information. ajax call used change detail in database select , refreshes original function re-open modal refresh information there. seems however, (1/2+ times done) details don't update fast enough in db before functions collects details display run again. i want try delaying when second function ran give better chance details being updated before being fetched again, unsure on how this. i've tried various things, 1 seems popular, shown below, not work. have suggestions how can fix code pauses x time before continuing? function changerank(strusername, strpage) { var strrank = $("#sltrank option:selected").val(); //updates info in database moderatoreditaccount(strusername, strrank, 'rank', strpage); //displays info again settimeout(moderatoractions(strusername, strpage), 30000); } function moderatoreditaccount(strusername, val

matlab - Set a text field to 2 values -

i'm trying set text field 2 different values value1 *new line* value 2 this current solution set(handles.text1,'string',a); set(handles.text1,'string',fs); it textfield fs, ignoring a . how can post both values? thank you you can use format text field have 2 values have described. set(handles.text1,'string',sprintf('%-s\n%-s',a,fs))

javascript - How to get option selection from table cell with jquery -

i have table header cell contents this: <th rowspan="1" colspan="1"> <select> <option value="date" selected="selected">date</option> <option value="number">number</option> </select> </th> i trying selected value this var $selectors = $("#mytable thead tr th").each(function(index) { var cell = $(this).html(); console.log ("cell:" + cell.tosource()); var value = cell.options[cell.selectedindex].value; }); but error when try read selected value typeerror: cell.selectedindex undefined if dump cell console cell.tosource() above looks this cell:(new string("<select><option value=\"\"></option><option value=\"date\" selected=\"selected\">date</option><option value=\"number\">number</option></select>")) i have no idea 'new

switch statement - Program that displays all multiples of 7 between 1 and 100 C++ -

how write program switch condition statement instead of if ? #include <iostream> using namespace std; int main() { int i; (i = 1; <= 100; i++) { if ((i % 7 == 0) && (i > 0)) { cout << << endl; } } return 0; } it sounds little unfamiliar switch statement. switch statement if-else statement, except isn't boolean argument. asks: tell me value of . , each case (possible outcome), has follow action. so want ask: tell me value of number, modulus 7. if zero, add 1 counter. if 1, . so code should have general structure of: switch(i%7): case 0{increment counter or display std. out or store in array} case 1{other action}

javascript - CSS and Java Script not rendering 404 error spring-boot -

Image
here snippet of paths using: <link rel="stylesheet" type="text/templates.css" href="../templates/css/superfish.css" th:href="@{../templates/css/superfish.css}"/> <link rel="stylesheet" type="text/templates.css" href="../templates/css/style.css" th:href="@{../templates/css/style.css}"/> <link rel="stylesheet" type="text/templates.css" href="../templates/css/nivo-slider.css" th:href="@{../templates/css/nivo-slider.css}"/> <link rel="stylesheet" type="text/templates.css" href="../templates/css/jquery.qtip.min.css" th:href="@{../templates/css/jquery.qtip.min.css}"/> <link rel="stylesheet" type="text/templates.css" href="../templates/css/jquery-ui.css" th:href="@{../templates/css/jquery-ui.css}"/> <link rel="stylesheet" type="text/templates.

Jquery UI Drag And Drop add check mark to grid on drop -

a quick question maybe know answer. i have drag , drop , have grid box next needed data check, when draggable dropped in want tick , when it's dragged out want untick not sure use tried on function jquery ui did not work. $('#td2').droppable({ accept: "#r3,#r4", over: function( event, ui ) { $('#q1v1_1').attr('checked', true); $('#q1v1_1').prop('checked', true); } you should using drop event instead of over event. when using over , checkmark appear on every cell drag over. $('#td2').droppable({ accept: "#r3,#r4", drop: function( event, ui ) { var $el = $(event.target), draggable = ui.draggable, drid = draggable.attr("id"); // if dropping in td , checkbox child if (drid === "r4") { $el.find("input[type=checkbox]").attr('checked', 'checked&

objective c - XMPP: How to parse XMPPMessage element -

i'm getting following xml format every message coming xmpp - (void)xmppstream:(xmppstream *)sender didreceivemessage:(xmppmessage *)message { nslog(@"message %@",message); } in console printing <message xmlns="jabber:client" from="10000006956@xmpp-dev.peeks.com" to="10000006956@xmpp-dev.peeks.com/mobile"> <result xmlns="urn:xmpp:mam:tmp" id="1483781596098940"> <forwarded xmlns="urn:xmpp:forward:0"> <message xmlns="jabber:client" from="10000006931@xmpp-dev.peeks.com/mobile" to="10000006956@xmpp-dev.peeks.com" type="chat"> <body>hi</body> <delay xmlns="urn:xmpp:delay" from="xmpp-dev.peeks.com" stamp="2016-12-22t04:50:17.023z">offline storage </delay>

graphics - How and when does viewport change happen in OpenGL? (glViewport) -

i have question computer graphics pipeline. in opengl, use glviewport function in reshape callback. heard glviewport related viewport transformation. in our vertex shader, calculate our vertices , make these vertices defined in clipping coordinate(normalized clipping cube). when viewport transformation work? i guess if vertex shader output vertices information rasterizer, pipeline translate these vertices information. x(v) = (x + 1)/2 * width + left y(v) = (y + 1)/2 * height + bottom. (viewport transformation) consequently, thought glviewport set how work viewport transformation after finishing vertex shader work. is right? in opengl, use glviewport function in reshape callback no, "we" don't. glviewport belongs display function. consequently, thought glviewport set how work viewport transformation after finishing vertex shader work. yes, that's how works. viewport variable, not different uniform, contains parameters vertex tr

ios - Core Data and UICollectionView. "Invalid update: invalid number of items in section 0" -

(please, review whole source code at: https://github.com/flostik2008/lnch ) main vc contains uicollectionview populated coredata , , "add" button create/add coredata entities. when pressed, new vc slides in, creates new object within current nsmanagedobjectcontext . on view, user sets type of entity, , assigned 1 of entities attributes. upon choosing, new segue performed leads 3rd vc more detailed entity creation process. after pressing button on 2nd vc, xcode shows errors: 1. assertion failure in -[uicollectionview _enditemanimationswithinvalidationcontext:tentativelyforreordering:animator:]... 2. error: serious application error. exception caught during core data change processing. bug within observer of nsmanagedobjectcontextobjectsdidchangenotification... 3. 'nsinternalinconsistencyexception', reason: 'invalid update: invalid number of items in section 0... by running series of breakpoints, able identify between 2nd vc , 3rd vc, create new co

symfony - PhpStorm does not recognise services defined in yml files -

according symfony plugin documentation phpstorm should able recognise services when using service container: references services in containerinterface::get() detect containerinterface::get() result type i have phpstorm 2016.3.2, symfony plugin 0.13.134, symfony plugin enabled project, phpstorm unable recognise services defined in yml file in custom symfony bundle. when referencing services in yml files @my.service.id ide raises warning: "missing service". same problem occurs when requesting services containerinterface::get('my.service.id') . all works fine services defined in symfony core, fails work when comes own services. apparently ide able recognise event listeners defined inside bundle's src/[bundle]/resource/config/event_listeners.yml without problem, yet can't recognise services defined in src/[bundle]/resource/config/services.yml check on settings->languages & frameworks->symofony configuration paths c

How to generate insert statements and exclude some tables when forward engineering a database schema in MySQL Workbench with a python script? -

my goal generate database schema console, while generating insert statements , excluding single table. here code have an answer similar question (slightly modified): import os import grt grt.modules import dbmysqlfe c = grt.root.wb.doc.physicalmodels[0].catalog dbmysqlfe.generatesqlcreatestatements(c, c.version, { 'generateinserts' : 1, }) # http://unix.stackexchange.com/a/308666/67375 stdout = '/proc/' + str(os.getpid()) + '/fd/1' dbmysqlfe.createscriptforcatalogobjects(stdout, c, {}) when run: mysql-workbench \ ${mysql_workbench_file} \ --run "`cat the-script-above.py`" \ --quit-when-done this outputs database schema stdout, but 'generateinserts': 1 nothing, other key-value pairs tried put there after browsing mysql-workbench's source code. resulting sql code doesn't contain insert statements; i don't know start excluding 1 of tables resulting sql code. i can generate required schema using g

Loop cat walks video continuously | Adobe premiere -

i bought this video cat walks, want know if possible how loop video cat walks continuously ? appreciated, thanks you might try edit video cat walking , starts/ends close same position. can create subclip , paste down several times morph dissolve if you're using current project, or can , export clip gif if you're looking cute tumblr. depending on video, might end being able use 1 cycle of steps keep cat in similar position. why i'd suggest morph dissolve, doesn't jitter badly. due nature of walking, might have spend quite bit of time smooth transition. break viewer's eyeline cat can giving more room reset loop more smoothly, , in case slide new video in along fault line, instead of morphing it. i use premiere pro 2015 & 2017, don't know if hold true older versions.

c++ - Why can't I use arrow operator in initialization list? -

i'm beginner in c++. when practicing writing linked list, tried use initialization list class constructor assign null head->next. in class contructor warned arrow operator "expected '(' or '{'". why there such error? (i know can initialize class members in block, why can't this pointer?) thanks! here's header file linkedlist: linkedlist.h #include <iostream> using namespace std; struct node { int val; node *next; }; class linkedlist { private: node *head; int listlen; public: linkedlist(); void insert(node*, int); void del(node*); void reverse(node*); void traverse(node*); int random(); ~linkedlist(); }; and here's class constructor: linkedlist.cpp #include "linkedlist.h" #include <iostream> linkedlist::linkedlist() :listlen(0), head->next(null){} in general can initialize members part of initialization lists. if issue here, initialize next-pointer null part of body of ctor. however,

php - How to display Under Line of selected page in header Menu -

Image
i want show under line of selected page in header menu. , header comman file all. header.php <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav" id="nav"> <li class="<?php (basename($_server['php_self'], "index.php") !== false) ? 'active' : '' ?>"><a href="index.php">home</a></li> <li class="<?php (strpos($_server['request_uri'], "jobslist") !== false) ? 'active' : '' ?>"><a href="jobslist.php?id=3">bank job</a></li> <li class="<?php (strpos($_server['request_uri'], "boardresult") !== false) ? 'active' : '' ?>"><a href="boardresult.php">board result</a></li> <li class="<?php (strpos($_server['request_uri'], "admitcard")

CUDA - GB/s for PCI-E vs Gbps for memory clock speed for GPUs -

i'm astounded @ pci-e 3.0 speed: ~16 gb/s (gigabytes per second) against top gamma gpus memory clock speed (a titan x lists ~10 gbps i.e. giga-bits per second) so have pci-e 3.0 16 gb/s titan x ~1 gb/s so question is: why there abysmal difference? in regard cuda pci-e biggest hurdle @ harnessing gpu power seems contrary: pci-e can handle way bigger loads gpu memory can (even pci-e ~8 gb/s) is reasoning flawed somehow? the 10 gigabit/s memory bandwidth value titan x per-pin . 384 bit wide memory interface amounts total theoretical peak memory bandwidth of 480 gb/sec. practically achievable values 80% of theoretical peak bandwidth, both memory , pcie well.

c# - Consuming Api in Console Application -

i'm trying consume api using console application , i'm getting exception. when i'm trying put json data model, these following exceptions: exception thrown: 'newtonsoft.json.jsonserializationexception' in mscorlib.dll exception thrown: 'system.aggregateexception' in mscorlib.dll exception thrown: 'newtonsoft.json.jsonserializationexception' in consoleapplication1.exe my source code: class program { public class individualmodel { public string payorcode { get; set; } public string adminlvl { get; set; } public string lvldesc { get; set; } } static void main(string[] args) { httpclient cons = new httpclient(); cons.baseaddress = new uri("http://localhost:52505/"); cons.defaultrequestheaders.accept.clear(); cons.defaultrequestheaders.accept.add(new system.net.http.headers.mediatypewithqualityheadervalue("application/json")); tr

Setting up selenium, chromedriver, and wdio mixed with vagrant or docker -

i started out trying learn how write automated tests small project nothing working right out of box. after couple hours of searching & experimenting found right configuration project & figured sharing might folks in future. here's small summary of errors encountered on debugging journey: using jasmine & wdio, send_keys crashing it firefox/geckodriver bug, or that wdio appeared hang after switching firefox chrome chrome needed run in --no-sandbox mode, essentially i figured problem stemming having wdio execute tests on local machine while selenium hammering on browser in vagrant vm. applicable people using separate environments (vagrant->local, vagrant->vagrant, docker->local, etc) wdio & selenium/chromedriver. here gist of configuration file ended with. i started fanatique/vagrant-selenium-vm , modified use chrome instead of firefox because send_keys broken firefox/geckodriver @ time of writing . after swapping out packages, i

visual studio - C# Uploading image to Cheverto's upload.php -

i have c# application takes screenshots , creates image files. can't seem find out how create uploading method file path passed using cheverto's upload.php. cheverto image gallery system. here there api: https://chevereto.com/docs/api-v1 here upload.php stored on server: https://pastebin.com/bu4ejavx <?php namespace chv; use g, exception; class upload { // filename => name.ext // file => /full/path/to/name.ext // name => name public $source; public $uploaded; // sets type of resource being uploaded public function settype($type) { $this->type = $type; } // set source public function setsource($source) { $this->source = $source; $this->type = g\is_url($this->source) ? 'url' : 'file'; } // set destination public function setdestination($destination) { $this->destination = g\forward_slash($destination); } // set storage public function setstorageid($storage_id) { $this->storage_id = is_numeric($stor

regex - Extracting dates from text using python and regular expressions where the dates are in the form october 12 - 2010 -

i extract dates following text: some text more text october 12 - 2010 the result be: yyyy-mm-dd: 2010-10-12 how can tell regex month words , can "january", "february" etc single space, [a group of 1-2 characters] space , final [group of 4 digits \d{4}] writing out actual names of months in regex makes readable , maintainable expression, feel important when comes regexes. so: (january|february|march|april|may|june|july|august|september|october|november|december)\s\d{1-2}\s\d{4}

php - Laravel backpack select_from_array -

i totally confused select_from_array field in laravel backpack. in controller using select_from_array field in options call function,but when run code error displayed. please me this. error : fatalerrorexception in eventcontroller.php line 106: syntax error, unexpected '$this' (t_variable) controller.php public $crud = array( "model" => "app\larapen\models\event", "entity_name" => "event", "entity_name_plural" => "events", "route" => "admin/event", "reorder" => true, "reorder_label" => "name", "reorder_max_level" => 2, "details_row" => true, // ***** // columns // ***** "columns" => [ [ 'name' => "id", 'label' => "id" ], ], "fields" => [ [

Maven resolution of snapshots when non-snapshot version exists -

say "myproject" depends on "n-snapshot" version of projecta. projecta parallelly developed(by other team) , graduates "n" "n-snapshot" , released repository. can maven extension written fetch version "n" of projecta (though pom of myproject has version "n-snapshot"for projecta) once "n" released / "n-snapshot" removed? there pitfalls / downsides in doing this? if want version 1.0.0-snapshot or 1.0.0 (when released), can use version range [1.0.0-snapshot,1.0.0] this automatically resolves version range (the highest found, if no other constraints given). downside obstructs dependency mediation: if other transitive dependency of project [2.0.0-snapshot, 2.0.0], build fail.

java - How better can you rewrite these lambdas? -

consider following class class person { private string firstname; private string lastname; private int age; private address address; //assume getters available } lambda #1 : filter persons of specific age public list<person> getpersonsofage(int age) { list<person> persons= fillpersonsinfo(); persons.stream().fiter(person -> person.getage() == 21).collect(collectors.tolist()); } lambda #2 : filter persons specific last name public list<person> getpersonsaboveage(string name) { list<person> persons= fillpersonsinfo(); persons.stream().fiter(person -> person.getlastname().equals(name)).collect(collectors.tolist()); } lambda #2 : filter persons living @ given address public list<person> getpersonsaboveage(address address) { list<person> persons= fillpersonsinfo(); persons.stream().filter(person -> person.getaddress().equals(address)).collect(collectors.tolist()); } how compact can make these lamb

swift - iOS UIDatePicker timezone causes disabled spinner(s) -

Image
i have uidatepicker set timezone nstimezone(forsecondsfromgmt: seconds) . reason time on uidatepicker gets disabled first time set new date, after switch mode .date works again. how can make 1 work always? if don't set timezone time never gets disabled, need set time zone on. here code set, newdate nsdate , adjustment seconds. self.timepicker.timezone = nstimezone(forsecondsfromgmt: adjustment) self.timepicker.setdate(newdate, animated: false) disabled spinner screenshot:

Give status update from a Spring controller method before actually returning -

i have 3 endpoints in web application, /overview , /insert , , /update . @ /insert user can specify data , submit /update data processed. in /overview user can see status. the /update consists of 2 steps: verification , doing update. when verification fails user redirected again /insert change data. when verification successful, user redirected /overview see updated data. code this: @requestmapping(value = "/update", method = {requestmethod.post}) public modelandview processdata(modelmap model, @requestparam(value = "data", required = true) string data) { // verification, needs time boolean verificationfailed = verify(data); // in case of failed verification, return insert page if (verificationfailed) { return new modelandview("insert", model); } // todo: send udpate web page // perform action dosomething(data); // redirect overview page see effects return new modelandview("redirect:/o

ios - If HTTPS is unavailable switch to HTTP -

im developing customized app used couple of people own domains. i'm trying check if domain has ssl certificate , proceed https if not switch http. i'm trying change @ httprequest method lot of problems. can me make right method check availability of https/http on swift? thank you

angularjs - using $mdDialog.show with spring servlerdispatcher -

i trying show dialog in mvc angularjs application config.$inject = ['$routeprovider', '$locationprovider']; function config($routeprovider, $locationprovider) { $routeprovider .when('/', { controller: 'homecontroller', templateurl: 'home', controlleras: 'vm' }) .when('/login', { controller: 'logincontroller', templateurl: 'login', controlleras: 'vm' }) .when('/users', { templateurl: 'users', controlleras: 'ul' }) .when('/companies', { templateurl: 'companies', controlleras: 'comp' }) .when('/projects', { templateurl: 'projects', }) .when('/suppliers', { templateurl: 'supplier