Posts

Showing posts from September, 2013

Paypal integration with asp.net -

i have created paypal account on paypal site testing(buyer , seller account). developed site , created page redirects me on paypal site buy product. login required there buyer. can login there test account? mypaypalid@live.com, (as given @live id , returned me paypal @live.com) me plz posible... you'll need set tests accounts through https://developer.paypal.com/ (signup required, separate live paypal account). in here, create 1 buyer/seller account. change "action" point https://www.sandbox.paypal.com/cgi-bin/webscr , opposed https://www.paypal.com/cgi-bin/webscr don't forget modify 'business' of button match sandbox seller account created.

java - My program isn't reading the file as it's supposed to be -

i'm trying make int value, goes counter every second, when close program down, save value .txt file, , then, should, when start program again, read int value file, , continue value again, however, saving correctly, makes file, when startup program again, start @ 1 again, , not @ value saved in .txt file. the int value: public int points; the getter , setter, located in mrstan.class public int getpoints(){ return points; } public void setpoints( int points ){ this.points = points; } how i'm reading file: mrstanreadfile r = new mrstanreadfile(); r.openfile(); r.readfile(); r.closefile(); my readfile class: public class mrstanreadfile { private scanner x; mrstan = new mrstan(); public void openfile(){ try{ x = new scanner(new file("d:/mrstan/text.txt")); }catch(exception ex){ system.out.println("could not find text.txt"); } } public void readfile(){ while(x.hasnext()){ ...

oracle - Can you using joins with direct path inserts? -

i have tried find examples simple single clause. here situation. have bunch of legacy data transferred database. have "good" tables in same database. need transfer (data-conversion) data legacy tables thew tables. because different set of tables data-conversion requires complex joins put old data new tables correctly. so, old tables old data. new tables must have old data requires lots of joins old data new tables correctly. can use direct path lots of joins this? insert select (lots of joins) direct path apply tables on same database (transfer between tables)? loading tables text file? thank you. the query in select can complex you'd direct-path insert. direct-path refers destination table. has nothing way data read or processed. if you're doing direct-path insert, you're asking oracle insert new data above high water mark of table bypass normal code reuses space in existing blocks new rows inserted. has block other inserts since ...

c++ - How would one get a UTF-8/Unicode string from GetOpenFileName? -

i'm developing application in mingw/c++ uses windows' common dialogs. need has arisen collect file name might have non-ascii characters in it. there flag or option retrieving file name in unicode, or preferably utf-8? call getopenfilenamew. can without converting entire app unicode may expedient solution. windows api comes in 2 flavours, ansi , unicode. former has functions suffix. latter have w suffix. using former.

iphone - Comparing two arrays for equivilant objects with Kiwi (Sentesting) Kit -

i want compare 2 arrays equivalent objects, 1 property inside class , other in test method. i cannot compare directly since objects allocated seperately , have different memory locations. to around implemented description on object list out properties in string: (vel cgpoint) - (nsstring *)description { return [nsstring stringwithformat:@"vel:%.5f%.5f",vel.x,vel.y]; } i test with: nslog(@"movearray description: %@",[movearray description]); nslog(@"currentmoves description: %@", [p.currentmoves description]); [[thevalue([movearray description]) should] equal:thevalue([p.currentmoves description])]; my nslog's yield: project[13083:207] movearray description: ( "vel:0.38723-0.92198" ) project[13083:207] currentmoves description: ( "vel:0.38723-0.92198" ) but test fails: /projectpath/objecttest.m:37: error: -[objecttest example] : 'object should pass test' [failed], expected subject equal <9086b104...

symfony1 - Symfony - Redirect to action with form values filled in -

how can redirect action, , form fields filled in on new action? i have action , want call redirect() like: $this->redirect('foo/search?search[last_name]='.$this->form->getvalue('last_name')); which should redirect search action, , form in action should last_name parameter filled in. action has code so: public function executesearch(sfwebrequest $request) { $this->form = new searchform(); $submission = $request->getparameter($this->form->getname()); ...do stuff $submission... the searchform has name format 'search[%s]'. nothing i've tried parameter redirect() has worked. search[] parameters messed in way , not populate form. i try symfony generate url based on route , parameters: @search = route search action in routing.yml $parameters = array of parameters want pass $url = $this->generateurl('search', $parameters); $this->redirect($url); the array of parameters should take following f...

javascript - prototype Event Observer not working -

please check doing here false? event.observe(form['postalcode'], 'blur', function(form) {return updatecityname(form) }(form)); i getting javascript error "handle undefined" give element id of "postalcode", makes lot easier. $('postalcode').observe('blur', function(e) { var element = e.element() var myform = element.up('form') return updatecityname(myform) });

html - Ways to make a voice call from a web page? -

my app this: 2 people enter chat or else in page , have skype name or gtalk. possible make anchor call voice client web page? there flash fallback this? i know skype: prefix doesn't work me in ubuntu, should work windows users. i target pcs & macs, supporting mobile platforms solution nice. for downvoters : comments why this? please bother explain me obvious thing don't know , make question. your question complex. instead of answering it, take several pages, person might write application him/herself , sell it. you have divide problem in tiny bits, , have question each one. you @ least start looking @ gtalk api , skype api see need yourself.

can spring inject EJBs into annotated fields of servlet in a Java SE webapp? -

spring has support injecting javax.ejb.ejb annotations , injects @autowired , other jsr-220 injection annotations, commonannotationbeanpostprocessor class. however, injection doesn't work servlets, since servlet isn't created spring. this article - spring injects servlets too - doesn't give example using servlets, claims it's possible using compile-time weaving of aspects. unfortunately, compile-time weaving not option us. possible @ runtime? it's ok introduce subclass servlet if helps, want keep ejb annotations servlets can still deployed in java ee container. edit: app deployed java ee container in production, thinking of using spring running functional tests , local deployment development take advantage of hot jsp loading in tomcat. you need java ee container in glassfish supports injection of ejbs , beware injection works on managed classes servlets, managed beans..etc (classes managed containers) ejb injection in normal classes require use ...

variables - Python: Store Token in Memory -

i have class , in class have function performs authentication , returns token. i store token in memory use other functions in same class. how ? presuming structure this: class myclass(object): def doauth(self): callauthprocedure() if callauthprocedure returns token, adjust this: class myclass(object): def doauth(self): self.token = callauthprocedure() later, other methods on instance of class can use self.token necessary.

javascript - SetTimeout how to do it? -

i want make code run after 20 seconds settimeout: <script type="text/javascript"> soundcloud.addeventlistener('onplayerready', function(player, data) { player.api_play(); }); </script> the code works correctly alone don't know how delay it. how can it? thanks settimeout(function() { soundcloud.addeventlistener('onplayerready', function(player, data) { player.api_play(); }); }, 20000);

android - how to use on resume method()? -

help me this, have button image should unselected,when click should selected if go next activity , if come should selected,if not selected before going next activity should unselected.how can have 32 buttons totally in activity 1. dwn15=(button)findviewbyid(r.id.adultdwn15); dwn15.setonclicklistener(new view.onclicklistener() { public void onclick(view view){ if(teeth[30]==0){ dwn15.setbackgroundresource(r.drawable.adultdwn15); teeth[30]=31; } else{ dwn15.setbackgroundresource(r.drawable.adultdwn15_pressed); teeth[30]=0; } } }); try selector this: <?xml version = "1.0" encoding = "utf-8" ?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/selectable_image" /> <item android:state_focused="true" andr...

objective c - how can i alter table in sqlite database through the obj c methods in iphone project -

hii every one i need add 1 column existing table how can alter table in sqlite database through obj c ,i using following code inserting data table in same way how can write updata table method - (void) insertrecord { if(addstmt == nil) { const char *sql = "insert tbl_users(firstname,middlename) values(?,?)"; if(sqlite3_prepare_v2(database, sql, -1, &addstmt, null) != sqlite_ok) nsassert1(0, @"error while creating add statement. '%s'", sqlite3_errmsg(database)); } sqlite3_bind_text(addstmt, 1, [strfirstname utf8string], -1, sqlite_transient); sqlite3_bind_text(addstmt, 2, [strmiddlename utf8string], -1, sqlite_transient); //sqlite3_bind_text(addstmt, 3, [strlogin utf8string], -3, sqlite_transient); if(sqlite_done != sqlite3_step(addstmt)) nsassert1(0, @"error while inserting data. '%s'", sqlite3_errmsg(database)); else //sqlite provides method last primary key inserted using sqlite3_last_insert_rowid ...

c++ - application get hung while freelibrary -

i got crashdump generated drwtsn32 on site, show application blocked while invoking system api freelibrary. here's class stack: childebp retaddr args child 06f0fc14 7c827d29 7c83d266 00000718 00000000 ntdll!kifastsystemcallret (fpo: [0,0,0]) 06f0fc18 7c83d266 00000718 00000000 00000000 ntdll!zwwaitforsingleobject+0xc (fpo: [3,0,0]) 06f0fc54 7c83d2b1 00000718 00000004 00000000 ntdll!rtlpwaitoncriticalsection+0x1a3 (fpo: [2,7,4]) 06f0fc74 7c839874 7c8897a0 00000000 00000000 ntdll!rtlentercriticalsection+0xa8 (fpo: [1,1,0]) 06f0fd7c 77e6b1bb 014e0000 00000000 02a67430 ntdll!ldrunloaddll+0x35 (fpo: [seh]) 06f0fd90 005e8cdd 014e0000 02a4bc88 06f0fdbc kernel32!freelibrary+0x41 (fpo: [1,0,0]) .... i noticed line ntdll!rtlentercriticalsection+0xa8 (fpo: [1,1,0]), , think should critical_section relative. used dt command in windbg show critical_section information it 0:037> dt 7c8897a0 rtl_critical_section siteadminsvc!rtl_critical_section +0x000 debuginfo : 0x7c8897...

SQL Server PDF Full-Text Search not working on FileStream PDF File -

i cannot full-text search work on pdf files loading sql db via filestream. version: sql server 2008 r2 (developer edition - doing proof of concept) os: windows 7 steps have taken. installed adobe ifilter made sure sql server full text daemon service running added environment path adobe pdf filter bin directory ran below scripts setup new ifilter , make sure active exec sp_fulltext_service @action='load_os_resources', @value=1; -- update os resources exec sp_fulltext_service 'verify_signature', 0 -- don't verify signatures exec sp_fulltext_service 'update_languages'; -- update language list exec sp_fulltext_service 'restart_all_fdhosts'; -- restart daemon exec sp_help_fulltext_system_components 'filter'; -- view active filters created full-text index on filestream table wanted index create fulltext index on local.file_repository (document type column file_extension) key index pk_file_repository on (filesearchcat, filegr...

xpath - How to change an XML element in a namespace with MSDeploy Parameters.xml file? -

i can't change element in web.config msdeploy. parameters.xml file: <parameterentry kind="xmlfile" scope="\\web.config$" match="//spring/objects/object[@id='cultureresolver']/@type" /> the relevant section of web.config : <spring> <objects xmlns="http://www.springframework.net"> <object id="cultureresolver" type="spring.globalization.resolvers.sessioncultureresolver, spring.web"> <!--configure server--> <property name="defaultculture" value="en" /> </object> </objects> </spring> the problem namespace declaration on <objects/> element. xpath query doesn't have match because there no <objects/> element empty namespace (which query looking for). now, specifying xml namespaces in xpath tricky issue (in case it's impossible), i...

ruby - Checking if a file exists in the user's home directory -

how i, say, determine if file ~/.my_proj_config exists on os in ruby? a call dir.home os independent way home directory user. can use like file.exists?(file.join(dir.home, ".my_proj_config"))

jQuery .append() in Firefox: vertical scrollbar appears? -

i want dynamically add number of divs target div in page .append(), set heights , positions they're visible in page without scrolling. all of goes ok, in firefox (3.6.16 on ubuntu) vertical scrollbar appears, though height of each new div being added total height of page content - though each new div near top of screen, , height isn't anywhere near length of screen. ubuntu chrome behaves fine. when ask jquery height of target div after appending new divs, hasn't changed. here's of page code test page wrote isolate problem - in advance! <style type="text/css"> #target { width: 50px; height: 50px; background-color: #cfc; } </style> <script> $(document).ready(function() { var cols = new array('#660', '#606', '#066', '#993', '#939', '#399', '#cc9', '#c9c', '#9cc', '#ffc',...

dictionary - Are there any APIs to draw custom maps in Android like Google Maps? -

i customize maps satellite view ,maps view. add custom view google maps. there no way supply custom map tiles google maps android. can create own map tiles web-based google maps , display via webview widget. or, can see if open street map , osmdroid can custom map tiles mapping engine.

http - How to deal with number of pageviews in RESTful calls? -

i'd have request returning "analytics" part of request: importantly, i'd every requests return number of times request has been called. is fundamentally incompatible restful concept? if it's not fundamentally incompatible, how can have restful server return different result each request seen that, definition of problem, every requests means next request must return different? if it's fundamentally impossible in restful way, should drop rest or drop altogether? p.s: first question on so apparently won't able comment unless hit 15 rep nice if commenters/answerers upvote me can part of community : ) there no incompatibility rest in principle here. should consider effect constantly-changing resource not benefit caching (assuming don't want visit count go stale). should consider number "eventually consistent"; is, represent count subset of requests if have lots executing in parallel. , should consider returning count in ...

Android: Sqlite rawQuery out of range -

i trying use rawquery simplecursoradapter display listview, keeps throwing me error 04-29 13:36:36.453: error/androidruntime(29539): java.lang.runtimeexception: unable start activity componentinfo{com.quotemachine/com.quotemachine.quote}: android.database.sqlite.sqliteexception: bind or column index out of range: handle 0x2f65e0 i have table called quotes columns _id, auth_name, quote, category , query looks follows return qmdb.rawquery("select _id _id, auth_name, quote, category quotes", new string[]{"where auth_name = 'robert anton wilson'"}); might know of suggestion fix problem?my original plan use basic query statement, there problem column _id , suggested go approach. your using rawquery() wrong. second variable arguments, not clause. use instead: return qmdb.rawquery("select _id _id, auth_name, quote, category quotes auth_name = ?", new string[] { "robert anton wilson" } );

java - convert int to string in android? -

i want store 1 110 in string array variable, when tried getting null pointer exception. string age[]; for(int i=0;i<=101;i++){ age[i]=integer.tostring(i); } you'll need initialize string-array first: string[] age = new string[110];

sql - How to look for changes in a table that keeps historical data? -

example: field_1 | date x | 2010-01-01 x | 2010-02-01 x | 2010-03-01 y | 2010-04-01 y | 2010-05-01 y | 2010-05-01 i select return following: (a change occurred in field_1) y | 2010-04-01 is there easy way this? writen mssql: declare @t table(field varchar(20), date date) insert @t values('x', '2010-01-01') insert @t values('x', '2010-01-02') insert @t values('x', '2010-01-03') insert @t values('y', '2010-01-04') insert @t values('y', '2010-01-05') insert @t values('y', '2010-01-06') select b.* @t join @t b on dateadd(day, 1, a.date) = b.date , a.field <> b.field result: field date -------------------- ---------- y 2010-01-04 it should work sybase if replace @t table , ignore test data

windows server 2003 - php notice Undefined index -

possible duplicate: php: “notice: undefined variable” , “notice: undefined index” i'm getting following php notices on web. i've check line mention in notice lines commented. further can check fix notice? php 5.0.4 (winnt) notice: [8] undefined index: http_referer line: 4 file: d:\ipplan\www\adodb\adodb.inc.php(1) : eval()'d code notice: [8] undefined index: http_referer line: 4 file: d:\ipplan\www\adodb\adodb-time.inc.php(1) : eval()'d code notice: [8] undefined index: http_referer line: 4 file: d:\ipplan\www\adodb\adodb-iterator.inc.php(1) : eval()'d code notice: [8] undefined index: http_referer line: 4 file: d:\ipplan\www\class.dbflib.php(1) : eval()'d code notice: [8] undefined index: http_referer line: 4 file: d:\ipplan\www\config.php(1) : eval()'d code you are, @ point, attempting access index http_referrer in array, no value ever set index. typically because you've got $_server['http_referrer'] in code. t...

c# - Why Does Binding to a Struct Not Work? -

i've encountered issue have observablecollection bound listview. people structure have written. long set value(s) of people objects prior binding, seems work ok. however, when try set values gui @ runtime, underlying objects not seem reflect change. i overcame problem changing people structure class. no other changes necessary. can please explain me why is? your binding gets copy of struct since structs passed value methods. if binding updates something; copy in memory somewhere being modified , hence original object of yours not updated.

integration - How to keep track of which rows have been imported in SQL? -

let's want import customers (or rows in other specific table) external system. not @ once every 1 after have been created in database. have keep record of rows have been reported because want find ones have not been reported yet. better add column or create kind of batchlog table? i'm using ms sql server if relevant a simplified example: select * customer reportedtoexternalsystem null or select * customer cus_id not in (select cus_id integrationbatchlog) or there maybe more ways that might better? first time don't know best practise yet. the simple solution add column marks row imported. status int (0/1) or if want keep track of when imported imported date. solution have limitations: you can import row once. need import customer again when record updated? going clear update field when customer updated? it causes row locked when update row status. sure application inserts customer record happy code locking records? on system causes entire row wr...

javascript - How to display or list the contents of the Mirth GlobalMap objects -

is there method/function available in mirth connect list or output contents of global map? both 'key' , value of key. following code print key value of global map variable in mirth each(key in globalmap.getvariables().keyset().toarray()) logger.info(key + ': ' + globalmap.get(key));

Input time + timezone with Rails -

i want ask specific time includes timezone field. possible? at moment i'm using retrieve time: <%= f.time_select :meeting_time %> <%= f.time_zone_select :timezone %> and try change timezone: meeting_time.in_time_zone(params[:meeting][:timezone]) but when user inputs time automatically set timezone on rails server(in case gmt). if user selects example gmt-1 decrease time 1 hour want increase times shown in gmt. example: the user inputs 18:00 gmt-1 , f.time_select put 18:00 utc. next, try convert gmt-1 in utc give me 17:00 gmt-1 instead of 19:00 gmt want. note: not want show times in gmt don't think can save in other format without changing server timezone i'm not sure if proper rails convention, it's workaround seems working fine me. if change local time utc before saving database, should save correct utc time regardless of server time zone. set time.zone current request time.zone = params[:meeting][:timezone] adjust u...

php - Syntax error, IDK where? -

<?php include("../package/mysql-connect.php"); //connect- succeeds //cleanin' data $username = trim(mysql_real_escape_string($_post['username'])); $password = hash('sha512', $passround); $fname = ucfirst(trim(mysql_real_escape_string($_post['fname']))); $lname = ucfirst(trim(mysql_real_escape_string($_post['lname']))); $gender = mysql_real_escape_string($_post['gender']); $email = mysql_real_escape_string($_post['email']); $bio = mysql_real_escape_string($_post['bio']); $interests = str_replace(',',':',mysql_real_escape_string($_post['interests'])); //the query - error here think o. o mysql_query("insert `kapip_data`.`userdata` (`id`, `username`, `password`, `fname`, `lname`, `gender`, `hidden`, `hide-gender`, `hide-name`, `bio`, `interests`, `email`) values (null, $username, $password, $fname, $lname, $gender, '0', '0' , '0', $bio, ...

scala - Getting a 302 http redirect location with Databinder-Dispatch -

with databinder-dispatch 0.8.3 i'm trying redirect url 302 http response, following exception: caused by: dispatch.statuscode: unexpected response code: 302 here's i've attempted, some help : import dispatch._ import org.apache.http.{httprequest,httpresponse} import org.apache.http.protocol.httpcontext import org.apache.http.httpstatus._ val http = new http { override def make_client = { val client = new configuredhttpclient(new http.currentcredentials(none)) client.setredirectstrategy(new org.apache.http.impl.client.defaultredirectstrategy { override def isredirected(req: httprequest, res: httpresponse, ctx: httpcontext) = false }) client } } val req: request = :/("graph.facebook.com") / "kmels" / "picture" val pictureurl: string = http(req.secure >:> { _("location").head }) //error prone code, we're testing. line exception thrown. what missing? always, in advance. ...

sed - How many commands can you concatenate in a bash pipe? -

i have parse file many regular expressions. concatenation of sed 'replace' commands. question how many sed commands, @ maximum, can concatenate in bash pipe? as far know, there no limit on number of pipes, commands executed 1 after other. limit quantity of data passed in through pipe, or "pipe buffer limit." see here more details: https://unix.stackexchange.com/questions/11946/how-big-is-the-pipe-buffer

c# - Custom Properties in Linq Generated Tables -

it makes more sense use integer in database, want pretend it's been string (and not string corresponding int) because it's simpler. the reason behind user-facing view encrypted version of string, never want see int unless working directly database (the int identity column). so, have linq mapping want replace. basically, wish replace (which in designer) [global::system.data.linq.mapping.columnattribute] //... public int tid { { return this._tid; } set { if ((this._tid != value)) { this.ontidchanging(value); this.sendpropertychanging(); this._tid = value; this.sendpropertychanged("tid"); this.ontidchanged(); } } } with this [global::system.data.linq.mapping.columnattribute] //... public string tid { { return convert.tostring(this._tid + 5); } set { if ((this._tid - 5 != int32.parse(value))) { ...

facebook - Tag friends in uploaded image -

i have code upload image , and tags users in wall $facebook->setfileuploadsupport(true); $args = array('message' => 'by http://www.lookmywebpage.com/api'); copy('http://demo.lookmywebpage.com/facebook-upload-photos/penguin.png', 'tmp/file.jpeg'); $args['image'] = '@' . realpath('tmp/file.jpeg'); $data = $facebook->api('/me/photos', 'post', $args); unlink('tmp/file.jpeg'); //assigning users tag , cordinates $argstag = array('to' => $user); $argstag['x'] = 40; $argstag['y'] = 40; $datatag = $facebook->api('/' . $data['id'] . '/tags', 'post', $argstag); echo 'success! check facebook wall now'; but need tag 20 friends on ..some 1 me please very...

javascript - Is it possible to change form data before sending it? -

i'd find generic method change data before sending forms. is, if have <form> contains <input> of type (class) , user press send button, i'd transform input value format arrive server in corrected format. i know can set submit() handler process data, need generic solution setup mechanism on load on page forms , forgets (perhaps forms sent ajax, other use jquery.validate send, etc) use jquery's select form elements: $('form') , register handler form submit event. this: $('form').submit(function(e){ e.preventdefault() var $this = $(this) var formdata = $this.serialize() // thing var yourdata = transform(formdata) $.ajax({ post: $this.attr('action'), data: yourdata, ... }) }) references submit() jquery css selector form serialize()

jQuery each() results to array to php to database -

basically doing making sort of invitation system, user clicks on users , go list, works, can ids of them using each() need pass through jquery ajax php send database notifications. have: $(".group-video-create").click(function(){ var url = $(".group-input-url").val(); var exp = /(\b(https?|ftp|file):\/\/[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|])/ig; var checked_url = url.match(exp,"<a href='$1'>$1</a>"); if(checked_url) { $("#group-input-names li").each(function(){ // relevant code var user_id = $(this).attr("id"); // here }); // & here if(user_id) { $.ajax({ type: "post", //url: "", //data: "", //this array of of ids, (could 1, 100). ca...

jquery Carousel problem -

i have script found here http://jsfiddle.net/g4txt/ using carousel http://www.thomaslanciaux.pro/jquery/jquery_carousel.htm the problem won't show images. the script running, in way scrolling through images wont show them all try adding , deleting li 's , notice problem any idea? thanks a couple things: first: img tags need closed. second: $(function(){ ... } same $(document).ready(function(){ ... } , therefore redundant. third: if float li's left, you'll set. cheers

how to fetch android phone conatacts of a persion like home phone numer, work phone number, home email, work email and put it in the edittext? -

the following code, showing persons phone number type radio button selection,but not showing emails, need select email also` public void getcontacts() { log.i(classtag, "contactsbutton on click"); intent intent = new intent(intent.action_get_content); intent.settype(contactscontract.commondatakinds.phone.content_item_type); startactivityforresult(intent, 1); // log.i(classtag, "contactintent:"+contactpickerintent); } protected void onactivityresult(int requestcode, int resultcode, intent data) { if (data != null) { uri uri = data.getdata(); if (uri != null) { cursor c = null; cursor e=null; try { c = getcontentresolver().query(uri, new string[]{ contactscontract.commondatakinds.phone.number, ...

c - Segmentation fault and I don't know what's causing it -

main.c:132:26: warning: "/*" within comment main.c: in function ‘importsettings’: main.c:152: warning: control reaches end of non-void function main.c: in function ‘cs_init_missions’: main.c:84: warning: control reaches end of non-void function j@jonux:~/projects/csgtk/c$ ./a.out segmentation fault j@jonux:~/projects/csgtk/c$ this output compile -wall , running program. not ideal. the error seems involve code below. static xmldocptr importsettings(char file[], gtkbuilder *builder) { cur = cur->xmlchildrennode; while (cur != null) { if(xmlstrequal(cur->name, (const xmlchar *) "options")) { cur = cur->xmlchildrennode; while (cur != null) { cur = cur->next; } } cur = cur->next;// <- segfault here } } it seems obvious outer loop attempting set cur cur->next when cur == null causing segfault. possible reconstruct loop avoid this? (i thought of do...

objective c - iPad development: Circular and Linear Gauges -

Image
i have created desktop (winforms) , web based (asp.net) dashboard application uses dundas circular , linear gauges. e.g. i need recreate these gauges using xcode ui , objective c (or can imported view based project) are there frameworks available can create these types of gauges? had @ core plot, doesn't have type of functionality. they not difficult seem. need graphic assets distinguish static vs animatable graphics assets. the animation can done using core animation. let's have first gadget (though quartz2d more performant - start make using simple uiviews). the first gadget has needle animates (or rotates based on given value). rest of image can simple uiimageview. do like: needleview.layer.anchorpoint = bottom_right_point;//to not rotate @ center bottom right or whatever ... [uiview beginanimations:nil context:null]; [uiview setanimationduration:1.0]; cgaffinetransform transform = cgaffinetransformmakerotation(angle_in_radians); needleview.trans...

php - How to convert text to SVG paths? -

i have font in ttf file , want generate svg text turned paths. don't need image (so using imagettftext or image magick font rendering capabilities not enough), need shape, can scaled , down , want lose information font used , don't want reference in svg file (so font-face declarations can't used here). possible? i have created own class process svg font file , turn text glyphs. example of using: include "svgfont.php"; $svgfont = new svgfont(); $svgfont->load("/path/to/font.svg"); $result = $svgfont->texttopaths("simple text", 20); example result: <g transform="scale(0.009765625) translate(0, 0)"><path transform="translate(0,0) rotate(180) scale(-1, 1)" d="m92 471l183 16q13 -110 60.5 -180.5t147.5 -114t225 -43.5q111 0 196 33t126.5 90.5t41.5 125.5q0 69 -40 120.5t-132 86.5q-59 23 -261 71.5t-283 91.5q-105 55 -156.5 136.5t-51.5 182.5q0 111 63 207.5t184 146.5t269 50q163 0 287.5 -52.5t191.5 -15...

PHP: Avoid undefined index? -

every time post value not equal list of values set in array return: undefined index error, made if statement not working. here's if statement: if ($products[$_post['product']] == $_post['product']) { everything;} else { echo "this item not available"; } edit2: seen current situation avoiding warning wont because i'm dealing several factors, example list of items in shopping cart, if invalid product not removed, added shopping list session. this full script: <?php session_start(); //getting list $_session['list'] = isset($_session['list']) ? $_session['list'] : array(); //stock $products = array( 'pineaple' => 500, 'banana' => 50, 'mango' => 150, 'milk' => 500, 'coffe' => 1200, 'butter' => 300, 'bread' => 450, 'juice' => 780, 'peanuts' => 800, 'yogurt...

automata in ocaml -

i bit new ocaml. want implement product construction algorithm automata in ocaml. confused how represent automata in ocaml. can me? a clean representation finite deterministic automaton be: type ('state,'letter) automaton = { initial : 'state ; final : 'state -> bool ; transition : 'letter -> 'state -> 'state ; } for instance, automaton determines whether word contains odd number of 'a' represented such: let odd = { initial = `even ; final = (function `odd -> true | _ -> false) ; transition = (function | 'a' -> (function `even -> `odd | `odd -> `even) | _ -> (fun state -> state)) } another example automation accepts onlythe string "bbb" (yes, these taken this online handout ) : let bbb = { initial = `b0 ; final = (function `b3 -> true | _ -> false) ; transition = (function | 'b' -> (function `b0 -> `b1 | `b...

javascript - Google Chart tools Visualizations - Implementing more than one on a page -

i'm trying use google chart tools visualize data on site. thing is, can't more 1 load... you can find docs here: http://code.google.com/apis/visualization/documentation/using_overview.html#load_your_libraries and here code far: <script type='text/javascript' src='https://www.google.com/jsapi'></script> <script type='text/javascript'> google.load('visualization', '1', {'packages':['annotatedtimeline']}); google.setonloadcallback(drawall); function drawall() { drawsales(); drawregistration(); } function drawsales() { // sales graph var data = new google.visualization.datatable(); data.addcolumn('date', 'date'); data.addcolumn('number', 'sales'); data.addrows([ [new date(2011, 04 ,30), 401.34], [new date(2011, 04 ,22), 180.00], [new date(2011, 04 ,18), 180.00] ]); var chart = ...

java - How to automatically call onClick for a Button when application is opened? -

public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); button b1 = (button) findviewbyid(r.id.button1); b1.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { loadfeed(statutory); } }); } i want app automatically call onclick button b1 when open application. how can make app automatically call onclick when app opened? looking modification existing code accomplish this. if got right, , need genereate click event on activity start, add b1.performclick(); after setting listener. yet don't understand why can't call loadfeed(statutory); directly

find - Batch to filter out duplicates in separate directories -

i have 2 folders 2 different locations bunch of automatically generated (generated through install , repair/ reset) files in them. occasionally happens file of particular name , extension found in both folders causes errors in associated program, solution delete 1 of 2 1 remains. i use batch @ work novice xcopy , on commands, how if can achieve desired result? the op wrote: never mind fixed it: for /r c:\1\ %%f in (*) if exist "c:\2\%%~nxf" del /s /q "c:\1\%%~nxf

authentication - Facebook decoded signed_request contains extra data which isn't mentioned in the documentation -

i have facebook signed_request received subscribing auth.login event , after user logs in using facebook login button after decode signed_request have following information in it: {'issued_at': 1318492701, 'code': 'aqcxi5aiyytylfntkyhtkwdho02lp[truncated]', 'user_id': '100000xxxxxxxxx', 'algorithm': 'hmac-sha256'} i cannot find in signed_request documentation . code , what's use? i thought might used obtain authorization code stated in this thread along signed_request receive access token user in response login event. this signed_request javascript sdk, right? code used sdk isn't server-side authentication. actually, update documentation reflect signed_request behaviors.

php - How can I capture the address that user was going to so I can redirect them after login? -

i'm directing users page on site email (possibly email client). when reach site presented login screen , address headed lost. how can capture entire address trying visit, can redirect them once log in? you need capture address redirect them login page, (ie when check if logged in) i'd recommend storing in session. quick method redirect /login.php?from=store.php example, not best way $_get['from'] hijacked redirect user somewhere else, why use $_session store value.

ajax - How to load plain text in to div from another page -

i'm trying load content page div page div. what i've got: jquery: $('#news_date-1').load('test.php .news_date-1'); test.php <div class="news_date-1">20-11-2009</div> destination.html <div id="news_date-1"></div> the result = <div id="news_date-1"><div class="news_date-1">20-11-2009</div></div> the result want = <div id="news_date-1">20-11-2009</div> can out? you can try calling unwrap() on in callback. $('#news_date-1').load('test.php .news_date-1', function () { $(this) //will refer #news_date-1 .find('.news_date-1') //find inserted div inside .contents() //find contents .unwrap(); //unwrap contents, removing unneeded div }); this not beautiful solution, because .load() inserts dom, , tamper dom again, should minimized. another way see using $.get() instea...

c# - upload file with ftp? -

how can upload files server ftp though code? web host apperently dont allow ous use "regular" fileupload in mvc or web forms anymore on iis7 i rather not use third part app use asp.net mvc 2, c# there various methods simplist in opinion make use of ftpwebrequest class. there nice example of simple file upload, making use of it, here: http://msdn.microsoft.com/en-us/library/ms229715.aspx

windows - Catch an error inside a batch file (7-zip) -

Image
i have batch file in execute following line list contents of archive: "\program files\7-zip\7z.exe" l "\backup google docs.7z" the archive intentionally corrupted. cmd.exe displays this: how can catch error in code? any program's exit code stored in %errorlevel% variable in batch script. from 7-zip manual: 7-zip returns following exit codes: code meaning 0 no error 1 warning (non fatal error(s)). example, 1 or more files locked other application, not compressed. 2 fatal error 7 command line error 8 not enough memory operation 255 user stopped process so: can do: "\program files\7-zip\7z.exe" l "\backup google docs.7z" if errorlevel 255 goto:user_stopped_the_process if errorlevel 8 goto:not_enough_memory if errorlevel 7 goto:command_line_error if errorlevel 2 goto:fatal_error if errorlevel 1 goto:ok_warnings caution, if errorlevel n checks %errorlevel% greater or equal n, therefore should put them in...

jQuery find link that matches current page -

i have following code trying find link matches current url: $item = $('ul#ui-ajax-tabs li a').attr('href', $(location).attr('pathname')); instead changes links current url :p can me fix it. cheers use query. code changes href attributes of selected links, rather returning selection of links matching href attribute: $("a[href*='" + location.pathname + "']") the [href*=..] selector returns list of elements href attribute contains current pathname. another method, return elements href contains current pathname. prop() used instead of attr() , relative urls correctly interpreted. $item = $('ul#ui-ajax-tabs li a').filter(function(){ return $(this).prop('href').indexof(location.pathname) != -1; });

php - MySQL: Query to Search All possible words -

i have form input box user can specify names, names can 2 or more words eg john smith or john michael smith . i need write query return records including words in submitted name. query return records has name words can have different order. for example, if search string john michael smith , query should able return records names such john smith michael , michael smith john , smith john michael or other combination words there. can seen return records still has words in name field can have different order. should not return results not contain name part example john michael should not returned since missing smith . i can't figure out how write query such requirement have. please help. update the answers provided far return records match john michael also. tried answers of @marco , @abesto , @eddie . the problem still persists :( you try fulltext search: select * table match (name) against ('+part1 +part2 +part3' in boolean mode); in soluti...

security - Suspect malicious probing in my asp.net ecommerce app -

i receiving repeated errors asp.net ecommerce web app. beginning suspect automated malicious probe twelfth attempt access productid=69 not exist (productid 69 removed month ago ). have not found info via google , hope recognizes this. here log entry. page location: /product.aspx?productid=69 message: violation of primary key constraint 'pk_shoppingcart'. cannot insert duplicate key in object 'dbo.shoppingcart'. statement has been terminated. source: .net sqlclient data provider method: void onerror(system.data.sqlclient.sqlexception, boolean) stack trace: at system.data.sqlclient.sqlconnection.onerror(sqlexception exception, boolean breakconnection) @ system.data.sqlclient.sqlinternalconnection.onerror(sqlexception exception, boolean breakconnection) @ system.data.sqlclient.tdsparser.throwexceptionandwarning(tdsparserstateobject stateobj) @ system.data.sqlclient.tdsparser.run(runbehavior runbehavior, s...

Ruby on Rails - get MySql DB size -

i want know current size of mysql db, data use following methods: def self.calculate_total_db_size sql = "select table_schema 'database', sum( data_length + index_length ) / ( 1024 *1024 ) size information_schema.tables engine=('myisam' || 'innodb' ) , table_schema = '#{get_current_db_name}'" return perform_sql_query(sql) end def self.get_current_db_name return rails.configuration.database_configuration[rails.env]["database"] end def self.perform_sql_query(query) result = [] mysql_res = activerecord::base.connection.execute(query) mysql_res.each_hash{ |res| result << res } return result end this works great in development , staging environment, reason when run in production query doesnt return value, if take mysql query , run manually on production db correct values. why cant through application in producti...

linux - stream out put to text file php centos -

i have follwoing code <?php $handle = popen('rate -c 192.168.122.0/24 2>&1', 'r'); echo "$handle'; " . gettype($handle) . "\n"; $read = fread($handle, 2096); echo $read; pclose($handle); ?> i want out put of rate command text file third party tool bandwith of when run code got follwing error 'resource id #2'; resource sh: rate: command not found but when type rate command on terminal can see out put any ideas? thank in advance php can't find rate program. path envorinment variable not contain folder rate resides. set path environment variable putenv or give full path in call.

c++ - QList children - struct or custom classes derived from QObject? -

i'm working on qt application on symbian platform. application has sqlite database , initial data populated txt files. i'm implementing online update data comes in json format. create generic functions in db update class takes qlist of classes/structs , updated db them. qlist populated objects either txt, or json. i have parsing in place, considering better in terms performance: creating c++ structs , passing them (as objects hold simple data) wrapped in qlist creating custom classes derived qobject , passing them pointers in qlist , deleting qdeleteall any other way... that depends on whether classes carrying behaviour or state. they carry behaviour. then, polymorphic class in order, yes. whether needs inherit qobject question. inherit qobject only if need services (introspection, signals/slots, event handling). otherwise, don't. as qdeleteall() : wouldn't go there. instead of naked pointers, use smart pointers, e.g. qsharedpoi...

java - Transforming code to multithread version -

i have following problem: for example, have 10 lists, each 1 has link other lists, create code search elements in theses lists, i've done algorithm sequentially, start search in first list, if search failed, send messages searching in lists have link (to first one), @ end of algorithm, show results number of lists visited , if find element or no. now, want transform parallel algorithm, @ least concurrent 1 using multi-threads: to use threads searching; to start search in 10 lists @ same time; as long don't change anything, can consider search read only. in case, don't need synchronization. if want have fast search, don't use threads directly use runnables , appropriate classes. if work directly threads, make sure don't exceed number of processors. before going further, read multi-threading. mention "java concurrency in practice" (rather safe) recommendation. it's easy wrong.

ios - Connect an iPhone to Arduino over Bluetooth -

Image
i love able let iphone-app communicate arduino on bluetooth. found bluetooth shields support following protocols: bcsp, dun, lan, gap sdp, rfcomm, , l2cap. found while googling bit, iphone hiding it's bluetooth stack away?!? correct? there no chance let iphone communicate other bluetooth enabled device without jailbreaking (which far know required if i'd use btstack: http://code.google.com/p/btstack/ )? if bluetooth not possible, other ways (expect wlan) suggest realize communication? love realize here: http://theiopage.blogspot.com/2011/08/yanis-android-wireless-eos-controller.html thanks tips! there several connection technologies available. as others have mentioned, standard bluetooth (3.0) controlled mfi program. way connect non-jailbroke iphone join mfi program. serial access interesting. have join mfi distribute serial device, can use redpark serial cable connect own iphone serial device. there several ways connect bluetooth le devices arduino. 1...

iphone - Storing/Extracting Objects to/from NSDictionary -

i getting errors using nsdictionary when trying assign it's contents new variables/objects. maybe isn't posible? thought be. i'm not sure if can use non-objective c specific objects in dictionary. can you? nsdictionary *preprocessresult = [[nsdictionary alloc] initwithdictionary: [self preprocessing:testimage]]; iplimage* resultimage = [preprocessresult objectforkey:@"resultimage"]; int numchars = [preprocessresult objectforkey:@"numberchars"]; [preprocessresult release]; and here method calling create dictionary: - (nsdictionary*) preprocessing: (iplimage*) testimage { //do stuff image nsdictionary *testimage_andnumchars = [nsdictionary dictionarywithobjectsandkeys:resultimage, @"resultimage", numchars, @"numberchars", nil]; return testimage_andnumchars; } is not correct way handle this? error when create dictionary is: "cannot convert 'iplimage*' 'objc_object*' in argument passing" and w...

php - How to convert template from table to div -

i have tried in weeks convert template: <!doctype html public "-//w3c//dtd html 4.0 transitional//en" "http://www.w3.org/tr/rec-html40/loose.dtd"> <html> <head> <?php echo head();?> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> </head> <body leftmargin="10" topmargin="10" marginwidth="10" marginheight="10" class="background"<?php echo onload();?>> <a name="top"></a> <table border="0" align="center" cellpadding="7" cellspacing="0" bgcolor="#ffffff"> <tr> <td><table class="main" align="center" width="755" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="header"colspan="2"><div class="siteti...