Posts

Showing posts from May, 2014

Check if a form field exists when doing form validation? Laravel 5 -

i have form has conditional logic displays or hides each field. want validate fields shown. see field list in validation script below , imagine hide "phone" form field in using conditional logic in view — still want validate rest of fields, if "phone" validation still there, script fails , shows error message saying "the phone number required." in laravel 5, there way check if form field exists or change whether it's required or not dynamically before or when validating form? here's validation code... $v = validator::make(input()->all(), [ 'firstname' => 'required|min:1|max:80', 'lastname' => 'required|min:1|max:80', 'address' => 'required|min:10|max:80', 'address2' => 'max:20', 'city' => 'required|min:2|max:80', 'state' => 'required|min:2|max:...

Setting request.session causes HTTP 500 Error when posting form to Django -

even setting session simple string changes http response status 200 500. httml button has id="requestquote". webpage javascript: $('#requestquote').click(function(){ var jpicks = json.stringify(picks); $.post("requestforquote",{counties:jpicks}).done(function(){ window.location = base_url + "countyparcels/quoteform" }); }); url.py urlpatterns = [ url(r'^(requestforquote)$',views.request4quote), url(r'^(quoteform)$',views.quoteform) ] views.py shopping_cart = 'shoppingcart' @csrf_exempt def request4quote(request,misc): try: request.session[shopping_cart] = request.post['counties'] # no exception here except exception e: print e.message try: response = httpresponse("true",content_type="text/plain") # no exception here except exception e: print e.message response = http404 return response # h...

c++ - Using pair in variadic templates -

okay, i'm trying implement range tree in n-dimensions using variadic templates. have basic setup working, want able optionally pass compare function object in template list sort tree other std::less. my first thought overload template list version includes pair first element, pair containing type , compare funcition. can't see template declaration line compile. visual c++ (2015) starts c2079: "std::pair::first uses undefined class 't'". anyways, on code. here's small snippet show i'm trying do: template <class... args> class rangetree{ }; template <class t, class... args> class rangetree<t, args...> { public: map <t, rangetree<args...> * > tree; }; this works normally. when add version of rangetree, pair first template member, have problems: template <pair<class t, class compare>, class... args> class rangetree<pair<t, compare>, args...>{ public: map <t, rangetree <ar...

DShow Sample Code for playing video does not play the video MSDN C++ -

i referring example program provided here run video file, in case mp4 format using dshow. refer complete code: #include <dshow.h> #pragma comment (lib, "strmiids.lib") void main(void) { igraphbuilder *pgraph = null; imediacontrol *pcontrol = null; imediaevent *pevent = null; // initialize com library. hresult hr = coinitialize(null); if (failed(hr)) { printf("error - not initialize com library"); return; } // create filter graph manager , query interfaces. hr = cocreateinstance(clsid_filtergraph, null, clsctx_inproc_server, iid_igraphbuilder, (void **)&pgraph); if (failed(hr)) { printf("error - not create filter graph manager."); return; } hr = pgraph->queryinterface(iid_imediacontrol, (void **)&pcontrol); hr = pgraph->queryinterface(iid_imediaevent, (void **)&pevent); // build graph. important: ch...

mysql - Unable to call a stored procedure -

i'm learning mysql stored procedures and, turns out, i'm not @ now. want create stored procedure selects columns different tables and, obviously, outputs result. have: use `usertable159`; drop procedure if exists `getdatafor`; delimiter $$ use `usertable159`$$ create definer=`michael`@`%` procedure `getdatafor`(in country varchar(2), in asin varchar(20),in fc varchar(1)) begin set @sql = "select p.price, p.sku, p.fulfillment_channel, group_concat(es.excludedseller) excluded, r.excludenonfeatured "+country+"_products p left join ("+country+"_excludedsellers es, "+country+"_excluderules r) on p.seller_sku = es.seller_sku , p.seller_sku = r.seller_sku p.asin = '" + asin + "' , p.fulfillment_channel = " + fc + "; "; prepare stmt @sql; execute stmt; deallocate prepare stmt; end $$ delimiter ; from errors expected when writing this... 1 surprising me: error c...

big o - Big O - Time Complexity puzzling for while loops -

as time complexity example (refreshing mind) attempting solve find running time (in terms on n) of following algorithm: for (i=1; <= n; i++) { //o(n) k = 1; (j=1; j <= i; j++) { //o(n) k = 2*k; } j = k*k; while (j > 1) { //o(..?) j = j / 2; } } i understand first 2 loops combined take o(n^2), little perplexed @ how find running time of while loop. although know while loop runs twice first execution, 4 times, 6... multiples of 2. make run o(nlog(n)) times? the repeated division log_2(j) same log(j) / log(2) . log(2) constant, it's written log(j) . because o(log(n)) @ same depth o(n) loop , o(n) loop dwarfs o(log(n)) loop, 2 combined takes o(n) time. the final time complexity o(n^2) .

go - Golang - How to initialize a list of objects given only an interface sample? -

i'm writing database interface in google go. takes encoding.binarymarshaler objects save , saves them []byte slices, , loads data encoding.binaryunmarshaler return it: func (db *db) get(bucket []byte, key []byte, destination encoding.binaryunmarshaler) (encoding.binaryunmarshaler, error) { i want implement being able load arbitrary length slice of encoding.binaryunmarshaler s in 1 go (for example "load data bucket x"). want function able load number of data objects without knowing beforehand how many objects loaded, don't expect final user pass me slice filled. instead, take encoding.binaryunmarshaler sample object know structures i'm dealing with: func (db *db) getall(bucket []byte, sample encoding.binaryunmarshaler) ([]encoding.binaryunmarshaler, error) { the problem ran while coding this, i'm not sure how initialize new instances of given object, since don't know object dealing with, interface conforms to. tried doing was: tmp:=new(refl...

javascript - Ember JS,Pass input tag value as parameter in action handlbars -

i want value <input> tag , pass parameter action in emberjs when used jquery {{action 'add' this.$('#x').val()}} ember failed build giving parse error on line ... here want pass x , y parameter {{action}} , know syntax sending parameters {{action parameter1 parameter2 ..etc}} templates\alpha.hbs <h1>alpha template</h1> <div> <label>x value</label> <input type="text" id="x"> <label>y</label> <input type="text" id="y"> <input type="button" id ="add-button" value="add" {{action 'add' }}> </div> controllers\alpha.js import ember 'ember'; export default ember.controller.extend({ actions:{ add: function(x, y){ alert('this done right '+x+ ' ' + y); } } }); i tested code without passing parameters , code worked expected giving alert required you need take...

The correct way to convert php array -

i have data array like $data = [ 'name' => [ (int) 0 => '095a108478345cac184f956b1e8dee91a5a89f87bbabd7b3fb4058f577adf.jpg', (int) 1 => '02059.jpg', (int) 2 => 'avatar.jpg' ], 'type' => [ (int) 0 => 'image/jpeg', (int) 1 => 'image/jpeg', (int) 2 => 'image/jpeg' ], 'tmp_name' => [ (int) 0 => 'c:\xampp\tmp\php17aa.tmp', (int) 1 => 'c:\xampp\tmp\php17ba.tmp', (int) 2 => 'c:\xampp\tmp\php17bb.tmp' ], 'error' => [ (int) 0 => (int) 0, (int) 1 => (int) 0, (int) 2 => (int) 0 ], 'size' => [ (int) 0 => (int) 80542, (int) 1 => (int) 6532, (int) 2 => (int) 6879 ] ] and need convert array this $data = [ (int) 0 => [ 'name' => ...

exploit - Virus on Wordpress. Can you tell me how I can compress the "zipped" code? and understand the virus? -

i found virus on wordpress installation seems malware redistribution bug. extracted code of zipped in way. tried decompress failed. the code in lot of directories name of uge.php, ghe.php , on. here find code: http://pasted.co/dc05c112 can please me delete virus, find hacked files , repair wordpress installation? ah, going fun. dumping code the code base64-decodes , gzip-uncompresses itself. creates anonymous function through php create_function($vars, $function_code) function. echo code instead eval() -ing it, , you'll see result. used dumping script: <php $v = 'enqm...'; //the string in source above echo gzuncompress(base64_decode($v)); ?> execute php , redirect output file. $ php -f decoder.php > uncompressed.php the result contain non-ascii-readable characters, might bit fuzzy. unreadable ascii characters part of variable's name. decoded them printing them hex characters, source becomes readable. decode \xff encoded hex-ch...

java - My Programming Lab standard output errors -

i've been working on code , seems working, when myprogramminglab runs code says there problem standard output. here problem: write temperature class hold temperature in fahrenheit , provide methods temperature in fahrenheit, celsius, , kelvin. class should have following field: • ftemp: double holds fahrenheit temperature. the class should have following methods : • constructor : constructor accepts fahrenheit temperature (as double ) , stores in ftemp field. • setfahrenheit: set fahrenheit method accepts fahrenheit temperature (as double ) , stores in ftemp field. • getfahrenheit: returns value of ftemp field fahrenheit temperature (no conversion required) • getcelsius: returns value of ftemp field converted celsius. use following formula convert celsius: celsius = (5/9) * (fahrenheit - 32) • getkelvin: returns value of ftemp field converted kelvin. use following formula convert kelvin: kelvin = ((5/9) * (fahrenheit - 32)) + 273 demonstrate temperature...

r - Find name of node associated with maximum degree in igraph data frame -

i using igraph package find degree of each node (the built in degree(g) function) , returns numeric vector. how can tell node has maximum degree (not value node name)? if have igraph data frame g , can create true/false vector degree(g)==max(degree(g)) . can use find name of node(s) meet criteria - v(g)$name[degree(g)==max(degree(g))] . i created small example illustrate: library(igraph) df = data.frame(node1=c("bob", "jim", "dave", "dave"), node2=c("jane", "john", "sally", "al")) g = graph.data.frame(df) v(g)$name[degree(g)==max(degree(g))] [1] "dave"

javascript - Similar function as attr() with parameter for callback function -

i have button , input box. when click button, it's suppose make input box readonly, before calling callback function, problem attr() in jquery doesn't have parameter callback function. there jquery function can use same thing have parameter callback function, or there way this? thank you. <button> click me </button> <input type = "text"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script type = "text/javascript"> $(function() { $('button').click(function(){ $('input').attr('readonly', 'readonly'); }); }); </script> $(function() { $('button').click(function() { $('input').attr('readonly', 'readonly'); // want here }); });

ruby on rails - Is it possible to receive e-mail using Google Apps for Work (gmail) with a heroku domain? -

i have google work account , i'm creating e-mail address herokuapp domain (e.g. me@myapp.herokuapp.com). have verified domain putting meta tag in header of app. can send e-mail through gmail me@myapp.herokuapp.com reason can't receive e-mail. i'm curious causing problem of e-mail not going through. if has insight, appreciate it. know it's possible receive e-mail using custom domain in heroku app, don't want spend money on custom domain right now. as mentioned miketreacy, need configure dns records herokuapp.com subdomain point google server. not heroku allows though. way can send , receive emails app own domain name.

idiomatic way to solve chicken-egg in scala -

how nicely initialize structures that: case class a(name: string, b: b) case class b(name: string, a: a) looking solution without lazy vals (performance overhead) , without adding new members existing case class (it looks ugly), special wrappers , changes of original type-signature maybe fine (at least it's best i've got now). tostring-problem negligible can override in trait. for now, came this: case class chicken[t](h: holder[t, _]) { def = h.chicken override def tostring = get.tostring } case class egg[u](h: holder[_, u]) { def = h.egg override def tostring = get.tostring } implicit def egg[t] = (_: egg[t]).get implicit def chicken[t] = (_: chicken[t]).get case class holder[u, t] (chickenf: (egg[t], chicken[u]) => (u, t)) { val (chicken, egg) = chickenf( egg(this), chicken(this)) } def mutual[u, t](chickenf: (egg[t], chicken[u]) => (u, t)) = { val h = new holder(chickenf) h.chick...

c++11 - Custom C++ stream for custom type -

i've read custom streams c++ seems people inherit std::streambuf , std::istream , , std::ostream . inspecting type's declarations becomes clear these meant characters: typedef basic_streambuf<char> streambuf; the docs confirm this: input stream objects can read , interpret input sequences of characters. obviously, makes sense. i'm wondering correct way of implementing stream other types. not want allow text other forms of binary input/output (i have specific formats). obvious step seems to inherit basic variants of above ( basic_streambuf , basic_istream , , basic_ostream ) , use whatever type see fit template parameter. failed find confirmation right procedure. so, it? edit clarification: have class called segment. these streams send/receive segments , segments on wifi connection these used in communication protocol. sending else break protocol. means stream cannot support other types. this not answer question in terms of inherit...

firebase - $firebaseArray $indexFor() not finding key when given value -

i have firebase: users: { userid: { notifications: { notificationid: "notification" } } } when given "notification", i'm trying find notificationid (which generated push() method) can delete it. according docs, $indexfor() method should me. here's code: var ref = new firebase('https://url.firebaseio.com/'); $scope.dismissnotification = function(notification) { var notificationref = ref.child('users/' + $scope.currentuser.id + '/notifications'); var notifications = $firebasearray(notificationref); notifications.$loaded().then(function(data) { console.log(data); console.log(data.$indexfor(notification)); }).catch(function(error) { console.log('error: ' + error); }); }; the first log correct object notification string inside i'm looking for, second log returns -1, when want return notificationid associated it. not sure you're trying accomplish,...

html - The position of SVG is off on Chrome. How do I align it to how it is displayed on Firefox? -

Image
i don't know why happening. ideally, svg displayed on text on browsers, chrome not making happen. how looks on firefox: and how looks on chrome: can tell, svg on text. don't know if it's margin or svg understand how can fix this. here css: svg{ display:block; } #rect{ margin-top:-150px; /*helps svg display on text on firefox. nothing happens on chrome*/ margin-left:200px; height:500px; } and svg code: <div class="circle-border"> <div class="svg"> <?xml version="1.0" encoding="utf-8"?> <!-- generator: adobe illustrator 19.0.1, svg export plug-in . svg version: 6.00 build 0) --> <svg id="rect" version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewbox="0 0 960 560" xml:space="preserve"> ...

c - Can't read the value from pipe correctly -

Image
i trying initiate simple pipe in c (using cygwin , dev-c++) pass values between parent , single child. here parent code (pipesnd.c): #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int fifo[2]; char *msg = "this test message"; char str[10]; if (pipe(fifo) == -1) { printf("cannot create pipe\n"); exit(1); } write(fifo[1], msg, strlen(msg)); sprintf(str, "%d", fifo[0]); printf("i parent , in pipe: %s \n", str); fflush(stdout); switch (fork()) { case 0: execl("c:/dev-cpp/lift 2/pipercv", "pipercv", str, null); exit(1); case -1: perror("fork() failed:"); exit(2); default: } exit(0); } and child code (pipercv.c): #include <stdio.h> #include <stdlib.h> #include <string.h> #define nbuf 100 int main(int argc, char *argv...

windows - Mingw C++ Building Dynamic/Static x86/x64 -

so i'm on windows, , i'm wondering how build dll , static library in mingw, , in different architectures x86 , x64. i'm new mingw, not c++. i've been looking around google while , haven't found way yet, reason being because of tutorials find out-of-date. gnu 'make' file sources = test.cpp utilities.cpp objects = $(sources:.cpp=.o) projname = myprogram buildname = $(projname).dll $(projname) : $(objects) g++ -o $(buildname) $(objects) $(objects) : g++ -c -d test_dynamic $(sources) clean : rm $(objects) $(buildname) addition information mingw version: 4.8.1-4 attempts http://www.mingw.org/wiki/sampledll -shared unrecognized command. okay figured out why wasn't working. sites not out-of-date, mingw was, system using cygwin, don't want. changed 'path' variable direct correct mingw.

VBScript Spoof iPhone Mobile User Agent in IE -

how can spoof user agent on demand in internet explorer via vbscript? there site want access intended mobile devices. goal spoof ios mobile device. need able fake agent, display page, ad interact it. google failing me. tia this snippet of code connects http://www.whatsmyua.com/ pretending iphone 6 , prints output of site: dim o : set o = createobject("msxml2.xmlhttp") o.open "get", "http://www.whatsmyua.com/", false o.setrequestheader "user-agent", "mozilla/5.0 (iphone; cpu iphone os 6_0 mac os x) applewebkit/536.26 (khtml, gecko) version/6.0 mobile/10a5376e safari/8536.25" o.send wscript.echo o.responsetext i didn't have iphone 6 hand used this question determine user agent.

ios - Broadcasting video iphone to Wowza server using AVCaptureSession -

i developing live broadcasting feature, have built custom camera shoot video using avcapturesession , , have wowza server broadcasting, so question how encode video avcapturefileoutputrecordingdelegate , avcapturevideodataoutputsamplebufferdelegate , send server, found many libraries, not suitable our application, provide own ui, can 1 suggest other library or step step integration are using avassetwriterinput init mediatype:outputsettings:sourceformathint: method?. takes dictionary desired settings. docs..."specify dictionary containing settings used encoding media appended output. may pass nil parameter if not want appended samples re-encoded."

"Back to the parent activity" button stopped working in Android application -

i have fix bug: clicking (tapping on) "back parent activity" arrow not bring parent activity in android application. the activity defined in manifest <activity android:name=".workhistory" android:label="@string/title_activity_list" android:parentactivityname=".progress" > <meta-data android:name="android.support.parent_activity" android:value="com.au.ontime.progress" /> </activity> and launched com.au.ontime.progress activity like intent = new intent(progress.this, workhistory.class); if (timeline.ontheclock()) { intent.putextra("activesince", timeline.getlastclockin()); intent.putextra("active", timeline.getactive()); } startactivity(intent); the activity not have code call finish() . closed tapping on arrow on top left , worked before. activity otherwise ...

run time error 91 : Object Variable or With block variable not set in excel 2013 -

i have macro : sheets("amend estimate").select cells.find(what:=sheets("amend quote").range("g4").value, after:=activecell, lookin:=xlvalues, _ lookat:=xlpart, searchorder:=xlbyrows, searchdirection:=xlnext, _ matchcase:=false, searchformat:=false).activate activecell.offset(41, 3).select selection.copy sheets("amend quote").select range("g4").offset(14, 0).select selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _ :=false, transpose:=false '#2 sheets("amend estimate").select cells.find(what:=sheets("amend quote").range("h4").value, after:=activecell, lookin:=xlvalues, _ lookat:=xlpart, searchorder:=xlbyrows, searchdirection:=xlnext, _ matchcase:=false, searchformat:=false).activate activecell.offset(41, 3).select selection.copy sheets("amend quote").select range("h4").offset(14, 0).select selection.pastespecial paste...

c - Working of bitwise XOR on int operands of arrays -

i beginner.so, problem facing :- how logic of bitwise xor works in case of arrays? for example in code below:- // function return odd occurring element int findodd(int arr[], int n) { int res = 0, i; (i = 0; < n; i++) res ^= arr[i]; return res; } int main(void) { int arr[] = {12, 12, 14, 90, 14, 14, 14}; int n = sizeof(arr)/sizeof(arr[0]); printf ("the odd occurring element %d ", findodd(arr, n)); return 0; } how, exactly, whole findodd function working? can please explain basic logic behind use of xor in above code example? you have used bitwise xor , deals binary bytes. not directly applied on array on binary representation of data stored in . and function to find number odd occurrence in array . and using property of xor operations - xor of number gives 0 , xor of number 0 gives number itself. we can understand operations in each iteration- 1 iteration- res=0(0000)^12(1100) -> res= 12(1100) // writin...

dictionary - Specified key type does not match the type expected for this container matlab -

i have cell_array 29136x1 cell value shows in workspace pallet. have map new_labels 4x1 map in workspace pallet. printing new_label on prompt gives new_labels = map properties: count: 4 keytype: char valuetype: double each entry in cell_array key in map, problem there type mismatch keytype in map char , entries of cell_array of type cell . because of cannot access map , hence following: arrayfun(@(x) new_labels(x), cell_array, 'un',0); gives error specified key type not match type expected container. i tried converting char type using char_cell_array = char(cell_array) converts array of size 29136x4 means every entry 1 char , not string. any appreciated. if want use iterative way, have use cellfun . arrayfun operates on numeric arrays. because cell_array cell array, need use cellfun instead of arrayfun cellfun iterate on cell arrays instead. however, you're after specifying more 1 key dictionary associate...

c# controlling program flow l by object type while in a loop -

i working system allows users add c.v.s company database. document consists of sections , each section there can 1 or more fields. field corresponds user control mapped specific field type. user controls not bound document object in way , save data document page containing user controls there method this: public void savedata(document document) { // user controls on page var usercontrols = finddescendants<usercontrol>(this); foreach (var section in document.sections) { foreach (var field in section.fields) { if (field address) { var address = field address; var addresscontrol = usercontrols.firstordefault(o => o.clientid.contains(field.id)) addressusercontrol; addresscontrol.savedata(address); } else if (field telephonenumbers) { var telephonenumbers = field telephonenumbers; var telephonenumberscon...

ruby on rails - Set id on a csv import for a has_and_belongs_to_many relationship -

i have 2 models in app: list.rb , contacts.rb , have has_and_belongs_to_many relationship. have following method in contacts_controller.rb : def import contact.import(params[:file]) redirect_to contacts_path, notice: "contacts imported." end i calling method after creating list in list#create action. how can set/input list_id import method above, records created through csv file? thank you! you need first list, example in show method. make sure import member-route. @list = list.find(params[:id]) you need modify import method, takes second parameter list. def contact.import_for_list(file, list) # loop on csv lines # each line create contact element # , add new contact element list list.contacts << newly_created_contact # or create contact list object list.contacts.build(....) # depending how created objects need save them explicitly end and lastly call modified method def import @list = list.fin...

mysql - Foreign Key is not Updating with the primary key of other table -

i added primary key named "loc_id" in location_table. , in employee_table, making 'loc_id' foreign key. doing in wamp "innodb" set in both tables , on delete cascade , on update cascade set. i inserting value in "loc_id" column of location table value inserting not reflecting in employee table even-though set foreign key in employee_table. example : i inserting value "101" primary key in "loc_id" column of location_table, think since have made "loc_id" column foreign key on update cascade on in employee_table, value should automatically reflects/show in loc_id column of employee_table. can me in this??

c++ - How do I add this condition in this and make it optimal? -

Image
the question link is: http://codeforces.com/problemset/problem/431/c quite creative student lesha had lecture on trees. after lecture lesha inspired , came tree of own called k-tree. a k-tree infinite rooted tree where: each vertex has k children; each edge has weight; if @ edges goes vertex children (exactly k edges), weights equal 1, 2, 3, ..., k. the picture below shows part of 3-tree. as dima, friend of lesha, found out tree, wondered: "how many paths of total weight n (the sum of weights of edges in path) there, starting root of k-tree , containing @ least 1 edge of weight @ least d?". dima find answer question. number of ways can rather large, print modulo 1000000007 (10^9 + 7). (open question link above picture of mentioned tree) input single line contains 3 space-separated integers: n, k , d (1 ≤ n, k ≤ 100; 1 ≤ d ≤ k). output print single integer — answer problem modulo 1000000...

opengl - Issue overriding c++ class for drawing curve -

i'm trying implement program lines drawn point point when user clicks on screen. have polyline class, subclass of freeform class, subclass of curve class. draw method of curve superclass calls getpoint, weighted point curve @ specific point. however, in case of draw method polyline, i'm trying override curve class point user clicking on (as can see, draw method of polyline class never calls getpoint). however, when debug code see getpoint still being called when try draw polyline. suggestions? class curve { public: virtual float2 getpoint(float t)=0; void draw(){ glbegin(gl_line_strip); (float = 0; < 1; i+=.01) { float2 point = getpoint(i); float x = point.x; float y = point.y; glvertex2d(x, y); } glend(); }; }; class freeform : public curve { protected: std::vector<float2> controlpoints; public: virtual float2 getpoint(float t)=0; virtual void a...

javascript - Listener method inside auto-binding template? (Polymer 1.0) -

<template is="dom-bind"> <custom-element></custom-element> <iron-ajax auto url="data.json" handle-as="json" last-response="{{data}}" on-response="receivedresponse"></iron-ajax> </template> in example above "custom-element" needs know when iron-ajax has received response. problem don't know put "receivedresponse" method. how do this? prefer put inside "custom-element", don't know how bind "on-response" event of iron-ajax. i bind "{{data}}" property of "custom-element" , have observer property, feels hack , i'd find out correct way of doing this. assign id auto-binding template ease of access <tempalte id="app" is="dom-bind"> then init template in javascript var app = document.queryselector('#app'); and create function. app.receivedresponse = function () { // pro...

Get full conversation with Android query -

i messages 1 contact. have contact id _id , i've : private void displaymessages() { contentresolver cr = this.getcontentresolver(); try { cursor cursor = cr.query(uri.parse("content://mms-sms/conversations"), new string[]{"*"}, this.contid + "= _id" , null, null); //contid unique id 1 contact in our android. while (cursor.movetonext()) { system.out.println("number: " + cursor.getstring(cursor.getcolumnindexorthrow("address"))); system.out.println("body : " + cursor.getstring(cursor.getcolumnindexorthrow("body"))); } cursor.close(); } catch (exception e) { system.out.print("error"); } i've asked like select * content://mms-sms/conversations _id = contid as can see, in query, ask system messages 1 contact (user id know) can display last message body . think exists others query messages 1 user ? any id...

passing flask python variables on the server to reactjs as props -

i'm trying pass flask variables server react can't working. @ moment have render function in reactjs file looks like: reactdom.render( <attribute prop1='{{ prop1 }}' prop2='{{ prop2 }}' />, document.getelementbyid('main') ); in python on flask server have: return render_template('index.html', prop1=var1, prop2=var2) it should <attribute prop1={ prop1 } prop2={ prop2 } />

thingsboard - Pushing data on Raspberry pi 3 -

my code work push data on demo server, when push same data on raspberry pi 3 got error message in thingsboard.log [http-nio-0.0.0.0-8080-exec-10] error o.a.coyote.http11.http11nioprotocol - error reading request, ignored thanks in advance help

c# - SQL randomize rows and columns -

may know, how can randomize data gathered , randomize selected using sql integrate c# winform for example main content-----content1-----content2-----content3-----content4 to main content-----content1-----content4-----content2-----content3 like multiple choice question, randomize question , choices. in advance. edit: this class. public class qbank { string question, c1, c2, c3, c4, ans; public string ans { { return ans; } set { ans = value; } } public string c1 { { return c1; } set { c1 = value; } } public string c2 { { return c2; } set { c2 = value; } } public string c3 { { return c3; } set { c3 = value; } } public string c4 { { return c4; } set { c4 = value; } } public string question { { return question; } set { question = value; } } this winform using system; using system.collections....

javascript - Android Studio - Add, Edit and Delete records using SQLite -

Image
i extreme beginner @ android studio , using javascript , still learning , trying grasp new concepts of android studio whole. i trying create database adds, edits , deletes records user manually inputs. when friends.xml page ( friends.java ) , fill out fields add user , press "add" comes toast notify user data has been added succesfully when click on "view data" (which links view_data.xml ( listdata.java )) doesn't seem show entries . it great if answer put possible still beginner! appreciated! thanks! friends.java package com.example.chris.mobileappsassignment; import android.content.context; import android.content.intent; import android.os.bundle; import android.support.design.widget.floatingactionbutton; import android.support.design.widget.snackbar; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.view; import android.view.menu; import android.view.menuitem; import android.w...