Posts

Showing posts from April, 2012

jquery - How to get to the 2nd "span" tag and change the displayed text there? -

Image
i'm using jquery v2.0 the "span" tag , change text value there. i'm getting javascript error saying "object doesnt support property or method text". here's html resposne in firefox's firebug. excuse typo below if there's any. i'm able objects when using "var $grouprows" no problem. it's use of "text()" don't work. var jqgridgroups = $('#' + jqgridspreadsheetid).jqgrid('getgridparam', 'groupingview').groups; if (jqgridgroups != undefined) { //this means columns aren't being grouped... var jqgridgroupslength = jqgridgroups.length; for(var x = 0; x < jqgridgroupslength; x++) { var $grouprows = $('#' + jqgridspreadsheetid).find(">tbody>tr.jqgroup>td").eq(1)[0]; $grouprows.innertext.text("ddd"); //$grouprows.text("eee"); } } you need use innertext javascript dom object instread

.net - In C# how do I get the file position of each text row in an output file (as it is being written)? -

as write text lines temp file, i'd store file position of each line future random access. this not work streamwriter outfile; { ... fpos[i++] = outfile.basestream.position; } fpos values in above loop 0,0,0,...,1024,1024,...2028,2048 etc - i.e. physical positions. the following work away buffering: { ... outfile.flush(); fpos[i++] = outfile.basestream.position; } is there better way (logical) file position go without giving buffering ? if data small enough fit in memory, have streamwriter write memorystream . flush after each line, , memory stream's position before writing each line. , when you're done writing data memory stream, copy file. if data larger fit in memory, use memorystream buffer, , flush memory stream disk file whenever fills up. take little bookkeeping, wouldn't terrible. slightly more involved create own class derived bufferedstream counts bytes written it. open stream writer buffer siz

php - simpleXML error with google calendar feed with pdo on server -

i using php grab google feed simplexml display on site. works fine staged on test server (no pdo). installed live on site , worked. needed update cms needed either pdo or mysqli , host installed pdo extensions. after no longer worked. here error message: : call member function asxml() on non-object in /home/cactusta/public_html/calendar.php on line 121 here relevant part of script using: // private feed - right-clicking 'xml' button in 'private address' section of 'calendar details'. if (!isset($calendarfeed)) {$calendarfeed = "myfeed.com/public/basic"; } // date format want details appear $dateformat="j f y"; // 10 march 2009 - see http://www.php.net/date details $timeformat="g.ia"; // 12.15am // timezone user/venue in (i.e. time you're entering stuff in google calendar.) http://www.php.net/manual/en/timezones.php has full list date_default_timezone_set('europe/london'); // h

actionscript 3 - how to access dynamic/static movieclip with linked class? -

hi question still bothering me. looks simple. got movieclips in lib , on stage has link-class "box.as" , linked "circle.as". want access movieclip of box.as circle.as or vice-versa. public class circle extends movieclip { private var _circle:movieclip; private var _box:box; public function circle() { _circle = new movieclip(); if (stage) onstage(); else this.addeventlistener(event.added_to_stage,onstage); } private function onstage(e:event = null) { _circle = stage.getchildbyname("blue_circle") movieclip; this.addeventlistener(event.enter_frame,hittarget); } private function hittarget(e:event):void { if (_circle.hittestobject(_box.mc)) //test if 2 movieclips colliding { // _box.mc created same _circle trace("hi"); } } this code ain't workin. , wanted use 1 can access if movieclip wasn't on stage(which h

google app engine - What are the characters appearing at the end of my appengine URL -

i have appengine python application. includes simpleauth library. viewing application in google chrome. after load page in application, text looks (for example) "#.uhjcz2twka4" appended end of url. what , come from? upon edit, maybe it's 1 of javascript includes doing it. here javascript includes: <script type="text/javascript" src="/static/js/tinymce/tiny_mce.js"></script> <script type="text/javascript" src="//use.typekit.net/dvk0ttp.js"></script> <script type="text/javascript">try{typekit.load();}catch(e){}</script> <script type="text/javascript" src="//api.filepicker.io/v1/filepicker.js"></script> <script src="/static/js/bootstrap.min.js"></script> thanks in advance, aaron looks you're using addthis apis , have enabled address bar tracking appends "strange" characters page url. those

Chrome occasionally renders my HTML/CSS differently -

Image
i started learning html/css , trying make personal site scratch (no css tools) when tested site in firefox , ie last night looked nice , clean seen when tested site in chrome links got moved around: does know happened here? markup: <!doctype html> <html> <head> <title>home | website!</title> <style> * { padding: 0; margin: 0; } body { width: 960px; font-size: small; font-family: verdana, helvetica, arial, sans-serif; line-height: 1.6em; background-color: #fffff0; margin: 0 auto; } #header { border-style: solid; } #header img { margin: 4px 0px 0px 4px; } #header ul { list-style-type: none; display: inline;

Where parameters in EntitydataSource from dropdown control -

using following markup, details view not populating when dropdown selected. id parameter come dropdwon selected value.it appears control parameter not functioning properly. <asp:updatepanel id="updteditcontact" runat="server"> <contenttemplate> <asp:dropdownlist id="ddlcontacttoedit" runat="server" cssclass="dropdowns" autopostback="true" clientidmode="static"/> <asp:detailsview id="dveditcontacts" runat="server" height="50px" width="125px" autogenerateeditbutton="true" cssclass="mgrid"/> <asp:entitydatasource id="edsselectedcontact" runat="server" connectionstring="name=webentities" defaultcontainername="webentities" enableflattening

c# - Can I use ".fxh" file extensions in XNA? -

in code have run problem program can not auto-detect importer use file included in content pipeline. how enable xna import .fxh files in game? set file's build action none . prevent going through content pipeline, #include directives should still work fine.

ajax - jQuery condition for stop setInterval polling -

i have following jquery code: <script> $(document).ready(function() { setinterval(function() { $.get('async', function(data) { $('#datum').text(data); } ); }, 1000); // 1000 milliseconds = 1 second. }); </script> in case present string result servlet called async using following html: the string either contains word running, or completed. want stop polling in above if data variable contains "completed". have tried following code snipplet confused place it, or if correct: if (data ==="completed") { (var = 1; < 99999; i++) {window.clearinterval(i);} } i have tried if ( $('#datum').text(data) ==="completed" ) { (var = 1; < 99999; i++) {window.clearinterval(i);} } i have made multiple attempts, of break functionality. without attempting stop polling, above

linux - Accidently Deleted GL folder located at /usr/include/GL -

[i working on fedora 19 x64] this sounds silly intended remove gl folder located @ /usr/local/include. accidently removed gl folder located @ /usr/include. so have kind of lost gl.h, glu.h , many other header file. is there way fix this. you have reinstall following packages: sudo yum reinstall mesa-libgl-devel sudo yum reinstall mesa-libglu-devel

c# - xna zoom using mouse scroll wheel -

how zoom using mouse scroll wheel, got try this if (currentmousestate.scrollwheelvalue < originalmousestate.scrollwheelvalue) { cameraposition += new vector3(0, -1, 0); updateviewmatrix(); currentmousestate.scrollwheelvalue.equals(0); } if (currentmousestate.scrollwheelvalue > originalmousestate.scrollwheelvalue) { cameraposition += new vector3(0, 1, 0); updateviewmatrix(); currentmousestate.scrollwheelvalue.equals(0); } but keep zooming in if scroll once , kinda new xna. please help. scrollwheelvalue gets cumulative mouse scroll wheel value since game started, every time need copy value in variable, in order compare next cycle. moreover, can't set scrollwheelvalue , , line wrong: currentmousestate.scrollwheelvalue.equals(0); i think idea set value 0, instruction compares value 0 , gives boolean. edit: should this: declare global

audio - In C#, how to make wav form file? -

i'm developing collaborating music files. know how read file in c# don't know how make "wav form" file' after merging music files. how go that? i think these classes used: wavestream; wavechannel32; directsoundout

c - Draw when called -

i'm trying draw table of colors (already constructed) selected area in window. i'm learning this source. however, in of given code examples, draw being carried out window opened. what should if want drawing occur when click menu item, or not in beginning? edit: i created new window called gifpanel drawn. my variables: hwnd gifpanel; rect r; my gifpanelproc: case wm_paint: drawframe(gifpanel); // drawframe uses beginpaint, setpixel, endpaint in order draw break; next, have function click following: getclientrect(gifpanel, &r); invalidaterect(gifpanel, &r, false); when first opening window, can see gifpanel has red background (just test working). after executing process above, no pixels changed. explain why? a window required draw whenever receives wm_paint message; typically wm_erasebkgnd message first erase background. if don't want draw table need keep flag can test in wm_paint handler skip drawing of table. in m

node.js - Asyncjs Waterfall and SinonJS stub -

how can stub @ra.do_post goes "step 2" right when run spec inside async.waterfall after step1 goes step 5 what think in spec not returning callback go step2 scroll end see doing. bunch in advance ra = require('./request_adapter') class queryhandler constructor: (@adapter) -> @ra = new ra() create_test: (id, data, cb) -> self = _url = url + adapter_apis.create bll_url = "http://localhost:" + 11 + "/" + bll_apis.pkg_switch async.waterfall [ (done) -> console.info("step 1 ==================") @ra.do_post some_url, data, done , (resp, done) -> console.info("step 2 ==================") console.info(resp) if resp? , resp.status isnt "success" console.info("step 3a ==================") cb({error: true, message: "error."}) else console.info("step 3b ==

Differences between Keyword Arguments in Ruby 2.0 and Interleaved method signatures in Objective-C -

i've been playing macruby, , noticing how extends ruby able handle smalltalk-like method (or message ) signatures of objective-c. @ first glance, thought looked lot new keyword arguments of ruby 2.0, further inspection shows work in fundamentally different way. my first clue when reading macruby method spec on github . it "can have multiple arguments same name" def @o.dosomething(x, withobject:y, withobject:z); x + y + z; end @o.should have_method(:'dosomething:withobject:withobject:') @o.should_not have_method(:'dosomething') end as far know, behavior not allowed in ruby 2.0, because withobject: part used sole identifier parameter, , therefore there not 2 same name. is insurmountable problem? macruby forced remain ruby 1.9 because of this? the key difference between keyword arguments , interleaved arguments you've guessed; keywords not part of method name (the selector in objective-c). specifically, can't reorder o

linuxmint - Linux Mint Cinnamon CSS theme misbehaving -

i trying create cinnamon css theme, i'm having strange issue. as can see below, have set .menu-application-button:hover , .menu-application-button-selected 's backgound-colour attribute #3478db . this works fine except when scrollbar present, background appears white. bizarre, have not set white in menu code @ all. have tried using !important problem still persists. is silly mistake done me, or bug in cinnamon? , if mistake how can fix it? here's menu code: /* =================================================================== * menu (menu.js) * ===================================================================*/ .menu-favorites-box { width: 50px; margin: auto; padding: 10px; border: 1px solid #aaa; border-radius: 3px; background-color: rgba(85,85,85,0.1); transition-duration: 100; } .menu-favorites-button { padding: 10px; } .menu-favorites-button:hover { padding: 10px 4px 10px 16px; } .menu-help-button { padding-top: 2px; padding-left: 5px; padding-right:

sql - Joining Tables and Displaying Result as Text, in one column -

i need join 2 columns 2 tables , display them in specific order table1 , columnnm table2 , columndesc the primary key columnid i have multiple rows of columndesc each columnnm. have display in following format: columnid columnnm ------------------- columndesc columndesc columndesc columndesc columnid columnnm ------------------- columndesc columndesc columnid columnnm ------------------- columndesc columndesc columndesc i have display results text, instead of grid. suggestions on how this? have create stored procedure. appreciated. below far got: declare @name nvarchar(max), @lesson nvarchar(max), @lb nvarchar(max) set @lb = '----------------------------------------------------' select @name = module.name module join lesson on module.modulesequence = lesson.modulesequence module.modulesequence = 1 print '1 ' + @name print @lb select lesson.description module join lesson on module.modulesequence = lesson.modulesequence module.modulesequence = 1

git - how to put an eclipse project into github -

i have empty repo in git hub. have project full of code in eclipse. have egit plugin installed in eclipse. if right click on project, , share, select git, gives option create local repo - no ability select remote 1 check code or clone. this seems massive omission in plugin. not sure now. install external git command line, , there, kind of defeats object of git plugin. guess need clone emtpy repo in emtpy dirctory using git command line, copy project on using file explorer, add, commit , push files repo. guess need create new project in eclipse, , try , check project out scratch git, delete old project. not sure files have avoid copying though. surely there easier way? any ideas? here have do: clone remote repo using action in "git repositories" view "share" project local repo created clonining commit code local repo using "commit" action on repo in "git repositories" view or team -> commit on project. push chang

c - Reading multiple user input strings inside a loop -

trying solve problem codechef having troubles using fgets() inside loop. the first input (t) going positive integer containing number of user inputs. delimited newline characters, user going input string below length of 10 under circumstances. so, i've tried this: #include <stdio.h> #include <stdlib.h> #define size 10 int main() { int t; int diffx, diffy; char s[size]; scanf("%d", &t); while (t--){ fgets(s, size, stdin); printf("%s\n", s); } return 0; } however, when attempted test code following inputs: 3 hello hi what i able input until "hi" program exited (returning 0). why case , how can fix it? thank in advance, kpark. fgets() consumes newline left behind first call scanf() . so, consuming 3 lines, first line looks empty line fgets() loop have. you can fix using fgets() first line too, , parse string number using sscanf() . fgets(s, size, s

html - Ribbon and stars - How to get this done without an image file? -

Image
i need create ribbon , stars (image attached) without image file. know how put stars in it, needing ribbon sides image attached. how can without image file, , pure css , html? thinking border-radius need manipulated here. this have far , terrible. how can use border-radius effect? i recommend combining css triangles pseudo elements :before , :after side triangles of ribbon, , html character ★ stars: working jsfiddle html: <h1>&#9733; kristine coady &#9733;</h1> <!-- &#9733; html star character --> css: h1{ /* regular attributes here */ background:#a52927; display:inline-block; padding:0px 30px; color:#eee4d3; position:relative; height:40px; line-height:40px; } h1:before{ /* create white triangle on left side */ position:absolute; content:""; top:0px; left:0px; height:0px; width:0px; border-top: 20px solid transparent; border-left: 20px solid white;

objective c - Sorting an nsmutable array --> order is not being saved? -

kind of noob question maybe: i'm trying sort nsmutablearray, somehow order not being stored. typedef struct { float distance; int index; } distanceandindex; = 0; nsmutablearray *ordereddistances = [nsmutablearray arraywithcapacity:(self.waypoints.count)]; cllocation* rwp2 = [[cllocation alloc] initwithlatitude:52.080752 longitude:4.7527251]; latlontoecef(rwp2.coordinate.latitude, rwp2.coordinate.longitude, 0.0, &myx, &myy, &myz); (routewaypoint *rwp in [[self waypoints] objectenumerator]) { double poix, poiy, poiz, e, n, u; latlontoecef(rwp.location.coordinate.latitude, rwp.location.coordinate.longitude, 0.0, &poix, &poiy, &poiz); eceftoenu(rwp2.coordinate.latitude, rwp2.coordinate.longitude, myx, myy, myz, poix, poiy, poiz, &e, &n, &u); distanceandindex distanceandindex; distanceandindex.distance = sqrtf(n*n + e*e);

html - Django Template: remove the buttons when session starts -

i trying make login authentication in django. have made sign in , sign buttons in upper navbar. now need achieve when sign in application redirection take place , @ time session checked , if session has started sign in , sign button disappears , user abc button comes @ place. i trying code snipped here is. {% if request.session.loggedin %} <li><a data-toggle="modal" href="#"><b>hello chitrank</b></a></li> {% else %} <li><a data-toggle="modal" href="#signup"><b>sign up</b></a></li> <li><a data-toggle="modal" href="#signin"><b>sign in</b></a></li> {% endif %} please suggest me , using wrong way check session or if there other way solution welcome. {% if user.is_authenticated %} is looking for. https://docs.djangoproject.com/en/dev/ref/templates/api/#django-contrib-auth-context-processor

Can you set the timezone with trigger.io calendar -

i using add calendar function of trigger.io part of app. wondering if there way set calendar time-zone items not default users' time-zone. i not see in trigger.io documentation time zones, appears support javascript. you need javascript time zone library such 1 of listed here .

How to change EMPTY_CHANGELIST_VALUE in Django Admin? -

in django/contrib/admin/views/main.py, can find: # text display within change-list table cells if value blank. empty_changelist_value = ugettext_lazy('(none)') how can cange value without use of translations , without overriding whole django-admin app? it looks need monkey patch empty_changelist_value . try put on top of settings.py : from django.contrib.admin.views import main main.empty_changelist_value = <your_value> it doesn't nice hope works you.

google chrome - Chromium: missing sass support -

Image
i tried enable support sass source mapping in chromium (v31.0.1606.0) seems there "support sass"-option missing in case. i followed instructions: http://fonicmonkey.net/2013/03/25/native-sass-scss-source-map-support-in-chrome-and-rails/ screenshot of "experiments"-window: see http://i.stack.imgur.com/uhfnp.png hint: tried google chrome canary , chrome v30 , didn´t worked either. this 1 got me too, after reading nettuts article on developing sass , chrome devtools. seems articles on subject outdated. turns out chrome v30 , later ship souce maps , sass support enabled defualt. in v29 , earlier have check "support sass" box. furthermore, according google: "currently sass preprocessor supports css source maps..." so long don't uncheck "enable css source maps" in dev tools > settings > general, can hack away @ scss/sass directly chrome. i followed google dev tools docs , got working on osx.8 canary 32.0

mysql - Is this valid "on duplicate key" syntax? -

i have no place test right , hoping knows don't have wait until tomorrow find out.... insert item_properties (itemid, propid, value, updateon) values (538, 25, 'some description stuff goes here', unix_timestamp()), (541, 25, 'some description stuff goes here', unix_timestamp()), (1276, 25, 'some description stuff goes here', unix_timestamp()), (1319, 25, 'some description stuff goes here', unix_timestamp()) on duplicate key update itemid = values(itemid), propid = values(propid), value = values(value), updateon = values(updateon) can re-written be: insert item_properties (itemid, value) values (538, 'some description stuff goes here'), (541, 'some description stuff goes here'), (1276, 'some description stuff goes here'), (1319, 'some description stuff goes here') on d

IOS Cancelling Local Notifications -

i dont asking vague questions couldnt tell problem is. in app set daily local notifications. shooting everyday @ 200pm. later removed codes sets local notifications, , added push notification feature. i test push , works (whenever want to). still old notifications well, because set them earlier somewhere on phone itself. there way cancel them without coding. example cancelled if remove app? uninstalling app remove local notifications, although people have reported cached 24 hours (so if delete app, don't reinstall more 24 hours) see here more details. otherwise, if still have access code can cancel local notifications this: [[uiapplication sharedapplication] cancelalllocalnotifications];

How do i install Linux on windows 8? -

i running on windows 8 acer s7 laptop. there vm can use load linux directly on windows 8? computer doesn't "boot" when starts. i assuming want boot pc see if works? ... there couple of options use windows 8 recovery disk use linux live cd, https://help.ubuntu.com/community/livecd allow boot pc , browse file system

android - Don't reload Activity orientation change but still reload Fragments -

im using mainactivity few fragments. in activity connect server. i used: android:configchanges="orientation|screensize" in manifest. so activity keeps connection on orientation change. but cant use different layout port/land (fragments). is there way force fragments reload on change without activity reloading? you need move network operations outside of activity/fragment lifecycle activity , fragments can work intended , can have long running network operations aren't interrupted activity , fragment lifecycles. remember activities , fragments meant dynamic, have narrow concerns, etc. they're not designed network operations. that's why there's emphasis on using background threads various things , why there services. example, use intentservice handle network operations. here's example of how activity deal resuming/updating information when configuration changes happen: https://stackoverflow.com/a/4481297/2306657

How do I track, pull, etc. from an existing git branch on Github -

i have master branch repository on github cloned on machine. there other existing branches in repository able switch , use. i'm trying use command: git branch --track nameofbranch origin/nameofbranch this isn't working me. error: error: requested upstream branch (url) not exist basically need create branch on local machine , tie existing branch. thank help! i think understand want. create local tracking branch can work on following should work. first need clone repository: $ git clone git://thisismyrepo.com/project $ cd project next find branch want working on: $ git branch -a that output branches in repo. next want switch on branch want work on by: $ git checkout origin/examplebranch in order work on branch can do: $ git checkout -b examplebranch origin/examplebranch that should cause track , allow work on local branch. hope helps.

jquery - Loading JavaScript File With Rails -

so running rails 3.2. in assets/javascripts folder have file " main.js.erb ". contents of file follows: $(function(){ $(document).load(alert("hello")) }) my application.js file default generated after install initiated ' rails new '. any ideas why load event not being triggered? since application.js default, haven't included file usage. following different ways can include file: in app/assets/javscripts/application.js //= require main in template file or layout file eg. app/views/layouts/application.html.erb <%= javascript_include_tag "main" %> for further details please refer the asset pipeline railsguides .

javascript - Change texture of loaded .obj in three.js at runtime -

i'm trying swap image texture @ runtime on loaded three.js .obj. here's code straight three.js examples slight modification: var container, stats; var camera, scene, renderer; var mousex = 0, mousey = 0; var windowhalfx = window.innerwidth / 2; var windowhalfy = window.innerheight / 2; init(); animate(); function init() { container = document.createelement( 'div' ); document.body.appendchild( container ); camera = new three.perspectivecamera( 45, window.innerwidth / window.innerheight, 1, 2000 ); camera.position.z = 100; //scene scene = new three.scene(); var ambient = new three.ambientlight( 0x101030 ); scene.add( ambient ); var directionallight = new three.directionallight( 0xffeedd ); directionallight.position.set( 0, 0, 1 ); scene.add( directionallight );

list - Java Synchronized Collections vs Object -

i'm wondering difference between these ways of synchronization list<integer> intlist = collections.synchronizedlist(new arraylist<integer>()); synchronized (intlist) { //stuff } and using object lock object objectlock = new object(); list<integer> intlist = new arraylist<integer>(); synchronized (objectlock) { //stuff } the first approach makes sure individual method calls synchronized, , avoids needing manage separate lock object. 1 thread can call intlist.add(3); and can call intlist.clear(); without synchronized block, , it'll synchronized. (unfortunately, doesn't when need hold lock group of function calls; then, need synchronized block around calls.) also, if need pass list around, can use otherobject.dostuffwith(intlist); and return intlist; instead of otherobject.dostuffwith(intlist, objectlock); and return listandlock(intlist, objectlock);

ruby on rails - Rake db:migrate not ignoring old migrations? -

running through michael hartl's known rails tutorial, hit snag. i have in migration file, created rails generate model etc: class createusers < activerecord::migration def change create_table :users |t| t.string :name t.string :email t.timestamps end end end later, added second migration file: class addindextousersemail < activerecord::migration def change add_index :users, :email, unique: true end end to try , update database include new one, followed instructions , ran rake db:migrate , gives me error telling me i'm trying create table exists, i'm missing something. am i...supposed delete first migration? wouldn't make sense. do? (these files under db/migrate ) if realy want see migrations have been ran database, can inspect app database, there table called schema_migrations, in there can see unique id of each migration row example migration called: 20130402190449_add_flagand_table.rb, should see

lint - Is there a GIT api that can tell if a specific line of a file has a whitespace only change -

is there git api can tell if specific line (say given line no.) of file has whitespace change? i'm writing rule in lint (arcanistlinter) alert if lines have whitespace changes, , they're not adjacent real change (say got modified editor). not exactly. there is, however, way request diff omits whitespace-only changes: git diff --ignore-space-change this omit lines whitespace changed (with exception of creating whitespace in between 2 non-whitespace tokens adjacent, e.g. foobar -> foo bar ). you compare diff result regular diff find items present in latter not former.

android - Swiping between Fragment Activites using FragmentPagerAdapter -

i created 2 separate fragment activities linked button have decided wanted swipe between them. wanting use fragmentpageradapter , wondering if fragmentpageradapter treated fragment activities fragments or if there way make so. i'm not sure should return in getitem method within fragmentpageradpater. fragment activites end being complex want avoid recreating within fragment.

Firebase FQuery how do you detect when at the end of a list of nodes -

how detect when have finished processing found nodes when doing query? in following example, processing on each encountered node. when reach "end" of list able detect know it's finished. fquery* messagelistquery = [m_firebaseref querylimitedtonumberofchildren:100]; [messagelistquery observeeventtype:feventtypechildadded andprevioussiblingnamewithblock:^(fdatasnapshot *snapshot, nsstring *prevnodename) { // 1. interesting stuff snapshot data // 2. want detect when i'm @ end of list know when i'm done processing list. }]; here example use case. load latest 100 messages in background. once messages have been loaded, update ui. however, i'm not sure how know messages have been loaded given there might less 100 messages in list. i figured out how read messages front using observesingleeventoftype , iterating on children. [m_firebaseref observesingleeventoftype:feventtypevalue withblock:^(fdatasnapshot *snapshot) { nslog( @"n

c# - PetaPoco/NPoco - calculated properties in poco -

i using petapoco/npoco in project. database schema working not thought our , therefore can't directly bind poco wpf mvvm view (which used able when creating database schema). considering 2 possible solutions problem: add unmapped properties poco create wrapper pocos reference poco does proven pattern exist problem? you can manipulate petapoco maps wish using explicitcolumns map different named column. can use resultcolumn properties wish grab db not update/insert. finally, can use unmapped properties work not related db. namespace site.models { [tablename("hotel")] [primarykey("hotelid")] [explicitcolumns] public class hotel { [petapoco.column("hotelid")] public int hotelid { get; set; } [petapoco.column("hotelclaseid")] public int? hotelclaseid { get; set; } [resultcolumn] public string hotelclase { get; set; } [required] [petapoco.colu

java - XYTextAnnotation in DynamicTimeSeriesCollection -

Image
i'm trying implement xytextannotation in dynamictimeseriescollection. have no idea how find x value of series in dynamictimeseriescollection. code far: dynamictimeseriescollection dataset = new dynamictimeseriescollection(1, 60, new minute()); final jfreechart result = chartfactory.createtimeserieschart(title, "a", "b", dataset, true, true, false); float[] series1small = new float[10]; dataset.settimebase(new minute(1, 1, 1, 1, 2013)); dataset.addseries(series1small,0,"1"); jfreechart result = chartfactory.createtimeserieschart(title, "Время", "Платежи", dataset, true, true, false); final xyplot plot = result.getxyplot(); -----------------------------------------------------------below line doesn't work. timeseriesdataitem item1 = series1.getdataitem(series1.getitemcount() - 1); createannotation(item1,plot); this function used work annotation timeseriescollection. public static void createannotation(timeseriesdatai

c++ - qmake: How to link a library twice? -

i need link liba.a library in qmake file twice: libs = -la \ -lb \ -la \ -lc \ -ld but qmake removing first -la while running g++ . should do? tell qmake disable merging of libs flags with: config += no_lflags_merge however, result in duplicate libraries not cleaned up. shouldn't matter in practice though. alternatively, can trick qmake doesn't find duplicate libary; since matches strings , doesn't parse library flags, can do: libs += -la -lb -l -lc -ld note difference between -la , -l a . makes sure qmake doesn't see flags equal, though compiler's point of view, equal, since compiler actual command line argument parsing while qmake not.

android - Facebook logout is not Working -

i working in android app facebook integration getting issue whenever try logout facebook not getting logout, i searched lot , have used code follows: public facebook mfacebook = new facebook(app_id); sessionstore.clear(logoutactivity.this); try { mfacebook.logout(logoutactivity.this); } catch (malformedurlexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } i tried above code not @ working,the facebook not getting complete logout. me out?? this may you... activity.masyncrunner.logout(this, new requestlistener() { public void oncomplete(string response, object state) { log.d("logout facebook", response); if (boolean.parseboolean(response) == true) { // user logged out toast.maketext(getapplicationcontext(), "successfully logged

sql server - ROW_Count in VIEW -

i able run query in sql server: select "hiring pipe req number", row_number() on ( partition "hiring pipe req number" order "hiring pipe req number") rownumber dbo.talentdelivery_req_3facts however, failed when put code below in view . select "hiring pipe req number", row_number() on ( partition "hiring pipe req number" order "hiring pipe req number")as rownumber (select * dbo.talentdelivery_req_3facts) why fail in view? how can write above in view? try 1 - create view dbo.vw_view1 select [hiring pipe req number] , row_number() on ( partition [hiring pipe req number] order 1/0 ) rownumber ( select * dbo.talentdelivery_req_3facts ) t

php - Javascript Sign-on, Basic knowledge -

i'm building small website in spare time, @ moment solely based on html, javascript, php (though php skills rudimentary) , simple mysql db. extend project allowing users login own account, in order have highscore lists (i have small laborative javascript games on site) , basic community features. my knowledge of dealing sign-on process, handling/encrypting login credentials , related stuff close none. need piece of guidance, based on mentioned techniques. where/how should start, in order learn these things? are there js frameworks out there, handling login functionality? does know of tutorials or other readings on topic? i've tried scan interwebs, no prevail. what should/must consider? and on. logins best handled php rather js because php can use database save usernames , password etc. js users need hardcoded in script very insecure , can seen when checking source code. try tutorial better understanding of making simple php login system: http://www.wikih

ruby on rails - I want to show data from two tables in a single view -

i have 2 tables: 1 named um_org_data , other addresses . the problem want show data um_org_data addresses addresses has foreign key um_org_datum_id . here code of view in want show data 2 tables together: <p id="notice"><%= notice %></p> <div class="container"> <div class="row"> <div class="span3 pull-right"> <div class="well"> <h2>heading</h2> <p>sample text</p> </div> </div> <div class="span9"> <h2>organization details</h2> <table class="table table-hover"> <tr> <th col span="1" style="width: 200px"> </i>&nbsp;&nbsp;&nbsp;organization name: </th> <td><%= @um_org_datum.org_name %></td> </tr> <tr>

jboss - Java process memory Keeps Rising -

my production env: os: windows server 2008 r2 64bit jdk: 1.6u41 64bit jboss: 5.1.0 ram: 24gb jvm parameters in jboss below: set "java_opts=-xms3072m -xmx3072m -xx:maxpermsize=256m -xx:newsize=1024m -xx:maxnewsize=1024m -xx:survivorratio=32" then found java.exe memory usage(private working set) in windows task manager keeping going up, after few hours reachs 6gb, after few days, reachs 20gb, jboss server stop working. i wonder why memory usage can far beyond jvm xmx setting? can kindly me this? full gc infomation below: c:\users\administrator>jstat -gcoldcapacity 2456 ogcmn ogcmx ogc oc ygc fgc fgct gct 2097152.0 2097152.0 2097152.0 2097152.0 20565 1959 3746.986 11586.727 i wonder why memory usage can far beyond jvm xmx setting? the -xmx setting just gives maximum size of java heap. java uses other memory apart heap; e.g. code of jvm, , memory segments containing compiled code, thread stacks, ,

ajax - Spring dojo request issue -

i quite new spring framework , have problem. have page a.jsp , in page have link page b.jsp <c:url value="${pagecontext.request.contextpath}" var="contextpath" /> click <a href="${contextpath}/pageb">here</a> and in controller @requestmapping("pageb") public string pageblink(sitepreference sitepreference, device device, model model) { return "pageb"; } now on page b.jsp want invoke ajax call. i have link <a href="javascript:myfunction();">send request</a> function myfunction(){ dojo.xhrget({ // url of request url: "requestpage", method: "post", handleas: "json", // success callback result server load: function(jsondata) { var content = ""; dojo.foreach(jsondata.newsitems,function(locationpoint) { // build data json content += "<p>" + locationpoint.name + "</p>"; content += &q

java - Eclipse Code Completion: Is it possible to select a method without the parameters? -

Image
the code completion in eclipse offers available methods object. string object select this, example: lastindexof(str, fromindex) . is somehow possible method lastindexof without parameters (str, fromindex) ? in preferences go to: java->editor->content assist. in insertion section uncheck "fill method arguments , show guessed arguments" option. after method name , parenthesis after it, no parameters.

dom - JavaScript insert script with async and use functions from it? -

this question has answer here: accessing variables after dynamically loading script 2 answers i have written small widget include onto pages this: <script type="text/javascript"> var _sid = '1'; (function() { var se = document.createelement('script'); se.type = 'text/javascript'; se.async = true; se.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://') + 'dev.domain.com/widget/hello.js'; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(se, s); })(); </script> now want find way call functions exist within hello.js , looks this: var widget = function () { function setname(a) { console.log(a); } return widget; }(); so want able make call setname so: widget.setname("andy") ...

multithreading - Making a Queue for a function so it only runs once at a time in python -

i have multithreaded function, write same log file. how can make function (maybe function decorator) add execution of writing log file queue. small example: #!/usr/bin/python import thread import time # define function thread def print_time( threadname, delay): count = 0 while count < 5: time.sleep(delay) count += 1 writetolog(threadname, time.ctime(time.time())) print "%s: %s" % ( threadname, time.ctime(time.time()) ) # create 2 threads follows try: thread.start_new_thread( print_time, ("thread-1", 2, ) ) thread.start_new_thread( print_time, ("thread-2", 4, ) ) except: print "error: unable start thread" def writetolog(threadname, time): self.filewriter = open("log.txt", "w") self.filewriter.write("threadname: " + threadname + "\n") self.filewriter.write("time: " + time + "\n") self.filewriter.close() how can make functio

matlab - Calculating the norm of each row in a matrix -

this question has answer here: applying norm function rows of matrix - matlab 3 answers i have nx3 matrix (a) columns x,y,z respectively. want calculate norm sqrt(x^2+y^2+z^2) each row. did loop that: for = 1:length(a) result(i) = norm(a(i,:)) end is there other way avoiding loop? thanks you can this: sqrt(sum(a.^2, 2)) your method returns 1x3 returns 3x1. if want can transpose doubt need to.

unit testing - TeamCity Code Coverage of C++ code -

we have project using c#, c++/cli , native c++ code. use teamcity building , testing. we run tests using vstest.console (vs2012 test runner). for managed code, dotcover (which integrated teamcity) used code coverage. however, doesn't work native c++ code (which expected). how code coverage results our unit tests native c++ parts teamcity? ideally, solution free. we use bullseye coverage c++ code coverage. use provided covxml tool convert binary coverage files xml file, read out bunch of useful attributes function , conditional coverage (e.g. fn_total , fn_cov , cd_total , cd_cov ) , provide these teamcity via statistics service messages using predefined coverage keys . it bit of work set up, think teamcity still has no support c++ coverage tool, our solution still works years later. edit: i've uploaded xml parsing code our in-house tool gist.

jquery - how to show element when mouse hold on it -

i have 1 ul , many li in it. want when mouse hold on in li 3 second show me 1 div , when leave mouse element div hide. many search in google , understand should use fadein , fadeout don't know how use those. want when click on li show me 1 alert. please guide me because i'm confused. thanks lot this code: html: <ul id="friend-list"> <li id="1"></li> <li id="2"></li> <li id="3"></li> <li id="4"></li> <li id="5"></li> <li id="6"></li> </ul> jquery: $(document).on('mouseover','#friend-list li',function(){ $('#center-side').fadein('slow'); }); $(document).on('mouseout','#friend-list li',function(){ $('#center-side').stop().fadeout('slow'); }); $(document).on('click','#friend-list

android - is this also an example of anonymous derived class? (java basics) -

this sample code android developers website: public void onclick(view v) { new downloadimagetask().execute("http://example.com/image.png"); } private class downloadimagetask extends asynctask<string, void, bitmap> { /** system calls perform work in worker thread , * delivers parameters given asynctask.execute() */ protected bitmap doinbackground(string... urls) { return loadimagefromnetwork(urls[0]); } /** system calls perform work in ui thread , delivers * result doinbackground() */ protected void onpostexecute(bitmap result) { mimageview.setimagebitmap(result); } } here, in line new downloadimagetask().execute("http://example.com/image.png"); , new downloadimagetask() create object of downloadimagetask class, or create annonymous class extends downloadimagetask ? for comparison: in code, public void onclick(view v) { new thread(new runnable() { public void run() {

php - Zend: How to prevent double library in includePath? -

zend quick start public/index.php set_include_path(implode(path_separator, array( dirname(dirname(__file__)) . '/library', get_include_path(), ))); configs/application.ini includepaths.library = application_path "/../library" as result print get_include_path(); // prints %localpath%/application/../library:%localpath%/library if drop "includepaths.library" ini, ./zf (zend_tool) fails. if drop in index.php, bootstraping fails. how correctly prevent duplicate? i think you're right include path shouldn't in application.ini well, i'd remove that. zend tool working, think have 2 options: change setup top answer in question: zend tool include path (which zf find include path). zf's auto discovery changed somewhere along way though i'm not sure if approach still work. alternatively there environment variable can set give zend tool library location, details here: http://framework.zend.com/manual/1.12/en/z

c - Tree traversal - Segmentation fault error -

code : #include<stdio.h> #include<malloc.h> typedef struct tree { char data; struct tree *left; struct tree *right; }*pos; pos stack[30]; int top=-1; pos newnode(char b) { pos temp; temp=(struct tree*)malloc(sizeof(struct tree)); temp->data=b; temp->left=null; temp->right=null; return(temp); } void push(pos temp) { stack[++top]=temp; } pos pop() { pos p; p=stack[top--]; return(p); } void inorder(pos t) { if(t!=null) { inorder(t->left); printf("%s",t->data); inorder(t->right); } } void preorder(pos t) { if(t!=null) { printf("%s",t->data); preorder(t->left); inorder(t->right); } } void postorder(pos t) { if(t!=null) { postorder(t->left); postorder(t->right); printf("%s",t->data); } } void main() { char *a; pos temp,t; int j,i;