Posts

Showing posts from April, 2014

java - Copy objects into arraylist instead of pointing -

i trying create arraylist of nodes used come 1 place(node) another. nick name of place , node's pi previous node in path. arraylist<node> bestway = new arraylist<node>(); while(chosen.nick != from){ bestway.add(chosen); chosen = chosen.pi; } the problem elements in bestway becomes same. when print bestway place1, place1, place1, place1 , , not place1, place2, place3, place4 . is possible copy elements array, , not add pointers chosen-element changes on line after. lot! here example trying mimic explained. works me hence, error should somewhere else guess: public class example { public static void main(string[] args) { list<node> bestway = new arraylist<node>(); node chosen = new node("place1"); string = chosen .add("place2") .add("place3") .add("place4") .add("place5") .

java - Spring security between web apps- NOT SSO -

i'm using spring security 3.1.4 , have following question: have 2 web apps 1 "admin" , other "users". admin calls other using controllers. communication use spring security, thought of option create special "login" controller in user app admin , create special "admin user" authentication information (login name, password , role..) , every time want communicate admin app use controller. valid , common solution?

Protractor + AngularJS + Jasmine get output results on xml file -

i'm trying export protractor results xml files, found great link on web: https://github.com/angular/protractor/issues/60 after running : npm install jasmine-reporters i added following lines protracotr config file: require('jasmine-reporters'); jasmine.getenv().addreporter(new jasmine.junitxmlreporter( 'c:\temp\test', true, true)); and following error: jasmine.console_reporter.js:2 if (! jasmine) { ^ referenceerror: jasmine not defined i attached here config file, please advise doing wrong, , how can fix this: require('jasmine-reporters'); jasmine.getenv().addreporter(new jasmine.junitxmlreporter( 'c:\temp\test', true, true)); // example configuration file. exports.config = { seleniumaddress: 'http://localhost:4444/wd/hub', chromeonly: true, capabilities: { 'browsername': 'chrome' }, specs: ['../test/protractor/publisher_list_e2e.js&

jQuery on binding when loading partial -

i'm loading partial shown here: <div id="catering-dialog" title="catering new booking"> <div id="itemstable"> @{html.renderaction("addcateringitem", new { model.booking.bookingid });} </div> </div> and have jquery .on() $('a.editrow').on("click", function () { alert("clicked"); }); basically, partial table , each row has cell "edit" in , when clicked should display alert "clicked" nothing @ happens. any ideas? to update: <div id="cateringtable"> <table border="2" bgcolor="#ffffff" id="cateringlisttable"> <thead> <tr> <th>time:</th> <th>description:</th> <th>quantity:</th> <th>cost £:</th> </tr> </thead> <tbody> @foreach (var item in model) { html.

ruby - Using constraints in Rails to change the default root_path for some users -

i looking way change default routing (root_path specifically) of app using other simple if/then check different types of users. found this code example online, can't make work app , main problem don't understand underlying code does, therefore cannot adapt code app. first create rule in router: root 'admin#index', constraints: roleconstraint.new(:admin) then create new file called role_constrait.rb in lib directory , user code: class roleconstraint def initialize(*roles) @roles = roles end def matches?(request) @roles.include? request.env['warden'].user.try(:role) end end i see guy using warden here, using cancan, , since piece of code makes no sense me, can't make changes it, have tried, keep getting undefined local variable or method `root_path' error. would highly appreciate help! i don't think router should in charge of doing that. it's hard implement , hard test. more than, it's extremely inco

uniqueness with nested_form_for rails is not working -

i have models vehicle, tag, vehicletag class vehicletag < activerecord::base attr_accessible :vehicle_id, :tag_id, :capacity belongs_to :vehicle belongs_to :tag validates_uniqueness_of :tag_id, :scope => [:vehicle_id] end and have used 'nested_form_for' enter value in vehicle_tags tables validates_uniqueness_of not working when user select same tags multiple times , saving data in tables. but when have single record in vehicle_tag tag_id=2, vehicle_id=24 , when user select same tag again time thronging uniqueness validation. getting first time don't have value in db , second time have. but want through uniqueness when user select multiple same tag. edit: vehicle_tag table structure: +-----+------------+--------+----------+---------------------+---------------------+ | id | vehicle_id | tag_id | capacity | created_at | updated_at | +-----+------------+--------+----------+---------------------+---------------------+ | 241 |

validate and expire the link using gwt - java -

my requirement sent mail concerned users when record created. mail contains link our system lets user interacting system without login. link expires after time. mailing done using javax.mail . how can expire link? i generate key/id add link , store database. filters (web.xml) can check if url (id) still valid , pass on desired page. if provide more details, can give more detailed answer.

vb.net - Reading Only Words in Text File in Visual Basic -

i'm working on project visual basic class in i'm supposed read in file , display information (employee names , salaries) in list box. i have total of 4 forms. first form doesn't display anything, has menu items open file, select of other 3 forms, , exit form. in second form (names), employee names read in file displayed in list box. in third form (salaries), employee salaries read in file displayed in list box. fourth form second , displays employee names read in file. the problem is, don't know how parts of file displayed in list boxes (names , salaries). also, in fourth form have ask user enter amount of months calculate salary selected employee , multiply salary number of months entered user. know how this, except how go getting salary. example, i'm thinking this: lbltotal.text = dblsalary * intmonths but don't know how store salary of selected employee in dblsalary variable? here's code have written far, it's opening open file dialog b

Neo4j: Create multiple relationships with cypher and parameters -

i try create lot of relationships (16k) 1 cypher statement , parameters in py2neo writebatch. if try create 10 (or so) relationships, works without problems. 16k relationships, neo4j server hung @ 100% cpu , py2neo gives error (after while). i use following code create relationships: graph_db_batch = neo4j.writebatch(graph_db) graph_db_batch.append_cypher\ (\ "\ foreach (par in {params} |\ merge (s:users {userid1:par.sval})-[r:member_of]->(e:groups {groupid:par.eval})\ set r = par.cprops\ );\ ",\ object_props\ ) graph_db_batch.run() object_props looks this: {'params': [{'sval': 'usera', 'cprops': {'marked': 1, 'datedeleted': 0}, 'eval': 'groupx'}, {'sval': 'userb', 'cprops': {'marked': 1, 'datedeleted': 0}, 'eval': "groupy"}]}

c# - Insert image to crystal reports -

Image
insert image crystal report have ado.net data connection i'm using <xs:element name="drawing" type="xs:byte" minoccurs="0" /> for image field, how can use image byte data display image in crystal reports 2013. i'm not using backend coding because there's possible many images in retrieved data, here's data structure of table "drawing" image field of data have stored byte i'm using image contained report sub report i not sure if understood question, let me share may lead useful. understand said there no "backending code", hope may contain useful tip case. when use image in crystal reports, it's type base64binary in xsd. in dataset, it's type byte[]. we save image serialized string in database. that: filestream stream = new filestream(filepath, filemode.open); binaryreader binreader = new binaryreader(stream); byte[] buffer = new byte[(int) stream.length]; buffer = binreader.r

Cocos2d-x opengl error in visual studio 2010 -

Image
my windows saying device driver date. in visual studio giving error opengl higher version required. i attached error screenshot. according specsheet graphics hardware supports opengl 1.4 not 1.5. need different graphics card or computer launch cocos2d-x apps under windows.

any way to track install_referrer for sideloaded android app? -

i know apps dl play store able pass referral data, there way pass data sideloaded app? let's if want promote app, , have 10 affiliates. want sideload app. correct way can track traffic doing 10 separate builds? or if there's way send data install_referrer ? from understanding, way trigger install_referrer through google play store. if that's case, there easy way builds? in case if have on hundreds of affiliates later.

python - How can I avoid "Object currently drawn" error? -

i want write python program shows letter in graphics window. if click right side of window, text needs turn red , if click left side needs turn green. needs work @ least 5 times. write down following change color 2 times , gives me "graphics.graphicserror: object drawn". idea how fix problem? from graphics import * def main(): win= graphwin("name",400,400) win.setcoords(0.0,0.0,4.0,4.0) win.setbackground("white") p=text(point(2.0,2.0),'b') p.setsize(36) in range(0,6): c=win.getmouse() s=c.getx() if s>=2 : p.settextcolor("red") else: p.settextcolor("green") p.draw(win) main() i new this. used zelle graphics module this the problem position of p.draw(win) call @korefn suggests. however, change makes 'b' visible before first click unlike original code. i've included commented out code in rework below make 

angularjs - Angular UI bootstrap modal, ng-click entry argument is undefined -

hello using angular ui bootsrap modal. , have multiple buttons on there, using 1 single method in ng-click, different input argument. problem in controller side, input argument undefined here part of code: modal controller: controller('mymodalcontroller', [ '$scope', '$modalinstance', function ($scope, $modalinstance) { $scope.keypressed = function (key) { console.log(key); }; $scope.close = function () { $modalinstance.dismiss('cancel'); }; } ]) and template using modal: <tr> <td ng-click="keypressed(1)"><span>1</span></td> <td ng-click="keypressed(2)"><span>2</span></td> <td ng-click="keypressed(3)"><span>3</span></td> <td ng-click="keypressed(4)"><span>4</span></td> <td ng-click="keypressed(5)"><span

java - Mapping of type: char**& in JNA -

my client gave me dll couple of functions. 1 of them is: int getversions(char* name, char** &pversions); it returns number of versions given name , array of strings versions. using jna, i'm trying write equivalent java method in interface: int getversions(string name, string ll, ??? pversions); the problem type should instead of ??? ? i trying put there pointerbyreference , after method invocation had: pointer ptr = ptrref.getvalue(); string ppp = ptr.getstringarray(0); but got here invalid memory access . pointer ptr = ptrref.getvalue(); string ppp = ptr.getstring(0, "utf-8"); returns garbage. any idea how solve it? thanks in advance! the char ** mapping pointerbyreference. example. c code. char **xs_directory(struct xs_handle *h, uint32_t t,const char *path, unsigned int *num); jna: pointerbyreference xs_directory(xenstorelibrary.xs_handle h, int t, string path, intbuffer num); this xenstore api contents of directory,th

Rewrite plex media server url on nginx? -

i have limited knowledge rewriting url in nginx. have plex media server running behind on nginx, can access dashboard http://domain.com/web/index.html these config found on github: upstream plex-upstream { server plex-server.example.com:32400; } server { listen 80; server_name domain.com location / { if ($http_x_plex_device_name = '') { rewrite ^/$ http://$http_host/web/index.html; } proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_redirect off; proxy_set_header host $http_host; proxy_pass http://plex-upstream; } } what want remove /web/index.html when go http://domain.com , pms dashboard load. tried 1 liner rewrite rules failed. thanks. i not nginx specialist, had similar problem. diference not trying alias domain.name/ domain.name/web/, goal alias domain.name/plex/ domain.name/web

Can't login into development copy of Typo3 -

i'd create local copy on windows 8 machine further develop existing extensions , test upcoming updates of typo3 6.1.7 installation. tared including mysql db dump, extracted fresh install of xampp , imported database. after adjusting db , openssl settings in localconfiguration.php tried login password, message stating credentials must wrong. the loginsecurity on configured rsa, , installtool states openssl config running correct. why can't login? did miss? searching wrong looked @ requirements typo3 6.1.x, , states supports mysql 5.5.x. sure enough, freshly installed xampp uses mysql 5.6. removed it, installed other current xampp package mysql 5.5 , works.

c# - Programatically start selenium test -

Image
using c#, possible start selenium test? the way found via ui right clicking on test , starting manually. as arran said, question how run tests written using visual studio unit testing framework , has nothing selenium. since can run test command line, need start calling command c# code. for example, here how start mstest.exe tests (see msdn documentation more test options please): process myprocess = new process(); processstartinfo myprocessstartinfo = new processstartinfo(path_to_mstest_exe, "/testcontainer:" + path_to_test_dll); myprocessstartinfo.windowstyle = processwindowstyle.hidden; myprocess.startinfo = myprocessstartinfo; myprocess.start();

wicket - Show correct model value even if error on field -

i have wicket textfield displays calculated value. value calculated in get-method in model object. have attached custom validator field. my problem occurs when validator fails. if change values in fields, calculated value should change in failed field. not happening. have verified get-metod called, , calculates correct value. however, not displayed in text-field. field still showing old one.. does know why happening? when validation fails on formcomponent , rawinput isn't cleared - user can fix value, rather having enter scratch. in case changing model behind formcomponent 's doesn't know there new value. should call modelchanged() method on after changing model value - among other things reset validation , rawinput , form work expected.

ios - How to make one label to set score on all view controllers? -

i have label , need show score, coins ect on every viewcontroller, means when score changes changes every throughout whole app... i've tried set label show score on whole app cant figure out how! please help this have far in view controller: -(void)viewdidload { { [super viewdidload]; nserror *error; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); //1 nsstring *documentsdirectory = [paths objectatindex:0]; //2 path = [documentsdirectory stringbyappendingpathcomponent:@"settingslist.plist"]; //3 nsfilemanager *filemanager = [nsfilemanager defaultmanager]; if (![filemanager fileexistsatpath: path]) //4 { nsstring *bundle = [[nsbundle mainbundle] pathforresource:@"settingslist"oftype:@"plist"]; //5 //5 [filemanager copyitematpath:bundle topath: path error:&error]; //6 } savedstock = [[nsmutabledictionary alloc] initwithcontentsoffil

xml - R cannot be resolved to a variable using Android Studio and Google Maps -

i aware there must problem somewhere in manifest or xml cannot find it. appreciated! i've spent while trying figure can't anywhere it. error:element type "activity" must followed either attribute specifications, ">" or "/>". (i cannot see anywhere tags problem) <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.clubnightsdeals" android:versioncode="1" android:versionname="1.0" > <permission android:name="info.androidhive.googlemapsv2.permission.maps_receive" android:protectionlevel="signature" /> <uses-sdk android:minsdkversion="12" android:targetsdkversion="18" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.internet" /> <

iis - Hosting IIS8 ASP.Net site -

i have asp.net website running on server 2012, iis 8. getting generic, not server provided 404 message. have ports forwarding through router, have site , ip setup in hosts file, , have site bindings configured proper address , port. site works fine on local machine browsing url (not localmachine), nothing outside server, other machines on network can site. any suggestions should next?

Doubts in development of a basic ontology using RDF/S: ontology reuse and "instance vs. inheritance" -

i trying develop simple "ontology" using rdf , rdf schema. for now, have written following classes , properties: <rdfs:class rdf:about="#model">...</rdfs:class> <rdfs:class rdf:about="#system">...</rdfs:class> <rdfs:class rdf:about="#concept">...</rdfs:class> <rdfs:property rdf:about="#represents"> <rdfs:domain rdf:resource="#model" /> <rdfs:range rdf:resource="#system" /> </rdfs:property> <rdfs:property rdf:about="#includes"> <rdfs:domain rdf:resource="#model" /> <rdfs:range rdf:resource="#concept" /> </rdfs:property> the idea i'd define "model" (i.e., model instance) set of "concept"s. thus, such "model" instance "represent" "system": "system" can described using "concept"s defined in "model" (

Cannot iterate the HashMap converted as JSON String in JSP -

in spring controller: returning map values json string map keyttlmap = getrediscachettlvalues(filterpattern); jsonobject jsonobject = new jsonobject(); jsonobject.put("cachettlmap", keyttlmap); return jsonobject.tostring(); in jsp ajax call: var json = xmlhttp.responsetext; ( var = 0; < json.cachettlmap.length; i++) { var obj = json.cachettlmap[i]; ( var key in obj) { name = key; value = obj[key].tostring(); alert("name "+name +" value "+value); } } json string value: { "cachettlmap": { "product1":81213, "product2":79936 }} when try run jsp, json string cannot iterated.is there simple way display hashmap in ajax, kindly me this. thanks! var json = '[{"userid" : "123123", "password": "fafafa", "age": "21"}, {"userid" : "321321", "password" : "nana123", &qu

php - Insert query not working even though it is right -

you have error in sql syntax; check manual corresponds mysql server version right syntax use near ','','','')' @ line 2 i above error when running php file. my insert query $updateusercanvas="insert user_canvas(cns_id,course_id,context_id,email_id,resource_id) values(".$canvasid.",".$courseid.",'".$contextid."','".$email."','".$resourseid."')"; cns_id,course_id integer datatype , context_id,email varchar , resource_id text datatype i searched problem , tried adding mysql_real_escape_string $updateusercanvas="insert user_canvas(cns_id,course_id,context_id,email_id,resource_id) values(".$canvasid.",".$courseid.",'".mysql_real_escape_string($contextid)."','".mysql_real_escape_string($email)."','".mysql_real_escape_string($resourseid)."')"; but still not working. dont know

ios - How to copy sqlite database when we clicked on a UIButton? -

i storing details coredata nsstring. nsentitydescription *entitydesc=[nsentitydescription entityforname:@"addnewvehicle" inmanagedobjectcontext:self.managedobjectcontext]; nsmanagedobject *newobject=[[nsmanagedobject alloc]initwithentity:entitydesc insertintomanagedobjectcontext:self.managedobjectcontext]; nserror *error; nsstring *instr = [nsstring stringwithformat: @"%d", (int)x]; [newobject setvalue:instr forkey:@"slno"]; [newobject setvalue:txt_platename.text forkey:@"platenumber"]; [newobject setvalue:txt_vehiclename.text forkey:@"vname"]; [self.managedobjectcontext save:&error]; also have 2 buttons named backup button , restore button.when cilck on backup button, current core data must duplicate coredatabackup.sqlite. tried following way:- - (ibaction)savedata:(id)sender { nsstring * databasename = @"coredata.sqlite"; nsstring * databasebackupname = @&qu

linux - finding file ib the directory and extract the file using Perl script -

another question experts here. have perl script here , intention find file , untar . when execute line nothings happen . my $bundle = "`awk -f \'=\' \'{print \$2}\' config.txt`"; $bundlename = `awk -f \'=\' \'{print \$2}\' config.txt | awk -f \'/\' \'{print \$11}\'`; print $output; system ("wget $bundle"); print "$bundlename\n"; $cd = `tar -xzvf $bundlename`; can me ? right script find file , after finding extract file tar.gz file for background of code. have config file have address download file , if file finished downloaded in machine $bundlename variable find print name of file , after $cd variable extract file after finding name of file.

Magento: sort products by attribute position -

in site have setted filter ordering products attribute, order alphabetical , order position attribute setted in backend. example attribute color: valuename | position green | 1 blue | 2 red | 3 the actual result in frontend product blue green red, result green blue red what classes can modify resolving problem? thanks in advance i thinking create custom option product , set short_order of value. if right use code. go app/code/core/mage/catalog/model/product/option.php there function getproductoptioncollection line no:- 373 . comment out code of ->setorder('title', 'asc'); , add " ; " after ->setorder('sort_order', 'asc') public function getproductoptioncollection(mage_catalog_model_product $product) { $collection = $this->getcollection() ->addfieldtofilter('product_id', $product->getid()) ->addtitletoresult($product->getstoreid()) ->addpricetoresult($

md5 - MessageDigest.Digest, cannot catch the exception android -

i have trouble code, heres method bothering me. public static byte[] createchecksum(byte[] b){ messagedigest md; try { md = messagedigest.getinstance("md5"); md.update(b); byte[] checksum = md.digest(); return checksum; } catch (nosuchalgorithmexception e) { e.printstacktrace(); } catch(exception e){ e.printstacktrace(); } return null; } what happens statement md.digest() executed steps directly return null. dunno goes wrong, problem inside android? edit: wanna note using java.security.messagedigest , not android.security.messagedigest as can see there not exceptions digest method, reacts if there error inside function, send 186 bytes in array method. i changed code bit, seems work, when use digest outside try catch, can't explain why, unless update change fixed it. public static byte[] createchecksum(byte[] b){ messagedigest md = null; try { md = messagedig

javascript - Can't get Firebase update() to work with provided object -

ok, after lot of trial , error have try asking here. i'm trying update firebase entry , code this, this service.js: //this dosn't work var updateitem = function (item, id) { var ref = new firebase(firebase_uri + '/lessons/' + id); ref.$update(item); } //this works (items ref new firebase(firebase_uri + '/lessons/'); var additem = function (item) { items.$add(item); } and controller: $scope.updatelesson = function (item) { lessonsservice.updatelesson(item, id); } the error i'm getting this: error: firebase.set failed: first argument contains invalid key ($id). keys must non-empty strings , can't contain ".", "#", "$", "/", "[", or "]" the object i'm passing in looks this: object { $id: "-jliuvvmlqocvghaed9f", $bind: function, $add: function, $save: function, $set: function…} $add: function (item) { $auth: function (token)

java - getting action of buttons on receive() method which is a method of broadcast receiver but its show a null -

i getting action of buttons getaction on receive() method method of broadcast receiver sho null plz tell me in value not null +my notify method following private void notify(string notificationtitle, string notificationmessage) { string ns=context.notification_service; notificationmanager notificationmanager=(notificationmanager)getsystemservice(ns); @suppresswarnings("deprecation") notification notification=new notification(r.drawable.bg,"time",system.currenttimemillis()); remoteviews notificationview=new remoteviews(getpackagename(),r.layout.main); intent notificationintent=new intent(this,playeraudioactivity.class); pendingintent pendingnotificationintent=pendingintent.getactivity(this, 0, notificationintent, 0); notification.contentview=notificationview; notification.flags|=notification.flag_no_clear; //supposed button call intent intent switchintent=new intent(

sql - How to use LIKE operator with wildcards in parameterized query in MS-Access -

i using ms access database, need pass parametrized query. ms access uses in format ... ' [par1] ' {par1 parameter in ms-access-query} need way use parametrized query wildcard support. example, if user enter 325 par1, sql-command text in condition ... field1 "*325*" have tried following: like "*" & [par1] & "*"

file - Simultaneously writing out an array while casting efficiently -

i have array of long double s. want write out array of double s, don't want create double array first (i don't have memory), , i'm worried performance. my (naive) solution: file.open(filename.c_str(), std::ios::binary | std::ios::out); if (file.is_open()) { (auto& : out) { t2 ni = static_cast<t2>(i); file.write(reinterpret_cast<const char*>(&ni), static_cast<size_t>(sizeof(t2))); } file.close(); } however, arrays i'm attempting write out, calling file.write 630,000,000 times (and since file.write creates sentry object on each instantiation, expensive). there more efficient way this?

c# - WPF Custom Component Datagrid binding -

so, trying perform databinding custom component have, can't seem find information on how so. have custom component in main window have bindning property... <local:multicolumncombobox itemssource="{binding customers}" x:name="newcombo"></local:multicolumncombobox> and in custom component... <datagrid itemssource="{binding itemssource}" name="datagrid"></datagrid> if knows how this, guidance appreciated :) edit public static readonly dependencyproperty itemssourceproperty = dependencyproperty.register("itemssource", typeof(ilist<customer>), typeof(multicolumncombobox)); public multicolumncombobox() { initializecomponent(); } //items source binding public ilist<customer> itemssource { { return (ilist<customer>)getvalue(itemssourceproperty); } set { system.console.writeline("binding"); system.console.writeline(value);

asp.net - Web Api not converting json empty strings values to null -

example json: {"field1":"","field2":null}. in mvc, field1 converted null default. tried [displayformat(convertemptystringtonull = true)] attribute, (which should default anyway) , did not make difference. i'm using web api 2.1 any ideas? first empty string not null, , json.net underlying json implementation should not auto conversions. you can add following custom converter deal that public class emptytonullconverter : jsonconverter { private jsonserializer _stringserializer = new jsonserializer(); public override bool canconvert(type objecttype) { return objecttype == typeof(string); } public override object readjson(jsonreader reader, type objecttype, object existingvalue, jsonserializer serializer) { string value = _stringserializer.deserialize<string>(reader); if (string.isnullorempty(value)) { value = null; } return value; }

python - Getting a function to execute periodically -

this question has answer here: how create timer using tkinter? 3 answers i working on simple project , need little help. have created program draws circles on canvas. circles blue, , method flash() takes random int count, , light circle , change color yellow. problem want function continue execute every second or so, because want able let user of program click onto circle lit, , have program respond dialog stating correct/incorrect if user got right. of right can light 1 circle , it. tried using thread , set every 2 seconds, didn't work or maybe didn't correctly. appreciated. from graphics import * tkinter import * import random class app(): def __init__(self): self.win = graphwin('demo2', 400, 300) # give title , dimensions count = random.randint(1,9) self.flash(count) def flash(self,count):

PHP Loops to Functions -

i understand looping through mysql tables for loops , extracting out data via if statements (among other things). but trying better understand functions. keep simple , point of reference understand, used doing: require 'get_member_email.php'//where $memberemail defined $query = "select * table something='something else'"; $results = mysql_query($query); foreach ($results $data){ if ($memberemail == $data['member_email']{ $id = $data['member_id']; } } i store script in file call website require (as file 'above' (where $memberemail defined), call both files webpage via: require 'get_member_email.php';// $member email defined require 'get_memeber_id.php'; //where code above echo "<h1>your member id is: $id</h1>"; 1) how write functions 2) there benefit doing so? (rather keeping require , for loops) 1) okay question how write function. function l

objective c - TableViewCell subviews can't access in IOS 7 -

i using customized tableviewcell in app. works fine ios 6 got error in ios 7. error occurred when access sub views of uitableviewcell see code below got error - (void)addbuttonclicked:(uibutton *)button { product *product = [productsarray objectatindex:button.tag]; nsstring *code = product.code; otatablecell *cell = (otatablecell *) [[button superview] superview]; cell.pricelabel; // here error } error shown is: -[uitableviewcellscrollview pricelabel]: unrecognized selector sent instance 0x15d0ff80 please me solve problem. in advance. need 1 more superview call: otatablecell *cell = (otatablecell *)[[[button superview] superview] superview]; you can check like: for ios >= 7: nslog(@"%@",[[sender superview] class]); //uitableviewcellcontentview nslog(@"%@",[[[sender superview] superview] class]); //uitableviewcellscrollview nslog(@"%@",[[[[sender superview]superview]superview] cl

nginx - How to use ffi.C.lstat? -

i want file's basic infomation lstat function in ngx_lua programme. init.lua's content fallow: local ffi = require "ffi" local ffi_c = ffi.c local ffi_new = ffi.new ffi.cdef[[ typedef long long time_t; typedef struct timespec { time_t tv_sec; long tv_nsec; ...; }; typedef struct stat { struct timespec st_mtim; ...; }; int lstat(const char *path, struct stat *buf); ]] buf = ffi_new("struct stat *") function checkfile (filename, buf) ffi_c.lstat(filename, buf) end when start nginx, there errors happen. content fallow: 2014/04/25 15:00:39 [error] 26396#0: lua entry thread aborted: runtime error: /home/nginx/conf/cop/init.lua:42: /usr/local/lib/libluajit-5.1.so.2: undefined symbol: lstat stack traceback: coroutine 0: [c]: in function '__index' /home/nginx/conf/cop/init.lua:42: in function 'checkfile' /home/nginx/conf/cop/

jquery - Sending Contents of a HTML page to a PHP file -

how send contents of html file php file. have got total html content in jquery variable using below code $(document).ready(function(){ $("#btnexportpdf").click(function(){ var html= $("#tblexport").html(); }); }); i stuck here, how can send such big string new php page? please provide me sample example or link you have post .php file. using jquery post function. var html = 'here <b>some</b> text!'; $.post( "example.php", html, function() { alert( "success" ); }) .done(function() { alert( "second success" ); }) .fail(function() { alert( "error" ); }) .always(function() { alert( "finished" ); }); more information @ jquery docs: https://api.jquery.com/jquery.post/ && https://api.jquery.com/jquery.ajax/

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

i in process of writing application using opal makes h323 calls. have looked online number of working examples , have managed put resembles should like, @ present able call external ip via application when accept call craps out , dies. leaving me with: 0:12.949 setupcall:8752 sert.cxx(259) assertion fail: transport not terminated when reattaching thread , file d:\voip\software\opal\src\opal\transports.cxx, line 1021 passertfunc(0xde3f88, 0xffffffffd228226f, 0, 0) + 0x82 passertfunc(0x10d6e5f8, 0x3fd, 0, 0x10d6eb98) + 0x15b opaltransport::attachthread(0xde5870, 0xffffffffd22fc76b, 0, 0) + 0x96 h323connection::setupconnection(0xffffffffd22fc713, 0, 0, 0xde6ea8) + 0x196 asynchcallsetup(0x10d3572c, 0, 0, 0xdd0108) + 0x7c pthread1arg<psafeptr<opalconnection,psafeptrbase> >::main(0xffffffffd2282faf from have deduced, perhaps incorrectly if there thread lock issue caused (possibly arising fact application sending expected h323 call, throwing in c

mysql - Not Unique Table Alias error in java -

i have 2 tables: error table id, loc, no, mesg, psg, stu, auth user table id, name, sname, ptg id's primary keys, ptg , psg have same records, and sql syntax use in swing project, string sql = select error.id, user.name, user.sname, error.loc, error.no, error.msg error, user error.stu = '1' , (user.ptg = error.psg , error.auth = '5' error is: com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: not unique table/alias: 'error' there several errors in query. first, , important, join clause without condition: "from error, user" when wish join 2 tables using comma instead of join command, put linking condition in clause: "from error, user error.userid = user.id" second error double quote (") after '1'. remove it. third error unclosed bracket "(" in last line. remove it. try , post here results. cheers

git - Undo local changes interactive -

i add debug code while developing need remove these changes later. currently, check git diff , remove changes manually or type git checkout -- myfilename if undo entire file. i love interactive patch function ( git add -i ). there tool or command in git can undo changes interactive git add -i ? in other words: interactively checkout files , hunks out of index. what looking think git reset --patch or git reset -p from the docs : git reset (--patch | -p) [] [--] [...] interactively select hunks in difference between index , (defaults head). chosen hunks applied in reverse index. this means git reset -p opposite of git add -p, i.e. can use selectively reset hunks. see “interactive mode” section of git-add(1) learn how operate --patch mode. and git add -p it says -p interactively choose hunks of patch between index , work tree , add them index. gives user chance review difference before adding modified contents index. this runs

javascript - How to get this checkbox toogle to work -

i creating toggle checkbox own css , jquery got stuck, want inner-box slide left right , right left onclick event changing text yes no , no yes. my css file as: .outer-box{ background:green; padding:5px; width:50px; height:20px; } .inner-box{ background:blue; padding: 2px; width:17px; height:17px; display:inline; } js file as: $(document).ready(function(){ $('.outer-box').click(function(){ var value = $('.outer-box').attr('id'); alert(value); if(value === 'right-box'){ // alert(value+" -- "); //$('.outer-box').text('n'); $('.inner-box').css('float','left'); $('.outer-box').text('n'); $('.outer-box').removeattr('id'); $('.outer-box').attr('id','left-box'); }else if(value === 'left-box'){ $('.inner-box').css('float','right');

Django compressor tags ignored on production machine -

i'm using django compressor (1.3) seems ignored on production machine. i've tested on local (with manage.py run server ), , both css , js being amalgamated (although not minified). on development machine, {% compress %} tags seem ignored. my base template looks - {% load compress %} <!doctype html> <html lang="en-gb"> <head> {% block css %} {% compress css %} <link rel='stylesheet' type='text/css' href='{{ static_url }}css/base.css' media="all"/> <link rel='stylesheet' type='text/css' href='{{ static_url }}css/nav.css' media="all"/> <link rel='stylesheet' type='text/css' href='{{ static_url }}css/catalog.css' media="all"/> <link rel='stylesheet' type='text/css' href='{{ static_url }}css/cart.css' media="all"/> <link rel='styles

ios - Angularjs: linking to phone's mapping app -

i have webapp wants offload walking / driving directions phone's native apps. google maps app , maps.apple.com android , ios respectively. can detect phone user agent presumably, can't work out how configure link. <li><a href ng-click="geohandler()"> directions</a></li> this have in relevant controller. $scope.geohandler = function() { // user agent sniffing here var path = "geo:0,0?q="+$scope.resto.lat+","+$scope.resto.lng+"("+$scope.resto.rname+")"; // var path = http://maps.apple.com/?ll=$scope.resto.lat+","+$scope.resto.lng return $location.path(path); } when had geo link href in html, phone did right thing, code taking me home page of spa. so, questions are: is ng-click right way go (i can't use function ng-href think); how launch intent via $location? ok, moved different , simpler approach. not sure whether elegant, works. view <a ng-

3D and physic simulation with java -

im student , must semester project. i must make physic simulator of magnetic forces on current loop. i don't know simulation coding either physic java. i read recommendations make project. teacher told software have coded in java. looked simulation in google there weren't information i don't know lot java 3d so, i've learn several things, offcourse. time. you can learn lot looking @ source jbullet, java port of popular bullet physics engine. don't know if project write own engine or can use existing one, either task learn lot studying jbullet. link: http://jbullet.advel.cz

c# - Lambda: efficiently find, modify, then group elements -

let's have list <pagehit > , pagehit having these properties: datetime requesttime , int pageresponsetime . ultimately i'm trying round each requesttime value nearest 30 minute increment (using how can round time nearest x minutes? ), group them together, , overall average of pageresponsetime increment block (real world user story: track average page response time per 30 minute block). this far i've gotten, brain won't show me how efficiently average each increment without gross loop. there way in step 1? // step 1: round request times pagehitlist.foreach(x => x.requesttime = x.requesttime.roundup(timespan.fromminutes(30)); // step 2: average of each increment block ? haven't tested it, do: var avg = pagehitlist.groupby(x => x.requesttime.roundup(timespan.fromminutes(30))); .select(hit => new { hit.key, average = hit.average(x => x.page

jquery - Implement Detect Mobile for scrollReveal Javascript -

i'm using scrollreveal plugin. can me out why mobile detect business not working in script? i'm trying disable javascript effect on mobile devices. //start scrollreveal (function($) { 'use strict'; window.scrollreveal = new scrollreveal({reset: true}); // see: http://stackoverflow.com/a/11381730/989439 var ismobile = (function () { var check = false; (function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|