Posts

Showing posts from March, 2011

javascript - Efficient way to long poll in jquery -

i beginner in javascript , jquery , looking efficient way long poll in jquery. came across piece of code , puzzled attribute complete: . aware of use of 'complete' piece of code result in recursive function call? (function poll(){ $.ajax({ url: "server", success: function(data){ //update dashboard gauge salesgauge.setvalue(data.value); }, datatype: "json", complete: poll, timeout: 30000 }); })(); thanks in advance. :) you can avoid recursion using short timeout ensure current call stack clears: (function poll(){ $.ajax({ url: "server", success: function(data){ //update dashboard gauge salesgauge.setvalue(data.value); }, datatype: "json", complete: function () { settimeout(poll, 0); }, timeout: 30000 }); })(); this execute poll (probably) next event after current execution clears. in other wo...

date - MySQL compare unix timestamps -

i'm trying records have date_created within 2 hours ago. it's unix timestamp created php function time() . here current query: select id gsapi_synsets name = "beyonce" , date_created between unix_timestamp(date_created) , unix_timestamp(date_add(curdate(),interval 2 hour)) doesn't seem working though. if none of date_created values in future, can use this: select id gsapi_synsets name = 'beyonce' , date_created > unix_timestamp(now() - interval 2 hour); if date_created values can in future, use this, cuts off @ current select id gsapi_synsets name = 'beyonce' , date_created between unix_timestamp(now() - interval 2 hour) , unix_timestamp() note calling unix_timestamp without argument returns timestamp "right now".

c# - Excel process not closing -

this question has answer here: how clean excel interop objects? 36 answers i've got c# program never closes excel process. finds number of instances string appears in range in excel. i've tried kinds of things, it's not working. there form calling method, shouldn't change why process isn't closing. i've looks @ suggestions hans passant, none working. edit: tried things mentioned , still won't close. here's updated code. edit: tried whole process.kill() , works, seems bit of hack should work. public class comparehelper { // define variables excel.application excelapp = null; excel.workbooks wkbks = null; excel.workbook wkbk = null; excel.worksheet wksht = null; dictionary<string, int> map = new dictionary<string, int>(); // compare columns public void getcounts(string startrow, string end...

jquery - Locate an element and change the class -

i trying change class of div divprintdetailed divprintselected <div id= "maindiv" class ="maindiv"> <div id ="partialviewdiv"> <div class="ui-submenu"> </div> <div id="reportcontainer" class="divprintdetailed"></div> </div> </div> the following line of code doesn't job. doing wrong. $('#maindiv').find('div.divprintdetailed').attr('class', 'divprintselected'); try this: demo both versions. $('#maindiv').find('div.divprintdetailed').removeclass('divprintdetailed').addclass('divprintselected'); and change html maindiv has id: <div id="maindiv" class ="maindiv"> you can use toggleclasse() like: $('#maindiv').find('div.divprintdetailed,div.divprintselected').toggleclass('divprintdetailed divprintselected');

php - display menu grouped by headings - array grouped by -

i looked around grouped didn't find either made sense or worked. im trying make menu grouped headings salads/pizza/pasta etc got save database fine , have reading array( think called multidimensional[if know dumped array called please tell me id know]. here array dump array ( [heading] => array ( [0] => salads [1] => salads [2] => pasta ) [special] => array ( [0] => [1] => [2] => ) [item] => array ( [0] => small green [1] => regular caesar [2] => baked lasagna ) [description] => array ( [0] => grape tomatoes, onions, green peppers , cucumbers on bed of crisp lettuce. [1] => classic recipe romaine lettuce , croutons [2] => meat sauce, tomato vegetarian sauce or alfredo sauce ) [price] => array ( [0] => see desc [1] => $5.99 [2] => $9....

javascript - Persist user name when login fails -

my app built on html (bootstrap), javascript (jquery). my login form has input user name , password. how can persist user name when login fails? cross-browser? thanks helpful tips! use jquery store in cookie: $.cookie("username",theusername);

vim short for search replace with space in between -

what vim short case? a bcd_x 1.pdf bcd_x 2.pdf desired output: a bcd_x 1.pdf:::a bcd_x 2.pdf you mean this? :s/\s\(a\s\)/:::\1 or how this? :s/\sa\@=/::: of course, regexp search-and-replace depends on particulars of data. of haven't given work with.

jquery - Change mp3 src attribute works in Firefox, but not in Chrome -

i want switch src attribute of embedded mp3. <embed id="aplayer" width="10" height="10" src="audio/gong.mp3"> js $("#btnplay").click(function() { if (mm==0) { $('#aplayer').attr('src', 'audio/01.mp3'); mm = 1; } else { $('#aplayer').attr('src', 'audio/gong.mp3'); mm = 0; } works in firefox (the new file plays), not in chrome. is there way solve in chrome ?

Ruby 1.9.3 Is Not Installing (Mac OS X Lion) -

this question has answer here: installing ruby - rvm - mac osx mountain lion 3 answers here's current version of ruby: matts-macbook-pro:~ cinicraft$ ruby -v ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0] so want upgrade 1.9.3, i'm trying: matts-macbook-pro:~ cinicraft$ rvm install 1.9.3 searching binary rubies, might take time. no binary rubies available for: osx/10.7/x86_64/ruby-1.9.3-p448. continuing compilation. please read 'rvm mount' more information on binary rubies. installing requirements osx, might require sudo password. certificates in '/usr/local/etc/openssl/cert.pem' date. requirements installation successful. installing ruby source to: /users/cinicraft/.rvm/rubies/ruby-1.9.3-p448, may take while depending on cpu(s)... ruby-1.9.3-p448 - #downloading ruby-1.9.3-p448, may take while depending on connection... r...

java - Writing an infinite loop -

i writing code should create infinite loop, terminating unexpectedly. when either type in 'y' yes or 'n' no, code should enter non-terminating loop. import java.util.scanner; import java.text.numberformat; import java.text.decimalformat; public class math_island_xtended_final { static scanner sc = new scanner(system.in); static scanner keyboard = new scanner(system.in); public static void main(string[] args) { //declarations int bignumber; int mednumber; int smallnumber; double addition; double subtraction; double multiplcation; double division; double sphere_radius1; double sphere_radius2; double sphere_radius3; double rectangle_measurements; char repeat; string input; system.out.println("welcome math island :d ! "); system.out.println("we use numbers our formula ! "); system.out.println(...

android - Using AsyncTask to read items from a database -

i decided add asynctask fragment in app in order receive items database more efficiently. i set generics void, void, list<object> (where object object created), , inner methods follows: private class getobjectstask extends asynctask<void, void, list<object>> { @override protected list<object> doinbackground(void... params) { sqlitedatabase db = mdbhelper.getinstance(getactivity().getapplicationcontext()).getreadabledatabase(); string[] projection = { ......... }; string sortorder = ...; cursor c = db.query(table_name, projection, null, null, null, null, sortorder); while(c.movetonext()) { long itemid = ...; string title = ...; long startmil = ...; long endmil = ...; mlist.add(new object(itemid, title, new date(startmil), new date(endmil), null, null)); } db.close(); return mlist; } } ...

c - Strange behaviour of the pow function -

while running following lines of code: int i,a; for(i=0;i<=4;i++) { a=pow(10,i); printf("%d\t",a); } i surprised see output, comes out 1 10 99 1000 9999 instead of 1 10 100 1000 10000 . what possible reason? note if think it's floating point inaccuracy in above loop when i = 2 , values stored in variable a 99 . but if write instead a=pow(10,2); now value of comes out 100 . how possible? i can't spell c, can tell why. you have set a int . pow() generates floating point number, in cases may hair less 100 or 10000 (as see here.) then stuff integer, truncates integer. lose fractional part. oops. if needed integer result, round may better way operation. be careful there, large enough powers, error may large enough still cause failure, giving don't expect. remember floating point numbers carry precision.

PHP - Changing the datetime to mysql readable datetime -

my date , time string is: january 28, 2010 1417 last 4 numbers being time. how should go converting string acceptable mysql? when try using strtotime warning: strtotime(): not safe rely on system's timezone settings. $timestamp = strtotime($string); date("y-m-d h:i:s", $timestamp);

api - create lua5.2 library from c++ -

i've got experience c lua api, i'm trying create library c++. have following c++ code in main.cpp : #include <lua.hpp> #include <iostream> //library function int mylibfunction(lua_state* l){ int argc = lua_gettop(l); for(int i=0; i<argc; i++) { std::cout << " input argument #" << argc-i << ": " << lua_tostring(l, lua_gettop(l)) << std::endl; lua_pop(l, 1); } lua_pushstring(l, "return value"); return 1; } //the library static const struct lual_reg cfunctions[] = { {"mylibfunction", mylibfunction}, {null, null} }; //library open function int luaopen_test (lua_state *l) { lual_newlibtable(l, cfunctions); lual_setfuncs(l, cfunctions, 0); return 1; } int main(int argc, char* argv[]) { lua_state *lua_state; lua_state = lual_newstate(); static const lual_reg lualibs[] = { { "base", luaopen...

spring - How can update the Grails ElasticSearch Plugin to the latest Version of ElasticSearch? -

i want use grails elasticsearch plugin seems outdated because uses version 0.17.8.1 of elasticsearch whereas current released version 0.90.3. what have update plugin latest version of elasticsearch? is enough change follow in buildconfig.groovy? compile 'org.elasticsearch:elasticsearch-lang-groovy:1.2.0' to compile 'org.elasticsearch:elasticsearch-lang-groovy:1.5.0' what else have change? you need update this line use 0.90.3. unable give more details right using phone.

ios - Building a flexible editing form for attributes of an NSManagedObject subclass -

i have nsmanagedobject subclass 30 different attributes. in app, user should able edit (most of) attributes in table. there 3 attributes automatically set based on values of other combinations of attributes. example: @implementation mynsmanagedobjectsubclass @dynamic one; // edited user in form @dynamic two; // edited user in form @dynamic three; // edited user in form @dynamic four; // edited user in form @dynamic five; // edited user in form @dynamic icon; // automatically set based values of above 5 items @end i have 2 questions: 1) regarding building form in table view user can use edit objects : other hard-coding content of table view, how can table view build cells attributes needs show? current idea use this method iterate through properties of object , have binary "display mask" table view can use determine whether or not should display cell particular item. there better way? 2) regarding automatically setting 1 attribute based value of others : how? th...

drupal - Passing a variable to setTimeout() -

i've installed jcarousel on drupal 7 need scroll horizontally both sides when client hovers on arrows. i've been trying pass variable timeout function , doesn't seem work. in following code timeout recognizes only: var n = function () {c.next();}; need able tell timeout either scroll left or right using c.prev() or c.next() depending on arrow user clicked. var c = this; var k = 1; var n = function () {c.next();}; if (k == 1) n = function () {c.prev();}; if (k == 5) n = function () {c.next();}; this.timer = window.settimeout(n, 500) i've tried way , doesn't work either. var c = this; var k = 5; this.timer = window.settimeout(function() {c.nextprev(k);}, 500) ... nextprev: function(k) { if (k === 1) return "prev()"; if (k === 5) return "next()"; } any or guideline appreciated! try this, doesn't feel 100% right, introduces techniques seem need: c.nextprev execute , return function needed, capturing c , k closu...

java - AWS.SimpleQueueService.NonExistentQueue Exception thrown when Accessing Existing SQS queue -

i relatively new aws sqs services. have written code wrap amazon sqs api. i able perform basic functionality created queues, despite (in fact have been using code ever no problem, , creating junit tests formality), failing junit test because of error makes little sense me. i have created queue names serenaqfortest using aws management console. when @ aws console can see queue have created listed. have set permissions on queue open everyone. coding in java. when try interact queue, amazonserviceexception error code aws.simplequeueservice.nonexistentqueueerror. here code. in junit class: /** * prefix queues used run junit tests. */ private static final string testq = "serenafortest"; /** * ensures queue exists. */ @test public void testexists() { system.out.println("junit test exists."); cloudsqs cloudsqs = new cloudsqs(); // queue exist , can see through aws management console in sqs asserttrue(cloudsqs.exists(testq)); // queu...

jquery - Dynamically Removing Record from pageBlockSection in Visualforce -

i've built visualforce page below jquery snippet dynamically adds pageblocksection when button "add dev" clicked. <apex:commandbutton value="add dev" action="{!newdev}" rerender="devs" oncomplete="scroll();"/> <script type="text/javascript"> var j$ = jquery.noconflict(); function scroll(){ var docheight = j$(document).height(); var winheight = j$(window).height(); j$('html,body').animate({scrolltop: docheight - winheight}, 1000); } </script> below method adding newdev. want add button within pageblocksection executes removedev method that, when clicked, removes pageblocksection it's in both view , list dev. public void newdev(){ devs.add(new development__c(change_set__c = changeset.id)); } i've tried deleting dev through dml operation, causes error. i've tried removing dev .remove list method doesn't seem right approach. i...

php - JMS serializer can't serialize: cannot access private property -

i'm trying serialize doctrine2 entity json using jms serializer bundle. have set up, when try serialize json following error: fatal error: cannot access private property snow\frontbundle\entity\district::$id in e:\school\socialgeo augustus\coding\socialgeo-php\vendor\jms\metadata\src\metadata\propertymetadata.php on line 46 this controller code: public function indexaction() { $em = $this->getdoctrine()->getmanager(); $districts = $em->getrepository('snowfrontbundle:district')->findall(); $serializer = $this->get('jms_serializer'); echo $serializer->serialize($districts, 'json'); return array( 'districts' => $districts ); } and lastly, district entity: <?php namespace snow\frontbundle\entity; use doctrine\orm\mapping orm; /** * district * * @orm\table(name="district") * @orm\entity(repositoryclass="snow\frontbundle\entity\repositories\districtrepository") */ class di...

model - columnfamily setup for nested structure cassandra -

i have data nested - a -> bb (multiple columns name values bb) -> bb -> ccc (multiple columnn name values ccc) -> bb -> ddd (multiple columnn name values ddd) -> cc -> eee (multiple columns name values eee) p -> qq p -> qq -> rrr p -> qq -> rrr -> ssss -> ttttt...... .... for input 'a' , need things under 'a'. input 'bb' things under 'bb' , on. with no defined limit on nesting, best way model in cassandra. composite column, need know how many nesting levels in advance not sure thats going work out well. i.e. composite column (a:bb:ccc) break if encounter more nested structure. any suggestions........ have looked using maps/dicts column type? post explains different collection types available in cassandra

ios - Where the background image get loaded? (Need to change it) -

this question has answer here: implementing splash screen in ios 10 answers i need change initial background of application. when debug ios code, found initial windows's background set before enter - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions i wondering what's possible place set background image. in project's summary settings, can set default loading image. here can set icon! project > summary make sure images choose have correct dimensions .. if manually, swap project's files called "default.png" , default-568h.png" ones of choice. files located in projects root folder see: https://www.google.se/search?q=project+summary+xcode&safe=off&client=safari&hl=en-gb&source=lnms&tbm=isch&sa=x&ei=dp8furnhopdp4qskiih4ag&ved...

sql - Optimized query with performance measurement (from mysql to) in postgresql -

select m.title , m.run_time movie m m.run_time < (select avg (run_time) movie) *1.1 , m.run_time > (select avg (run_time) movie) *0.9; it costs 4.6 8 in postgresql baisically selects title&runtime of movies within 10% of average runtime. movie table goes this: create table movie ( title varchar(40) not null, production_year smallint not null, country varchar(20) not null, run_time smallint not null, major_genre varchar(15) , constraint pk_movie primary key(title,production_year) ); and has 101 entries. since "select avg (run_time) movie" used twice, thought of sticking average in variable, , referring variable in 2nd query. mysql looks this, runs, , sum of 2 commands times shorter reference query above. set @average = (select avg (run_time) movie); select m.title , m.ru...

python - @reboot cronjob not executing -

i have python script writes text , saves file #! /usr/bin/python3 def main(): filename = '/home/user/testhello.txt' openfile = open(filename,"w") print("hello cron", file = openfile) if __name__ == "__main__": main(); i want execute script @ startup via cron. edit crontab listing using >crontab -e my entire crontab looks : shell = /bin/bash path = /sbin:/bin:/usr/sbin:/usr/bin mailto = root home = / # run-parts 1 * * * * /home/user/tester.py @reboot /home/user/tester.py this location of file, , file has permissions execute. can run file no problem script commandline. yet when restart machine, no file generated. trying understand why, , played around crontab entry. @reboot /usr/bin/python3 /home/user/tester.py this didn't work either. edit: ps aux | grep crond gives me user 2259 0.0 0.0. 9436 948 pts/0 s+ 23:39 0:00 grep --color=auto crond i unsure how check if crond running, or i...

html - jquery form submission not working -

i'm using jquery-1.10.1 , html code is: <li> <a href='' id='logout'>log out</a></li> <form id='logout_form' method='post'> <input type='hidden' name='logout' value='true' /> </form> my jquery code @ end of every document: <script type="text/javascript"> $(function() { $("#logout").click(function(){ $("#logout_form").submit(); }); }); </script> and php code this: if(!empty($_post['logout'])){ $object=new logout(); $content='5;url='.$path.'index.php'; } but form submission not working. pls me. the problem href=' ' attribute, remove it change this: <a href='' id='logout'>log out</a> for this: <a id='logout'>log out</a> you can add css avoid lost pointer cursor <style> a{cursor:pointer}...

com.google.gwt.dev.Compiler Wont Start when compiling large GWT project -

i have large gwt project compile output javascript of 3.5mb when compile. project not modularized , not use runasync. of thursday 8/9/2013 project compiling fine in development environments (as on build servers) developers. starting friday (8/9/13) none of these environment compile. java sources compile fine build stops tries run com.google.gwt.dev.compiler. some facts: 1. gwt versions (i have projects on 2.3 , 2.5 , wont compile more) 2. there no significant size changes day before when projects compile fine without problems 3. compiles not working single browser (user-agent) , single locale 4. smaller gwt projects -- including new projects created test compiling; work fine , compile ok 5. have tried on both 64bit , 32bit platforms ram in excess of 12gb on dev boxes 6. dev environments , build servers windows based any ideas on has changed , can make com.google.gwt.dev.compiler fire again these projects. i disturbed synchronized-like in dev environments stopped working on sa...

Java Error: The constructor is undefined -

in java, why getting error: error: constructor weightin() undefined java code: public class weightin{ private double weight; private double height; public weightin (double weightin, double heightin){ weight = weightin; height = heightin; } public void setweight(double weightin){ weight = weightin; } public void setheight(double heightin){ height = heightin; } } public class weightinapp{ public static void main (string [] args){ weightin weight1 = new weightin(); //error happens here. weight1.setweight(3.65); weight2.setheight(1.7); } } i have constructor defined. add class. public weightin(){ } please understand default no-argument constructor provided if no other constructor written if write constructor, compiler not provided default no-arg constructor. have specify one.

ruby on rails - Is it possible to view a remote database in heroku on my computer (using Induction)? -

in rails 4 application directory, typed "heroku pg:credentials database" terminal information database application deployed on heroku. since i'd view data inside postgresql database, tried inputting information induction, ended not responding , forced enter activity monitor , force quit. followed same procedure several more times same result. version of induction faulty? should using different program view database? or doing wrong? i'm new rails, help! yes, can. heroku postgres allows connections outside heroku's network. credentials displayed heroku pg:credentials need , should work. maybe try using official pgadmin tool instead?

database - Does the foreign key in sqlite store the whole value, or just the pointer to the actual value in other table? -

i have table thousands of records, each of them have field "region", can have 1 of 6 values - "north america", "south america", "asia", etc. size of db decrease if create separate table "regions" , point original db's region field new table foreign key? your region strings stored 1 byte per character, while small numbers can stored in single byte. database size indeed decrease. (the theoretical number of saved bytes determined select sum(length(region) - 1) mytable , dividing of pages records, , additional page needed store regions table, reduce that.)

css - How to add some pixels to the current height of div -

i want increase height of div rendered 10px additional in advance auto. in css have set height of div auto css : div { height: auto; } but want this: div { height: auto + 10px; } use padding. div { height: auto; padding-bottom: 10px; } or div { height: auto; padding-top: 10px; } or div { height: auto; padding-top: 5px; padding-bottom: 5px; } if not desired add jquery css below: css: div#auto10 { height: auto; } javascript: $(document).ready(function(){ $('#auto10').height($('#auto10').height() + 10); });

html - Diffifcult in finding two different iframes with same tag -

i'm trying find xpath given within iframe html/body tag. there 2 comment boxes same tags in application. need find unique id this. <tbody> <tr class="mcefirst" role="presentation"> <td class="mceiframecontainer mcefirst mcelast"> <iframe id="summary_ifr" frameborder="0" src="javascript:""" allowtransparency="true" title="rich text areapress alt-f10 toolbar. press alt-0 help" style="width: 100%; height: 260px; display: block;"> <html> <head xmlns="http://www.w3.org/1999/xhtml"> <body id="tinymce" class="mcecontentbody " contenteditable="true" onload="window.parent.tinymce.get('summary').onload.dispatch();" dir="ltr"> </body> </html> </iframe> </td> </tr> ...

javascript - Form to use AJAX rather than a page refresh but also utilise error handling? -

i have webform integrate on site. http://app.bronto.com/public/webform/render_form/gmy3v1ej883x2lffibqv869a2e3j9/37ea72cebcc05140e157208f6435c81b/addcontact/ firstly error handling. if don't enter name or valid email, validation messages appear on page, after page refresh. secondly, on submitting valid (not empty) name , valid email address, submits , redirects (redirect url site offline). my question is, how can serialize form not refresh page both error message display , submit? if submitted no errors message such "you have been subscribed" should appear. i have tried if data == success displaying success message no luck. can't seem error messages displaying if it's not success, presume issue determining if there's error or success. in short, i'm trying use ajax error messages , success message on submit, without refresh. any ideas on one? thanks i think jquery.form may suit you, used submit form without refresh, , famous. the...

boost - interval map in C++ -

i need map intervals (actually these intervals of addresses) object ids. i tried use boost's interval_map, example looks pretty, enumerates intervals like: while(it != party.end()) { interval<ptime>::type when = it->first; // @ party within time interval 'when' ? guestsett = (*it++).second; cout << when << ": " << << endl; } which outputs: ----- history of party guests ------------------------- [2008-may-20 19:30:00, 2008-may-20 20:10:00): harry mary [2008-may-20 20:10:00, 2008-may-20 22:15:00): diana harry mary susan [2008-may-20 22:15:00, 2008-may-20 23:00:00): diana harry mary peter susan [2008-may-20 23:00:00, 2008-may-21 00:00:00): diana peter susan [2008-may-21 00:00:00, 2008-may-21 00:30:00): peter but cannot this: interval<ptime>::type when = interval<ptime>::closed( time_from_string("2008-05-20 22:00"), time_from_string(...

android - proximity alert does not fire and notify -

does know issue cause fire alert not working when proximity radius? has been struggled week in solving issue , appreciated if can me out on issue or give me guide complete it. mainactivity.java import android.location.locationmanager; import android.os.bundle; import android.app.activity; import android.app.pendingintent; import android.content.context; import android.content.intent; public class mainactivity extends activity { private static final long point_radius = 150; // in meters private static final long prox_alert_expiration = -1; // not expire private static final string prox_alert_intent = "com.example.myalert"; private locationmanager locationmanager; double latitude = 2.81202, longitude = 101.75989; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); locationmanager = (locationmanager) getsystemservice(context.loc...

html - Create dynamic sitemap from text file using php -

i have create dynamic site map uni assignment using php. first time studying php please bare me if terminology little wrong! basically (at suggestion of tutor) have saved names of links in text file called "sitemap.txt". these names names of pages minus extensions , supposed use content generate link. content looks this: index,services,contact us,register,login,class manager my code below: <?php $fp = fopen("sitemap.txt", "r"); echo '<p class="smallertext">'; while(!feof($fp)) { $line = fgets($fp); $array = explode(",", $line); } fclose($fp); $num_elements = count($array); $list = '<ul class="serviceslist" name="sitemap">'; for($count = 0; $count < $num_elements; $count++) ...

java - Restlet & MULTIPART_FORM_DATA or another way to put files on Google App Engine via Restlet -

i tried receive files via restlet gets complete multipart_form_data. how can extract specific file? i found code-blocks types of them not available... restlet: how process multipart/form-data requests? diskfileitemfactory factory = new diskfileitemfactory(); factory.setsizethreshold(1000240); // 2/ create new file upload handler restletfileupload upload = new restletfileupload(factory); my current code: @put public void handleupload(representation entity) { if (entity !=null) { if (mediatype.multipart_form_data.equals(entity.getmediatype(), true)) { request restletrequest = getrequest(); response restletresponse = getresponse(); httpservletrequest servletrequest = servletutils.getrequest(restletrequest); httpservletresponse servletresponse = servletutils.getresponse(restletresponse); try { upload2(restletrequest, entity); } catch (ioexception e) { // todo au...

c# - Why are ListBoxItems added in XAML not styled? -

why listboxitems declared within xaml not affected datatemplate? template fine when bind source, , that's i'll doing ultimately, wondering why declared items aren't styled. <listbox> <listbox.itemtemplate> <datatemplate> <grid> <textblock text="{binding}" foreground="red"/> </grid> </datatemplate> </listbox.itemtemplate> <listboxitem>lbi 1</listboxitem> <listboxitem>lbi 2</listboxitem> </listbox> here lbi 1 , lbi 2 not red if use listbox.itemsource , bind list, items red. you need apply style . datatemplate used apply template data bound listbox. hence not applying items directly added child within xaml. <listbox> <listbox.resources> <style targettype="listboxitem"> <setter property=...

php - How do I join tables from two different PDO object? -

i don't know how must join tables 2 different pdo object. hope of can me solve problem. respons. $dbsql = new pdo('mysql:host=localhost;dbname=dbpenggajian', $user='root', $pass=''); $dbaccess = new pdo("odbc:driver={microsoft access driver (*.mdb)};dbq=d:\\kepegawaian arto moro\back_up_absensi\tj_main_data.mdb; uid=username;pwd=everyday;"); and experiment code $acc=$dbaccess+$dbsql->query("select * dbaccess.hr_personnel h right join dbaccess.ta_record_info on h.id=a.per_id inner join dbsql.pegawai_tetap p on h.per_code=p.nip ;"); while($k=$acc->fetch(pdo::fetch_assoc)){ but still error fatal error: call member function fetch() on non-object please me. thanks that's impossible, of course. you have import odbc table in mysql first.

javascript - Google charts not cooperating with me -

i have few issues google chart: i want y-axis 0 20 , grid-line should occur every 2 points: i'll have 0,2,4,6,8,10,12, etc , i'm trying achieve line of code 'vaxis':{ title: 'score', titletextstyle: {color: '#27318b'}, maxvalue:20, minvalue:0, gridlines: {count:10, color:'#27318b'} } but starts @ 0 , ends @ 22,5 , shows grid line @ every 2,5. don't understand why is? i want width of graph 100%, when change (wether in html or javascript) width of 100% height gets small nothing readable anymore, if specified height. in jquery var options = {'width':800, 'height':600} in html <div id="chart_div" style="width:800; height:300"> try increasing gridlines count 1, since there 11 values between 0 , 20 step size of 2. regarding question width , height, better see code trying use can see trying do. want width of graph 100%, 100% of what? container or page? want called cha...

javascript - CSS nth-of-type not selecting in order -

i use jquery add different classes repeating div it's not working expected… here's javascript: $('div.cake:nth-of-type(1n)').css('border-bottom', '3px solid red'); $('div.cake:nth-of-type(2n)').css('border-bottom', '3px solid blue'); $('div.cake:nth-of-type(3n)').css('border-bottom', '3px solid green'); $('div.cake:nth-of-type(4n)').css('border-bottom', '3px solid yellow'); and html: <section id="menu"> <h1>title</h1> <p>texty text lorem ipsum blah blah</p> <div class="cake"> <a href="#"><img src="http://lorempixel.com/400/400/food/1/" /> <span class="caption">image 1 here</span></a> </div> <div class="cake"> <a href="#"><img src="http://lorempixel.com/400/400/food/2/...

c# - Lucene.net - How do I extract small snippets of texts from each match? -

http://quranx.com/search?q=oh+people+of+heaven&context=quran could tell me how change following code show snippets of text each match result? i've tried reading through examples etc can find relevant information newer version of lucene java. lucene seems of black box of magic me. public static ienumerable<searchresult> search( string querystring, out int totalresults, int maxresults = 100) { totalresults = 0; if (string.isnullorempty(querystring)) return new list<searchresult>(); var query = new multifieldqueryparser( lucene.net.util.version.lucene_30, new string[] { "body", "secondaryreferences" }, analyzer ).parse(querystring); var indexreader = directoryreader.open( directory: index, readonly: true); var indexsearcher = new indexsearcher(indexreader); var resultscollector = topscoredoccollector.create( numhits: maxresults, docss...

php - How to login to website without a page refresh -

i using twitter bootstrap modal window registration form. when click on "register" after filling form, sends data mysql , session begins. how ensure 1 remains @ same webpage has clicked "register" link. <!doctype html> <html> <head> <link href="http://www.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> <script src="http://www.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script> <script> $(document).ready(function(){ $("#ajax-contact-form").submit(function(){ var str = $(this).serialize(); $.ajax( { type: "post", url:"register_process.php", data: str, success:function(result) { $(...

File Upload Module in Apache2 Ubuntu (solved) -

i'm newcomer/hobbyist go easy on me. have searched , experimented quite bit before asking. system: linux-mint-14-kde (based on ubuntu 12.10) server: apache2 installed via sudo apt-get install apache2 my goal able allow remote users upload files, via form, directory. from site: commons.apache.org/proper/commons-fileupload/ <form method="post" enctype="multipart/form-data" action="fup.cgi"> file upload: <input type="file" name="upfile"><br/> notes file: <input type="text" name="note"><br/> <br/> <input type="submit" value="press"> upload file! </form> i added code index.html , form shows ok. when go upload files, returns: the requested url /fup.cgi not found on server. the apache2 documentation hard follow. /etc/apache2/sites-available added 1 part cgi <directory /var/www/> options indexes followsymlinks multiv...

android back button doesn't close my dialog -

i have activity layout. open dialog it. when click button, doesn't work , don't close , activity. i know can solve overriding onkeydown() method, want know why problem occurred. about 2 days ago, worked , haven't problem it. want know how solve problem? here dialog class code: package digitaldreams.ddvolume; import android.app.dialog; import android.content.context; import android.media.audiomanager; import android.os.bundle; public class dialogvolume extends dialog { context cont; public dialogvolume(context context) { super(context); cont=context; // todo auto-generated constructor stub } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); . . . } @override public boolean onkeydown(int keycode, keyevent event) { //****** super.onkeyup(keycode, event); ***** if forget line . . ...

php - iconv Detected an illegal character in input string -

i don't know chinese language. faced problem using these codes: iconv('utf-8', 'gb2312', '在世界自由软件日给中国自由软件爱好者的视'); runs ok no problem. and one: iconv('utf-8', 'gb2312', '冠軍集團安心居台北旗艦總店開幕酒會暨記者會'); which causes error: message: iconv(): detected illegal character in input string both chinese what's difference? your second string not gb2312 encode, it's big5 encoding. so, should use 'gbk' 'from encoding' instead, covers gb2312 , big5.

javascript - google analytics to track goal conversions - re directs -

i using google analytics track goal conversions, using bridge page re directs user affiliate website. i have question regarding time out before re directs. what's quickest time can set page redirect google can collect analytics goal conversions data? below code use on bridge page before redirects, it's set to: 1500 - 1 , half seconds delay. <script type="text/javascript"> settimeout(function(){ window.location = "http://www.example.com"; },1500); </script> any feedback appreciated. many paul you can use analytics events make sure redirect recorded before it's redirected. //fires after page load addlistener(document, 'load', function() { //sends event page action redirect , value current page ga('send', 'event', 'page', 'redirect', document.location); //refferes new location after recording action. window.location = new_location });

PHP - Code only giving one value from Mysql database, while it should give more -

i have piece of code executes calendar. on calendar names have appear. however, on each date appears 1 name, while in database dates hold 20 names. this image should clarify things: http://imgur.com/a31pj0s in image can see each date, on of them 1 name. stated before, of these contain many more names. now, understand why not work, executes once, how can work? please me out :) here link same piece of code, except easier read: http://codepad.org/tvszhdtx <?php $j = 2; $i = 1; //query database $query = mysql_query("select * months"); //fetch results / convert results array echo '<div class="accordion" id="calendar">'; while($rows = mysql_fetch_array($query)) { $month = $rows['month']; $id = $rows['id']; echo ' <div class="accordion-group"> <div class="accordion-heading" id="month_'.$id.'"...