Posts

php - jQuery voting system -

so making voting system, thumbs & thumbs down voting system. using cakephp , jquery mysql want make sure front end correct , best way it. i want user able change vote, so utilizing jquery best , efficient way? i'm novice jquery when comes class manipulation. the id field going unique id of photo users voting on. of course test , not going final product in production. there multiple photos on page , user votes or down each of them. here code. <?php echo $javascript->link('jquery/jquery-1.4.2.min',false); ?> <script type="text/javascript"> $(document).ready(function() { $('.vote').click(function () { if ($(this).hasclass("current")) { alert("you have voted option!"); return; } var parentid = $(this).parent("div").attr("id"); if ($(this).hasclass("up")) { //do backend...

WPF ListView SelectedValue not being set -

i've looked @ few solutions nothing has worked yet me. i'm using mvvm project , have listview can't set selecteditem property. if (simplified) xaml. <listview name="uxpackagegroups" itemssource="{binding path=packagegroups, updatesourcetrigger=propertychanged, mode=twoway}" borderthickness="0" borderbrush="#ff0000e8" scrollviewer.cancontentscroll="true" selecteditem="{binding path=packagegroupselecteditem, mode=twoway}" > <listview.itemtemplate> <datatemplate> <label content="{binding name}" height="20" margin="0" padding="0"/> </datatemplate> </listview.itemtemplate> and bind packagegroups in viewmodel public packagegroup packagegroupselecteditem {get; set; } public observablecollection<packagegroup> packagegroups {get; set; } private void loadui() { packagegroups = fact...

greasemonkey - Trigger inline onchange javascript -

i'm writing greasemonkey script creates auto-complete search type box makes easier select large dropdown on webpage. dropdown has inline onchange code can't seem trigger when change selection using javascript. ideas? suppose the page had like: <input onchange="somefunction()"> then greasemonkey javascript change input value , call function using: unsafewindow.somefunction();

sql - delete from table1,table2,table3 where? -

if tables want delete have column gamer_id can delete table1, table2, table3 gamer_id = 123? or there different syntax? mysql supports multi-table deletes : delete t1, t2, t3 table_1 t1 join table_2 t2 on t2.gamer_id = t1.gamer_id join table_3 t3 on t3.gamer_id = t1.gamer_id t1.gamer_id = 123

iPhone - how to declare a method and avoid leaks -

suppose have method this - (uibutton *) createbuttonatx:(cgfloat)vx y:(cgfloat)vy{ //... bla bla bla... //at point have uibutton *mybutton = [[uibutton alloc] initwithframe:myframe]; // have alloc here... // ... more bla bla , return mybutton; } as button allocated , not released technically leak, right? on main code, caller like uibutton *onebutton = [self createbuttonatx:100 y:100]; [myview addsubview:onebutton]; [onebutton release]; in theory, onebutton mybutton on createbutton method being released on main code, so, instruments point method leaking... how solve that? using autorelease? thanks replace last line with return [mybutton autorelease]; the truth view retains subview when use -addsubview:.

CakePHP form helper problem with date for editing -

i'm quite newbie in cakephp, i've tried create form form helper on date field echo $this->form->input('item.date'); yes, works fine (i'm using cakephp v1.3.3) input/add new record when try using on edit page nothing. here's code echo $this->form->input('item.date', array("value"=>$rs['item']['date'])); it still display listbox without retrieving value desired table. appreciated, sorry english.. you shouldnt use inline params default values. pass them down controller: http://www.dereuromark.de/2010/06/23/working-with-forms/ see "default-values"

C : Dynamically storing strings (of dynamic sizes!)? -

am missing incredibly simple? because can't seem find reason why code isn't storing strings dynamically. blank lines when print them @ end. supposed print last "n" lines of arbitrary number of lines. there seems problem storage of actual lines though. can lend hand? this not hw way. problem k&r book (whose answers online). i'm trying learn c on own. void tail5_13(int n) { int maxpoint = 3; size_t *maxlength; *maxlength = sizeof(char) * 10; char **pointptr = malloc(sizeof(void *) * maxpoint); char **pointcnt = pointptr; char *lineptr = malloc(sizeof(char) * *maxlength); int numlines = 0; int printnum = 0; int c; while((c = getline(&lineptr, maxlength, stdin)) > 1) { if(numlines < maxpoint) { storeline5_13(pointcnt, lineptr, c); pointcnt++; } else { maxpoint *= 2; printf("increased pointer amount %d\n...