Posts

Showing posts from January, 2014

iphone - Display Pageviewcontroller using storyboard segue -

i have pageviewcontroller want display , in project using storyboard , segue nsstring *path = [[nsbundle mainbundle] pathforresource:@"paper" oftype:@"pdf"]; pageviewcontroller *page = [[pageviewcontroller alloc] initwithpdfatpath:path]; //[self presentviewcontroller:page animated:no completion:null]; if use statement //[self presentviewcontroller:page animated:no completion:null]; then doesn't display navigation bar , backbarbuttonitem and when remove statement //[self presentviewcontroller:page animated:no completion:null]; then doesn't display pageviewcontroller using curl effect transition turning page on displays navigation bar , backbarbuttonitem. and when replace statement //[self presentviewcontroller:page animated:no completion:null]; with statement [self.view addsubview:page.view]; then displays pageviewcontroller doesn't turn page on @ all. please help. thanks lot. i think see issue. since have segue

c - Can't load custom PHP module -

it compiles dll w/o problems. it's not being recognized loaded when use extension_loaded function in php or in phpinfo list. put dll extensions folder add it's entry php.ini. think problem may in code. am missing or doing wrong? zend_function(myfunction) { char var1 = null; char var2 = null; char var3 = null; char var4 = null; char var5 = null; char var6 = null; int var7; double *var8; if (zend_parse_parameters(zend_num_args() tsrmls_cc, "ssssssla", &var1, &var2, &var3, &var4, &var5, &var6, &var7, &var8) == failure) { return_null(); } cfunction(&var1,&var2,&var3,&var4,&var5, &var6, var7, var8); return_true; } zend_function_entry myextension_functions[] = { zend_fe(myfunction, null) {null,null,null} }; php_minit_function(myextension) { return success; } php_mshutdown_function(myextension) {

jsf 2.2 - Composite Component Binding is resolves to null -

i trying bind composite component ajax listener bind variable resolves null. if use bind variable part of body, eg. #{bind} resolve properly. assume bug, second opinion before report it. thanks page: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:composite="http://xmlns.jcp.org/jsf/composite" xmlns:jstl="http://xmlns.jcp.org/jsp/jstl/core" xmlns:jfunc="http://xmlns.jcp.org/jsp/jstl/functions" xmlns:jid1="http://mydomain.com/facelets"> <h:head></h:head> <h:body> <h:form id="commentboxform"> <jid1:confirmmodal title="t" cssid="a" binding="#{bind}"> </jid1:confirmmodal> <h:commandlink value="cli

c++ - how to make a protobuf dependent lib avalaible in a non-protobuf environment? -

i have c++ project depending on protobuf, there's no guarantee users have protobuf installed on there own pc( protobuf not way of serialization ) want use project lib. in case, dynamic linking protobuf while compiling project not choice(the project.so dynamically depending on libprotobuf.so) can do?

c# - Save As dialog box when downloading PDF file -

Image
i'm trying allow webapp download pdf file save dialog. however, after trying, there wasn't save dialog box appeared when used chrome/firefox. when use ie, given error could error between browser? have saved / convert pdf file bytes. protected void btnpdf_click(object sender, eventargs e) { //byte array hold our pdf, empty byte[] bytes; //instead of filestream we'll use memorystream using (var ms = new system.io.memorystream()) { //standard pdf setup, itext doesn't care type of stream we're using var doc = new itextsharp.text.document(); var writer = itextsharp.text.pdf.pdfwriter.getinstance(doc, ms); doc.open(); pdfptable table = new pdfptable(1); table.totalwidth = 585f; table.lockedwidth = true; var logo = itextsharp.text.image.getinstance(server.mappath("~/image/logo.jpg")); doc.add(logo);

c++ - issues in understanding pointers -

the following codes book programming interviews exposed having problem understand concept of pointers. why can't use code no. 1. code no. 1 bool insertinfront( intelement *head, int data ) { intelement *newelem = new intelement; if( !newelem ) return false; newelem->data = data; head = newelem; // incorrect! return true; } code no. 2 bool insertinfront( intelement **head, int data ) { intelement *newelem = new intelement; if( !newelem ) return false; newelen->data = data; *head = newelem; // correctly updates head return true; } say calling function 1 as: insertinfront(h, data); upon calling of function, computer makes duplication of arguments, release them when function returns. in code no.1, head=newelem assigned address of newelem head (which duplicate of h ), released head , , address of newelem lost forever. in code no.2, however, function should called as: insertinfront(&h, data); this means a

Upload pics to a server using c++ -

i'm trying upload photo 1 of our server in c++, following excerpt of testing code //in main ifstream fin("cloud.jpg"); ofstream fout("cloudcpy.jpg"); string data; while ( fin ) fin >> data; fout << data; fin.close(); fout.close(); return 0; but output file not copy, more smaller original one. wrong in code? you may not use string data type. since jpeg file not textfile. please try use primitive type such unsigned char or unsigned int it.

ruby - Rails NoMethodError when calling method on parent -

playing around single table inheritance , hstore in rails 4 getting error when trying call method in parent: # models/item.rb class item < activerecord::base def getter_setter_for(key) define_method(key) properties && properties[key] end define_method("#{key}=") |value| self.properties = (properties || {}).merge(key => value) end end end # models/disk_item.rb class diskitem < item %w[filename path].each |key| getter_setter_for(key) ## <== error calling method end end error: exception encountered: #<nomethoderror: undefined method `getter_setter_for' #<class:0x007f8c739a5ae0>> what obvious thing have overlooked? getter_setter_for(key) instance method. getting called @ class level. called during diskitem class load on class scope.

xcode4.6 - Xcode Does Not Slice .ice File -

i'm new ice touch (and ice, , xcode), , i'm trying use ice touch ios app. downloaded icetouch-1.3.0 , trying build demo app "chat". xcode tells me cannot find chatsession.h. find chatsession.ice in file, i'm pretty sure problem xcode did not slice .ice file objc files. cannot find helpful information on internet. please me! thanks!! i'm using xcode 4.6. here's xcode tells me: 'chatsession.h' file not found warning: no rule process file '$(project_dir)/classes/chatsession.ice' of type text architecture i386 warning: no rule process file '$(project_dir)/classes/chat.ice' of type text architecture i386

javascript - Resizing canvas to full browser window width and height -

i'm playing around node/socket.io pictionary game. apologize in advance, designer , not keen js. i'm trying re-size canvas entire width , height of browser window without scaling stroke path? right now, javascript sets canvas 500px. here relevant code: // ================================================ // canvas drawing section // ================================================ var canvas = $('#canvas'), context = canvas[0].getcontext('2d'); socket.on('drawcanvas', function(canvastodraw) { if(canvastodraw) { canvas.width(500); context.linejoin = 'round'; context.linewidth = 2; // ... } }); canvas[0].width = $(window).width(); canvas[0].height = $(window).height(); worked great.

android - Adding an inflating view with an animation -

i have view inflate when use clicks button, , want animate view screen when button clicked, have tried code below view snaps screen instead of animates on screen. not sure why view not animate position. view want animate previewmemberpanel previewmemberpanel = ((layoutinflater) this.getsystemservice(context.layout_inflater_service)) .inflate(r.layout.main_member_listing_imagepreview, null, false); //button click body animation anim = new translateanimation(new displaymetrics().widthpixels / 2, 0, 0, 0); anim.setfillafter(true); anim.setduration(5000); anim.setstartoffset(500); if( !previewmemberpanel.isshown() ){ ((linearlayout) findviewbyid(r.id.rootmembers)).addview(previewmemberpanel); previewmemberpanel.startanimation(anim); } use handler post animation: ((linearlayout) findviewbyid(r.id.rootmembers)).addview(previewmemberpanel); new handler().post(new runnable() { public void run() { previewmem

java - How to delete a file after uploading using Struts 2? -

i able upload file using struts2, want drop specified directory don't know how delete. here code: public string execute(){ destpath = "/tmp/listfile"; try{ system.out.println("src file name: " + myfile); system.out.println("dst file name: " + myfilefilename); file destfile = new file(destpath, myfilefilename); fileutils.copyfile(myfile, destfile); filelist = listfiles.listallfiles("/tmp/listfile"); return "listfiles"; } catch(ioexception e) { e.printstacktrace(); return "error"; } } if use apache commons io it's one-liner: fileutils.deletedirectory(dir);

CSS text-decoration hierarchy -

this question has answer here: css text-decoration property cannot overridden child element [duplicate] 2 answers apologies if duplicate, i'm enough of css neophyte don't know search for. i'm trying modify text-decoration within block adding span , , it's not working. how come? can add new text-decoration within span , can't subtract old one. <h1 class="strikethrough"> stricken<span class="no-strikethrough"> no strike</span> </h1> http://jsfiddle.net/zv3ga/2/ is there way can achieve goal? i'd inherit properties of h1 except text-decoration, i'd prefer have "no strike" text inside tag. i think trying keep first part atrile , second part without strike. so this <h1> <span class="strikethrough">stricken</span> no strike </h1>

android - enable and disable a textview on animation start and end -

how disable , enable multiple textview on animation start , end public void animatekeyboardbutton(textview param1, edittext param2, boolean b) { int = (param1.getwidth() - param2.getwidth()) / 2; int j = (param1.getheight() - param2.getheight()) / 2; int k = param2.getleft() - (i + param1.getleft()); int m = param2.gettop() - (j + param1.gettop()); localanimationset = new animationset(true); scaleanimation localscaleanimation1 = new scaleanimation(1.0f, 1.2f, 1.0f, 1.2f, 1, 0.5f, 1, 0.5f); localscaleanimation1.setduration(100l); scaleanimation localscaleanimation2 = new scaleanimation(1.0f, 0.8f, 1.0f, 0.8f, 1, 0.5f, 1, 0.5f); localscaleanimation2.setduration(100l); localscaleanimation2.setstartoffset(100l); translateanimation localtranslateanimation; localtranslateanimation = new translateanimat

actionscript 3 - Sprite not displaying in as3 -

i have class in game tells sprite spawn, class movieclip code attached it. call spawn() function on class , draw sprite using graphics api it. spawn function follows: public function spawn(){ this.addchild(window) window.x = 5 window.y = 10 window.width = this.width - 10 window.height = this.height - 10 window.graphics.clear() window.graphics.drawrect(5, 10, this.width - 10, this.height - 20) window.graphics.beginfill(0xffffff, 1) trace(window.visible) } the problem child window doesn't appear, despite visible trace returning true . in advance help! try : window.graphics.clear() window.graphics.beginfill(0xffffff, 1) window.graphics.drawrect(5, 10, this.width - 10, this.height - 20) window.graphics.endfill(); and make sure class add window on stage.

My app's deploy target is iOS 5.1 but my friend's iPad can't open my app, she's using iOS 5.1.1 -

my app in app store means app has passed apple's review when friend install , download app couldn't see splash screen , crashed right after tapped app icon. can reason problem? edit: here meat of crash log. based on error appears @thomasw , @rahul-vyas correct deployment target inside build settings set ios6.x. recommend checking both target , project settings make sure they're set ios5.1. exception type: exc_breakpoint (sigtrap) exception codes: 0x00000001, 0xe7ffdefe crashed thread: 0 dyld error message: symbol not found: _objc_setproperty_nonatomic_copy referenced from: /var/mobile/applications/b4f5424c-1593-4150-9ad0-6cf3fe3bd3e5/tubenostop.app/tubenostop expected in: /usr/lib/libobjc.a.dylib dyld version: 199.6 thread 0 name: dispatch queue: com.apple.main-thread thread 0 crashed: 0 dyld 0x2fe2a080 dyld_fatal_error + 0 1 dyld 0x2fe2cefc dyld::halt(char const*) + 72 2 dyld

wpf - need to create a custom control -

i have below requirement: i wanted create custom control in developer should able access below 3 properties. label: isrequired content. example 1: name(label): textbox/any input control(content) example 2: name(label)*(isrequired): textbox/any input control(content) developer should able apply globalization label if field required should able set property enable * symbol developer should able set input control content of control. i request suggestions, if send me sample code me. this demo doesn't seem latest should start. googling around bit more keywords found in demo yield relevant results.

Javascript var a = function b() {} -

var = function b() { console.log( typeof b === 'function' ); }; a(); // true console.log( typeof b === 'function' ); // false why second result false? this named function expression . its name visible inside function. for more information, see this article

android - Broad Cast Manager issue -

i new in android programming.i create 1 alarm manager , broadcast manager program . broadcast manager class defined inner class in main activity. inner class not working. give code here. please me. public class alarmactivity extends activity { button btn1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); btn1=(button) findviewbyid(r.id.button1); btn1.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub startalert(null); } }); } public void startalert(view view) { alarmmanager am=(alarmmanager)this.getsystemservice(this.alarm_service); intent = new intent(this, broadcas.class); pendingintent pi = pendingintent.getbroadcast(this, 0,i,0); am.s

java - How to update cell reference values using Apache POI -

i using apache poi create new xssfworkbook existing one, after updating values. suppose have 2 worksheets (lets say: worksheet & b) in existing workbook. worksheet b has cell reference worksheet a. if modify cell values of worksheet , save them new workbook, corresponding cell values of worksheet b should updated too. doesn't. how can update them programmatically? . thank you. my code: public void createexcel(clientdata cd) throws filenotfoundexception, ioexception, invalidformatexception{ // create new file double[] dataholder1= cd.getfinaldata1(), param1 = cd.getrecord1param(); double[] dataholder2 = cd.getfinaldata2(), param2 = cd.getrecord2param(); double[] ncv = cd.getncv(); string[] pname = cd.getname(); workbook workbook = new xssfworkbook(opcpackage.open(new fileinputstream("template/mncv.xlsx"))); // or sample.xls //creationhelper createhelper = workbook.getcreationhelper();

php - inserting into database using post method in android -

i have register form in android application. want need insert registration information web database after registration can login verifying database stored. my onpostexecute method @override protected void onpostexecute(string result) { super.onpostexecute(result); if(result.equals("working")){ toast.maketext(getapplicationcontext(), "http post working...", toast.length_long).show(); }else{ toast.maketext(getapplicationcontext(), "invalid post req...", toast.length_long).show(); } } and php code is $varusername = $_post['paramusername']; $varpassword = $_post['parampassword']; if (isset($_post['tag']) && $_post['tag'] != '') { $con= mysql_connect('localhost', 'root', ''); if (!$con) { die('not connected : ' . mysql_error()); }

java - Can I trigger a dialogue box from an applet? -

i'm new java... i'm creating applet project , wonder if applet can launch warning or dialogue box. if so, instruction or method? frame getmyparent() { container parent = getparent(); while (!(parent instanceof frame)) { parent = ((component)parent).getparent(); } return (frame)parent; } public optionsdialog(mainapplet applet, boolean modal) { super(null, "options", modal); this create dialogue box. add other features , refer here more information on frames.

php - adding font to mPDF -

i'm getting following error when try , generate pdf using mpdf class: ttf file "c:/wamp/www/inc/mpdf/ttfonts/verdana.ttf": invalid checksum 20f65173c11 table: dsig (expected 65173c11) i've uploaded font files ttfonts directory , defined font in config_fonts.php this: "verdana" => array( 'r' => "verdana.ttf", 'b' => "verdanab.ttf", 'i' => "verdanai.ttf", 'bi' => "verdanaz.ttf", ), i see error when turn on font error reporting in config settings. when turn error reporting off, pdf generated, font being used not verdana. any idea on i'm doing wrong? based on @hrvoje-golcic answer, here's improved , less dirty way add fonts mpdf without editing config_fonts.php . i'm using laravel, installed mpdf using composer. as suggested author, define constant named _mpdf_ttfontpath before initializing mpdf value path ttfonts

javascript - IE 10 - Unable to get property 'PageRequestManager' of undefined or null reference: -

telerik controls not working fine internet explorer 10 browser, have changed ie10 compatibility mode worked fine, noticed when loading page js error: unable property 'pagerequestmanager' of undefined or null reference: any ideas/suggestion appreciated thanks browser definition files shipped .net 2.0 , .net 4 may need updated. see following microsoft link details , hotfix .

require once - PHP - require_once seems to be including files multiple times and causing errors -

in php app, have several calls require_once . on development pc works fine , doesn't try include same file multiple times. when moved production server i'm getting error cannot redeclare class myclass after searching through code i've found happens after call require_once , must causing it. i've searched through entire project , class declared in 1 file, , it's ever included through require_once . there weird php config make require_once behave differently on production server? thanks put following @ top of included class file: if( class_exists( "<yourclassname>")) { throw new exception("class defined"); } you receive clear error message class re-called.

Get file ID in skydrive SDK Android -

i'm making app can download file skydrive. app using skydrive sdk. i've found piece of code can download file skydrive android device below: final livedownloadoperation operation = mclient.downloadasync(fileid + "/content", file, new livedownloadoperationlistener() { @override public void ondownloadprogress(int totalbytes, int bytesremaining, livedownloadoperation operation) { int percentcompleted = computeprecentcompleted(totalbytes, bytesremaining); progressdialog.setprogress(percentcompleted); } @override public void ondownloadfailed(liveoperationexception exception, livedownloadoperation operation) { progressdialog.dismiss(); showtoast(exception.getmessage()); } @override

Node.js: What HTTP exceptions can it throw? -

i have simple server http.createserver(function(request, response) { response.writehead(200); response.end("hello world"); }).listen(8080); what exceptions can throw except listen eaddrinuse ? can thow error if user disconnects in middle of request sending? or this? it not throw exception in such scenario disconnected client - 'normal' behaviour. the eaddrinuse exception thrown @ moment of calling http.createserver , tries create socket , fail in case if port in use. while events talking, behind scenes stuff, client disconnects, or timeouts, or similar. events happening asynchronously , why can't thrown node.js execution in middle of nowhere. you still have events request self, , have subscribe them, here answer covers need: node.js http server, detect when clients disconnect

MongoDB Java Driver: Aggregation using $match with multiple condition -

i've been doing search haven't been able find answer. docs , in mongo, if $match: { type: "airfare"} translated as: dbobject match = new basicdbobject("$match", new basicdbobject("type", "airfare") ); in mongo java driver, how translate 1 mongo java driver? $match : { score : { $gt : 70, $lte : 90 } } edit this wanted do: $match : { bookingdatetime: { $gte : fromdate, $lte : todate } } and how implemented in mongodb java driver, no luck far: dbobject matchfields2 = new basicdbobject("$match", new basicdbobject("bookingdatetime", new basicdbobject("$gte", fromdate.gettime()).append("$lte", todate.gettime()))); dbobject match2 = new basicdbobject("$match", matchfields2); fromdate calendar object hence gettime() method convert calendar class date class. object match = new basicdbobject("$match", new basicdbobject("score", ne

mysql - Unable to populate table with data from database -

i have problem when trying fetch data database , display in database. user input , store search variable. how set table: //i user input perform search @fxml public void searchresident(actionevent event){ string search=gettb_search().gettext(); if(search.equals("")){ dialogs.showerrordialog(null, "please enter something", "blank fields detected", ""); }else{ setupsearchtable(search); } } //how set table public void setupsearchtable(string search) { tablecolumn rmnamecol = new tablecolumn("name"); rmnamecol.setvisible(true); rmnamecol.setcellvaluefactory(new callback<tablecolumn.celldatafeatures<searchneedyresidentcontroller, string>, observablevalue<string>>() { public observablevalue<string> call(tablecolumn.celldatafeatures<searchneedyresidentcontroller, string> p) { return p.getvalue().searchnameproperty(); } }

mysql - SQL: do we need ANY/SOME and ALL keywords? -

i'm using sql (sql server, postgresql) on 10 years , still i'm never used any/some , all keywords in production code. situation i've encountered away in , max , min , exists , , think it's more readable. for example: -- = select * users u u.id = any(select p.user_id payments p); -- in select * users u u.id in (select p.user_id payments p); or -- < select * users u u.salary < any(select p.amount payments p); -- exists select * users u exists (select * payments p p.amount > u.salary); using any/some , all : postgresql sql server mysql sql fiddle examples so question is: missing something? there situation any/some , all shine on other solutions? i find , useful when you're not testing equality or inequality. consider 'blah' (array['%lah', '%fah', '%dah']); as used answer question . any , all , negations can simplify code that'd otherwise require non-trivial subqueries or ctes, ,

linker - How to get the image base address in the code when compiling with GCC? -

i'm doing embedded programming gcc. how image base address in c code? p.s. know set-up variable in linker script. there other way achieve without bother modify script? thanks in advance. if understand question correctly, don't want explicitly set base address want know base address set part of output. you can generate map file part of compile passing argument linker. example: gcc -wall -o hello_world.exe -wl,-map,hello_world.map hello_world.c the relevant section being -wl,-map,hello_world.map meaning passing -map option linker , telling generate file hello_world.map . the resultant output has lot of information in looking section following: linker script , memory map 0x00400000 __image_base__ = 0x400000 0x00000000 __dll__ = 0x0 0x00400000 ___imagebase = 0x400000 0x00001000 __section_alignment__ = 0x1000 0x00000200

odata - Kendo UI Grid - Add new record shows 0 as ID -

i'm using kendo ui grid asp.net mvc, entity framework , odata. have record id inside grid - far good. but when click on "add new record" in toolbar id column shows me 0 while i'm editing data. and after click on "update" button doesn't change correct id (which has been returned service): { "odata.metadata":"http://localhost:61534/api/$metadata#assetlist/@element", "id":17, "manufacturername":"test", "name":"test", "serialnumber":"test", "assetstateid":1, "assetstatename":"test", "nextcalibration":"2013-07-11t09:08:28.298z" } when refresh page/browser correct id shown. here's post method: public override httpresponsemessage post(assetlistviewmodel item) { // #### mg: create asset rsams.webui.models.asset asset = new asset(); asset.manufacturer = item.ma

javascript - All links with one class - how to add additional class on click? -

it possible if have more links same class, on click add aditional class active item? have tried jquery '.toggleclass()' if click on next link both links has same class <a href="link1.html">1</a> <a href="link2.html">2</a> <a href="link3.html">3</a> i have tried: $('a').click(function() { $('a').toggleclass('active'); }); i don't see class in html, add example. try this: html <div class="menu"> <a href="link1.html">1</a> <a href="link2.html">2</a> <a href="link3.html">3</a> </div> jquery $('.menu a').click(function(){ //check thru <a> elements inside .menu $('.menu ').removeclass("active"); // remove active class $(this).addclass("active"); //put active in parent of <a> clicked });

objective c - passing data from parent to child -

in app i'm trying pass data parent view child view. however, when run app delegate method isn't being called. here code on how implemented custom delegate: parent.h @protocol slbwallviewcontrollerdelegate <nsobject> - (void) picturetobeuploaded:(id)picture; @end @interface slbwallviewcontroller : uiviewcontroller <uiactionsheetdelegate, uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate> - (ibaction)createpotbuttonpressed:(id)sender; @property (weak, nonatomic) id <slbwallviewcontrollerdelegate> delegate; @end parent.m [self.delegate picturetobeuploaded:info[uiimagepickercontrollereditedimage]];//i'm taking pic uiimagepicker child.h @interface slbpostviewcontroller : uiviewcontroller <slbwallviewcontrollerdelegate> @property (weak, nonatomic) iboutlet uiimageview *picture; @end child.m #pragma mark - wall view controller delegate - (void)picturetobeuploaded:(id)picture{ self.picture.image = picture; } is t

django - write an advanced migration with south -

i added field "is_capital" model "realm" has foreign key pointing "user". this looks like: class realm(models.model): user = models.foreignkey(user) is_capital = models.booleanfield( default=false ) #field not synced yet #... by default, want records per user have "is_capital" flag set false, first (or random one). in end there should 1 "realm" flagged "is_capital" per user. so table should in end: realm realm_id ; user_id ; is_capital 1 ; 1 ; true 2 ; 1 ; false 3 ; 1 ; false 4 ; 2 ; true 5 ; 2 ; false how can such migration ? examples have seen filling new columns single value. add schemamigration add field default=false . python manage.py schemamigration app_name --auto run migration. then create data migration making changes ./manage.py datamigration app_name mark_is_capital in forwards() of created migration file, write: for user in orm.user.objects.all(): realms = or

jquery - Html SELECT : send both value and text on submit -

i have select <select name="country" multiple> <option value="in">india</option> <option value="us">united states</option> </select> while submitting form if both country selected, default behaviour is, send as: country=in,country=us but want send both value , text i.e in , india both. how can done i think should give try: $("#btnsub").on('click',function(){ // submit button click $(".select option:selected").each(function(i, option){ console.log($(this).val() + "," + $(this).text()); }); return false; }); html <select class="select" name="country" multiple="multiple"> </select> fiddle demo

php function for linux time conversion -

i'm new php , need php function converts linux times 1396310400 $variable , returns human-readable date 1. apr. 2014! (time of day not needed)? suggestions appreciated. echo date('d/m/y', $time_linux); read here: http://php.net/manual/en/function.date.php learn how modify result show want.

How to get a verb connecting two nouns in an Apache OpenNLP parse tree? -

what strategy find out verb connecting 2 nouns in parse tree, assuming exists? example, in sentence: the man called wife before coming home. given inputs "man" , "wife", i'd verb "called". opennlp gives me parse tree: (top (s (np (dt the) (nn man)) (vp (vbd called) (np (prp$ his) (nn wife)) (pp (in before) (s (vp (vbg coming) (advp (rb back)))))) (. home.))) so guess @ least partly tree navigation question. maybe first isolate verbs, test recursing down, until both nouns found? or try find shortest path 1 noun other , save verb on way? my problem don't know enough parse tree structure devise strategy. or should perhaps use other (java) tool? thanks! the task want accomplish complex. biggest problem can see here need "a verb connecting 2 nouns". generic, , maybe have saw parse trees can assume different (and "wrong") structures. if want more generic approach problem suggest relation extracti

sql server - Select distinct statement not working, Active reports and SQL -

i have relatively unique problem, , although have looked 2 days cant find correct answer yet. in current project using active reports 6 create reports out of data stored on our sql server. i attempting use select distinct statement no luck. i using sql create view, not saving view, code run query everytime report requested. the report show current vehicles company has on lease. report must bring unique hits on registration field. can in there multiple times, if more 1 person has driven vehicle etc.. here sql code select distinct on registration companycars companycars.registration regno, [staff details].[first name] + ' ' + [staff details].[last name] driver, companycars.car_type vehicletype, companycars.reg_date regdate, companycars.price price, [staff details].[ni number] ninumber, companycars.end_mile - companycars.start_mile usedmiles, companycars.lease_mile -(companycars.end_mile - companycars.start_mile) excessmiles, case when companycars.lease_mi

e commerce - Is it possible to use Magento checkout on non Magento site -

i'm working on non-magento e-commerce website, created symfony because standard e-commerce framework restrictive towards website specifications. however know if possible use magento checkout solution standalone because part of framework compliant specifications. i haven't found attempt of since magento quite modular wondering if there chance of doing this. yes possible using magento soap api here's a link reference.

c# - Starting application before target application -

i have c# windows forms application need run before microsoft infopath. my application needs have access parameters passed in infopath. application processes parameter, has conditional logic, sets registry key/value. needs open infopath (with parameters passed in first time around) , close. eg 1. user opens infopath param "c:\file.xml" 2. before infopath starts need application open , able access above param 3. application it's stuff 4. application starts infopath instance param above basically need middle man. know how open infopath after using process.start unsure of how "intercept" user's request open infopath, open application , open infopath once application has finished. i suggest replacing infopath executable own , afterwards starting "original one" (which have stored under different name of course).

java - Finding GlassFish sub component versions -

how (best) find glassfish sub component versions, e.g. cdi (weld)? i know @ webapp startup versions displayed, i'm looking reliable listing on page: https://glassfish.java.net/downloads/3.1.2.2-final.html this version has hundreds of bug fixes updated versions many of sub-components: jersey 1.11, grizzly 1.9.46, weld 1.1.4.final, eclipselink 2.3.2, mojarra (jsf) 2.1.6, metro 2.2, osgi core 4.3.0, javadb 10.8.1.2, openmq 4.5.2 , more. ...where overview doesn't seem reliable @ all, since i've upgraded 3.1.2.2 , weld version displayed is [org.jboss.weld.bootstrap.weldbootstrap] (1) weld-000900 1.1.8 (final) even though release notes list weld 1.1.4. (i've asked person responsible our project setup: has never upgraded weld version. weren't able determine location of library in gf 3 :-) ... ) so, there reliable way find sub component versions (also sub components don't log version on startup)? mentioned, i/we couldn't find respecti

r - Assigning value labels with factor() using mapply() -

i'm having trouble assigning value labels lists numeric variables. i've got dataset (in form of list() ) containing eleven variables. first 5 variables each have individual value levels, last 6 each use same 1-5 scale. created lists value labels each of first 5 variables , 1 scale. automatically assign labels lists variables. i've put eleven variables in list able use mapply() . here's example of current state: # example variables: <- c(1,2,3,4) # individual variable b <- c(1,2,2,1) # individual variable b c <- c(1,2,3,4,5) # variable c using scale d <- c(1,2,3,4,5) # variable d using scale mydata <- list(a,b,c,d) # example value labels: lab.a <- c("these", "are", "value", "labels") lab.b <- c("some", "more") lab.c <- c("and", "those", "for", "the", "scale") labels.abc <- list(lab.a, lab.b, lab.c) # assigning labels in 2

amp - C++ Assistor -

is possible specify parameters pointer called &amp; in c/c++? basically let's have function: int vba (unsigned long *a, unsigned long *b){.....} can declare non-pointer values parameters using mysterious &amp; call? reading book , author using so, doesn't declare is, or in general. googled "&amp c++ call" , didn't results. so specifies non ptr assignment using in anothe function so: int vca () { unsigned long c, d; vba(&amp;c, &amp;d); //etc ... } this confused, don't know happened here, or call does, how did assign pointer non-pointer ... seems quite awesome though never heard of before. mind elaborating on is, or how possible? also when put code says in error log: "intellisense: identifier "amp undefined"? got lost because compiler highlights amp call in blue, how undefined? that html encoding & character. website got got wrong. hm, reread question , noticed you're talking b

sql server - SQL Getting 2 digit numbers from row_number Over () function -

is possible numbers 2 digits using following function? row_number () over(order uh.stuff) hsn i want query return 01 , 02 , 03 instead of 1,2,3... do this: right('0' + convert(varchar,row_number() on (order uh.stuff)), 2) hsn

Insert Data into Mysql from PHP from a nested foreach loop -

i'm trying enter data fetched json database. have fetched data multidimensional array , used foreach loop loop through arrays. i'm trying insert data mysql database keep getting error error: field 'summary' doesn't have default value . my database table called articles in database called tracking , has following fields: article_id, url, domain, favicon, title, summary, likes, tweets, plusones, image, category my php file called json_parser.php , follows <?php define('db_name', 'tracking'); define('db_user', 'xxxxxxxxxxx'); define('db_password', 'xxxxxxxxx'); define('db_host', 'localhost'); $link = mysql_connect(db_host, db_user, db_password); if (!$link){ die('could not connect: ' . mysql_error()); } $db_selected = mysql_select_db(db_name, $link); if(!$db_selected){ die('cannot use '. db_name . ': ' .mysql_error()); } $url = "http://digitalrand.n

XML to XML using XSLT through C# -

i've got xml file (book) need make changes before creating output xml file. i've got xslt transform file part of job fine, i'm needing go 1 step further i'm struggling. in c# i'm using xslcompiledtransform object trigger transform task , not works because xml file output empty ... code behind xslcompiledtransform transform = new xslcompiledtransform(); transform.load(server.mappath("~/rss91.xslt")); transform.transform(server.mappath("~/book.xml"), server.mappath("~/output.xml")); rss91.xslt <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="html" indent="yes"/> <xsl:param name="title"/> <xsl:template match="rss"> <xsl:for-each select="channel/item"> <br> <strong> <a href="{link}"

linux - What is the usage of sorted command? -

i have read of example comes sort command. how ever not sure usage of sort command in style? sort <word> sorted that 2 file names, in sort file1 file2 file3... if pass multiple file names, sort concatenates them , sorts of them together.

sql - auto increment option error in sqlite3 -

create table filemanager(oid auto_increment int primary key,filepath text unique); insert filemanager(filepath)values("c:\a.txt") select *from filemanager output: |c:\a.txt kindly let me know missing here.thanks http://sqlite.org/autoinc.html correct create command is: create table filemanager ( oid integer primary key autoincrement, filepath text unique);

c++ - how to use FMOD to record sound more than 5 seconds -

i came across fmod recently, , have been trying record sound c++ program using fmod. saw nice little example given in fmod documentation. easy understand, records audio 5 seconds. how can use fmod record audio more 5 seconds, of custom size passed program? troubleshooting done far- i think need changes fmod::sound object, not quite sure what. in example given fmod, exinfo.length = exinfo.defaultfrequency * 25 * exinfo.numchannels * 5; this 1 of parameters passed sound object, tried changing it, no effect. changed value passed sleep function, reduced value, , commented line, had no effect on output of program. i'd appreciate hints given on this. :)

I want c++ generate random number is repeat -

i 2 week newbie programming in c++ having challenge code work desired. goal generate non repeated random number. here part of code, unsigned long seed = time(null); int gsmnun (int l, int h) { srand(seed); int user_phone = rand()%h+l; return user_phone; } int main() { int z = gsmnun(70000000, 99999999); for(int i=0; i<20; i++) { cout << "the random number is!" << z << endl; } return 0; } you're reseeding random number generator each time function called same seed, you're going same random number rand(). i've modified code , added comments, please note seed random number generator once when application starts , calls rand() produce actual random numbers. reseeding generator should not done each time want new random number, calls made result in same numbers being generated iterations. unsigned long seed = time(null); int gsmnun (int l, int h) { // removed srand() here. int user

Alignment of UL in template footer (HTML & CSS) -

Image
the problem @ footer of website. trying make footer of main template i'm missing can't understand. please guide. what want like: please move lists little shown in first picture. many tanks.. you should have applied css reset you're missing padding:0 ul in footer this help!