Posts

Showing posts from March, 2012

javascript - Event Propagation and Multiple Event Handlers -

okay, i'm confused. i've got global click event handler on document . on page have few links. each link handled same click event handler that, among other things, prevents event bubbling document level , prevents link executing. of these links, 1 has specific click handler supposed thing , pass off event generic click event links. it's not. document.onclick = function() { document.body.innerhtml += "you clicked me!"; }; document.getelementsbytagname("a")[0].onclick = function(e) { this.innerhtml += " click it!"; e.stoppropagation(); //this return false appears //prevent link default action return false; }; document.getelementbyid("link").onclick = function(e) { this.innerhtml += " go ahead, "; //but return false appears stop //the propagation previous event //i think removing link below //would cause event propagate event //above stop propagation , //prevent default, apparent...

xslt - Concatenate duplicate elements information based on multiple elements using XSL -

i not bright in xsl. have xml below: <?xml version="1.0" ?> <accountitem> <entry_date>2011-06-24t00:00:00-05:00</entry_date> <contract>4570000010</contract> <account>0</account> <general_desc>systematic withdrawal</general_desc> <net>1108.3700</net> <gross>1108.3700</gross> <person_name>whitey house</person_name> <last_name>house</last_name> <agent_name>brown, jack</agent_name> <legal_verb>n</legal_verb> <payeename>none</payeename> <closed_flag>0</closed_flag> </accountitem> <accountitem> <entry_date>2011-06-24t00:00:00-05:00</entry_date> <contract>4570000010</contract> <account>0</account> <general_desc>syste...

swing - change popup height -

i have java swing popupmenu couple of menuitems. is there way increase size of popup keeping same number of menuitems? example, add 10px before 1st menuitem , 10px after last menuitem. how can this? can give me hint? thanks this pretty simple. since jpopupmenu container following code produce effect desire jpanel p1 = new jpanel(); p1.setpreferredsize( new dimension(100,10)); jpanel p2 = new jpanel(); p2.setpreferredsize( new dimension(100,10)); menu.add(p1); menu.add(new jmenuitem("item 1")); menu.add(new jmenuitem("item 2")); menu.add(new jmenuitem("item 3")); menu.add(p2);

iphone - Table View Crashing When Accessing Array of Dicitonarys -

all, when table view loads, accesses several delegate methods. when configure cell, have calling method (where "linkedlist" array of dictionarys): - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } // configure cell... vuwimanager *vuwimanager = [vuwimanager sharedvuwimanager]; nslog(@"%@", [[vuwimanager linkedlist]objectatindex:indexpath.row]); nslog(@"testzomgofdsojfdsjfpodjsapfds"); cell.textlabel.text = [[vuwimanager linkedlist]objectatindex:indexpath.row]; return cell; } it crashes @ line cell.textlabel.text = [[vuwimanager linkedlist]objectatindex:indexpath.row]; - know i...

Javascript Split Array -

i trying write custom string splitting function, , harder have expected. basically, pass in string , array of values string split on, , return array of substrings, removing empty ones , including values splits on. if string can split @ same place 2 different values, longer 1 has precedence. that is, split("go ye away, want peace && quiet. & thanks.", ["go ", ",", "&&", "&", "."]); should return ["go ", "ye away", ",", " want peace ", "&&", " quiet", ".", " ", "&", " thanks", "."] can think of reasonably simple algorithm this? if there built-in way in javascript (i don't think there is), nicer. something this ? function mysplit(input, delimiters) { // sort delimiters array length avoid ambiguity delimiters.sort(function(a, b) { if (a.leng...

Php sqlite command line access -

is there anyway access sqlite packaged php via command line? from command-line, without using php executable execute php script, won't use sqlite extension that's bundled php. sqlite databases created php standard sqlite databases (which stored in file) , they can opened , manipulated existing sqlite client . example, linux shell, can use : $ sqlite3 -header -column /home/squale/.../db/krypton-lite-scores.db sqlite version 3.7.4 enter ".help" instructions enter sql statements terminated ";" sqlite> select * highscores; id name score latitude longitude timestamp ---------- ---------- ---------- ---------- ---------- ---------- 1 squale 20 45.7686 4.8128 1310533429 2 squale 63 45.7682 4.8131 1310579495 3 squale 42 45.7686 4.8127 1310586793 sqlite> and allows me work sqlite database -- manipulated php ...

android admob button -

can't figure 1 out. have 5 buttons , 5th want display admob advertisement not work. i'm close! assistance appreciated. below activity.java , main.xml package com.companyname.sandbox; import android.app.activity; import android.content.intent; import android.net.uri; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import com.google.ads.*; public class sandboxactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); //--> create adview adview adview = new adview(this, adsize.banner, "a14e27391701ceb"); // lookup linearlayout assuming it’s been given // attribute android:id="@+id/mainlayout" button btn5 = (button)findviewbyid(r.id.btn_button05); // add adview btn5.addview(adview); // initiate g...

Maven: Multiple plugins invoking multiple lifecycles -

i've been using maven quite time (years), it's surprising me i've never come across issue before, or @ least have way of dealing it... i trying invoke following plugin/goals (in specified order): sql-maven-plugin:execute hibernate3:hbm2ddl dbunit:operation jetty:run in nutshell, i'm creating database, generating schema, inserting data, , starting webapp. however, both hbm2ddl , jetty:run goals invoke (fork) lifecycle phases of own, causes of other bound plugin goals run multuple times. this not want. there way workaround issue? thanks!! i've found few stack overflow issues related (jetty:run goal in particular), related bugs: maven-jetty-plugin question http://jira.codehaus.org/browse/jetty-1365 https://bugs.eclipse.org/bugs/show_bug.cgi?id=342643

python - argument of type 'NoneType' is not iterable -

i trying open directory contains series of xml's in 1 specific directory. in following code, iterating through each xml document, , i'm setting "if statements" read text in xml, find keywords , replace them , write new file new location. getting following error when run script: traceback info: file "z:\esri\python\test scripts\elementtree6.py", line 62, in <module> if "%begdate%" in element.text: ... error info: argument of type 'nonetype' not iterable i have hard coded directory 1 specific xml , when run through if statements, work fine. it's when try set iterate through series of xml's run error. searched through site see if final solution, issues either different mine or not quite understanding work-around. i have used number of print lines test outputs. works fine until if statement , error arises. # location of xml's folderpath = r"z:\data" # set variable store files exten...

Parsing of json array with jquery -

i have json array var a_values = new array(); a_values["af:all"] = new array('kbl:kabul','us:new york'); a_values["al:all"] = new array('tia:tirana'); how can find , whether given string in a_values, using jquery for example, need check whether 'kabul' there , in a_values i think you'd little better: var abbreviations = new array(); abbreviations['af'] = new array(); abbreviations['af']['kbl'] = 'kabul'; abbreviations['af']['us'] = 'new york'; abbreviations['al'] = new array(); abbreviations['al']['tia'] = 'tirana'; then there 2 ways of checking existence of string. 1 be: json.stringify(abbreviations).indexof('kabul') >= 0 and loop through array loop, looking @ each value.

python - Change number of items per page or view all in a view using a paginator in django -

i using django 1.3 , have view takes paginated queryset (set use 50 objects). here relevant part of get_context_data() method in view: #build paginator querysets paginated_scanned_assets = paginator(scanned_assets_qs, 50) #get specified page try: page_num = int(self.request.get.get('page', '1')) except valueerror: page_num = 1 #get paginated list of object try: scanned_assets = paginated_scanned_assets.page(page_num) except (emptypage, invalidpage): scanned_assets = paginated_scanned_assets.page(paginated_scanned_assets.num_pages) the template renders builds table queryset , has links go next , previous pages. what want either have link view all, display queryset unpaginated, or option modify number of objects per page (which recreate paginator). haven't worked views or design though not sure how this. can js, , if how? otherwise can django , html? might simple, pretty inexperienced , haven...

android - How to get field value instead of column name? -

i want fill list data cursor way: mycursor = mydba.getallcompanies(); startmanagingcursor(mycursor); mylistadapter = new simplecursoradapter(this, r.layout.company_row, mycursor, from, to); mylistadapter.setviewbinder(view_binder); companieslistview.setadapter(mylistadapter); i use custom viewbinder fill 2 textviews , 1 imageview in each row: private final viewbinder view_binder = new viewbinder() { /** * binds cursor column defined specified index * specified view. */ @override public boolean setviewvalue(view view, cursor cursor, int columnindex) { int viewid = view.getid(); switch (viewid) { case r.id.company_name: case r.id.company_desc: log.d(tag, "binding textview"); textview venuetext = (textview) view; venuetext.settext(cursor.getstring(columnindex)); return true; case r.id.company_icon: log.d(tag, ...

c - memory allocation in Stack and Heap -

this may seem basic question, been in head so: when allocate local variable, goes stack. dynamic allocation cause variable go on heap. now, question is, variable lie on stack or heap or reference in stack , heap. for example, suppose declare variable int i . i allocated on stack. so, when print address of i , 1 of location on stack? same question heap well. i'm not entirely sure you're asking, i'll try best answer. the following declares variable i on stack: int i; when ask address using &i actual location on stack. when allocate dynamically using malloc , there two pieces of data being stored. dynamic memory allocated on heap, , pointer allocated on stack. in code: int* j = malloc(sizeof(int)); this allocating space on heap integer. it's allocating space on stack pointer ( j ). variable j 's value set address returned malloc .

eclipse - C++ pass enum to object constructor -

say have following: foo::foo() { value = 25; //default constructor... } foo::foo(enum bar) { value = (int)bar; //purpose allow integer take enum constant's integer value. } from... enum enum { = 25, b = 50, } class foo { public: foo(); foo(enum bar); private: int value; } yet, if following: enum bar = a; //a = 25 foo * foo = new foo(a); //error: "undefined reference foo::foo(enum)" this in eclipse cdt 3.6. why happening? there can solve problem? it sounds forgot link foo.c final application.

PHP date is one day ahead? -

when write <?php echo date('d'); ?> day 1 day ahead? i've checked , doesn't echo on other websites on same database try setting timezone 1 of these values . for example, try @ start of script (with appropriate timezone, of course): <?php date_default_timezone_set('pacific/auckland'); ?>

c# - Protobuf.NET using -

need send data between managed c# , unmanaged c++. after research tried use protobuf.net. i'm not sure if understand functionality of protobuf... build type definition in proto. need type definition in both projects c++ , c# use command-line tool "protogen.exe" .cs file , .cpp, .h type definition copy .cs files c# project , .cpp, .h in c++ solution. seems i'm stupid to solve this. here problem , questions. is possible define type in c# generate files in c++ ? tried use command-line tool protogen.exe following files test1.proto using protobuf; namespace protocolbuffers { [protocontract] class person { [protomember(1)] public int id {get;set;} [protomember(2)] public string name { get; set; } } } test2.proto message person { required int32 id = 1; required string name = 2; optional string email = 3; } nothing working me. tried everything. put proto files commandline dir, tried eve...

How to code CakePHP components when used in Tasks? -

i have component code i'd in cakephp task, i'm not sure i'm bootstrapping controller in right way. as simplified version, have 2 components operate fine when accessed via extended appcontroller. 1 component includes other, because calls other. the first component: class bigbrothercomponent extends object { var $controller = null; var $components = array('sibling'); function startup(&$controller) { $this->controller =& $controller; } function dothis() { $this->controller->loadmodel('samplemodel'); $this->sibling->dothat(); } } the second component: class siblingcomponent extends object { var $controller = null; function startup(&$controller) { $this->controller =& $controller; } function dothat() { /* doing stuff */ } } to make operate command line, define shell , task. task, though i'm not sure i'm doing right...

javascript - Need help to resolve modal popup issue? -

i implementing modal popup application. doing modal popup login form. took plugin "http://deseloper.org/read/2009/10/jquery-simple-modal-window". take entire login form popup, want div's in form. how this? i suggest @ jquery ui modal. there can load parts of current page, parts of page , show fragments @ using usual selectors

javascript - jQuery Form Plugin: ajaxForm() not working with file upload -

here's issue i'm having .ajaxform() method of jquery form plugin . keep things understandable possible, i've included of salient info in comments snippets below. tested in both chrome , firefox, , form_2 post server once select file upload. problem deal_upload_image_file input not being included post, server not receiving file. html: <!-- form_1: big form, need position file input field in here, --> <!-- don't want submit file form --> <form id="edit_deal_form"> <div id="upload_image_div"> <!-- javascript appends "deal_upload_image_file" input here, --> <!-- appends form_2 when file selected --> </div> </form> <!-- form_2: second form not visible user , --> <!-- post of multipart data --> <form id="deal_upload_image_form" name="upload_image_form" method="post" enctype=...

email - Android Intent.EXTRA_STREAM Question -

- the description of intent.extra_stream says: a content: uri holding stream of data associated intent, used action_send supply data being sent. - my question is: can use extra_stream action_sendto send attachment sms ? if can't, there way send attachment sms ? yes, used email may use sms, although not file types supported. i'm pretty sure run trouble when trying attach streams aren't images. there lot of complaints , have yet accomplish this, (in sms)

delphi - Not getting path of various System Processes by getModuleFileNameEx -

i have created function path of various network processes , svchost, firefox etc. here code: function getprocesspath(var pid:integer):string; var handle: thandle; begin result := ''; try handle := openprocess(process_query_information or process_vm_read, false, pid); if handle <> 0 begin try setlength(result, max_path); if getmodulefilenameex(handle, 0, pchar(result), max_path) > 0 setlength(result, strlen(pchar(result))) else result := ''; closehandle(handle); end; end; except on e:exception showmessage(e.classname+':'+e.message); end; end; my problem not path of processes. works fine getting path of firefox, , other similiar user level processes. processes alg, svchost, cannot path method. guess must use diff. api. please me in regard. thanks in advance you need set debug privilege...

c# - Shared AssemblyInfo for uniform versioning across the solution -

i've read technique: http://blogs.msdn.com/b/jjameson/archive/2009/04/03/shared-assembly-info-in-visual-studio-projects.aspx basically means create sharedassemblyinfo.cs versioning information assembly, , adding file link projects of solution, actual file resides in 1 location on disk. my question deals 2 scenarios: existing solution doesn't use mechanism: there way add shareassemblyinfo projects? (lets have solution 50 projects). when creating new project, default new assemblyinfo.cs created. i'd link automatically sharedassemblyinfo well. is there solution this? common practice? first point solved simple text editor handle several files @ once , find/replace. open of csproj in , replace string <compile include="properties\assemblyinfo.cs" /> with <compile include="..\sharedassemblyinfo.cs"> <link>properties\sharedassemblyinfo.cs</link> </compile> my editor of choice editpad pro . alternati...

python - Use openpyxl to edit a Excel2007 file (.xlsx) without changing its own styles? -

i have .xlsx file edit, found openpyxl manipulate excel 2007 files. want change value in cells , leave other settings unchanged. but after went through documentation , cannot find examples edit existing file. demostrated reading .xlsx file , writing new one. i tried below way edit existing file, after saved it, styles in file has been removed( fonts, colors): from openpyxl.reader.excel import load_workbook wb=load_workbook(r'd:\foo1.xlsx') ws=wb.get_sheet_by_name('bar') ws.cell('a1').value= 'new_value' # save workbook new file finish editing # style settings has been removed (such font, color) in new file wb.save(r'd:\foo2.xlsx') now openpyxl cannot handle styles enough, tried using pywin32 com , got solution. here python-excel-mini-cookbook use pywin32 com excel

javascript - php mysql and pagination -

i have problem displaying data mysql database. client requires display paginated data - i.e.15 rows per page, there sholdn't scrollers, , @ same time, data displayed ordered category , each new category have add 2 new rows @ table displayed in php file, sth. like: r1-category1 r2-item name | item data1 ... db-item1 db-item2 ...new item x r1-category2 r2-item name | item data1 ... db-item 1 db-item 2 ... i tried call data database, each category added 2 new rows (such name of category , th items displayed), put them in array, counting rows , divided pages 15 results on it, , continue processing javascript. cons of method is, here lot of data , takes minute job done. the best solution - data displayed asap imo use pagination, need define limit .. , there problem - how can define limit if categories among 15 results can various (sometimes 3, 4 or one) ? tried find out how many categories within 15 results database, make call database limit = limit-2x(no of categories) .....

android - how to define the screen orientation before the activity is created? -

i defined activity in portrait mode : android:screenorientation="portrait" when take picture camera function via intent, take picture in landscape mode , turn screen portrait mode when saving it, return activity again. dont understand is, activity short time in landscape mode, destroyed , built again in portrait mode... oncreate ond onrestore functions need time, waiting time user doubled... is there workaround or else? you can register activity explicitly handle orientation changes adding android:configchanges="orientation" activity definition , overriding oncofigurationchanged method in activity this: @override public void onconfigurationchanged(configuration newconfig) { super.onconfigurationchanged(newconfig); setrequestedorientation(activityinfo.screen_orientation_portrait); } i'm not sure if specific problem, remember doing when wanted activity display in portrait mode. let me know if helps :)

iphone - How to cancel the link like this? -

i used nstimer update data in link every seconds,and method this: nsstring *url=[nsstring stringwithformat:@"http://disca.malauu.com/jsbfall.txt"]; nserror *error=[nsstring stringwithformat:@"you error"]; nsstring *urldata=[nsstring stringwithcontentsofurl:[nsurl urlwithstring:url] encoding:nsutf8stringencoding error:&error]; nslog(@"urlstring:%@",urldata); and if network conges,the connection connect long time.how can cancel if link doesn't update data half of second? can me answer,think much! if think implement using nsurlconnection , delegate pattern allow cancel connection, , set options timeout. second advantage request performed asynchronously, , won't block execution of app, if network doesn't answer immediatly. you find more information way, on nsurlconnection class reference page, , in url loading system programming guide .

c++ - Mapping byte array data to structs in C# -

i've been wrestling problem many hours turn here see if has idea how solve problem. have legacy c++ program sends packets via sockets. these contain c++ structs, thought easy define struct looking 1 in c++ in c# application , read byte array. i've noticed it's not simple , think i've boiled down problem alignment, still can't head round it. my c++ struct looks this: typedef struct { int int_1; short short_1; long long_1; char char_11[11]; long long_2; short short_2; int int_2; } test_klient_rec, *ptest_klient_rec; which thought translate c# struct this: [structlayout(layoutkind.explicit, pack=0)] public struct test_klient_rec { [fieldoffset(0)] [marshalas(unmanagedtype.i4)] public int int_1; // 4 [fieldoffset(4)] [marshalas(unmanagedtyp...

javascript - ColorField for ExtJS 4.0 -

Image
do know colorfield implementation extjs 4.x? i try create own (looking datefield source code) picker background transparent , can't fix :( this how create color picker: ext.create('ext.picker.color', { pickerfield: me, ownerct: me.ownerct, renderto: document.body, floating: true, hidden: true, focusonshow: true, listeners: { scope: me, select: me.onselect }, keynavconfig: { esc: function() { me.collapse(); } } p.s. ask here, because on sencha forum never (even single) answer why don't try adding style: {backgroundcolor: "#ddd"} picker's config?

.net - Reference not deployed to the remote device -

we have windows ce project bunch of references. added 1 (a dll use in many projects). this dll never deployed remote device assembly not found exception . when copy manually device works fine. for other resources know there's property 'copy to...' can set never, always, ... looked on references properties , didn't find that. if have suggestions thx

php hello world in eclipse not working -

i have created simple hello world php app in eclipse name od firstphp when try run "run php web page" tries opening page http://localhost/firstphp/first.php in eclipse web browser , got message web page not found when open http://localhost:8080/ works fine , tomcat ok any suggestion install server correct. why use tomcat in first place. thats not used php, jsp. check if localhost:80 works fine too, thats wants go... make sure set documentroot in eclipse. gr.

c# - got an error Null reference exception was Handled -

i trying show reporting chart clicking on 1 chart using following code showing error error : null reference exception handled object reference not set instance of object. @ line targetcontrol.chartareas.clear(); and click event chart control using system.windows.forms.datavisualization.charting; private void kpichartcontrol_click(object sender, eventargs e) { chart targetcontrol = null; series series = null; title title; string are; targetcontrol.chartareas.clear(); targetcontrol.series.clear(); targetcontrol.titles.clear(); datatable accepts = null; accepts = kpidata.acceptedvisitsbymembership(mf ,"accepted"); = " acceptedvisitsmshiptypes"; targetcontrol.chartareas.add(are); series = targetcontrol.series.add(are); series.chartarea = are; title = targetcontrol.titles.add("accepted visits membership type"); title.dockedtochartarea = are; title.font = new font(fontfam...

Constant Contact API, Adding a new contact -

i trying add new email subscriber contact contact list. getting 404 error. following code. can help? $usernamepassword = $key . '%' . $un . ':' . $pw ; $entry = '<entry xmlns="http://www.w3.org/2005/atom"> <id>http://api.constantcontact.com/ws/customers/'.$un.'/contacts/'.$subid.'</id> <title type="text">contact: '.$email.'</title> <updated>2008-04-25t19:29:06.096z</updated> <author></author> <content type="application/vnd.ctct+xml"> <contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/'.$un.'/contacts/'.$subid.'"> <emailaddress>'.$email.'</emailaddress> <optinsource>action_by_customer</optinsource> <contactlists> <contactlist id="http:/...

ERROR C:\>"Program Files\java\jdk1.5.0_22\bin>keytool -genkey -keystore myStore -keyalg RSA" -

i getting following error when try run above command '"program files\java\jdk1.5.0_22\bin>keytool -genkey -keystore mystore -keyalgrsa"' not recognised internal or external command,operable program or batch file. go command line ( cmd ) in windows (that's pretty obvious). type c:\program files\java\jdk1.5.0_22\bin>keytool -genkey -keystore mystore -keyalg rsa (see, removed quote)`. or enclose quotes (and remove > ): "c:\program files\java\jdk1.5.0_22\bin>keytool -genkey -keystore mystore -keyalg rsa” alternatively, use vineet reynolds' advice. :-)

asp.net mvc - Multiple posts on click to submit form using jquery dialog and asp mvc3 -

i using following form : @using (ajax.beginform("saveitem", "itemscontroller", null, new ajaxoptions() { onsuccess = "onformsubmit" }, new { id = "itemsaveform" })) { // form fields below } and fallowing javascript code manage : function onformsubmit(content) { $("#dialog-form").dialog("close"); $("#form-data").html(""); //empty form $.post('@url.action("getitemrow", "itemscontroller")', { id: id, adm:true }, function (data) { // update logic.. ignore } }); } and jquery dialog script witch use submit : $(function () { $("#dialog:ui-dialog").dialog("destroy"); $("#dialog-form").dialog({ autoopen: false, height: 255, width: 420, modal: true, buttons: { "add": function (...

asp.net mvc - Why am I getting a "Unable to update the EntitySet because it has a DefiningQuery..." exception when trying to update a model in Entity Framework? -

while updating of linq sql using entity framework, exception thrown. system.data.updateexception: unable update entityset 't_emp' because has definingquery , no <updatefunction> element exists in <modificationfunctionmapping> the code update : public void updateall() { try { var tb = (from p in _te.t_emp p.id == "1" select p).firstordefault(); tb.ename = "jack"; _te.applypropertychanges(tb.entitykey.entitysetname, tb); _te.savechanges(true); } catch(exception e) { } } why getting error? the problem in table structure. to avoid error have make 1 primary key in table. after that, update edmx. problem fixed

iphone - how know if uitableview has a selected cell -

i'm developing app , @ point have several uitableview. want know outside delegate methods, action instance, if tableviews have selected cell , one. i tried use: (nsindexpath *)indexpathforselectedrow doesn't work, because if don't have selected cell [(nsindexpath *) row] returns "0" , not nil could please give help?? thanks.. your method correct - indexpathforselectedrow indeed returns nil if no cell selected. if try send message nil object , use value returned 0, need test if path value nil or not before trying cell's row it: nsindexpath *path = [table indexpathforselectedrow]; if (path){ row = [path row]; ... } else{ // no cell selected } p.s. nil typecasted 0, in practise same thing.

php - Facebook wall post -

i use below code post on friends wall. $facebook->api('/'.$item.'/feed?'.$token,'post',$attachment); it works post on wall shows name , photo. how can show photo , name in post???? this how generate token: $ch = curl_init(); curl_setopt($ch, curlopt_url, 'https://graph.facebook.com/oauth/access_token?client_id='.app_id.'&client_secret='.app_secret.'&redirect_uri=http://www.facebook.com/pages/cosmetics/167231286678063?sk=app_233227910028874&grant_type=client_credentials'); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_httpauth, curlauth_basic); curl_setopt($ch, curlopt_ssl_verifyhost,0); curl_setopt($ch, curlopt_ssl_verifypeer,0); $token = curl_exec($ch); you should set authentications token 1 generated using login details. you have set access token before can evoke api eg: $facebook->setaccesstoken($token); token created when user logs in app. user author of posts made ...

Django complex query which may need union -

i try complex query in django through these models. class jobtitlestatus(): pending = 0 confirmed = 1 banned class employer(models.model): name = models.charfield(max_length=1000) isvalidated = models.booleanfield(null=false) eminence = models.integerfield(blank=false,null=false,default=4) class jobtitle(models.model) name = models.charfield(max_length=1000) employer = models.foreignkey(employer,null=true,blank=true) status = models.integerfield(null=false, choices=jobtitlestatus) i try list validated employers depending on size of confirmed jobtitles. if there no conmfirmed jobtitle of employer should @ end of list. i try elist = employer.objects.filter(name__icontains=emp).filter(isvalidated=true) elist.filter(jobtitle__status=jobtitlestatus.confirmed).annotate(jtt_count=count('jobtitle')).order_by('-jtt_count','eminence') this query want more or less however, expect, employers doesn't have confir...

javascript - Check whether link's text is "B" then remove its class? -

i want check whether a node contains word "b". if so, node's someclass class should removed. for example: <a href="http://link.com" class="someclass">b</a> $("a:contains('b')").removeclass('someclass');

javascript - How to concurrently run mongo scripts -

how can run mongo mydbname script1.js mongo mydbname script2.js concurrently? is there way fork execution? (i searching --fork option in mongod --fork) thanks folks! olmo running 2 scripts running 2 commands on shell. simplest thing run them in 2 different shells. or can run them in background if not writing important stdout in scripts. in more complex way, can write program fork , exec these 2 commands, it's overkill.

treeview - Want to bold few characters of a word get bold in treenode in winforms using c# -

i have "search textbox" search in treeview, give result well. want parts bold typed in "search textbox" of winform. ex: typed ram gives * ram *esh . the treenode class doesn't support that, text drawn 1 font, treeview.font. making parts of text bold technically possible hard right. need enable custom drawing treeview.drawmode property , drawitem event, there's example of in msdn library article. that's easy part, hard problem node small fit text after draw parts of in bold font. treeview missing "measurenodetext" event allow ask enough space. workaround lie node text , make artificially wider prefixing characters. don't draw in drawitem event. hard consistently right, you'll want consider fixed pitch font instead. i cannot recommend pursue unless feature important you. otherwise explains why never see feature in other programs. consider changing color instead of font weight too. still hard glue pieces btw. ...

iphone - Cannot find protocol declaration for 'NSPasteboardWriting' -

i getting error cannot find protocol declaration 'nspasteboardwriting' i have created class #import <uikit/uikit.h> #import <foundation/foundation.h> @interface errorlog : nsobject<nscoding, nspasteboardwriting, nspasteboardreading> { } @end can 1 tell me whether missing header file or whats reason that? nspasteboardwriting available in mac os x v10.6 , later. check project setting(base sdk).

logic - Prolog Beginner - Is This a Bad Idea? -

the application i'm working on "configurator" of sorts. it's written in c# , wrote rules engine go it. idea there bunch of propositional logic statements, , user can make selections. based on they've selected, other items become required or unavailable. the propositional logic statements take following forms: a => ~x abc => ~(x+y) a+b => q a(~(b+c)) => ~q <=> b the symbols: => -- implication <=> -- material equivalence ~ -- not + -- or 2 letters side-by-side -- , i'm new prolog, seems might able handle of "rules processing" me, allowing me out of current rules engine (it works, it's not fast or easy maintain like). in addition, of available options fall in hierarchy. instance: outside color red blue green material wood metal if item @ second level (feature, such color) implied, item @ third level (option, such red) must selected. if know feature false, of o...

python - Automatically create title from a given text -

i trying write program give apt title when article give ( abstract). there standard algorithm available? if want hand, you'd have start word frequency counting, analyzing phrases appear lot or words appear around each other. have briefly touched topic in java, there seems book python deals text analysis: text processing in python openfts , open full text search engine has python interface, called [pyfts]. 3 check out. maybe that's want.

Simple javascript / jquery window resize question -

i'm writting small script detect if window size larger initial screen size, write jquery handle css. problem i'm having if zoom in 1 notch on mouse wheel (ctrl + wheel scroll) works fine, zoom 1 notch doesn't go original value. so screen 1920px wide. zoom in 1 notch on wheel, screen 1586px, fine. when zoom out 1 notch on wheel screen should 1920px (theoretically) it's not. zooms out 1903px , can't figure out why won't go 1920px. here code, if more explanation or clarification needed, please let me know. var intinitialsize = {width: screen.width, height: screen.height}; var intwindowsize = {width: $(window).width(), height: $(window).height()}; var int125; $(window).load(function() { calcmargin(); }).resize(function() { intwindowsize = {width: $(this).width(), height: $(this).height()}; //int125 = math.round(math.abs((intwindowsize.width * 1.25))); calcmargin(); }); function calcmargin() { console.log(intinitialsize.width,...

swing - Java Application : repaint isn't executed in While Loop? -

i've got thread supposed update game's elements, i.e. repaint, wait bit of time again, problem doesn't repaint. i've tested every other component, works, paint method called once ( because components painted ), if call repaint() in loop. here's code of loop: thread t = new thread(){ public void run() { mouse.init(); while(true) { mouse.refresh();//adds dirty regions in repaintmanager swingutilities.invokelater(new runnable() { @override public void run() { //what here? } }); } } }; no need see thread or anything, loops. here's paint method : @override public void paint(graphics g) { endtime = system.currenttimemillis();//for fps counter time = endtime - starttime; fps = (byte) (1000/time); totalfps += fps; totalframe++; jpt.averagefps...

java - Compare disparate Date formats, which are stored as Strings -

i have 2 disparate date formats presented in application strings. here formats: 07/01/2011 2011-07-01 i'm looking efficient way assert equality. parse both dates using simpledateformat , use equals() method. the formats use "mm/dd/yyyy" , "yyyy-mm-dd" . sample code: simpledateformat format1 = new simpledateformat("mm/dd/yyyy"); simpledateformat format2 = new simpledateformat("yyyy-mm-dd"); date date1 = format1.parse(value1); date date2 = format2.parse(value2); return date1.equals(date2);

sql - SQLite combo-request with concatenating results -

i use sqlite, , want create request such option. i have 2 tables a, b. in records contain field id integers, , field string, example name in table b have columns names: number a<name1> a<name2> a<name3>... i need number table b, field a<namek> equal value, name id in table a. know id , want know number b. so have 2 requests. select name my_name id=<value>; and after want that: select number b a||my_name = <value>; ( || - mean concatenacting of strings), it's not work:( update - example of tables structures: a: id name 1 2 b 3 c b: number aa ab ac 10 1 2 3 11 4 5 6 12 7 8 9 so example id=2 , value in b=5 , name=b , column name in b ab . result number=11 id=3, value=6 . result number=11 id=3, value=4 . result no result without more information table structure, highly assume flawed. save a<name> 's number in individual rows, if necessary column flags. ...

How to configure Spring to make JPA (Hibernate) and JDBC (JdbcTemplate or MyBatis) share the same transaction -

i have single datasource, use spring 3.0.3, hibernate 3.5.1 jpa provider , use mybatis 3.0.2 queries , app runs on tomcat 6. have hibernatedao , mybatisdao, when call both same method annotated @transactional looks don't share same transaction, different connections. how can make them do? i've tried getting connection datasourceutils.getconnection(datasource) , 1 used mybatis strange thought problem in mybatis config , can't use jpatransactionmanager. calling multiple times datasoruceutils.getconnection gives same connection always, ok. after googling i've tried spring-instrument-tomcat's classloader (although don't know if tomcat uses :)) partial applicationcontext <bean class="org.apache.commons.dbcp.basicdatasource" destroy-method="close" id="datasource"> <property name="driverclassname" value="${database.driverclassname}"/> <property name="url" value="${datab...