Posts

Showing posts from February, 2015

logging - Implement syslog to remote host in Windows service -

i've been looking implement sending log data remote syslog host windows service, far decent library based option have found udp remote syslog sender in poco net library. i'm interested in syslog tls described in rfc 5425 , poco library doesn't support. my question twofold, firstly have missed existing implementation of syslog windows supports sending remote host via tcp/tls? secondly, if no such implementation exists, looking write own (or perhaps extend poco one) - doesn't more complicated establishing secure tls session , putting syslog formatted text strings tcp socket, use .net tls implementation discussed here tls part. have missed something, not simple? or reason can't find libraries implement sort of syslog communication windows nobody wants this? missing brilliant alternative syslog every other windows dev using? thanks in advance. the packaged solution i've come across balabit . seems thing out there supports tls , rfc5425. if else h...

different design for portrait and landscape mode in android -

hi have created 2 fragments on single layout. in layout-land : fragments need display horizontally. in layout-port : fragments need display vertically. now have run app on portrait mode means displaying fragment vertically. have rotate these landscape mode means displaying fragments vertically only. at same time have run app on landscape mode means displaying fragment horizontally.now have rotate these portrait mode means displaying fragment horizontally. but wish display output like: i have run app on portrait mode means displaying fragment vertically. have rotate these landscape mode means displaying fragments horizontally. at same time have run app on landscape mode means displaying fragment horizontally.now have rotate these portrait mode means displaying fragment vertically. how can ??? why getting result above.please give me suggestions . edit: layout-land : fragment.xml: <?xml version="1.0" encoding="utf-8"?> <relativela...

Javascript For loop in multidimensional javascript array -

can give me sample/example of javascript multidimensional array of inputs? hope because i'm still new javascript. like this: var cubes = [[1, 2, 3],[4, 5, 6],[7, 8, 9]]; output : [1,4,7], [1,4,8], [1,4,9], [1,5,7], [1,5,8], [1,5,9], [1,6,7], [1,6,8], [1,6,8], ......... ......... [3,6,7], [3,6,8], [3,6,9] thanks this code should work: var cubes = [[1, 2, 3],[4, 5, 6],[7, 8, 9]]; for(var i=0; i<cubes[0].length; ++i) for(var j=0; j<cubes[1].length; ++j) for(var k=0; k<cubes[2].length; ++k) { alert([cubes[0][i],cubes[1][j],cubes[2][k]]); }

ios - how to custom back button in storyboard -

Image
i create 1 application has 3 viewcontroller names : (viewcontroller,viewcontroller2,viewcontroller3) in viewcontroller exist 1 button checking file in document folder or download it.for example first check file if file exist in document folder go viewcontroller3 else go viewcontroller2 , download it. so viewcontroller2 download , has uilable & uiprogress show download status.if file dont exist in page downloaded , go viewcontroller3. so viewcontroller3 show file. (these pages connect push segue image in bottom) when go page , click button return pervious page right?? when click on button in first page , file dont exist , downloading in second page finished download go page 3.now want when click on button in page 3 go page 1 no page 2!!!! i work in storyboard. you can achieve intercepting button event in viewcontroller3 , using unwindsegues. check out william jockusch's reply question how intercept button event. to use unwind segues in particular case n...

android - next button in Eclipse -

i create application eclipse contain 2 activity , want go mainactivity activity2 , create button run didn't work me fix if need other code tell me this code for mainactivity (xml): <relativelayout 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:background="#6f0fba" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignpa...

ruby on rails - When using first_or_create, in the after_create callback, the Model queries get extra conditions added automatically -

for explanation purposes, i'm going create brand new rails (3.2.13) project using sqlite. rails new testapp cd testapp/ rake db:create rails g model blog name:string description:string rake db:migrate this content of blog model. class blog < activerecord::base attr_accessible :description, :name after_create :print_other_name private def print_other_name # example, running query here. blog = blog.first end end then open rails console . 1.9.3-p125 :001 > blog = blog.where( name: 'first blog' ).first_or_create!( description: 'this first blog' ) blog load (0.2ms) select "blogs".* "blogs" "blogs"."name" = 'first blog' limit 1 (0.1ms) begin transaction sql (63.9ms) insert "blogs" ("created_at", "description", "name", "updated_at") values (?, ?, ?, ?) [["created_at", thu, 09 may 2013 11:30:31 utc +00:00], [...

ruby - Rails execute script on server on Dojo Button click -

i've ruby script part of rails application used copy files directory inside server. using dojo front-end. i've dojo widget displaying button fine. want script executed when click dojo button. wigdet extract: <input type="button" data-dojo-type="dijit.form.button" dojoattachevent="_onclick:copyfiles" label="copy files"></input> javascript function part of widget: copyfiles: function() { window.location = '/files/copy_files' } in routes have: resources :files :copy_files and in files_controller have: def copy_files fc = filescopier.new source = '/home/myname/sourcefiles' dest = '/home/myname/backup' fc.copy_files(source,dest) end but when clicked button nothing happens. i've tried running code inside view nothing happens. i've resolved it. have change routes file per below: put :copy_files, :on => :collection and if put on show method inside controlle...

Magento Can't add new product to a Category -

i'm new magento , i'm working version 1.7 . i have created sub category " computers " of " default category ", when create product , save edits gives me : one or more of cache types invalidated: blocks html output. click here go cache management , refresh cache types. i assign " computers " category product, , shows me category " computers " contains product, when search product doesn't give me anything.. do have idea ? thank :) you can pressed button “flush cache storage" else check link http://magentodeveloperstips.blogspot.com.es/2011/06/one-or-more-of-cache-types-are.html update: reading @ http://www.magentocommerce.com/boards/viewthread/219407/p30/ there explain bug current reported. http://www.magentocommerce.com/bug-tracking/issue?issue=11406 . i found extension inchoo_invalidatedblockcachefix extension refreshes block cache after saving product. used fix "one or more of cache types in...

What's an entity in entity framework? -

in tutorials im following learning entity framework, keep mentioning entities. see gets used synonym dbsets<> in database context class, what's literal meaning of it? i know how entity framework works, dont understand meaning of word. in entity framework entity largely equivalent class in conceptual model (or class model , mapped store model). in domain model terms entity is an object not defined attributes, rather thread of continuity , identity. (source: wikipedia ) that quite mouthful "an object identity", opposed value object , datetime or (maybe) address . customer entity, because identified "who" is. 2 customers same name still 2 customers. so entities can loosely defined "things" business domain about. things both customer/user , system designer/developer talk in ubiquitous language . , in ef things represented classes. so it's not dbset . dbset repository provides entity objects. i see people re...

Web service only responding with keep alive -

i trying colleague web service connection. using simple "hello world" request, see keep alives, when request different sub net responds expected. so appears can make request response never arrives. any ideas why?

html - selectOneListBox with size 1 appears as drop down menu -

i using h:selectonelistbox dynamically add data in it. empty. every time user presses on "add" button, entry added in list box. i have specified particular height of list box. issue appearance of listbox when has 1 entry. appears drop down menu of specified height rather list box. if has more 1 entry, looks fine. need know, if there way can control appearance of selectonelistbox when size 1. in below code, assume backingbean.names return 1 select item. <div style="height: 400px"> <h:selectonelistbox id="names" style="width:100%; height:100%; " value="#{backingbean.selectedname}"> <f:selectitems value="#{backingbean.names}" /> </h:selectonelistbox> </div> you need explicitly specify size 2 or larger, otherwise indeed default size of available select items. <c:set var="size" value="#{fn:length(backingbean.names)}" /> ... <h:selectonelistbox ... s...

django - updating an auto_now DateTimeField in a related model -

i update related models timestamp when saving record. here models: class issue(models.model): issuetitle = models.charfield() issuedescription = models.textfield() issuecreateddatetime = models.datetimefield(auto_now_add=true) def __unicode__(self): return self.issuetitle class issuehistory(models.model): fk_issueid = models.foreignkey(issue) issuehistorydetail = models.textfield() issuehistorycreatedby = models.foreignkey(user) issuehistorycreateddatetime = models.datetimefield(auto_now=true) def __unicode__(self): return self.fk_issueid def save(self): #1.1 # call parent's `save` function # record saved normally, without override super(issuehistory, self).save() #1.2 #this believe should updating "issuecreateddatetime" same datetime this post describes want final code wasn't posted (unless misunderstanding it). to further clarify, desired order of events: sa...

JSON Jackon deserialze filepath (String) in json to File object in java -

i using object mapper jackson map json file nested set of java beans. nested beans , string, integer , enum objects correctly set in based on defined in json. some of string represent filepath , nice have jackon object mapper directly map filepath string java file object. is possibly? i think, works default. please, see example: import java.io.file; import java.io.ioexception; import com.fasterxml.jackson.core.jsonfactory; import com.fasterxml.jackson.core.jsonparser; import com.fasterxml.jackson.databind.objectmapper; public class jacksonprogram { public static void main(string[] args) throws ioexception { objectmapper objectmapper = new objectmapper(); jsonfactory jsonfactory = new jsonfactory(); jsonparser parser = jsonfactory.createjsonparser("{\"id\":\"1s200d\", \"path\":\"/tmp/test/file.txt\"}"); entity employee = objectmapper.readvalue(parser, entity.class); syste...

java - How to switch from Hibernate to OpenJpa -

i've hibernate project developed spring mvc 3 , built maven 3. manage persistence jpa in particular hibernate framework; guess isn't difficult configure existing source openjpa, i'm new , i'd know steps configure project switch in consistent way hibernate openjpa. greetings follow below steps: to switch annotations, you’ll need to: add hibernate-annotations , jpa jars annotate classes modify hibernate.cfg.xml use classes instead of mapping files modify hibernateutil class use different configuration (this step tripped me up) to add right jars, i’m using maven , added following additional dependencies: <dependency> <groupid>javax.persistence</groupid> <artifactid>persistence-api</artifactid> <version>1.0</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-annotations</artifactid> <version>3.3.1.ga</versio...

css - Select next element when input is checked -

html: <label> <input type="checkbox" /> </label> <div> stuff </div> i'd able style div element depending on checked state of input, like input ~ div{ display: none; } input:checked ~ div{ display: block; } obviously the ~ selector doesn't seem work here. neither + is there other solution (besides javascript) ? sadly there no way select ancestor in pure css, require select ancestor's sibling. i have seen people surround other content label - while questionable practice, allow use + selector style div: <label> <input type="checkbox" /> <div> stuff </div> </label> edit: or (thanks @lnrbob pointing out) <label for="mycheckbox"> label </label> <input id="mycheckbox" type="checkbox" /> <div> stuff </div>

PHP Soap Client does not make request -

ini_set('soap.wsdl_cache_enabled', '0'); ini_set('soap.wsdl_cache_ttl', '0'); ini_set('max_execution_time', 123456); ini_set("default_socket_timeout", 100); $client = new soapclient( 'http://#########:9999/cardexternalservice.svc?wsdl', array( 'soap_version' => soap_1_2, 'trace' => 1, 'local_cert' => 'something.pem' ) ); try { $client ->__soapcall( 'getfullcarddata', array( 'carduniqueid, endclientdata' ) ); } catch ( exception $e ) { echo $e->getmessage(); } when execute function, apache downs. don't know happens, tried nusoap, native one, wso2 same result. php except certificate request. don't know how explain. cannot see error. warning: soapclient::soapclient() [<a href='soapclient.soapclient'>soapclient.soapclient</a>]: i/o warning : failed load external entity &quot;http://########:9999/cardexternalservice.svc?w...

javascript to bring back only a certain portion of text (codeigniter & JQuery) -

i have below syntax: $("#orderbynumber").autocomplete( { source: "get_orders_by_order_number", messages: { noresults: '', results: function() {} }, select: function( event, ui ) { var selectedobj = ui.item; alert(selectedobj.value); //get prices $.post('get_sku_prices', {data:selectedobj.value},function(result) { $('input[name^="deliveryweek"]').val(result[0]); }); } }); the alert returns, order number: customer name example 10827: massmart what want strip away : massmart selectedobj.value want new variable(for example) selectedobjectorder = 10827 i can pass order number get_sku_prices function. so like: $("#orderbynumber").autocomplete( { source: "get_orders_by_order_number", messages: { noresults: '', results: function() {} }, select: function( event, ui ) { var selectedobj = ui.item; alert(selectedobj.value); //how finx ...

php - Center image inside image using imagecopy function -

i have simple script adds image inside image. here code: <?php $im = imagecreatetruecolor(650, 400); $stamp = imagecreatefrompng('test.png'); $red = imagecolorallocate($im, 209, 231, 244); imagefill($im, 0, 0, $red); $marge_right = 10; $marge_bottom = 133; $sx = imagesx($stamp); $sy = imagesy($stamp); imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp)); header('content-type: image/png'); imagepng($im); imagedestroy($im); ?> now place test image 10x right of big image , 133px bottom of image. how place image centered vertically depending on height?? thanks $marge_right , $marge_bottom should correspond difference of horizontal , vertical sizes (respectively) between source , destination images. so need calculate difference way: $marge_right = abs($dest_sx-$src_sx); $marge_bottom = abs($dest_sy-$src_sy); the abs optional if sure source bigger source ...

asp.net - Dynamically creating multiple textboxes depending on minimum number of characters in previous textbox/ javascript/asp -

hi have webform in need add multiple textboxes dynamically depending on entry in previous textbox.. if 1 character entered in previous textbox should generate new texbox beside without losing focus previous textbox , should allow me enter many characters without limiting.. here code : getid = function () { var id = 1; return function () { id++; } } function createtextbox() { var box = document.getelementbyid("divcreatetextbox"); var curr = 'txt' + getid(); var inp = document.createelement('input'); inp.type = 'text'; inp.name = 'textfield'; inp.setattribute("id", curr); inp.setattribute("minlength",'1'); box.appendchild(inp); inp.setattribute('onkeyup', 'moveonmin(this)'); inp.focus(); } function moveonmin(s) { if(s.value.leng...

visual studio 2010 - Implementing a dialog background image -

using c++ under visual studio 2010. i have dialog creation section idd_logon dialogex 0, 0, 265, 70 style ds_setfont | ds_modalframe | ds_fixedsys | ws_popup | ws_caption caption "log on windows" font 8, "ms shell dlg", 400, 0, 0x1 begin edittext idc_name,61,9,127,14,es_autoscroll edittext idc_password,61,29,127,14,es_password | es_autoscroll edittext idc_domain,61,49,127,14,es_autoscroll defpushbutton "ok",idok,204,8,50,14 pushbutton "cancel",idcancel,204,25,50,14 ltext "domain:",idc_static,21,52,27,8 ltext "password:",idc_static,21,32,34,8 ltext "user name:",idc_static,17,12,38,8 pushbutton "shutdown",idc_shutdown,204,49,50,14 end i have image in background of dialog. how go performing action? thank you in oninitdialog() use: this->setbackgroundimage(idb_bitmap1, backgr_topleft, true); for more...

css3 - CSS Responsive Fluid Square (with scrollable content) -

so i'm trying build pure css responsive square (well i'm trying build circle that's easy once i've got square.) in other words: i want div has height percentage of body , width equal (or vice versa). the div needs have div inside can contain content , overflow: auto . lastly, div can never exceed height (or width ) of body or viewport . so far, have got solutions working partially (i.e. in portrait not landscape ) using 1px transparent .gif img fill out wrapper div . not ideal semantics don't see how can done without it. <div class="wrap"> <img src="http://www.neurillion.com/p/35/static/media/images/1x1t.gif" /> <main> <div class="content"> <h2>title</h2> <p> lorem... etc. </p> </div> </main> </div> here css solutions , wrong them: this works except exceeds height of body i...

wpf - How to get the label to match the grid column width -

i making simple leader board. want team name column label same size grid column located in. <listview x:name="teamlist" background="#00000000" borderbrush="#00000000"> <listview.view> <gridview> <gridview.columnheadercontainerstyle> <style> <setter property="frameworkelement.visibility" value="collapsed"/> </style> </gridview.columnheadercontainerstyle> <gridviewcolumn> <gridviewcolumn.celltemplate> <datatemplate> <grid> <grid.columndefinitions> <columndefinition width="70"></columndefinition> <columndefinition width="10"></columndefinition> ...

filesystems - Storing Images: MongoDb vs File System -

i need store large number of images (from around 10,000 images per day) average size of around 1 10 mb each image. i can store these images in mongodb using gridfs library or storing base64 conversion string. my question that, mongodb suitable such payload or better use file system? many thanks, mongodb gridfs has lot of advantages on normal file system , able cope amount of data describing can scale out sharded mongo cluster. have not saved binary data in on own not think there real difference between binary data , text. so: yes, suitable payload.

android - adding Markers on Map, that should not move -

i want add marker on googlemap ui controls (zoom controls, compass, mylocation button). when swipe on map screen, positions not change. https://developers.google.com/maps/documentation/android/interactivity can tried before, please suggest me how it. want use markers buttons in app. possible ? here code use overlay buttons on top of mapview. android layout <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/home_container" android:layout_width="fill_parent" android:layout_height="fill_parent"> <com.google.android.maps.mapview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apikey="yourapikey" android:clickable="true" /> ...

C++ errors when compiling -

i'm getting following errors when trying compile , can't understand why, apologies if it's simplistic , easy solve i'm pretty new c++ , having abit of trouble getting head around it. errors: main.cpp|20|error: invalid conversion 'char*' 'char' [-fpermissive]| msgpacket.h|15|error: initializing argument 5 of 'msgpacket::msgpacket(int, int, int, int, char)' [-fpermissive]| files main.cpp #include <iostream> #include <iomanip> #include "datastream.h" #include "msgpacket.h" using namespace std; datastream name; datastream * mypackets = new datastream(); int main() { int source; int destination; int type; int port; int input; char data[50]; msgpacket * packet = new msgpacket(source,destination,type,port,data); cout << "my assignment" << endl;; } msgpacket.h #ifndef msgpacket_h #define msgpacket_h #include <string> #include "packetaddress.h" using namespace std; ...

Zend and jQuery $.ajax() callback not working -

zend , jquery $.ajax() callback not working i can make $.ajax() work on web page, input boxes, filled query php program, can't make work using same function, valid zend action (either zend-like url or using fqdn url) server side $.ajax() in zend i have action i'm working, because accessing following url http://my_site/my_controller/my_action/some_id/some_number i web page json encoded record, because within my_action have call query follows ... $this->_helper->layout->disablelayout(); //disable "zend automatic behavior" $this->_helper->viewrenderer->setnorender(); $my_resulting_row = $my_model->my_query( $this->_getparam('some_id') ); $my_json = zend_json::encode($my_resulting_row); echo $my_json; as expected, probes query working, , encoding working client side i have working javascript function following function my_work( any_id ) { // alert(any_id); // working ok $( function() { //...

java - how is it possible to return different responses of your server based on URL -

lets have 2 urls points same server, , want tell users use 1 of urls no longer supported. best way it? have jetty application server , our server code written in java. redirect old 1 new one, 301 moved permanently status code. transparent, standard way of doing. if want tell users not use it, that: return page message saying not use url anymore, , add link new url in page.

javascript - How to get a value by URL, preventing typos? -

i'd id (1337) out of every url can find below. what's best way? id numeric. maybe split "/" , take first numeric value? appreciate ideas. actually url first one, i'd prevent typos. here's jsfiddle: http://jsfiddle.net/vkjfw/ /* outputs "1337" */ var url = "http://www.mydomain.com/module/action/1337/"; /* error: outputs "action" */ // var url = "http://www.mydomain.com/module/action/1337"; /* error: outputs "action" */ // var url = "http://www.mydomain.com/module/action/1337#"; /* error: outputs "" */ // var url = "http://www.mydomain.com/module/action/1337//"; /* error: outputs "bla" */ // var url = "http://www.mydomain.com/module/action/1337/bla/?x=y"; var url_parts = url.split("/"); var id = url_parts[url_parts.length-2]; alert(id); // should output "1337" everytime! var id = parseint(url_parts[5]); ...

Unable to publish a project into windows azure staging environment -

initially,i publish project windows azure staging environment using visual studio 2010(windows azure sdk v1.6), got warning exceptions like, warning: there no endpoint listening @ https://management.core.windows.net/ /services/hostedservices//deploymentslots/staging accept message. caused incorrect address or soap action. see innerexception, if present, more details. warning: there no endpoint listening @ https://management.core.windows.net/ /services/hostedservices//deploymentslots/staging accept message. caused incorrect address or soap action. see innerexception, if present, more details. warning: http request ' https://management.core.windows.net/ <>/services/hostedservices/service/deploymentslots/staging' has exceeded allotted timeout of 00:01:00. time allotted operation may have been portion of longer timeout. warning: http request ' https://management.core.windows.net/ <>/services/hostedservices/service/deploymentslots/staging' has e...

ibm midrange - Export data from As400 -

i want export data as400 flat file or csv file. try load text file oracle using oracle sql loader. do have experiences exporting as400 data? method can follow reaching best performance? the command cpytoimpf can export csv file. also available ibm navigator's run sql script facility. if set option allow save, can right click results of select statement , save csv. another idea set odbc connection , let oracle connect directly ibm i's db2 database.

asp.net - Populating SQLDataSource from Sessions in VB.NET -

i have below code , trying make connection string parameters pass stored procedure use values stored in session. how can done? <asp:sqldatasource id="sqlds" runat="server" connectionstring="<%# session("connstrep") %>" selectcommandtype="storedprocedure" selectcommand="getgeninfo_mines"> <selectparameters> <asp:parameter defaultvalue="6" name="revno" type="string" /> <asp:parameter defaultvalue="1003992" name="appno" type="string" /> </selectparameters> </asp:sqldatasource> an example of how pass session parameter can found here: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sessionparameter.aspx

asp.net - How to get CropImage.Net working? -

i trying latest version of cropimage.net working on site. i have added imageresizer.dll , imazen.crop.dll project, , able run diagnostics page imageresizer, not report errors, following warnings: 2 issues detected: (warning): potentially see additional errors here, perform image resize request. (warning): nocache development usage, , cannot scale production use. add diskcache or cloudfront production use i have registered assembly , added control page: <%@ register assembly="imazen.crop" namespace="imazen.crop" tagprefix="ic" %> <ic:cropimage id="cropimage1" runat="server" canvasheight="300" imageid="image1" canvaswidth="300" /> <br /> everything fine, when try access page following error: description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception det...

c# - How do I use an Ajax.ActionLink without updating the URL -

i got following ajax actionlink in cshtml page: @ajax.actionlink("sort date", "specific", "events", new ajaxoptions { updatetargetid="eventlistcontainer", insertionmode=insertionmode.insertafter, httpmethod="get" }) and got these 2 methods in controller: public actionresult overview(string user) { // return partialview here } and public partialviewresult specific() { // return partialview here } with following route: routes.maproute( name: "eventsroute", url: "events/{user}", defaults: new { controller = "events", action = "overview" } ); now, every time call ajax method, overview gets called, specific passed inside, instead of specific method. how can make sure specific() gets called, without updating url? something this. play aro...

java - Injecting factory class to other beans -

i have factory class , wonder if possible inject animalmapper factory class other beans needs it? animalmapper factory class public static mapper create(final string type) { if (type.equalsignorecase("dog")) { return new dogmapper(); } else if (type.equalsignorecase("cat")) { return new catmapper(); } ... } currently using animalmapper.create(...) here sample code public class testclass{ //member variable defination. @inject animalmapper animalmapper; //defining mapper instance } i not sure if looking if can clarify question more can add more details.

iphone - nsarray switching image texture randomly everyone one second -

i have array has 2 balloon textures,one green , 1 red.i have 12 green balloon object @ start of app.basically want 1 random green balloon turn red every 1 second.if can appreciated. init method balloontextures = [nsmutablearray array]; [balloontextures addobject:[sptexture texturewithcontentsoffile:@"greenballoon.png"]]; [balloontextures addobject:[sptexture texturewithcontentsoffile:@"redballoon.png"]]; [balloontextures retain]; playfieldsprite = [spsprite sprite]; [self addchild:playfieldsprite]; [self addballoon]; add ballon method -(void)addballoon { for(int = 0; < 12; i++) { spimage *image = [spimage imagewithtexture:[balloontextures objectatindex:0]]; image.x = 40*i; image.y = 10 ; [playfieldsprite addchild:image]; } } for getting random number: #include <stdlib.h> int r = arc4random() % 12; use nstimer called every second: how use nstime...

javascript - How to show a 'X' mark on a image preview -

i've upload image preview code: function readurl(input) { $.each(input.files,function(i) { var reader = new filereader(); reader.onload = function (e) { var container = $('#preview_drop'); var image = $('<img>').attr('src', e.target.result).attr('id', 'preimg') image.appendto(container); $("#add_photoajax").mcustomscrollbar("update"); }; reader.readasdataurl(input.files[i]); }); } how can show ' x ' mark or delete.png on each previewed image? ''' var container = $('#preview_drop'); //create first var x = $('<img>').attr('src', 'delete.png'); var image = $('<img>').attr('src', e.target.result).attr('id', 'preimg') image.appendto(container); //and append after/before img x.appendto(container); $("#add_photoajax").mcustomscrollbar(...

android - List view with button and popup -

am struck issue.. have list view contains 1 button , when click on button should show pop up. have implemented list view pop not showing on clicked button position.. sample code given below public view getview(int position, view convertview, final viewgroup parent) { view vi=convertview; if(convertview==null) vi = inflater.inflate(r.layout.list_row, null); vi.findviewbyid(r.id.statusimage).setontouchlistener(new view.ontouchlistener(){ @override public boolean ontouch(view v, motionevent event) { // todo auto-generated method stub x=(int) event.getx(); y=(int) event.gety(); showpopup(x,y);// calls popup return false; public void showpopup(int xk , int ys) { layoutinflater inflater = (layoutinflater)activity.getsystemservice(context.layout_inflater_service); view layout = inflater.inflate(r.layout.popup_layout,null); pwindo = new popupwindow(l...

cordova - get objective-c pointer to textbox in ViewController:CDVViewController html -

i writing cordova, ios app (i don't use phone gap) loads single html file in viewcontroller : cdvviewcontroller (cordova 2.5.0). have text box in html file. html file lives in viewcontroller. my question this: expression use within event handler in viewcontroller.m file, evaluate mytextbox, lives in html file? my textbox looks this: <input type="text" id="mytextbox" > use uitextfieldtextdidbegineditingnotification instead of uikeyboardwillshownotification. should allow access object key.

javascript - Creating a google map -

i going go out on limb here , ask if knows solution on how map coordinates on world map without using google maps. tried searching google didn't find relevant (i might have been searching bit poorly :p). doesn't have exact map, able have image of map , able point out new york is. i guess try map first, , try use canvas javascript paints different geo coordinates. problem not sure on how adjust map correct coordinates. does know or way on how around problem? thanks in advance not sure why can't use google maps api, there openstreetmap

android - What is going on with java.nio.charset.Charsets? -

so, far can tell, class doesn't exist in standard java library , addition in dalvik. correct? my reason thinking android class "ndefrecord" contains reference , uses there no way of importing standard java project (that can find). is there way import class android project? where can find it's up-to-date content, used android project? java.nio.charset.charsets , different charset , unique dalvik. if @ comment header in source file see: @hide internal use this means not part of public api, , should not used applications. if decide use anyway, need access through reflection.

Xml isn't correctly interpreted by Adobe Build -

i've create config.xml configure setup of app via adobe build. based file on document ( https://github.com/phonegap/phonegap-start/blob/master/www/config.xml ) <?xml version="1.0" encoding="utf-8"?> <!-- config.xml reference: https://build.phonegap.com/docs/config-xml --> <widget xmlns = "http://www.w3.org/ns/widgets" xmlns:gap = "http://phonegap.com/ns/1.0" id = "app.katho.midzomerrun" version = "1.0.0"> <name>midzomerrun beta</name> <description> dit de officiële app voor midzomerrun 2013 </description> <!-- enable individual api permissions defining each here. 'device' permission required 'deviceready' event. --> <feature name="http://api.phonegap.com/1.0/device" /> <!-- if not want permissions added app, add following tag config.xml; still have internet permission on app, phonegap r...

Alfresco activiti workflow deploy -

i have bit of problem. have created workflow activiti plugin in eclipse. have model, context file , bpmn20.xml file. deployed in shared/alfresco/extension but: if deploy workflow deleting entire following tag in bpmn20.xml file <bpmndi:bpmndiagram id="bpmndiagram_activiticustomworkflow"> (so without workflow diagram), works fine can't see workflow diagram in workflow details page in alfresco share . if leave tag (so eclipse created in beginning activiti project), alfresco not starting. (connection rejected in browser) log not telling me nothing, , tomcat cannot stopped (i have delete catalina.pid , tomcat temp folder manually). my bpmn20.xml file header is: <?xml version="1.0" encoding="utf-8"?> <definitions xmlns="http://www.omg.org/spec/bpmn/20100524/model" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://...

Inability of Linux Kernel to support 1GB physical memory and the HIGHMEM solution -

i have been reading [1] have idea highmem. article says " if kernel wishes able access system's physical memory directly, however, must set page tables map memory kernel's part of address space " .that have confusion. mean accessing physical memory directly? mean explicitly stating physical address?(afaik, not possible in linux kernel) go on stating " it must set page tables map memory kernel's part of address space ". in highmem solution,isn't it? please me understand problem lead highmem solution. [1] http://lwn.net/articles/75174/ 1 if kernel wishes able access system's physical memory directly, however, must set page tables map memory kernel's part of address space i think author want emphasize kernel need page table address physical memory. 2 t must set page tables map memory kernel's part of address space kernel part of address space need page tables map memory, while high memory, instead, has no direct kernel map...

xml - How do I XPath to attribute whose namespace is different to its ancestor's -

i'm trying query codebase attribute on line 11 of xml file. <?xml version="1.0" encoding="utf-8"?> <asmv1:assembly xsi:schemalocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestversion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-rel-r-ns" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2"> <assemblyidentity name="vcilapp.application" version="0.0.0.0" publickeytoken="0000000000000000" language="neutral" processorarchitecture="msil...

Openerp javascript debugging -

is there way debug javascript code openerp module? using eclipse. tried firebug, javascript code minified , hard follow. you have put ?debug in url following http://127.0.0.1:8069/?debug and it's better if use crome activating developer mode regards, matteo

javascript - Audio Sound Playing onload when its supposed to be a timed event -

the audio set play @ times, alarm clock built background of home page. it's playing @ correct times. however, it's playing on loading of web page reason. if can figure out that'd appreciated clueless. var date = new date(), year = date.getfullyear(), month = date.getmonth(), weekday = date.getday(), day = date.getdate(), time = date.gettime(), timeout1 = new date(year, month, day, 12, 15, 0, 0).gettime() - time, timeout2 = new date(year, month, day, 14, 30, 0, 0).gettime() - time, timeout3 = new date(year, month, day, 17, 0, 0, 0).gettime() - time, timeout4 = new date(year, month, day, 19, 0, 0, 0).gettime() - time, timeout5 = new date(year, month, day, 23, 45, 0, 0).gettime() - time, mp3 = new audio("audio/alarm.mp3"), ogg = new audio("audio/alarm.ogg"), audio; if (typeof mp3.canplaytype === "function" && mp3.canplaytype("audio/mpeg") !== "") audio = mp3...

html - th tags as footers for td cells -

is semantic wrong use 'th' tag alternative multiple footers in 'td' cells? example http://jsfiddle.net/marcelozep/dwsrs/ <table border="0"> <tr> <td><a href='http://mpn.p.ht/wp_br2/?cat=7'><img src = "http://mpn.p.ht/wp_br2/wp-content/themes/snapshot/images/m/polos_manga_curta.jpg" /> </a> </td> <td><a href='http://mpn.p.ht/wp_br2/?cat=8'><img src = "http://mpn.p.ht/wp_br2/wp-content/themes/snapshot/images/m/polos_manga_longa.jpg" /> </a> </td> <td><a href='http://mpn.p.ht/wp_br2/?cat=9'><img src = "http://mpn.p.ht/wp_br2/wp-content/themes/snapshot/images/m/camisetas.jpg" /></a></td> </tr> <tr> <th><a href='http://mpn.p.ht/wp_br2/? cat=7'>p&oacute;l...