Posts

Showing posts from July, 2015

PHP change email address on account when logged in -

i trying enable user change password on account when logged in. however, cant seem work. do have suggestions? <?php if ($_post['submitemail']) { $newemail = $_post['email']; $newemail = stripslashes($newemail); $newemail = str_replace("'", "&#39", "$newemail"); //checks database see if email user types in exists $query = "select * users email = '$newemail'"; $result = mysqli_query($db_connection, $query); $nums = mysqli_num_rows($result); if ($nums >= 1) { //if email exists, inform user echo "email exists"; echo "<br/>click <a href = 'account.php?page=email'> here</a> try again"; } else { //if email not exist, update users email $querychange = "update users set email = '$newemail' id = '$userid'"; $result3 = mysqli_query($db_connection, $querychange); echo "your email has been changed"; ...

c# - Windows Forms App not being ran in full size -

i'm working size-sensitive windows forms application right , noticed because i'm creating bitmap that's size of form, form shorter it's size.height property when it's created, there way fix , preferably lock form user can't resize it. please note, form's size ( form.size ) differs client area size ( form.clientsize ). difference equals width of window's border. prevent user resizing form, set appropriate value form's formborderstyle property.

python - Writing to a file from a Flask Server -

i writing small application. pretty small 1 learn new technologies.( angular -- front end) , flask server side . in server, have store users info in file. file has usernames , passwords. have tried : ( not working ): f=open('userinfo.txt','w') f.write(app.users) f.close() here store username , password in app.users dictionary. app= flask(__name__) app.users={} these 2 lines show dictionary part. how can store usernames , passwords in file. how can implement this. help. tutorials can learn. storing usernames , passwords in file may not best idea cannot write dictionary file can write strings file. example assume app.users dictionary in format {username: password} import os open('userinfo.txt', 'w') users_file: username, password in app.users.items() users_file.write(username + ',' + password + os.linesep)

Add slider to line chart fusion chart -

i using fusion chart library building line chart. want slider @ bottom of chart values can change when slider moved , forth. how can achieve in fusion charts ? are looking solution ? http://jsfiddle.net/subramaniashiva/anrsydf7/ i have used getjsondata , setjsondata of fusioncharts , updated line chart based on value slider. fusioncharts.ready(function() { var chartconfig = { "caption": "total footfall in bakersfield central - admin view", "subcaption": "year 2014", "xaxisname": "month", "yaxisname": "no. of visitors", //cosmetics "linethickness": "2", "palettecolors": "#0075c2", "basefontcolor": "#333333", "basefont": "helvetica neue,arial", "captionfontsize": "14", "subcaptionfontsize": "...

python - How to make a class that can run multi-threading program? -

i'm making spelling word game. in word fall sky , if players type in correct word, word disappears. i've realized ncurses library , self defined function. now need rewrite 1 self defined class. but it's hard figure out how realized 1 class in 2 threadings needed! 1 word falling sky, , player typing. do have ideals realize it? you not need multiple threads this. instead, can use select() wait data read (from keyboard) on stdin_fileno timeout (upon can advance next "frame" of animation).

iOS Bluetooth dual-mode; connect BLE (GATT) to an already connected BR/EDR (A2DP/HFP) stereo headset simultaneously -

i'm developing stereo headset bluetooth using classic profiles (hfp, a2dp, avrcp) 1 expect ina stereo headset. however, want deploy remote control app ios, , use simultaneously other classic links, dual-mode chipset i'm working in design not behave i'd expect; the headset setup peripheral, letting ios device act central. such, peripheral advertise ble services (with specific 128-bit uuids) , good. can browse peripheral central, when i'm not connected classic profiles (e.g., while not streaming audio). my device not seem able advertise ble, while connected hfp and/or a2dp! however, have seen demos of same chipset acting ble central, scanning , connecting other ble peripherals, while simultaneously streaming audio via a2dp. however, in setup device acting a2dp sink connected iphone, while scanning/connecting via ble third unit acting ble peripheral. hence, not point-to-point both classic , smart bluetooth same device. is there dual-mode constraint 1 cannot act p...

ios - Crash with NSURLSessionUploadTask when trying to upload in background -

Image
in app try upload data server when app enters background. code using: session self.session = [self backgroundsession]; this how session set up - (nsurlsession *)backgroundsession { static nsurlsession *session = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ nsurlsessionconfiguration *configuration = [nsurlsessionconfiguration backgroundsessionconfiguration:@"com.uploadsession"]; configuration.httpmaximumconnectionsperhost = 1; session = [nsurlsession sessionwithconfiguration:configuration delegate:self delegatequeue:nil]; }); return session; } initiate upload - (void)applicationdidenterbackground:(uiapplication *)application { [self uploadpossibledrives]; } upload // start uploading remaing gps log in th right order: nsoperationqueue *queue = [[nsoperationqueue alloc] init]; [queue setmaxconcurrentoperationcount:1]; (int = 0; < arrayofgpslogchunks.count; i++) { // ensure ch...

node.js - Express does not return all query string parameters -

route app.get('/pdf/:id', function(req, res) { request get http://localhost/pdf/123?option=456&clientid=789 i get req.query == { option: '456' } req.params == { id: '123' } how comes second query parameter cut off? delimiter standard '&' if using curl or terminal command, & has special meaning there. try gettig inside quotes as curl 'http://localhost/pdf/123?option=456&clientid=789'

String Search C program without using built-in functions -

i have problem in c program. string search program. problem when type string aabaaacaamaad , result comes null when search ab in should not ab there in aabaaacaamaad . same result comes am , ad right why come aabaaacaamaad ? code: char* mystrstr(char* pszsearchstring, char* pszsearchword); int main(int argc, char* argv[]) { char sztemp1[20] = {0}; char sztemp2[10] = {0}; char * psztemp1 = null; strcpy(sztemp1, "aabaaacaamaad"); strcpy(sztemp2, "aa"); psztemp1 = mystrstr(sztemp1, sztemp2); printf("%s", psztemp1); getch(); return 0; } char* mystrstr(char* pszsearchstring, char* pszsearchword) { int nfcount = 0; int nscount = 0; int nsearchlen = 0; int nindex = 0; char* pszdelstring = null; if(pszsearchstring == null || pszsearchword == null) { return null; } while(pszsearchword[nsearchlen] != '\0') { nsearchlen++...

windows 7 x64 - VB.NET SplashScreen "Program stopped working" -

environment: visual basic (version 2008) .net framework 3.5 windows 7 64 bits problem: i have program next start code, during years worked. public class splashfrm private withevents dosomework validatecls private sub splashfrm_load(byval sender object, byval e system.eventargs) handles me.load me.show() dosomework = new validatecls application.doevents() dosomework.doworks() end sub private sub react() handles dosomework.workfinished loginfrm.show() me.close() end sub end class public class validatecls public event workfinished() sub doworks() addhandler system.appdomain.currentdomain.unhandledexception, addressof onunhandledexception try 'here code validate licenses. 'i can not put code, works fine because can see validating ok. catch ex exception saveerror("validatecls-1", ex.tostring) end end try raiseevent workfinished() ...

wso2esb - WSO2 ESB 4.8.1 Custom Proxy Fail and 4.7.1 works -

i have custom proxy in wso2 esb 4.7 works correct. but, when copy esb 4.8.1 it's fail. this te code. <?xml version="1.0" encoding="utf-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="expertws" transports="http" statistics="disable" trace="enable" startonload="true"> <target> <insequence> <log level="full"/> <send> <endpoint> <http uri-template="http://1.33.33.103:8080/erpws/logistica/master/ume/{pempresa}"/> </endpoint> </send> </insequence> <outsequence> <send/> </outsequence> </target> <description/> </proxy> any idea?? thanks in http endpoint, properties names must start "uri.var" : uri.var.pempresa , ...

c# - Uploading files by dropzone.js give error, Request format is invalid: multipart/form-data; -

i using dropzone being able upload multiple files webservice, keep on getting error: system.invalidoperationexception: request format invalid: multipart/form-data; boundary=----------wmbuh1mgt5uyai5sek0qnm. @ system.web.services.protocols.httpserverprotocol.readparameters() @ system.web.services.protocols.webservicehandler.coreprocessrequest() this c# function public bool invoketest(byte[] binaryarray, string docname) as trying avoid page_load , try make work without form submit , jquery function as: $('#dropzone').dropzone({ url: '_upload/uploader.asmx/invoketest', enctype: 'multipart/form-data', maxfilesize: 1, paramname: 'photos', addremovelinks: true, enqueueforupload: false, }); my form submit looks simple: <form id="form1" action="_upload/uploader.asmx/invoketest" method="post" enctype="multipart/form-data" runat="server"...

javascript - Testing server's response -

i have form in angular app in user required provide valid url. therefore when submitting form, i'd test if url valid making request url provided , check if server sends 200. when click submit button, following code run: $http.get(scope.target_url).success(function(){ // code }).error(function(error){ console.log(error); }); however, never successfull answer: - if provide url like: ' http://www.somesite.com ', get: xmlhttprequest cannot load 'http://www.somesite.com'. received invalid response. origin 'mydomain' therefore not allowed access. if provide url like: ' http://somesite.com ', get: xmlhttprequest cannot load http://somesite.com/ . no 'access-control-allow-origin' header present on requested resource. origin 'mydomain' therefore not allowed access. where problem come from? that normal security constraints. read cors here: http://en.wikipedi...

c# - Uupdate values in two tables via stored procedure -

i have 2 tables , need update values in them via stored procedure. tried update times update first table only, others second or fail due cannot allow duplicates. when updates whole data in table becomes same new updated ones. i've reached error after these lines of codes cannot insert value null column 'emp_id',table 'datepics'; column not allow nulls. update fails.the statement has been terminated here sql code : alter procedure [dbo].[updateemp] @empname nvarchar(100), @nationality nvarchar(30), @passport nvarchar(20), @contractdate date, @healthdate date begin set nocount on; declare @ids table (id int ) update employee set empname=@empname, nationality=@nationality, visa=@visa, passport=@passport, receiveddate=@receiveddate,idissue=@idissue, idexpiry=@idexpiry, sponsor=@sponsor output inserted.id @ids (id) id = @id update datepics set fingerdate=@fingerdate, contractdate=@contractdate, healthdate=@healthdate emp_id ...

cypher - Neo4J:Data Modelling - Creating too many relationships -

i working on use-case,in this there users. there tags. user shares posts(content) other users. , each post connected multiple tags. thinking create user,tag , post nodes. when post shared: relationships added between post node , user nodes(with whom post shared with, can 20 users). a relationships added between post node , post creator. relationships added between post node , tag nodes(can 20 tags) i think adding relationships way helps retrieve posts user or tags. posts created frequently. my concern: feel approach creates lot of data(post node , relationships tags , other users) per post. also, think data grow fast posts shared , think each post creation expensive operation. do think approach fine or there better way? linking many nodes via meaningful relationships design because plays neo4j's strengths. if application has requirement know these relationships, design sounds me decent one. have other options; example, if wanted know tags post...

android - Receiving an intent in Cordova PhoneGap app -

i have registered cordova app intent fired when nfc tag read. app starts expected. i´m not able information of intent. tried 'webintent' plugin, return null. so how can information of intent app invoked by? edit: in 'ondeviceready' function call window.plugins.webintent.getextra("android.nfc.extra.tag", function(url) { alert(url); }, function() { alert("no extras 'tag'"); // there no supplied. } ); i tried 'android.nfc.extra.ndef_messages' still 'null'.

c# - How to get a byte** from managed byte[] buffer -

i've been using ffmpeg.autogen https://github.com/ruslan-b/ffmpeg.autogen wrapper decode h264 video sometime great success , have add aac audio decoding (previous using g711 , naudio this). i have aac stream decoding using avcodec_decode_audio4, output buffer or frame in floating point format flt , need in s16. have found unmanaged examples using swr_convert , ffmpeg.autogen have function p/invoked as; [dllimport(swresample_library, entrypoint="swr_convert", callingconvention = callingconvention.cdecl, charset = charset.ansi)] public static extern int swr_convert(swrcontext* s, byte** @out, int out_count, byte** @in, int in_count); my trouble can't find successful way of converting/fixing/casting managed byte[] in byte** provide destination buffer. has doing before? my non-working code... packet.resetbuffer(m_avframe->linesize[0]*2); fixed (byte* pdata = packet.payload) { byte** src = &m_avframe->data_0; //byte** dst = *pdata; i...

javascript - jQuery of multiple elements not executing, although works on concept -

on concept design jquery controlling things calendar appear when input(s) @ top right clicked on work fine, i'm trying integrate existing design, these javascript elements not working, although using same code amongst other things existed within old design. i considered compatibility issue of sidebar calendar, removed entirely , still nothing. within console defines "cannot read property 'datetimepicker' of null" example. live url of concept (all working elements): http://bit.ly/1m23oxt live url of non working site: http://bit.ly/1gxgxfx <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <link rel="stylesheet" type="text/css" href="<?php echo http_host; ?>styles/jquery.datetimepicker.css" /> <script src="<?php echo http_host; ?>scripts/jquery.idtabs.min.js"></script> . <div class="header-reservations"> <div id=...

c# - rebuild url with mvc bundle -

on website i'm building using built in bundling , minification. render our scripts using @scripts.render @scripts.render("~/bundles/scripts") it generates link like: bundles/scripts?v=3-duuaaegzl4yp1o4v0vl0gnj0u6gt3de8ykb41lfgs1 here thought hash: v=3-duuaaegzl4yp1o4v0vl0gnj0u6gt3de8ykb41lfgs1 would smart , change if made changes inlcuded scripts seems not case. now when trying implement custom cdn out bundling fails on updates since hash never seems change. does know of solution change hash when script changes or if doing wring? edit: noticed there difference in behavior depending on environment i'm using. local development seems working doesn't work on staging server. should there difference? edit2: seems working should on production servers well. have more research on cause can be. edit3: seem 1 causing problem in registry logrewrittenurlenabled set false allow url rewrites @ same time using dynamic content compression (gzip) have fi...

javascript - How to parse xml recived as response text? -

i calling webservice returning xml data in encrypted format. receiving encrypted data responsetext. want parse xml data. can me out you can use domparser allows parse xml. if (window.domparser) { parser=new domparser(); xmldoc=parser.parsefromstring(txt,"text/xml"); } else // internet explorer { xmldoc=new activexobject("microsoft.xmldom"); xmldoc.async=false; xmldoc.loadxml(txt); } then var tag = xmldoc.getelementsbytagname("tagname"); however, before doing so, need decrypt response state in question response encrypted.

ruby on rails 3 - Trying to access sphinx internal data -

i have table countries (model listed below). adding thinking sphinx search , use results displayed. country.rb class country < activerecord::base has_many :provinces has_many :cities has_many :zones has_many :users attr_accessible :alpha_2, :alpha_3, :country_name, :numeric, :country_active scope :ordered, order("country_name") scope :active, where(:country_active => true) end country_index.rb thinkingsphinx::index.define :country, :with => :active_record indexes country_name, :sortable => true has created_at, updated_at has "(select count(provinces.id) provinces provinces.country_id = id)", :as => :province_count, :type => :integer end in view need add conditional link provinces belong country if province count country greater 0. count = country.provinces.count if count > 0 link_to(country.country_name, provinces_path(:id => country.id)) else country.country_name end i tried replace active...

qtwebkit - Python and webkit Qt4 -

i'm trying show webpage in frame, can't figure out how it, because can't find right documentation and/or tutorial qtwebkit. thanks. import sys pyqt4 import qtgui, qtcore, qtwebkit class mainwindow(qtgui.qmainwindow): def __init__(self): qtgui.qmainwindow.__init__(self) self.resize(350, 250) self.setwindowtitle('mainwindow') self.statusbar().showmessage('loading...') self.web = qtwebkit.qwebview() self.web.load(qtcore.qurl('google.com')) self.web.show() app = qtgui.qapplication(sys.argv) main = mainwindow() main.show() sys.exit(app.exec_()) for doc, can try riverbank documentation (though code examples still in c…) it seems code fine (maybe add http:// ?. did try without classes? should work: import sys pyqt4.qtcore import * pyqt4.qtgui import * pyqt4.qtwebkit import * app = qapplication(sys.argv) web = qwebview() web.load(qurl("http://google.com")) web....

sockets - Java - Send between clients -

i have 2 clients, , server in between. trying send information text between clients. it works first 2 seconds, receives information other client. here server code handles message sending: import java.io.*; import java.net.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class server extends jframe{ private jtextfield usertext; private jtextarea chatwindow; private objectoutputstream output; private objectinputstream input; private objectoutputstream output2; private objectinputstream input2; private serversocket server; private socket connection; private socket connection2; private serversocket server2; private string message; private string message2; //constructor public server(){ super("server"); usertext = new jtextfield(); usertext.seteditable(false); usertext.addactionlistener( new actionlistener(){ public void actionperformed(actionevent event){ try { sendmessage(); } cat...

c++ - How to access get variable in POCO -

i have created 1 sample http server using poco c++ libarary http://xjia.heroku.com/2011/09/11/learning-poco-a-simple-http-server/ but not able understand how read , post variables. does 1 have examples related library both httprequest , httpresponse derive httpmessage , has methods get , has , hastoken . also, see comment naab and/or try constructing htmlform request stream: htmlform( const httprequest & request, std::istream & requestbody );

html - Finding matching word in MySQL and php -

can me problem. i'm trying echo 1 thing if matches , if doesn't match. $string = "i love hockey" $tokenize = strtok($string, " "); while ($tokenize !== false) { echo $tokenize; } you can use query select * `your_table` `field_name` '%your_word%'

Sqlite Update Query not working | Android -

i new android apps , trying run sqlite-query this; string query = "select isenabled translation_language order translation_language_id"; cursor translations = splashscreen.database.rawquery(query,null); and working. don't know how update same table. have tried methods failed. me resolve it??? update query code splashscreen.database.update("translation_language", "isenabled", "translation_language_id", new string[] {"1", "8"}); i want set isenabled property 1 have id=8. try way: contentvalues cv = new contentvalues(); cv.put("isenabled","1"); db.update("translation_language", cv, "translation_language_id=?", new string[] { "8" });

import mysql blob data using php -

i trying save image data in mysql using blob format these inserted , retrieved correctly using php have problem , need create separate sql file data includes blob data when try import sql file not able import blob data include 'database.inc.php'; if (isset($_files['sqlfile']) && !empty($_files['sqlfile'])) { $filename=$_files['sqlfile']['name']; $tmp_filename=$_files['sqlfile']['tmp_name']; move_uploaded_file($tmp_filename, $filename); $file_content=file_get_contents($filename); $commands = explode(';',trim($file_content)); foreach ($commands $command) { if(mysql_query($command)){ //header('location: '.$_server['http_referer']); } else { //echo 'failed import following command <br/>'.$command; echo mysql_error(); } } } you'll have encode data in sql file, in this answer "how insert blob , clob files in mysql?" .

python - how to retrieve the user name from the database? -

please fix error i added site , access authorization system user profile . each user has ability change login. must in following form enter login , click submit: from django import forms userprofile.models import userprofile django.contrib.auth.models import user django.conf import settings import os class userprofileform (forms.modelform): class meta: model = userprofile fields = ('family', 'name', 'nation', 'status', 'login', 'nation_show') def clean_family (self): family = self.cleaned_data ['family'] letters_quantity = len (family) if letters_quantity < 4 : raise forms.validationerror (" little beech in name! " ) return family def clean_login (self): login = self.cleaned_data ['login']. strip () if login! ='': login_form_db = user.objects.filter (username = 'qwe') if login_form_db: login_form_db = login_form_db.username if login == login_form_db: raise forms.validationerror ...

matlab - Plot output of second return variable with fplot -

suppose have multi-variate function myfun function [y1,...,yn] = myfun(x1,...,xm) which plot using fplot, keeping 1 variables fixed, example this: fplot('myfun(0,0,0,x,0,0,0,...,0)',[0,10]); this creates plot of y1 default. how can fplot show graph of y2? from fplot documentation : if function returns more 1 value given x , y matrix columns contain each component of f(x) . fplot display first output of given function. if put outputs in matrix form (a column each output value) fplot display of them in second example in documentation. if want use output only, have create duplicate or wrapper function output.

vbscript - copying column from one excel to another -

i have specific requirement copy b column each workbook , paste them sequentially in master work book. e.g. wb1, wb2 wb3 workbooks, , master should have data following ways: copy wb1 data b3 onwards till value exists , paste matser workbook b3 column onwards copy wb2 data b3 onwards till value exists , paste master workbook c3 column onwards copy wb2 data b3 onwards till value exists , paste master workbook d3 column onwards and on other workbooks i using vbs unable find requirement. in regard appriciated. in anticipation. this had been trying... set objexcel = createobject("excel.application") set sourcewb = objexcel.workbooks.open(sourcefilepath) set destwb = objexcel.workbooks.open(destfilepath) objexcel.visible = true set sourcews = sourcewb.sheets(sourcesheet) set destws = destwb.sheets(destsheet) sourcews.activate set sourcecolumn = selection.sourcews.offset(3, 1).range("b1").select set targetcolumn = destws.range("b3") sourcecolu...

WPF Tooltip, is there some sort of OnHint -

i have application displays contentcontrols on kind of desktop. now want show tooltips on these controls. tooltip changing time time , text tooltip coming outside application. need callback when hint appears , ask outside part text display. how can 1 that? if use data binding tooltip can fetch new outside data bound property , updated every time tooltip shown. xaml this: <contentcontrol tooltip="{binding myexternaldataproperty}"/> for datacontext object set this: public class datacontextforcontrol { public string myexternaldataproperty { { return myoutsidedatareader.somedata; } } }

javascript - Photos in circles on graph -

i have misarables.json : { "nodes":[ {"name":"myriel","group":1,"photo":"https://www.facebookbrand.com/img/assets/asset.f.logo.lg.png"}, {"name":"napoleon","group":1,"photo":"https://www.facebookbrand.com/img/assets/asset.f.logo.lg.png"}, {"name":"mlle.baptistine","group":1, "photo":"https://www.facebookbrand.com/img/assets/asset.f.logo.lg.png"} ], "links":[ {"source":1,"target":0,"value":1}, {"source":2,"target":0,"value":8} ] } so, every node has name, group , photo. use this graph visualisate json (json , html in different files). how need change js , show photos in circles in graph? thanks.

How to avoid memory problems when running php mongodb aggregate group function? -

i'm running memory problems when try group list field. input: it's list of items category , fields: { category: "catname1", field1: "value11", field2: "value21", ... }, { category: "catname2", field1: "value12", field2: "value22", ... }, { category: "catname3", field1: "value13", field2: "value23", ... }, { category: "catname4", field1: "value14", field2: "value24", ... }, .. output: should list of categories, each list of corresponding items: { category: "catname1", items: [ { field1: "value12", field2: "value22", ... }, { field1: "value14", field2: "value24", ... }, .. ] }, { category: "catname2", items: [ { field1: "value12", field2: "value22", ... }, { field1: "value14", field2: "value24", ... }, .. ] }, //edit: tried differe...

Headers in non-C++ OOP Languages -

i have been wondering while, why non-c++ oop languages (not sure if there other uses headers) doesn't have header files? well, concerns me in c++ can code class header, , sends mate compile other code against it, while happy coding actual implementation of class on own pace. how can achieved in languages doesn't have headers? or maybe, there missing in understanding? how can make class contract other colleagues, both can code in pace? should mock class without implementation methods, mock returns, satisfy need or how? header files legacy thing time compilers did not have power necessary compile source files without hints developer. modern languages (and in fact c++ can so, too) use interfaces or base classes implement design-by-contract.

angularjs ui-calendar events displayed incorrectly on calendar -

Image
i using angular ui calendar display events on calendar. whenever calendar loaded 1st time, events extend next date or shown on other date. however when change view(day/week) , come again month view, events displayed fine. similarly, after changing month , coming again current month , events displayed correctly. also, i've noticed calendar height increases 95px after changing view(when displayed correctly). why occuring. how can render events correctly 1st time? the problem css. solved it.

clojure - Invalid serialised value error when reading a map of stringified json objects from Cassandra 1.2 using DataStax 1.0.5 java driver and Cassaforte -

i'm using cassaforte 1.3.0-beta9, cassandra 1.2 (datastax), , com.datastax.cassandra/cassandra-driver-core 1.0.5 (since 2.0 not work cassandra 1.2). have table following schema: create table entities ( id text, address_country text, address_county text, address_region text, address_street_two text, csv_uploads list<text>, documents list<text>, name text, notes list<text>, photos list<text>, project_id text, property_code text, property_data text, retrofit_completion_date text, metering_point_ids text, devices map<text,text>, user_id text, primary key (id) ) this example of what's stored in row: 7b237da126d39ccf98f80d78b6145a10828970f8 | {'b9d88015c84312bf24cef0e7f1a0baf98dbc8d8d': '{"metadata":{"passivrole":"zone 1 temperature,zone 1 temperature"}, "readings": [{"type":"temperature","resolution":"120...

python - Vending Machine Program (Calculate the amount that has to inserted,etc.) -

i want write program simulate vending machine , calculate change (which has returned you) based on amount paid. given cost, user should first prompted add more money until cost met/exceeded payment. assume change given in coins , coins come in following denominations: 1c, 5c, 10c, 25c, $1 here program: x = eval(input("enter cost (in cents):\n")) b = 0 in range(x+500): if x<5 , x>=b: b += 1 print("deposit coin or note (in cents):") print(1) diff = b-x in range(diff): onecents = diff//1 new_onecents = diff - (onecents*1) print("your change is:") if onecents != 0: print(onecents,"x 1c") break elif x<10 , x>=b: b += 5 print("deposit coin or note (in cents):") print(5) diff = b-x in range(diff): fivecents = diff//...

java - How to link two Jlists -

i have 2 jlists of vectors filled data extracted mysql db. want when user select item (menu) jlist1 (which called menulist) jlist2 (which called productlist) must display products of menu , other things, such ability insert new product in menu or in new menu created. i've accomplished task in way think weak, using boolean variables tells if user inserting product in existing menu or in newly created one. please, can suggest me better solution (if exists)? here extract of significant part of code, method saves new product in db: private void baddprodactionperformed(java.awt.event.actionevent evt) { //if new menu saved, new menu's id if (newmenuissaved == true) { product newproduct = new product(); newmenuid = dbconnection.getnewmenuid(); newproduct.setmenuid(newmenuid); newproduct.setproductname(productname.gettext()); if (checkppricevalidity(productprice.gettext(), newproduct)) { ...

c++ - Reading from a text file that shows the last line details twice in the output -

this question has answer here: end of file in c++ 3 answers here text file (sample.txt) format john 123 jim 89 britney 852 when read file , output details, display last line twice. program needs take user name , password separately. comparison easy. sample output above file john 123 jim 89 britney 852 britney 852 how can overcome , give me reason shows twice in output. in advance. the code: #include <iostream> #include <fstream> #include <string> using namespace std; int main() { string passwd; string usern; string password; string username; ifstream infile; string line; infile.open("sample.txt"); if(!infile) { cerr << "error during opening of file" << endl; } else { while (!infile.eof()) { infile >> usern >> passwd ; cout <...

sql server - Restore database with full backup to exact date -

i'm trying restore sql server 2008 r2 database date 01/07/2013 full backup dated 11/04/2014 . restore possible? thanks the short answer is: no. simplifying bit, backups snapshot point in time. if worked way seem want them work, they'd unbounded in space they'd have keep track of previous state inception of database.

php - Wordpress / WooCommerce Custom Product type -

i have made custom product type woo commerce, problem getting work. i've added filter product type , appears in dropdown box, when click , has no boxes other sku . is there location file has go im missing? have lobbed other product type files. thanks may give first of need create class custom product type. let customproduct class wc_product_customproduct extends wc_product{ public function __construct( $product ) { $this->product_type = 'customproduct'; parent::__construct( $product ); } } and put class under includes/ folder. after that, need activate product type; add_filter( 'product_type_selector', 'add_custom_product_type' ); function add_custom_product_type( $types ){ $types[ 'customproduct' ] = __( 'custom product' ); return $types; } add functions.php

Linking error using CMake to create a shared library in C++ because multiple definition of symbol -

i'm having problems compile code, links poco c++ libraries, create shared library linux (mint 13, in case). reduced environment. i have these 3 files: il_notify.h #ifndef __il_notify_h__ #define __il_notify_h__ #include <string> #include "poco/logger.h" #include "poco/logstream.h" using poco::logger; using poco::logstream; namespace mynamespace { // logger. inherits root channel logstream lstr(logger::get("mylogger")); // other class, call logger way: //lstr << "this test" << std::endl; } #endif il_class1.cpp #include "il_class1.h" #include "il_notify.h" namespace mynamespace { void il_class1::foo() { // stuff... lstr << "this test msg il_class1::foo" << std::endl; } } il_class2.cpp #include "il_class2.h" #include "il_notify.h" namespace mynamespace { void il_class2::bar() { //...

How to append vector matrix in C++? -

i have struct vector "array" that's looks like struct competitor { vector<string> name; vector<int> points; }; and have file contains names , 10 pieces of result point read in, can't append vector. can't read it int = 0; string tmp; while(!x.eof()) { getline(x, tmp, '\t'); t[i].name.push_back(tmp); // tmp >> t[i].name; cout << tmp << endl; for(int = 0; < 11; i++) { x >> tmp; t[i].pontok.push_back(tmp); } i++; }

Problems returning data from PHP to JQuery using AJAX -

i trying commenting system jquery, ajax , php. able store comments on database, having problems when want show them database. believe doing wrong when reading data send .php file in json format. here code using. index.html <form id="form" method="post"> name: <input type="text" name="name" id="name"> comment: <textarea rows="5" cols="115" id="text"></textarea> <input type="submit" id="submit" value="submit"> </form> events.js $('#form').on("click",'#submit',function(){ var name = $("#name").val(); var text = $("#text").val(); var datastring = 'name='+ name + '&text=' + text; $.ajax({ url:'comments.php', type:'post', cache: false, data: datastring, success: function(data){ ...

mysql - PHP MySQLi Fatal call to member function fetch_array() for a non-object -

yes...this question has been posted many times. here's example: fatal error: call member function query()on non-object . i've looked through many of these duplicate posts , cannot find solution i pulled (working) code website ( nine-to-five ) but revised code (which different post) include code mentioned in post's answers , i'm still getting error: // credentials $dbhost = "localhost"; $dbname = "qmsdb"; $dbuser = "root"; $dbpass = ""; // connection global $tutorial_db; $tutorial_db = new mysqli(); $tutorial_db->connect($dbhost, $dbuser, $dbpass, $dbname); $tutorial_db->set_charset("utf8"); // check connection if ($tutorial_db->connect_errno) { printf("connect failed: %s\n", $tutorial_db->connect_error); exit(); } // search $search_string = preg_replace("/[^a-za-z0-9]/", " ", $_post['query']); $search_str...