Posts

Showing posts from March, 2015

java - Login with php return string with AsyncTask in android -

i'm developing android application first time , don't have knoweledge of java, i've created login screen & integrated parse notification. now wan't check username & password before sending registration parse api. i want create asynctask can send http request during onclicklistener, i want fetch http response, true or false & further function on condition. e.g. i've inputted username & password , app send request php page, page echo true if username & password correct & false if they're wrong. and if true next process continue & on false, toast wrong username & password. there quick code make happen? minor quibble: it's sending request onclicklistener... you want async tasks ( there no quick code in java, easy stuff long, , elegant stuff abstract =] ) so, in mind: guy great! http://www.vogella.com/tutorials/androidbackgroundprocessing/article.html official( informative ) source http://developer.and

c# - Finding a value in a database from a DataGridViewColumn -

i have datagridview want add searching criteria. should setup such it's billing form item saved in table. so whenever start typing value in datagridviewcolumn named bill , new listbox open, displaying list of items having similar names value entered using %like query. i don't have issue writing %like query or displaying listview , don't understand how actively use value datagridviewcolumn while it's being entered. you have create event handler datagridview.currentcelldirtystatechanged uses datagridview.commitedit datagridview . event can make calls necessary query database , create new listview actively, cell value changes (while active). the msdn article datagridview.commitedit explains well. have make listview addition.

javascript - What's causing this slow/delayed audio playback in Safari? -

var audio = new audio('data:audio/wav;base64,uklgroabaabxqvzfzm10ibaaaaabaaeaibuaaigvaaabaagazgf0yvwbaachlqa1xnlg7vv/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////tk1lsklhrkveq0jbqd8+pj08pds6ojk5otg4odg3nzc3nzc3nzc3nzc3nzg4odg5otk6ojs7ozw8pt4+p0baqujcq0rfruzhseljsktmtu5ot1brulnuvvvwv1hzwltcxv1ex2bhymnkzgvmz2hpawprbg1ubm9wcxfyc3r0dxz3d3h5exp6e3x8fx1+f3+agigbgokcg4oehisfhywghoahh4ehh4iiiiiiiiiiiiiiiiiiiiiiiiiiiiehh4ehhoaghywfhiseg4ocgogbgia='); setinterval(function() { audio.play(); }, 50); this code works correctly in chrome , firefox, in safari there's delay of on second between each sound. can't figure out why be, far can tell there no compatibility issues. want play sounds @ precise time , @ reasonably fast delay in game i'm making, how can working? (copied the same question answered now) safari displays curious behav

mysql - What happens if I interrupt a database compression query? -

i'm altering mysql table compressed using barracuda file format, setting key block size 8, , row format compressed. there 766 million records in table. or maybe 76 million. anyway, it's been processing 32 hours far, , i'm guessing when check tomorrow may still going. if kill process, happen? records compressed, others not? whole table corrupted? please advise.

php - jquery does not pass values to mysql db -

i,m trying pass text box value mysql database using jquery. nothing seems work , cannot figure out error. here's code. index.php <html> <head> <meta charset="utf-8"> <title></title> <script type="text/javascript" src="jquery.js"></script> </head> <body> <script> $(document).ready() $("btn").click(function() { $.post("send.php", {"named": $("named").val()}, function(data){ alert("data: " + data + ");} }) }); </script> <div> <form id="form" method="post" action=""> <input type="text" id="gname"/></br> <button id="btn">set</button> </form> </div> </body> and send.php <?php my

c++ - How works - Pointer / Unique_ptr without new -

foo.h #include <iostream> #include <memory> class bar { public: bar() {}; ~bar() {}; void print() { std::cout << "hello"; } }; class foo { public: foo(); ~foo(); void use() { pteste->print(); } private: std::unique_ptr<bar> pteste; }; #endif main.cpp #include <memory> #include "foo.h" int main(int argc, char *argv[]) { foo s; s.use(); return 0; } why , how works "normally"? thanks edit: understand incomplete types, happens when can use unique_ptr without using new , why works edit2: organized code better question short answer: doesn't work. this reference says default constructor of std::unique_ptr creates empty unique pointer, meaning has no associated object. the reason why code prints hello because statement std::cout << "hello"; doesn't need of bar . static method. maybe compiler inlines f

postgresql - Import .sql file in pgadmin iii -

i want import sql file in postgresql. using pgadmin iii. create sql file in phpmyadmin , want import same file in pgadmin iii. doing following didn't work me. select schema of database in pgadmin iii , after try execute following query: \i c:/users/umair/downloads/school_management_system(1).sql but generates error , error is: error: syntax error @ or near "\" line 1: \i c:/users/umair/downloads/school_management_system(1).sql ^ ********** error ********** error: syntax error @ or near "\" sql state: 42601 character: 1 please me out. i think best way import sql file using psql tool this: psql -u postgres -h localhost -d my_database -f "c:/users/umair/downloads/school_management_system(1).sql"

python - OpenERP - onchange method for fields in different page of view? -

it seems onchange method works on current visible fields. if use fill other fields in other pages of view, not anything. example have view many pages. information needs filled in first page, fields filled correctly. there 1 field need fill in other page, when choose partner_id in page. example in view this: ... <page string="page1"> <field name=partner_id on_change="onchange_partner(partner_id)" <field name="field1"/> <field name="field2"/> </page> <page string="page2"> <field name="field3"/> </page> ... field1 , field2 filled. how fill field3 or impossible, because system not save database using onchange method? my onchange method looks this: def onchange_partner(self, cr, uid, ids, partner_id, context=none): res = {} if partner_id: obj = self.pool.get('res.partner').browse(cr, uid, partner_id) res['field1'] = obj.field1 res[

who could explain more about the compare function in priority queue C++ -

we define operator < people seem use class define operator ()? how work. i have learned generic thing in c before, @ time, use pointer function. what difference? basically, want code contain least amount of surprises. let's have std::priority_queue<t> pq class t . t class natural ordering exists? if so, define operator < it. want pq prioritised based on ordering? if so, let use operator < , you're done. however, quite often, t class no intrinsic notion of ordering. imagine class employee storing name , startingdate , salary . there no universal ordering - given 2 employees, it's not clear 1 < other. at same time, may want std::priority_queue<employee> based on earns most. or least. or who's company longest. therefore, you'll use specific comparators these. in way, priority queue comparator , operator < independent concepts. if have naturally orderable class, give operator < . if want priority queue

ios - NSUserDefaults Saving only last entered data -

i saving textfield text using nsuserdefaults on button click in viewcontroller2 code buttonclick() { nsuserdefaults *userdefaults =[nsuserdefaults standarduserdefaults]; [userdefaults setobject:keywordfield.text forkey:@"keywords"]; [userdefaults synchronize]; } viewdidload method retrieving -(void)viewdidload { nsuserdefaults *userdefaults =[nsuserdefaults standarduserdefaults]; [keywordarray addobject:[userdefaults objectforkey:@"keywords"]]; [userdefaults synchronize]; } here assigning keywordarray tableview cell.textlabel.text =[keywordarray objectatindex:indexpath.row]; first entered text(first) in textfield , click button showing in table first second time entered text (second) in textfield , click button showing table first second here working fine. problem when come viewcontroller2 viewcontroller1. showing last entered value second what going wrong here? try this - (ibaction)buttonclick:(id)send

cordova - Install and run android for phonegap? -

Image
i using documentation provided phonegap phonegap installation stuck @ third command phonegap run android i getting following error. i have been trying solve many days. please me out. i did not know ugly install doc. it's better follow cli docs or/and platform guide docs install required dependencies. and here in case, if read message on screen, says missing apache ant program or it's not added path.

javascript - How can I close window after refresh page? -

how can close window opened: var open_win; function open(){ open_win = window.open("myfile.php", "name", "height=500, width=400"); } now when use: function close(){ open_win.close(); } a window closed. when refresh page cannot use open_win.close() . how can close window after refresh page?

android - No OutOfMemoryError, but cannot load image -

i have strange (and frustrating) problem in game. the game drawing in canvas, i'm not using layouts , other native elements. 1 root layout canvas. have implemented admob , analytics, it's disabled (and not allocating) testing. after few levels can't load images. logcat output imageref_ashmem create failed <(null)> *number of bytes* , no outofmemoryerror . i tried memory analyzer tool (mat), no luck. retained size after first level (at max) 10.6 mb, , 1 level before stops loading images 10.7 mb (sometime less). situation same (with different values) in emulator , in real device. comparison of hprof files taken on first level , last shows little differencies (~2kb). same thing in ddms heap. when things going fail, have 70.30% of used memory. garbage collector shows 27% free memory. here output in logcat: gc_concurrent freed 193k, 42% free 6680k/11363k, paused 2ms+2ms d/dalvikvm(16011): gc_concurrent freed 118k, 27% free 8396k/11363k, paused 2ms+2ms d/skia(

c# - SmtpClient: The maximum number of concurrent connections has exceeded a limit -

i have following method call every mailmessage: public static string sendemail(mailmessage email) { string rez = ""; try { var smtpserver = "10.xxx.xx.xx"; using (smtpclient mailclient = new smtpclient()) { mailclient.host = smtpserver; mailclient.send(email); } rez = "ok"; } catch (exception ex) { rez = "not ok: " + ex.message; } return rez; } i send 32 email-s @ once, , 2 of them got following error mailclient.send(): not ok: service not available, closing transmission channel. server response was: 4.3.2 maximum number of concurrent connections has exceeded limit, closing transmission channel i wondering if because created new smtpclient instance every mail? will following change fix

drupal - can't save arabic in php variable? -

i really knew php . i have been doing asp.net etc earlier , , php appears whole lot different. i using drupal 7 , , project has been made. i told trivial unable so. regarding arabic. i declare simple variable $simpletext = "شهس " . drupal_set_message($simpletext) . what see on web browser ??? instead of arabic . have confirmed content type of page set utf-8. meta tag of rendered html on browser can please me identify how eradicate issue ? thanks. i completed many php projects (including drupal projects) , there nothing wrong php , arabic :) add html , should work fine <meta http-equiv="content-type" content="text/html; charset=utf-8" /> or using php before releasing output header('content-type: text/html; charset=utf-8');

c# - Two different classes or one with unused properties -

i'm developing augmented reality windows phone 8. this app have database, , i'm using linq-to-sql create it. table have app: [table] public class arlocation : inotifypropertychanged, inotifypropertychanging { [column(dbtype = "int not null identity", isdbgenerated = true, isprimarykey = true)] public int arlocationid { get; private set; } private string name; private string description; private double latitude; private double longitude; [column] public string name { { return name; } set { if (name != value) { notifypropertychanging(); name = value; notifypropertychanged(); } } } [column] public string description { { return description; } set { if (name != value) { notif

api - JWPlayer how to change Captions Track from Javascript? -

in jwplayer, how change (or set) caption tracks .. lets clicking on external html buttons. lets say: if click html [ button 1] video captioned "eng.srt". if click html [ button 2] video captioned "esp.srt". and may there no captions tracks start @ all. respective captions tracks set upon html button click (even while playing?) you can change subtitles using javascript-api-reference captions these api calls used listen or update active captions track if 1 or more closed captions tracks provided video. api can used log captions usage or build own cc menu outside jw player. setcurrentcaptions(index) change visible captions track provided index. index must within list provided getcaptionslist. note index of 0 turns captions off. oncaptionslist(callback) fired when list of available captions tracks updated. happens shortly after playlist item starts playing. event attributes: tracks (array): full array new captions tracks.

c++ - Rtaudio in DLL makes program unresponsive -

i make dll in c++ streams sound speakers , can call visual basic program. creating dll , calling functions vb program worked. however, declare rtaudio object in dll, makes visual basic program unresponsive (and there no sound). if use exact same code in console application project instead of in dll works fine , hear sound. inexperienced in dll programming, have absolutely no idea cause such problem. give me hints might wrong? this part of code. still produces same problem: dll: //c , c++ libraries #define _use_math_defines #include <stdio.h> #include <iostream> #include <string> #include <vector> #include <valarray> #include <fstream> #include <stdlib.h> #include <map> #include <math.h> #include <stdint.h> #include <algorithm> #include <complex> #include <cmath> #include <iomanip> #include <limits> #include <time.h> #include <fcntl.h> #include <ctype.h> #include <windo

jquery - how to remove parent if child has specific text? -

i wanted remove parent div if child has specific text: <div> <span>test</span> </div> <div> <span>text</span> </div> in above code want remove div contains test . tried lot filter function,but thinking wrong concept. best way remove this? so, how detect text tested or not? try using has() contains-selector - used contains since said contains - if want check exact match can't use it $('div').has('span:contains(test)').remove() demo: fiddle for exact match $('div span').filter(function(){ return $.trim($(this).text()) == 'test'; }).parent().remove() demo: fiddle

objective c - post request to server does not send the content of textfields? -

i'm trying send content of textfields firstname , lastname button sendpost php server. once run app , fill textfields random text , press send, receive e-mail on server there no content. (void) sendaction{ nserror *error = nil; nsstring *postparams = [nsstring stringwithformat:@"info=%@_%@",firstname.text,lastname.text]; nsdata * postdata = [postparams datausingencoding:nsasciistringencoding allowlossyconversion:yes]; nsstring * postlength= [nsstring stringwithformat:@"%d",[postdata length]]; nsmutableurlrequest *request = [[nsmutableurlrequest alloc]init]; [request seturl:[nsurl urlwithstring:@"http://faketest.com/test/mail.php"]]; [request sethttpmethod:@"post"]; [request setvalue:postlength forhttpheaderfield:@"content-length"]; [request setvalue:@"application/x-www-form-urlencoded" forhttpheaderfield:@"current-type"]; [request seth

javascript - js field check not working properly -

i'm having problem required fields in form... i've got function check fields, reason keeps poping "please fill out required fields" when load page, instead of when leaves field(s) blank. please help! here web address of site; http://www.rubinosrestaurant.com/mobile/catering.php the other related files are; mobile/index.css mobile/email_catering.php if can me, eternally grateful. thanks! emailfailed = '<p>please fill out required fields!</p><img src="images/close-button.png" alt="close modal" id="close-modal">'; modalopen(emailfailed); you calling function "modalopen(emailfailed);" when page getting load.... function not written in , function called @ page load time.. not load function @ time. call when send button clicked..

sql server - Sql "IN" operator with using SqlParameter on varchar field -

i couldn't find how use in operator sqlparameter on varchar column. please check out @mailbox parameter below: using (sqlcommand command = new sqlcommand()) { string sql = @"select ei.id interactionid, eo.sentdate mailreplieddate bla bla mailbox in (@mailbox)"; command.commandtext = sql; command.connection = conn; command.commandtype = commandtype.text; command.parameters.add(new sqlparameter("@mailbox", mailbox)); sqldatareader reader = command.executereader(); } i tried these strings , query doesn't work. string mailbox = "'abc@abc.com','def@def.com'" string mailbox = "abc@abc.com,def@def.com" i have tried changed query mailbox in('@mailbox') , string mailbox = "abc@abc.com,def@def.com" any suggestions? thanks that doesn't work way. you can par

java - JSCH: closing channel and session -

i'm doing sftp operation jsch: jsch jsch = new jsch(); session session = null; channelsftp sftpchannel = null; try { session = jsch.getsession(user, host, integer.valueof(port)); session.setconfig(jsch_options); session.setpassword(password); session.connect(); channel channel = session.openchannel(sftp_channel_id); channel.connect(); sftpchannel = (channelsftp) channel; // sftp operations } catch (exception e) { log.error("error while sftp session", e); } { sftpchannel.exit(); session.disconnect(); } my question is: when i'm done enough call disconnect() on session object, or exit() on channel must before? thanks! update: checked behavior , there no errors, i'm not quite sure sockets/etc cleaned correctly.

angularjs - ng-repeat duplicating items after page reload -

i have angularjs application, node.js , express backend, i'm not using angular's routings. when refresh page using browser's refresh button, items on page loaded in ng-repeat duplicate. i'm not sure why occurs, i'm wondering happens controller when page reloaded? old controller destroyed, , new 1 created, or controller added, causing duplications? here part of html file, relvevant controller code: (trans.html) <div class="pure-u-1-2" ng-repeat="trans in transactions | filter:searchtext"> <div class="transaction" ng-style="{'border-style': 'solid', 'border-color': categorycolours[trans.category.name]}"> <h2 id="transname">{{ trans.name }}</h2> <h4>{{ trans.description }}</h4> <h4>{{ trans.date }}</h4> <div class="pure-u-1-1"> <h3 id="categor

if statement - PrestaShop CMS page if condition -

i wordpress developer past 3 years. i'm started prestashop first project. it's possible if conditions cms pages? for example: if (cms page1) { ...... } elseif (cms page2) { ... } else { ..... } in template cms.tpl can use following syntax: {if $cms->link_rewrite eq 'about-us'} ... {else if $cms->link_rewrite eq 'bbb'} ... {else} ... {/if} you can use directly id: $cms->id

python - Complete table get updated instead of single row in django -

i have table named tablecolumn. , getting columnlistobj below django model api query. updated object , save it. columnlistobj = tablecolumn.objects.get(columnone=one,columntwo=two) columnlistobj.column3 = 'some text' columnlistobj.save() accepted behavior : the 1 row being selected (columnone=one , columntwo=two) should updated. actual behavior : complete table (columntwo='two') update. note: 1. columnone , columntwo combined primary key. means no duplicate. 2. tried debug , print columnlistobje after get. prints same desired row. schema tablecolumn (please dont confuse above dummy names) class tablecolumn(models.model): table = models.foreignkey('tablelist',primary_key=true) table_column_id = models.integerfield(primary_key=true) current_column_name = models.charfield(max_length=255) column_description = models.charfield(max_length=1024, db_column='column_description',blank=true) class meta: db_table = '

php - MySQL query from two tables with multiple joining -

i've 2 tables, example - category & items. 1. category table has 2 fields- cat_id, cat_name. 2. items table has 4 fields field1, field2, field3, field4 value cat_id. now, need print cat_name instead of cat_id in each row. how can that? mysql query? for more info please, have here- url: http://smartmux.com/demo_roundflat/admin/ username: test password: test if understood right can this: select items.*, c1.cat_name, c2.cat_name, c3.cat_name, c4.cat_name items left join category c1 on c1.cat_id = items.field1 left join category c2 on c2.cat_id = items.field1 left join category c3 on c3.cat_id = items.field1 left join category c4 on c4.cat_id = items.field1; let me know if needed.

Get the exit value of batch file using vbscript -

please lend help, i'm beginner batch file , vbscript. grateful if me solve problem. given: a: @echo off pushd "c:\program files\appname" && popd if errorlevel 1 exit 0 pushd "c:\program files\appname" if exist application.exe goto installed popd exit 1 :installed exit 2 b: set objfso = createobject("scripting.filesystemobject") 'set objfile = objfso.opentextfile(listfile, 1) dim sh , res objname = objfso.gettempname objtempfile = objname '---- sample code 0 ----------------------' 'set sh = wscript.createobject("wscript.shell") 'res = sh.run("filefullpath",0,true) 'wscript.echo res '----sample code 1 ---------------' 'set sh = wscript.createobject("wscript.shell") 'res = sh.run("filename",0,true) 'wscript.echo res '---- sample code 2 --------------------- 'set sh = wscript.createobject("wscript.shell") 'res = sh.run("

functional programming - Fixed point in Scala -

is there shortcut following code snippet? while (true) { val newclusters = this.iterate(instances, clusters) if (newclusters == clusters) { return clusters } clusters = newclusters } i calculate fixed point, i.e. execute function such result stable. aware of higher-order functions suit purposes? an adaptation fixpoint calculation example scala example martin odersky (chapter 'first-class functions', section 5.3), val instances = ... // question statement def isapproxfeasible(x: clusters, y: clusters) = some_distance_x_y < threshold def fixedpoint(f: clusters => clusters)(initapprox: clusters) = { def iterate(approx: clusters): clusters = { val newclusters = f(approx) if (iscloseenough(approx, newclusters)) newclusters else iterate(newclusters) } iterate(initapprox) } where function f: clusters => clusters delivers new candidate clusters, , initapprox corresponds first, initial guess on fixpoint. function isapp

regex - Regular expression not showing multiple line content -

i have file following format. <hello> <random1> <random2> .... .... .... <random100> <bye> i want find whether bye , hello there, , bye below hello. tried regular expression. grep "hello.*bye" filename but fails match expected. you use pcregrep : pcregrep -m 'hello(\n|.)*bye' filename the -m option makes possible search patterns span line boundaries. for input, it'd produce: <hello> <random1> <random2> .... .... .... <random100> <bye>

c# - How to create litlle glow outside a button -

Image
i'm trying create little outer glow picture outside button on windows phone 8. do know way reproduce ? a = without glow b = glow (target) (it photoshop vision) if it's possible achieve code it's better because, button created code. thanks lot help.

api - Get contact list from outlook with PHP -

i'm looking php script, php method contact list hotmail, live, outlook user... i have chech live connect doc, there no example.. have check on google, find 1 or 2 examples, no 1 working. i don't know how can that.. ideas ? https://apis.live.net/v5.0/me/contacts?access_token=accesstoken by url contact of outlook

Defining multidimensional array while storing form data in JSON format in php -

i have convert form data json format. trying achieve this:- {"appconfiguration" : { "configuration_name" = "as400 configuration", "configuration_version" = "1.001", "connection" : [ { "ip_address" : [ “10.10.10.01”, “10.10.10.02”, “10.10.10.03” // saved ip address. ] "port" : "23" "ssl" : "no", "device_name" : "agicent device", "name" : "puga", "user" : "smart gladiator", "password" : "sgl2013", "barcode_enter" : "no",]}} this json should like. able store data in single-dimension array; how create structure this? "connection":["ohiuh","ghu","ip_addres

java - Preventing split packets over TCP -

i writing program transfers files on network using tcp sockets. now noticed when send packet in size example 1024 bytes, them split on other side. by "split" mean packets if part of whole packet. i tried reduce packet size , algorithm worked, when packet size immensely small (about 30 bytes per packet) file transferred slowly. is there can in order prevent splitting? solved:i switched connection on udp , since udp packet bounded worked there not such thing in tcp. tcp stream, write @ other end. not mean way written; tcp may break or group packets in order jobs possible. can send 8 mega bytes packet in 1 write , tcp can break down 10, 100 or 1000 packets, need know @ other end 8 mega bytes no more no less. in order file transfer need tell receiver how many bytes going send. receiver may read in 1 chunk or in 100 chunks must keep track of data reads , how many bytes read.

arduino - Saving data on excel -

is possible save on different excel sheets after number of data collected? data logging using arduino in real time , aiming create new sheet every day. or @ least possible change name of .csv? why not create function formats data csv on arduino side , prints out on serial monitor. can copy output on serial monitor , paste .csv file. write small program takes output on serial monitor , saves .csv file. here example of code on arduino side void print_data(int x, int y) { serial.print(x, dec); serial.print(","); serial.print(y, dec); serial.println(); }

c# - Binding images in WPF -

i want show multiple image on uniform grid i'm getting urls internet).when execute code images not displayed. videos window: <window x:name="videos" x:class="navigateur.presentation.videos" xmlns:my="clr-namespace:navigateur.presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="window2" height="207" width="463" windowstyle="none" resizemode="noresize" topmost="true" windowstate="maximized"> <grid> <itemscontrol margin="72,30,76,30" itemssource="{binding images}"> <itemscontrol.itemspanel> <itemspaneltemplate> <uniformgrid columns="4" rows="3"/> </itemspaneltemplate> </i

javascript - Insert and select parameters in a page -

i have web page insert text box , select box. when complete form, press button send me page. code this: <form id="login-form"> <input id="user-name" type="text" maxlength="30" name="user[name]" placeholder="enter username" autofocus="autofocus"/> <select id="meeting-id" name="meeting[id]"> <% _.each(meetings, function(meeting) { %> <option value='<%= meeting.get("meetingid") %>'> <%= meeting.get("meetingname") %> </option> <% }); %> </select> is possible skip page url insert these parameters? how can do? edit: want know if can obtain url pass these parameters instead insert parameters in form. possible. for example http://www.submit.com/username="prove"&meeting="yes"

Can't get this PHP code working -

this code go "index.php?err=1" , don't know why. 'acceso_db.php' database connection (it ok) $email = mysql_real_escape_string($_post['nick']); $usuario_clave = mysql_real_escape_string($_post['pas']); $usuario_clave = sha1($usuario_clave); //la clave se comprueba en sha1 // comprobamos que los datos ingresados en el formulario coincidan con los de la bd include('acceso_db.php'); $sql = "select * usuarios email='$email' , clave='$usuario_clave'"; $result = mysql_query($sql)or die ("error en el select."); if (false === $result) { echo mysql_error(); } else if($row = mysql_fetch_array($result)) { if($_post['recordar']){ mt_srand (time()); $auth = mt_rand(1000000,999999999); $sql="update usuarios set auth='$auth' email='$email'

database - Every permutation from two tables -

im using access 2010. i have 2 tables region holds 27 regions , product holds 75 product_id's. i build query assign every region each individual product_id. regions africa europe india product 2020015 1546873 5554449 results africa 2020015 africa 1546873 africa 5554449 europe 2020015 europe 1546873 europe 5554449 india 2020015 india 1546873 india 5554449 i have no idea how start build query can point me in right direction please. found uit easier thought haha select distinct region.region, marketinggroup.[parent] marketinggroup inner join region on marketinggroup.region = region.region;

ios - Terminated due to Memory Pressure with less then 15MB used -

Image
i'm facing strange problem, app i'm working on it's killed due memory pressure it's not using can see in screenshoot. i'm started "other" issues memory leaks, implicit casting, don't know how debug kind of things, so... know how out of problem ? :) typically termination due memory pressure occurs when app suspended ios itself. happens when device doesn't have lot of free memory , sign (meaning happen app sooner or later when user closes it). i offer use instruments , find app terminate (if case). instruments tutorial can found here - http://www.raywenderlich.com/23037/how-to-use-instruments-in-xcode

Perl: Delete keys in hash that don't exist as elements in array -

i have array of key names , need remove keys not in list hash. i gather deleting keys in hash bad thing while iterating on it, seem work: use strict; use warnings; use data::dumper; @array=('item1', 'item3'); %hash=(item1 => 'test 1', item2 => 'test 2', items3 => 'test 3', item4 => 'test 4'); print(dumper(\%hash)); foreach (keys %hash) { delete $hash{$_} unless $_ ~~ @array; } print(dumper(\%hash)); gives output: $var1 = { 'item3' => 'test 3', 'item1' => 'test 1', 'item2' => 'test 2', 'item4' => 'test 4' }; $var1 = { 'item3' => 'test 3', 'item1' => 'test 1' }; can explain me better/cleaner/safer way of doing this? many thanks. don't use smartmatch ~~ , it's fundamentally broken , removed or substantially changed in upcoming rel

ios - Why NSLog print like these? -

line of code: @interface viewcontroller (){ iboutlet uilabel *lbl_firstname; iboutlet uilabel *lbl_lastname; } @implementation viewcontroller - (void)viewdidload { [super viewdidload]; lbl_firstname.text=@"xfirst"; lbl_lastname.text=@"xlast"; nslog(@"first name: %@",lbl_firstname.text); nslog(@"last name: %@ %@",lbl_lastname.text); } result: first name: xfirst last name: (null) xlast problem: * why 2nd nslog statement print these? i know reason of (null), because didn't give reference lbl_lastname in .xib. don't know reason of print after (null). it appears next object in memory happens value of "xlast". what speculate happens is: you create string: @"xlast" the program attempts assign value lbl_lastname.text , since lbl_lastname nil, fails. the nslog correctly prints out fact lbl_lastname.text ni, since have 2 %@ , prints out next object in memory. happens string: @"xlas

Convert Image to Grayscale with array matrix RGB in android -

i'm creating code barre reader , have taken rgb picture , store in array using onpicturetaken(byte[] _data, camera _camera) , need convert binary matrix (greyscale) have done far public class cam extends activity implements callback { camera camera = null; @suppresswarnings("deprecation") @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); surfaceview view = new surfaceview(this); view.getholder().addcallback(this); view.getholder().settype(surfaceholder.surface_type_push_buffers); setcontentview(view); } @override public void surfacechanged(surfaceholder holder, int format, int width, int height) { camera.parameters parameters = camera.getparameters(); parameters.setpreviewsize(width, height); parameters.getsupportedpictureformats(); list<integer> formats = parameters.getsupportedpictureformats(); if (formats

excel - #GETTING_DATA message never resolves when calculation triggered from VBA -

i'm trying build range-level refreshing of cube functions large cube-formula based workbook, since build in batching of these functions invariably performs dreadfully on cube available when whole workbook refreshed (hours , hours of waiting). the code i'm trying use pretty simple: public sub refreshrange() dim rngtarget excel.range dim lngrescue long dim blncalccheck boolean set rngtarget = selection rngtarget.dirty rngtarget.calculate doevents '' used reluctantly in case vba blocks event '' causes recalc blncalccheck = blncalccheck or thisworkbook.connections("myconnection").oledbconnection.refreshing lngrescue = lngrescue + 1 sleep 200 '' api sleep function. tried application.wait. if lngrescue >= 200 debug.assert false loop until not fblnisgettingdata(rngtarget) '' function doesn't

c# - How to get the current UAC mode -

can check current uac type set in device before running application through c#. i got know approach check whether current user administrator or not. but, need know uac type set (i.e. default/never notify) internal logic. is possible? please help. this article self-elevation , checking level program runs in. due security reasons i'm afraid won't able retrieve uac level set. http://code.msdn.microsoft.com/windowsdesktop/csuacselfelevation-644673d3

Android start activity for result not working correctly for translucent activity -

i launch activity b activity startactivityforresult() , activity b translucent activity's method protected void onactivityresult(int requestcode, int resultcode, intent data) {} works activity b open. please suggest. i had exact same problem. solved removing intent.flag_activity_new_task flag intent used call activity b. check if there singleinstance or singletop in manifest in activity b. "you can't use startactivityforresult() if activity being launched singleinstance or singletop." source : android - startactivityforresult triggering onactivityresult

apache - PHP express checkout digital goods issue -

this our server info: apache version apache 2.2.26 apache 2.4.7 php version 5.3.28 5.4.25 our application (php) bit more complicated explain bottom line before apache + php update working correctly (testing in sandbox). after update no longer works when trying pay items. possible paypal api requires server "config" settings new apache/php might not have ? we looked on changelog apache/php , don`t see major change can impact our communication. believe request paypal our code made using curl. from tried debug looks response paypal empty , thats why our application throwing error. any ideas might preventing paypal -> server comunication since update ? you need see you're getting in curl response, sure, , can check curl_error see if useful detail there.

java - Clarification @ConcurrentModificationException in HashMap -

hi expecting concurrentmodificationexception in below secnarion,but it's working fine. could please clarify these one... hashmap<integer, string>table1 = new hashmap<integer, string>(); table1.put(1, "sam"); table1.put(2, "jon"); table1.put(3, "doe"); iterator itr1 = table1.entryset().iterator(); table1.put(3, "donn"); while(itr1.hasnext()) { system.out.println("---value--" + itr1.next()); } as per javadoc hashmap the iterators returned of class's "collection view methods" fail-fast: if map structurally modified @ time after iterator created, in way except through iterator's own remove method, iterator throw concurrentmodificationexception. so since modifying hashmap after getting iterator should getting concurrentmodificationexception putting entry existing key not considered structural modification in current implementation of ha

c# - LINQ Group By with subquery -

i trying make query on linq using groupby, on select statement try make kind of subquery. idea have 7 days for, need average value of these last 7 days current value current day. have tried following code: var odate = datetime.utcnow; var startdate = odate.addworkingdays(-7); var enddate = odate.addworkingdays(-1); var races = racetimes.where( x => x.odate >= startdate && x.odate <= odate && x.status == "finished") .groupby(x => x.athletes.name).select(x => new { name = x.key, description = "just random description now", odate = odate, sevendaysavg = (int?)x.where(y => y.odate >= startdate && y.odate <= enddate).average(y => sqlfunctions.datediff("s", y.starttime, y.endtime)), racetime = (int?)x.where(y => y.odate == odate).average(y

Round down and group by decade php mysql -

i know stupid question, there simple way round down date format such: 1992-12-11 ( thats in mysql database ) i run query , turn 1992 1990 , group 1990 entries. i dont know start it, , can seem find decimal rounding etc messy , not work. if can offer suggestion using mysql , or php appreciate it. --------- update ------------ $sql_decade = "select date archivals status=1 group year(date) div 10"; $result = mysql_query($sql_decade) or die(mysql_error()); while($r= mysql_fetch_array($result)) { $decade = $r['date']; echo $decade; } stil not quite rounding down. just gives me full dates still? you can perform integer division on year: group year(date) div 10 -- 1993 becomes 199, etc.

ocean - How to get coordinates in Petrel 2d Mapwindow through mouse click event? -

how coordinates dynamically in petrel 2d mapwindow through mouse click event? if implement custom windowmode, can access coordinates via pickedpoint api. "world" property give x-y coordinates in world space, , z determined domain object (if any) under mouse cursor. there separate window-based coordinate system uses fixed spacing x , y coordinates based on map viewport.

java - Refactoring predecessor code -

i'd ask , suggestion how refactor source code receive. here pseudocode of method: public void generalmethod(string type) { inputparameters params = new inputparameters(); if (type.equals("somekey1"){ decodesomekey1(params); } else if (type.equals("somekey2"){ decodesomekey2(params); } else if (type.equals("somekey3"){ decodesomekey3(params); } else if (type.equals("somekey4"){ etc... } } } all methods have same input parameters. in first step created new interface , created each method separate class implements created interface. interface isomeinterfacedecoder { void decode(inputparameters params); } class decodesomekey1 implements isomeinterfacedecoder { @override public void decode(inputparameters params) { // implementation } } class decodesomekey2 implements isomeinterfacedecoder {

php - Laravel 4 Eloquent Model Inside loop -

i wonder how handle this. have model: class mymodel extends eloquent { // assuming have proper codes here } and in services lets have code: class myservice { protected mymodel; public function __construct(mymodel $mymodel) { $this->mymodel = $mymodel; } public function savemanytimes() { // assuming have loop here needs // save many times $x = 0; $y = 5; while($x < $y){ $this->mymodel->name = 'joe'; $this->mymodel->age = 19; $this->mymodel->save(); } } } now question is, in savemanytimes method, can see, has loop saves upto 5x. output first iteration save. why eloquent behaving that? how handle that? but when try change code to: // note use **new** $x = 0; $y = 5; while($x < $y){ $mymodel = new mymodel(); $mymodel->name = 'joe'; $mymodel->

Doesn't call onStop and onStart after screen locked and unlocked android 2.3 -

doesn't call method onstart after screen locked android 2.3, after unlocking called resume method. on andoid 4.1.2 (jelly brain) works fine. can fixed ? or must move logic in method onresume/onpause ? the methods onstart , onstop bound visible lifetime of activity. if lockscreen not hide activity, these methods not called @ all. if have logic depending on different states use foreground lifetime methods onresume , onpause or observer techniques broadcastreceiver. also remember, prior android honeycomb application killable after onpause , onstop might not called @ all.

jquery mobile - Google maps touch scroll not working on Windows Phone -

my web application lets users create new location based trips. there google maps map displaying current location they've entered in form. i've read in this post touch scrolling , google-maps of touch scrolling ok code: var dragflag = false; var start = 0, end = 0; $('#maps-map').on('touchstart', function(e) { console.log('starting!'); dragflag = true; start = e.originalevent.touches[0].pagey; }); $('#maps-map').on('touchmove', function(e) { console.log('moving!'); if ( !dragflag ) return; end = e.originalevent.touches[0].pagey; window.scrollby( 0,( start - end ) ); }); $('#maps-map').on('touchend', function(e) { console.log('ending'); dragflag = false; }); and of course, google maps has added following container: <div id="#maps-map"></div> now if test on htc-device, in console get: 'starting!' 'moving!' 'moving!' 'ending

actionscript 3 - Why the Tween Class don't work inside a for with Flash AS3? -

problem i'm trying make tween many movieclips using command, this: for(var i:int = 0; < mcarray.length; i++) { new tween(mcarray[i], "x", regular.easeout, 0, 100, 1.0, true); } but doesn't works. i've tried change code follow down: var tween:tween = new tween(mcarray[i], "x", regular.easeout, 0, 100, 1.0, true); and doesn't works too. i can't use setinterval or timer because movieclips should synchronized , may cause problems. is there way this? as3 tween engine, bad: design, performance etc. if can't use greensock library animation, use gtween , it's great tweening engine under mit licence. without support , continuous improvement, engine much better tween adobe. working example, after start, if collect every object in center of scene: package { import com.gskinner.motion.gtween; import com.gskinner.motion.easing.sine; import flash.display.displayobject; import flash.displ