Posts

Showing posts from June, 2012

javascript - Why this simple code not working on JSfiddle? -

Image
http://jsfiddle.net/dolours/yazpj/577/ can't figure out issue js fiddle! why alert not showing up? <input type='input' name='name' id='name' value="test" class='required' /> <input type="button" value="test" onclick="test()"/> function test() { var testvalues = $('#name').val(); alert(testvalues); } you have set jquery in library option since using jquery in code. jsfiddle.net/yazpj/578/

php - How can I simply determine if there is (not) a result from PDOStatement fetch? -

consider following code: $conn = new pdo("connection string", "user name", "password"); $conn->setattribute(pdo::attr_errmode, pdo::errmode_exception); $sql = "select `id` `users` `displayname` = :displayname"; $parms = array(':displayname' => 'test'); $stmt = $conn->prepare($sql, array(pdo::attr_cursor => pdo::cursor_fwdonly)); $stmt->execute($parms); $res = $stmt->fetch(); echo $res == null; and more consider line: echo ($res == null); if there no row in database matches echo displays value of 1 -as expected -because $res in fact null . however, if there result returned $stmt->fetch(); echo produces nothing. but, have expected have produced 0 because value of $res array. how can consistently , concisely compare result simply determine if there result or not? when there's no result, doesn't return null . returns false (well, assuming pdo::fetch_both -- see full list, r

Prevent the user from turning on/off GPS, wifi, internet buttons in android form notification bar -

i looking solution problem 2 days. searched lot not found. have developed gps traking application in andorid. want while running app, app block user switch on /off gps, wifi,internet toggle buttons on notification area. any body have solution? please help

c++ - libcurl crashing program after execution? -

i using libcurl make request google server. curl library giving output , when use curl variables global every thing works fine when using curl variables local inside function or class private members program crashes. not able catch segmentaion fault occuring. code is void func1(); { internet_connection_through_curl internet_connection; internet_connection.simple_program(querry_url); } internet_connection_through_curl::simple_program(string url) { curl *curle; curlcode rese; curle = curl_easy_init(); if(curle) { curl_easy_setopt(curle, curlopt_url, url.c_str()); curl_easy_setopt(curle, curlopt_followlocation, 1l); curl_easy_setopt(curle, curlopt_ssl_verifypeer, 0l); curl_easy_setopt(curle, curlopt_ssl_verifyhost, 0l); curl_easy_setopt(curle, curlopt_writedata , (void *)(&uf)); curl_easy_setopt(curle, curlopt_writefunction, writememorycallback); curl_easy_setopt(curle, curlopt_headerfunction, he

mysql : timestamp this month, last month and every month -

i have following mysql table amount timestamp 3 1367638029 4 1367638029 5 1366445119 8 1366445200 how return sum(amount) based on month (not last 30 day) , last month below total amount month 7 last month 13 this canbe done way: select sum(amount) yourtable month(from_unixtime(timestamp)) in/between ... -- consider year(...)as group month(from_unixtime(timestamp))

jQuery ajax: how to prevent 404 errors spam in chrome DevTools? -

Image
this question has answer here: can prevent chrome developer tools console logging image 404 errors? [duplicate] 6 answers suppress chrome 'failed load resource' messages in console 2 answers i'm communicating couchdb via jquery ajax, , '404' errors expected rest contract. each requests ends '404', '412' or so, google chrome write red error line in devtools console, this: is possible somehow configure jquery '404' not error given request? fake errors spam clutter output , can miss real errors or console.log while looking @ hundreds of fake '404' , '412' "errors" :). this not possible programmatically, due potential script misuse blocking or filtering of errors in console hide activities chrome us

c# - Is there something called array of list? -

i declared list<double> close = new list<double>(); i pass list function xyz , function fill value. need run xyz function many times, there way create array of list can access third list element 7 typing listarray[2][6] . i think need this: list<list<double>> list = new list<list<double>>(); var list1 = new list<double>(); list1.add(1); list1.add(2); var list2 = new list<double>(); list2.add(3); list2.add(4); list.add(list1); list.add(list2); var element = list[1][1]; the value of element element of second list @ index of 1. in case, 4.

Clash between tinyMCE popup and DataTables with server side processing -

i need have table (with thousands of rows) inside tinymce popup, user can filter / select row , insert editor window. have datatables, server side processing , filtering. relevant code is <script type="text/javascript" src="../../tiny_mce_popup.js"></script> <script type="text/javascript" src="js/dialog.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready( function() { var resptable = $('#resp_table').datatable({ "bprocessing": true, "bserverside": true, "sajaxsource": 'insert_resp.php', ... ..etc. the json response good, "secho":"1","itotalrecords":"18783","itotaldisplayrecords":"18783","aadata":[["0","1","2","3","4","5"],["0","1&q

iphone - How to Display this kind of data into UITableview -

i having nsarray in having following data, using afhttprequestoperation give me result , after doing [listofname addobject:[responsedata valueforkey:name]]; , getting following result , result want display in tableview can understand how becuause new iphone ( ( "richard conover", "richard conover", "kaitlyn matheson", "andrea wannemaker", "andrea wannemaker", test, james, test, gaurav, sdfsdfs ) ) if nsarray.count return 1 how print separately in tableview what want set tableview datasource first object in array (which array ). this: nsarray *mytableviewdatasourcearray = [myoriginalarray objectatindex:0]; then use mytableviewdatasourcearray datasource methods of tableview .

How to get the characters from a byte array encoded in python -

i have byte array encoded in utf-8 format. need characters , write file. please b byte array b=[1,1,-127,-125] i need convert each byte character python 2: can use chr() function. 1 more hint: doesn't matter encoding list of integers has. python 3: can create instance of bytes() list.

compilation - Compiling U-BOOT bootloader on x86 -

i have download , extracted u-boot-1.1.6 on linux ubuntu. want compile source code using gcc(not targeting cross compilation embedded platform). i tried running provided makeall makefile "powerpc-linux-gcc : not found" happening. my understanding irrespective of platform source code should compile. what necessary makefile , environment changes need compilation on x86? i have taken recent code. still facing issues i have followed following steps compile on x86. 1) make clean; 2) make coreboot-x86_config 3) ./makeall -c x86 in step 3 observed following: ravitiwari@ravi-hp-pavilion-dv2000-gj175pa-acj:~/u-boot-2013.04$ make clean ravitiwari@ravi-hp-pavilion-dv2000-gj175pa-acj:~/u-boot-2013.04$ make coreboot-x86_config configuring coreboot-x86 - board: coreboot, options: sys_text_base=0x01110000 ravitiwari@ravi-hp-pavilion-dv2000-gj175pa-acj:~/u-boot-2013.04$ ./makeall -c x86 configuring coreboot-x86 - board: coreboot, options: sys_text_base=0x01110000 make[1

php - Uploading canvas image data results in a blank image -

i'm using ajax query upload canvas image data, along few other variables. here's relevant code looks on client side: front_content = document.getelementbyid("front_paint_canvas").todataurl("image/png"); ajaxhandler.open("post", "upload_card", true); ajaxhandler.setrequestheader("content-type","application/x-www-form-urlencoded"); ajaxhandler.send("name="+name+"&front_content="+front_content); and here's have on server side: $front_content = substr($_post['front_content'], strpos($_post['front_content'], ",")+1); $decodeddata=base64_decode($front_content); $fp = fopen( getcwd().'/assets/img/canvas.png', 'wb' ); fwrite( $fp, $decodeddata); fclose( $fp ); this creates file appears right size, , of right dimensions. however, file blank. none of image data in canvas shows up. what's being done wrong here? when using jquery.post

How to iterate over table in Access 2010 -

i iterate on rows in payment table. user chose month , year has wants book , want check in each raw if house booked year , month. want compare if houseid == chosenhouseid && bookingmonth == chosenbookingmonth && bookingyear==chosenbookingyear. if true should pop out message box info house booked month. if user chose more 1 month i.e. nummonths 3, should increment value of month (which text) should go next value (if there no next value should mod 12) , checking again. maybe necessary switch data type of bookingmonth numeric? however hope clear want do. have experience java, c, python , visual basic, did not in access quite confusing. not find useful info how perform operation. please advise me on issue. thank you yes, should store [bookingmonth] numeric. maintaining "month" column text nuisance in long run, since "august"<"january" , "12"<"2". you'd have @ least amount of juggling conve

c# - How to process data from 2 tables in database? -

i confused. followed tutorial : i know how add don't know how add method , data 2 table not table. because result want have properties 2 tables. example: customer:customerid,customername order:orderid,customerid,orderdate i want result: customerid,customername,orderdate. but confused because class customer , order different. don't know type of result should return can binding gridview. if it's customer type, orderdate don't have. , same order. please give me tip. thank in advance. you can create new class represents result need service method. let's say: public class mycustomerresult { public int customerid{get;set;} public string customername{get;set;} public datetime? orderdate{get;set;} } and create method returns new class public iqueryable<mycustomerresult> getmycustomerbylastname(string startinglastnameletter) { //you should modify query return data need, example var q = customer in th

android - How to show a list of color's to chose from -

this question has answer here: android color picker [closed] 5 answers how show list of color's chose . have list view colored text [user has option choose color want .] string available_colors[]={"#ff0000","#00ff00","#0000ff"}; string color_options[]={"red","green","blue"}; sharedpreferences preferences = preferencemanager.getdefaultsharedpreferences(getbasecontext()); sharedpreferences.editor editor = preferences.edit(); editor.putint("selected_color",position); sharedpreferences preferences = preferencemanager.getdefaultsharedpreferences(getbasecontext()); selected_color= preferences.getint("selected_color", 0); msg.settextcolor(color.parsecolor(available_colors[selected_color])); how can make more ittutive color picker color choser ??

Android Java get if minimized -

Image
is there anyway check if application minimized or if have locked device? because when minimize / lock device application still runnig, because i'd pause music / sfx not annoy people.. if calling. i using activity , surfaceview threads. i have tried putting pause method in surfacedestroyed / surfacechanged without success. you should understand activity lifecycle first when activity comes int foreground it'll enter onpause() , it'll enter onresume if user returns activity, example use onpause this @override public void onpause() { super.onpause(); // call superclass method first // stuff here } } for furthere reference onpause can see here -> onpause tutorial

Jqplot different kinds of rendering in one chart -

i build somthing chart in sample: barlineanimated.html. problem is; have more 1 series, render bars, , 1 should rendered line. can't undestand sample: 1 2 series in sample rendered in different way. how can set kind of rendering single series? try inside jqplot constructor: seriesdefaults : { renderer: $.jqplot.barrenderer, rendereroptions : { barwidth: 30 } }, series : [{}, {}, {}, { renderer: $.jqplot.linerenderer }] you can set 1 series drawn either line or bar... unless adding trendline (which different concept altogther). can add multiple series in 1 plot , show them in different rendering (bar + line)

ruby on rails - Can't start redmine server after restarting -

i have installation of redmine , ror running on mac server. today had restart server, , usual command start server, ruby script/rails server webrick -e productionrail -v returns this: rails: version unknown why? gem install rails --include-dependencies

c - The printf functions print something that shouldn't, why? -

Image
as can see images attached below, adding second element top of list create strange behaviour printf function. the function add list node is: void add_queuenode_top(item a) { if (head==null) { queueinit(a); } else { queueput_top(a); } return; } void queueinit(item a) { head=(link)malloc(sizeof(link*)); head->next=null; head->item=a; tail=head; printf("coda iniziallizata...\n\n"); } void queueput_top(item a) { link tmp; tmp=(link)malloc(sizeof(link*)); tmp->item=a; tmp->next=head; head=tmp; return; } here functions handle items: item fill_item() { item a; int i; for(i=0; i<dim-1; i++) { a.stringa[i]=rand(); } a.stringa[dim-1]='\0'; a.numero=rand(); printf("\noggetto generato: \n"); print_item(a); return a; } void print_item(item a) { printf("\nstringa elemento: "); printf("

calculate distance between 2 location selected from a database using php mysql -

i want calculate distance between 2 selected location drop list have table id , village_name, lattitude, longitude. i did follow example calculation did not understand can me ?? map.php <?php $village_id =""; $sql = mysql_query("select lattitude, longitude village id = '$village_id' ")or die(mysql_error()); $get_row = mysql_fetch_assoc($sql); $lattitude = $get_row['lattitude']; $longitude = $get_row['longitude']; if(isset($_post['calculate'])) { $pt1 = $_post['pt1']; $pt2 = $_post['pt2']; } //function calculate distance function distance($lat1, $lng1, $lat2, $lng2, $miles = true) { $result = ""; $lattitude = $lat1; $lattitude = $lat2; $longitude = $lng1; $longitude = $lng2; var_dump($lattitude); $pi80 = m_pi / 180; $lat1 *= $pi80; $lng1 *= $pi80; $lat2 *= $pi80; $lng2 *= $pi80; $r = 6372.797; // mean

matlab - Bicubic Interpolation -

Image
my assignment question : "in lecture 9 slide no.21 there affine transform based equations. take input gray-scale image , apply these transformations 1 one. interpolation used must bi-cubic." equations are: i not understanding meant question? mean should apply transformation on image or what? confused i'm sure ta answer here... anyway, have apply transformations set of coordinates (probably 2 coordinates per pixel if want transform images). since real values instead of integers (as pixel grid requires), have apply bicubic interpolation obtain final values on destination pixel grid.

php - Codeigniter set_value undefined variable -

i have code in ci controller: if ($this->form_validation->run() === false) { $data['category'] = $this->categories_model->get_categories($id); $this->load->view("templates/admin_header", $data); $this->load->view("categories/edit", $data); $this->load->view("templates/admin_footer", $data); } else { $array = array('id'=>$id, 'category_name' => $this->input->post('category_name')); $this->categories_model->update($array); $this->load->view("templates/admin_header"); $this->load->view("categories/edit"); $this->load->view("templates/admin_footer"); } and in view have this: <input type="text" class="text" name="category_name" value="<?p

java - Big elements on device with high screen density -

Image
i have application elements (buttons, images, ...) in layout. images in resources ldpi, mdpi, ... , xxhdpi. if run application on tablet 7" (800x480) elements has "correct" size. if run application on samsung galaxy s3 mini 4" (screen size 480x800) elements big. how can decrease size of elements automatically? tried insert these lines manifest, without succesfull. <supports-screens android:xlargescreens="true" android:smallscreens="true" android:largescreens="true" android:normalscreens="true" android:resizeable="true" /> edit here images. wrong good source: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingbottom="@dimen/activity_vertical_margi

sql - Automatically update record using if else in mysql table -

i new mysql , need help. to make clearer, have 3 columns in mysql table; date of membership membership expiry membership status 1st , 2nd column using date format. , 3rd column using varchar. so, i'm trying is, if expiry date exceed current date, record of 3rd column automatically changed 'expired'. , if not exceed, display 'active'. is possible? really appreciate if can help. mysql supports events . helpful when not want manually check status of each record. example code: delimiter $$ create event `update_status` on schedule every 1 hour begin update tablename set membershipstatus = if(curdate() > membershipexpiry, 'expired', 'active'); end $$ delimiter ; what statement after script has been created, fired every 1 hour interval. to lean more events , please see links below. create event syntax more examples

iphone - How to make UIDatePicker to show user selected time -

i have uidatepicker letting user chose time . uitableview in uiview on click of uibutton uiddatepicker appears, when user choose time , press button dismiss uiddatepicker view , if wants check whats time had chose in uiddatepicker . uiddatepicker doesn't show time user had selected shows current time or time start time of datepicker . i want display time user has chosen user when opens datepicker again. code when user press uibutton display uiddatepicker view -(ibaction)settingsbuttonchanged:(uibutton *)sender { usertimepicker = [[uidatepicker alloc]init]; [usertimepicker addtarget: self action: @selector(usertimepickervaluechanged:)forcontrolevents: uicontroleventvaluechanged]; } this code lets datepicker have custom time limit -(ibaction)datepickertimenbuttonchanged:(uibutton *)control { if (control.tag == 1) { self.selectedbutton = control.tag; int starttime = 7; int endtime = 11; nsdat

java - DataInputStream available() behaviour for reading files bigger than Integer.MAX_VALUE bytes -

i have binary file in custom format have written using dataoutputstream. simplified format of data in file is: intcharintcharintchar...intchar i using datainputstream read file, , available() determine whether or not next read successful. everything works fine small files. however, big files, filesize bigger integer.max_value bytes, available() call returns strange negative values after first read. file trying read 4751054632 bytes (about 4.8 gig). simplified test code: datainputstream reader=new datainputstream(new bufferedinputstream(new fileinputstream("/path/file"))); system.out.println("available @ start:\t" + reader.available()); while(reader.available()>0){ int a=reader.readint(); system.out.println("available after readint:\t" + reader.available()); char b=reader.readchar(); system.out.println("available after readchar:\t" + reader.available()); //do } output: available @ start: 2147483647 //this

c# - How to hide the console window -

this question has answer here: how can hide console window? 4 answers we have legacy app should have been service built service , when it's running don't want console displayed. is there way of hiding console window in windows console application and/or minimising console window system tray (not taskbar), bring when double clicked in system tray? have done winform not sure if it's possible on console app. thanks this hide console window: processstartinfo startinfo = new processstartinfo(); startinfo.createnowindow = true; startinfo.useshellexecute = false; startinfo.filename = "yourapp.exe"; startinfo.createnowindow = true; startinfo.windowstyle = processwindowstyle.hidden;

php - Apache high cpu usage post request -

Image
i have apache processes overloading cpu. i'm attaching image of apache server status mod on can see process causing problem post request. this post request made jquery xhr-post-request have exit such request somehow? or how can make not overload cpu. oh, , forgot mention post request image uploads. in dp.php there image processing. move_uploaded_file(); , extension checking etc. update1: problem

How to center links in header using CSS? -

i wanted make links centered on screen rather placed in location number of pixels. here's code: css: .horizlinks { position: absolute; top: 77px; left: 180px; } .horizlinks ul { margin: 0px; } .horizlinks li { margin: 0px 15px 0px 0px; list-style-type: none; display: inline; } this html on webpage: <div id="container"></div> <div id="header"></div> <div class="horizlinks"> <ul> <li><a href="http://www.website.com">header link 1</a></li> <li><a href="http://www.website.com">header link 2</a></li> </ul> </div> use text-align:center on <div class="horizlinks"> . also, set padding of ul elements 0 . your absolute positioning of container div pushing whole div side right side of page, unless remove that, content inside never able in middle. jsfiddle here. css:

windows - C++ Can not create instance of abstract class -

i have following class: (header) struct udtmapping { int bytestart; int bytecount; int ihpunitid; }; class clsmapping : public cbasestructure { private: vector<udtmapping> m_content; protected: public: vector<udtmapping> &content(); void add(int i1, int i2, int int3); }; cpp file: vector<udtmapping> &clsmapping::content() { return m_content; } void clsmapping::add(int i1, int i2,int i3) { udtmapping n; n.bytestart = i1; n.bytecount = i2; n.ihpunitid = i3; m_content.push_back(n); return; } now wanted use class saying clsmapping nmapping; but compiler tells me "can not create instance abstract class". i not sure went wrong. thank help. edit: on request here cbasestructure class cbasestructure { protected: virtual void processtxtline(string line) = 0; virtual void afterload(); virtual string compactline(string line); public: void loa

javascript - Speeding up website - marking scripts/images as optional? -

on website have ads network not load particularly fast. browsers won't draw page unless ads load, making website appear slower - there way prevent this? in mark script non-essential or javascript trick draw once it's loaded? tried googling solution, no avail. also, ads added site iframe, js script (much adsense) if loading ads optional, wait load them , use ajax load/add them later jquery.

rest - Why Jersey "default" JSP processor is null under embedded Grizzly? -

using grizzly 2.3.2 , jersey 1.8 , according many resources ( how implement custom viewprocessor<t> (jax-rs)? , blog ) jersey comes w/ off shelf jsp processor, yet debug sessions shows no such processor exist /** * set of template processors. * * @return set of template processors. */ private set<viewprocessor> getviewprocessors() { return viewprocessors; // ***this list empty !!!*** } i'd grateful if solve it/provide advice how plug jsp processor (not general purpose template engine !) jersey i've created sample maven project (based on this webapp). uses jersey's jsp viewable , runs on standalone grizzly server. hope help.

android - SQLite connection:application stops working -

i making diary application in android supposed data text fields. when run app on emulator, gets installed give input in fields , tap save option in menu, emulator prompts diary app has stopped working. i not able find database folder in app in emulator's file explorer means database not making. here sqlite connection making , insertion in table code writing in save item. if(item.getitemid()==r.id.save){ edittext et=(edittext)findviewbyid(r.id.mood); string mood=et.gettext().tostring(); et= (edittext)findviewbyid(r.id.weather); string weather=et.gettext().tostring(); et= (edittext)findviewbyid(r.id.text); string text=et.gettext().tostring(); date date= new date(); simpledateformat sdfdate = new simpledateformat("yyyy-mm-dd hh:mm:ss"); string strdate = sdfdate.format(date); sqlitedatabase db= openorcreatedatabase("diarydatabase",mode_private,null); db.execsql(&quo

visual studio - C# mutability - VS Code Analysis giving me CA2104? Seems... poor. Am I misunderstanding? -

in c#, want make "smart" enums, kind of possible in java, there's more information attached enum value underlying int. happened upon scheme of making class (instead of enum), in following simple example: public sealed class c { public static readonly c c1 = new c(0, 1); public static readonly c c2 = new c(2, 3); private readonly int x; private readonly int y; private c(int x, int y) { this.x = x; this.y = y; } public int x { { return this.x; } } public int y { { return this.y; } } } but when run visual studio's "code analyzer" on that, gives me warning c2104, "do not declare read mutable reference types". i why wouldn't want declare read mutable reference types, but... class not mutable, it? reading docs warning, seems they're kind of assuming read reference type mutable. example, says

footer - jQuery produces 'undefined' error - am I going mad? -

i trying dynamically position footer bottom of user's screen using jquery. i'm pretty sure code correct i'm getting 'undefined' message in firequery. can see i'm going wrong? $(document).ready(function(){ $(function(){ // define min height content based on window size var wrapper = $(window).height(); var content = $("#content_wrapper"); var header = $("#header_wrapper").height(); var footer = $("#footer_wrapper").height(); // content height contentheight = wrapper - header - footer - 279; $(content).css("min-height", contentheight + "px"); }); }); see fiddle here check fiddle: http://jsfiddle.net/gt3ex/5/ a few things: ¶ i don't think fiddle has jquery selected under frameworks & extensions (the drop-down on left) ¶ you have double nested document ready call unecessarily. this: $(document).ready(function(){ … }); is equivalent this: $(

read a random subset of a csv file in matlab -

i have large(150000) dataset in csv format. data set has noise , error in of fields. want read file , perform classification svm(with libsvm) on it. need read subset of data clean , usable. choosing 10000 random records clean , none of fields noisy. fileds noisy has value 0 or na. how can matlab? if want proper matlab solution, need make custom filereader. that's not worth effort, though. the fastest solution can think of filter out erroneous lines using tool (such grep ) prior loading file in matlab csvread . if have grep , can rid of lines 'na': cat file | grep --invert-match na > file.filtered you can read file.filtered without issues matlab's csvread function. can rid of rows 0's within matlab easily.

web services - Protocol Exception Wcf -

i wondering whether can trouble wcf, web.config <?xml version="1.0" encoding="utf-8"?> <configuration> <!--diagnostics section, catch error , warning in production--> <system.diagnostics> <trace autoflush="true" /> <sources> <source propagateactivity="true" name="system.servicemodel" switchvalue="error, warning"> <listeners> <add type="system.diagnostics.defaulttracelistener" name="itlocal.olapwcfservicebrowser2005"> <filter type="" /> </add> <add name="servicemodeltracelistener"> <filter type="" /> </add> </listeners> </source> <source name="system.servicemodel.messagelogging" switchvalue="error, warning"> <listeners>

Floatbox (lightbox) Gallery Order and Isotope -

although question specific floatbox ( http://floatboxjs.com/demo ), issue generic image gallery light-boxes. i need floatbox able show image galleries per isotope's reordering of page elements; e.g. div - thumbs. isotope please see http://isotope.metafizzy.co/demos/sorting.html . the problem plugins, floatbox, page order of elements (thumbnails) off of initial div's on page. can understand of isotope, doesn't rewrite html allow scripts floatbox read/parse new order of displayed thumbnails. i have black box understanding of jquery suppose asking if there way rewrite page such scripts floatbox can called parse them in isotopes new 'displayed' order. i have hunted everywhere solution, cannot find in way of asking question. seems odd affects uses masonry/isotope , lightbox combo ~ being able advance via lightbox in newly sorted order instead of original page order. for it's worth, site galleries working on leo labelle dot com. ps - posted similar qu

internet explorer - jQuery bind beforeunload - not working with IE 9 -

i have piece of code want fired when page closes (basically, send 'disconnected' message server. execution should fast enough me not have cancel , restart event. further that, works in chrome, firefox , safari, not in ie9 on closing tab. if navigate page in ie9, event fires. if close tab, doesn't. tried following bind code: jquery(window).bind("beforeunload", function() { dosomework(); }); i tried replacing jquery $ so: $(window).bind("beforeunload", function() { dosomework(); }); still works in chrome, not work in ie. suggestions? i using jquery 1.9.1 min (compressed production version). try this onbeforeunload = function() { return "are sure"; } tested in chrome version 26.0.1410.64 m firefox version 20.0.1 internet explorer version 9.0 fiddle

php - Removing duplicate array, from an array of arrays -

here's example of array i'm working against: array ( [0] => array ( [id] => 1331 [shortname] => mcs-115-113c [userid] => 663 [email] => asdfasfd@asdfasfd.br [username] => foobarbaz [nombrecompleto] => asdfasdf [lastlogin] => 1367501486 ) [1] => array ( [id] => 1331 [shortname] => mafa-eoof [userid] => 323 [email] => asdfasfd@asdfasfd.br [username] => foobarbaz [nombrecompleto] => asdfasdf [lastlogin] => 136732186 ) [2] => array ( [id] => 1331 [shortname] => mkt-foobar [userid] => 434 [email] => asdfasfd@asdfasfd.br [username] => adsfasdf [nombrecompleto] => asdfasdf [lastlogin] => 1367234486 ) in case, want compare username element in array , delete duplicates. so in case, return 2 elements, username foobarb

ruby on rails - Accessing Model from html -

i have loop in page displays cities in model. lets new york city 1 of these cities , want access new york city. how access particular city instance model in rails? <% @cities.each |city| %> <tr> <td><%= city.name %></td> <td><%= city.country %></td> <td><%= link_to 'show', city %></td> <td><%= link_to 'edit', edit_city_path(city) %></td> <td><%= link_to 'destroy', city, method: :delete, data: { confirm: 'are sure?' } %></td> </tr> <% end %> use attribute of object access object in view: for example, if name attribute of city "new york city", say: city.find_by_name("new york city") of course, it's not super railsy in view, add to relevant controller action: @newyork = city.find_by_name("new york city") and use @newyork in view.

c# - Why converting datetime to string gets me the error : ORA-01843: not a valid month -

i have following column : checkingtime ------------ 1 7/5/2011 2 3 4 5/8/2012 (the colomn format date.) i'm using datareader read colomns , rows in db1 , insert them db 2 follow : while (dr.read()) { string finalratingdate = ((dr[19] != dbnull.value) ? convert.tostring(dr[19]) : ""); } so when inserting it's supposed check if there's dbnull, if not, insert value, if yes insert "", thing following error : system.data.oracleclient.oracleexception: ora-01843: not valid month i error datetimes variable. other variables i'm able convert them string , insert them. do have idea ? thank you i believe exception indicating column in database of type date , can't accommodate empty string. instead of empty string in statement, should initialize variable null , enable set null value in date column. statement be: string finalratingdate = ((dr[19] != dbnull.value) ? convert.tostring(dr[19]) : null); i not sure why converting

asp.net - Cannot acess a class from virtual directory -

using c# in asp.net application, have class class1 in app_code folder. can create c1 object , use in default.aspx.cs page, , works fine. however, when create virtual directory , run there, gives me following error: cs0246: type or namespace name 'class1' not found (are missing using directive

json - Simple join between two tables in Rails -

i building rails application work end apis. (using grape apis) have 2 tables (user, comment) user has many comments , comment belongs 1 users. i trying return comments, , within comment object, want show user object user created comment. i tried: comment.includes(:user) and comment.joins(:user).includes(:user) and none of them managed return sub-object. returns comment object (which has user_id) attribute). is there way achieve in json format (as mentioned, use grape) you can use to_json or as_json :include option. in api: resources :comments :id comment.includes(:user).find(params[:id]).to_json(include: :user) end end however, sooner or later need more control on json responses generated api. suggest take @ grape-rabl gem (or other solution building json - there plenty of them out there). grant finer control...

wordpress - deploying wabapps (e.g. moodle) on heroku -

what proper way deploy webapps on heroku? i'm installing moodle, same procedure should apply e.g. drupal or wordpress. hace done unzip moodle locally, uploaded using git heroku. when visit site option install , select database, works fine. problem install procedure saves information in filesystem on server, gets overwritten next time deploy app. proper way of doing this? you have pre-configure app of database settings before deploy heroku. either fake "install" on local environment, or manually edit php config files. as you've discovered, heroku's filesystem not persistent: https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem .

import - Error in importing database in MySQL -

i'm trying import database in mysql kept on showing error saying 'no database selected'. there wrong xampp? i've installed xampp v3.0.12.. know how solve problem? don't know do. :( need import badly.this reason why can't log in wordpress. dany appreciated! thanks! error sql query: -- -- database: eucincor_psuccessdb.sql -- -------------------------------------------------------- -- table structure table wp_additional_attendees create table if not exists `wp_additional_attendees` ( `id` int( 11 ) unsigned not null auto_increment , `attendee_id` int( 11 ) not null default '0', `x_attedee_name` varchar( 45 ) default null , `x_attendee_email` varchar( 45 ) default null , primary key ( `id` ) ) engine = myisam default charset = latin1 auto_increment =1; mysql said: 1046 - no database selected you might have forgotten use database. dump file not contain the create database eucincor_psuccessdb use eucincor_psuccessdb eit

sockets - Java SocketException Broken pipe -

i doing client server log-in communication. i met java.net.socketexception: broke pipe @ server end. , have narrowed problem one single line @ client end . if move position line, code works. plese see following code. client end: socket socket = new socket(const.destip, 12101); objectoutputstream out = new objectoutputstream(socket.getoutputstream()); out.writeobject(this.message); out.close();//line cause problem objectinputstream in = new objectinputstream(socket.getinputstream()); servertoclientlogin msg = (servertoclientlogin) in.readobject(); //out.close();//move here, problem solved in.close(); socket.close(); server end: while (true) { socket = _serversocket.accept(); in = new objectinputstream(socket.getinputstream()); msg = (clienttoserverlogin) in.readobject(); servertoclientlogin msgtosend = null; out = new objectoutputstream(socket.getoutputstream()); msgtosend = handlelogin

download - wget fetch image from different domain -

when downloading page using wget -p option (page requisites), downloads files necessary display given html page, including such things inlined images, sounds, , referenced stylesheets. seems image belongs different domain (e.g. www.google.com ) not downloaded. there way cause downloaded well? you use -h option (go foreign hosts when recursive).

php - Allow Users to dynamically design printable products online -

i have tried researching web applications used companies vistaprint dynamically allow user design ideal logo inside preview mockups , wondering how can achieve in php based website. trying develop website printing company have application allows users upload existing logos , view in designated mockups(eg: card/flyers/tshirts/brochures) . suggestions on how achieve this? can't seem see questions in regards type of problem here in stackoverflow. basically software integrate php site: like this and this thank much. :)