Posts

Showing posts from August, 2013

jquery - calling partial view as popup window on click of ajax actionlink -

i trying open partial view popup window should contain image on click of ajax action link @ajax.actionlink("view document", "viewdocument","property", new routevaluedictionary { { "id", viewbag.documentname } }, new ajaxoptions{ httpmethod="get", insertionmode=insertionmode.replace, loadingelementid="loading", updatetargetid = "view" }) and using id finding filename , path of image , returning partial view public actionresult viewdocument(int id) { var document = db.documents.where(d => d.id == id).firstordefault(); var documentfilename = document.filename; viewbag.document = string.format("~/app_data/uploads/{0}.jpg",documentfilename); return partialview(); } and partial view l...

Log4Net filter out INFO from the log and only show DEBUG & ERROR -

is there way filter out info log , show debug & error, using config in web.config ? <root> <level value="debug" /> <appender-ref ref="coloredconsoleappender" /> <appender-ref ref="rollingfilesystemappender" /> <appender-ref ref="consoleappender" /> </root> in log4x there filters can applied appenders in order filter messages; here list of filters log4net.filter.levelmatchfilter filters log events match specific logging level; alternatively can configured filter events not match specific logging level. log4net.filter.levelrangefilter similar levelmatchfilter, except instead of filtering single log level, filters on inclusive range of contiguous levels. log4net.filter.loggermatchfilter filters log events based on name of logger object emitted. log4net.filter.stringmatchfilter filters log events based on string or regular expression match against log message. log4net.filter.pro...

c++ - In Which Library IFileDialog is Located -

now i'm writing code ifiledialog *pfd = null; hresult hr = cocreateinstance(clsid_fileopendialog, null, clsctx_inproc_server, iid_ppv_args(&pfd)); after compiling error appeared; "ifiledialog not declared in scope" what library of class ?? you don't need know library implements it. com interface invoke call cocreateinstance . system rest. looks implementing com server in com registry , instantiates object. in order compile need include shobjidl.h , , define version macros appropriately. need #define _winnt_win32 0600

c# - WCF RESTful - HTTPS for a single operation method -

it possible enable https single operation method in restful wcf? i'm using service mobile application don't want enable https whole service. sorry english... not single endpoint. binding of endpoint needs decide whether use http or https (based on transport binding element). if want (and may not need - try profiling "big" responses , without ssl , may find difference not much) can define 2 endpoints, 1 ssl single operation, , 1 without ssl other operations, in example below: public class stackoverflow_22865228 { [servicecontract] public interface isecureoperation { [webget] int add(int x, int y); } [servicecontract] public interface iinsecureoperations { [webget] int subtract(int x, int y); [webget] int multiply(int x, int y); } public class service : isecureoperation, iinsecureoperations { public int add(int x, int y) { return x + y; } public int s...

.net - Windows Service opening a mail box -

we had exchange server 2007 mail box.there windows service uses mapi protocol pull mails mailbox. the mailbox migrated exchange server 2013.the windows service started reporting issues mapi logon failed. on checking messaging team ,they have told mapi no longer supported in exchange server 2013. it great if can advise,if have faced problem earlier . you're going have switch using either imap or ews talk exchange box. also, found snippet : all mapi traffic rpc-based. historically, outlook clients have had 2 transport methods rpc traffic available them: rpc on tcp, , rpc on http (aka outlook anywhere). in exchange 2013, removed rpc on tcp option, leaving rpc on http connectivity method. not mean rpc no longer supported. in fact, still used (e.g., still make mapi/rpc calls), encapsulate them in http packets. so, stands reason old mapi-based code still work if made use http. not sure entail, if saves trouble of converting different protocol (re...

session - PHP session_destroy() stopped working -

session_destroy() stopped working due unknown reasons , active session not getting destroyed. have tried solutions mentioned on se not working. below code using. session_start(); # note session start $_session = array(); session_unset(); session_destroy(); header('location: thankyou'); exit(); entire script: <?php //session_start(); $to = 'equote@domain.com'; $products = $_post['product_id']; $subject = "request quote"; $errors = array(); $i = 0; if(!isset($_post['name']) || $_post['name'] == ''){ $errors[$i] = 'please enter name'; $i++; } if(!isset($_post['company_name']) || $_post['company_name'] == ''){ $errors[$i] = 'please enter company name'; $i++; } if(!isset($_post['phone']) || $_post['phone'] == ''){ $errors[$i] = 'please enter phone number'; ...

java - How to prevent SQL injection In App Engine JDO -

please help.. how prevent sql injection @ time of jdo insertion? my jdo class mydata.java package com.jdo; import java.util.date; import javax.jdo.annotations.persistencecapable; import javax.jdo.annotations.persistent; import javax.jdo.annotations.primarykey; import javax.jdo.annotations.identitytype; @persistencecapable(identitytype = identitytype.application,detachable="true") public class mydata{ @primarykey @persistent private string id; @persistent private string name; @persistent private string address; @persistent private date addeddate; /** * * @param id * @param name * @param address */ public mydata(string id,string name,string address) { super(); this.id=id; this.name=name; this.address=address; this.addeddate = new date(); } /** * @return id */ public string getid(){ return this.id; } /** * ...

restkit 0.20 - No Quotes in JSON for ManagedObject? -

in reading documentation , sample code posting objects, must have missed relating serializing entities. appears possible send entity postobject , expect use supplied mapping produce json , post server. i have been able map , post object, json not coming through formed. i have been able hand parameterize object , valid json. i'm dig source-code, wondering i'm missing. here's code , results i'm seeing. insight/help appreciated! i have following managed object: @interface tfuser : nsmanagedobject @property (nonatomic, retain) nsstring * first_name; @property (nonatomic, retain) nsstring * last_name; @end i have following code map it: +(rkentitymapping *) mapping { if (_mapping == nil) { rkobjectmanager *objectmanager = [rkobjectmanager sharedmanager]; assert(objectmanager && "object manager not initialized!?"); rkmanagedobjectstore *managedobjectstore = objectmanager.managedobjectstore; assert(objectmanager &...

android - How to save folder in specific folder in Google Drive -

i can save/copy file in folder of google drive using below code .but when apply method save folder in other folder, can't save folder, , nothing happens. want copy folder , save @ place string locationid="0b-wftscd2afsfs34tc-223";//getting id of parent folder have make new file child file orgnlfile =global_file; file copiedfile = new file(); copiedfile.settitle(orgnlfile.gettitle()); copiedfile.setmimetype(orgnlfile.getmimetype()); copiedfile.setparents(arrays.aslist(new parentreference().setid(locationid))); try { mservice.files().copy(orgnlfile.getid(), copiedfile).execute(); } catch (ioexception e) { system.out.println("an error occurred: " + e); } but unfortunately doesn't work copy-paste folder in other directory this because copy duplicating media contents of file new file. since folder has no media contents, there ...

Arduino sending sms in GSM sim900 error -

i have arduino mega 2560 , sim900 gsm module. interfaced them , written code. working, can send 1 sms @ time in while loop. means when write while loop execute sendsms() 5 times using while loop. 1 sms sent.. , stops... the code below: #include <softwareserial.h> #include <string.h> softwareserial myserial(52, 53); void setup() { myserial.begin(19200); // gprs baud rate serial.begin(19200); // gprs baud rate delay(500); } int x = 0; loop() { while (x<5) { sendtextmessage(); x++; } } void sendtextmessage() { myserial.print("at+cmgf=1\r"); delay(100); myserial.println("at + cmgs = \"+94776511996\""); delay(100); myserial.println("hey wow"); delay(100); myserial.println((char)26); delay(100); myserial.println(); } you can't dump @ commands @ sim900 100ms delay, , expect work. sim900 responds @ commands (typically "ok"), , should wait...

android maps view blank -

i following steps in google can't see map in fragment. bellow code. if guys please me? i added google-play-services_lib project. testing in real device. using google apis mainfest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.mymaps" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="12" android:targetsdkversion="17" /> <uses-feature android:glesversion="0x00020000" android:required="true"/> <permission android:name="com.example.mymap.permission.maps_receive" android:protectionlevel="signature" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="c...

cordova - phonegap plugin doesn't compile [Pluggin attached] -

my plugin github: https://github.com/keglevich3/notificationplugin when try compile project next error, have no idea can be. don't know why compiler can't find calss, despite face copy android folder: -compile: [javac] compiling 2 source files g:\phonegao\phomegapme\platforms\android \ant-build\classes [javac] g:\phonegao\phomegapme\platforms\android\src\com\vendrov\plugins\not ificationmanager.java:1: error: class, interface, or enum expected [javac] com.vendrov.plugins.notificationmanager; [javac] ^ [javac] 1 error build failed`enter code here` c:\program files\android\adt-bundle-windows-x86_64-20140321\sdk\tools\ant\build. xml:720: following error occurred while executing line: c:\program files\android\adt-bundle-windows-x86_64-20140321\sdk\tools\ant\build. xml:734: compile failed; see compiler error output details. total time: 2 seconds error code 1 command: cmd args: /s,/c,ant,debug,-f,g:\phonegao\phomegap me\platforms\android\build.xml,-dout....

jquery - How does php handle ajax post request -

maybe not smart think having issues ajax , php interacting each other. trying make save method. this php have. guess not checking right things. (this page called edit.php) <?php if(isset($_post['text']) && isset($_get['dir'])){ $file = $_post['location']; $handle = fopen($file, 'w') or die("can't open file"); $data = $_post['text']; fwrite($handle, $data); fclose($handle); } ?> <input type="text" value="<?=$_get['dir'];?>" id="savevalue"> function gets called when push ctrl , s function savefile(){ var data = new formdata(); data.append('text', e.getsession().getvalue()); data.append('location',$('#savevalue').val()); var url = $('#savevalue').val(); var split = url.split('/public_html'); alert(split[1]); var url = "edit.php?dir="+split[1]; $.ajax({ url: url, ...

php - sql associative array with column name as header -

i have simple table in database messages touser , fromuser. right there 1 touser , 3 fromuser. want organize result fromuser containing row data this: array( user1 => array(array( [id] => 1 [message] => message user 1 ), ( [id] => 1 [message] => message user 1 )), user2 => array(array( [id] => 2 [message] => message user 2 ), ( [id] => 2 [message] => message user 2 )), user3 => array(array(... i know syntax wrong hope point. tried using "group fromname" gave me last message. what's right syntax query this? $query = mysqli_query($link, "select * messages toname='$to' group fromname"); $messages = array(); while ($row = mysqli_fetch_assoc($query)) { $messages[] = $row; //or $messages[$row['fromname']] = $row; //didn't work either } print_r($messages); edit : found fricking answer: $query = mysqli_query($link, "select * m...

c# - Binding to another element? -

i can't work, have textblock want bind 'text' property window's title. tried this: <textblock text="{binding path=window.title}" ... /> you're using wrong syntax binding. first add name window, let "window1". following: <textblock text"{binding elementname=window1, path=title}" ... />

windows - Jscript - Variable in function name, possible? -

i have function names in array in wsh jscript, need call them in loop. al found here javascript - variable in function name, possible? doesn't work, maybe because use wsh and/or run script console, not browser. var func = [ 'cpu' ]; func['cpu'] = function(req){ wscript.echo("req="+req); return "cpu"; } (var item in func) { wscript.echo("item="+ func[item](1)); } the result is: c:\test>cscript b.js microsoft (r) windows script host version 5.6 copyright (c) microsoft corporation 1996-2001. rights reserved. c:\test\b.js(11, 2) microsoft jscript runtime error: function expected (this wscript.echo line) so, there way call function using name in variable in environment? no, problem not wsh not command line. this have in code: var func = [ 'cpu' ]; that is, array 1 element in it. content of element 'cpu' , index 0. array length 1. func['cpu'] = function(req){ ...

multithreading - Issues with C pthreads and a malloc/seg fault error -

having problems c code (kinda new language). have following code: .. rtspclient *clientinfo = (rtspclient*) malloc(sizeof(rtspclient)); if (!clientinfo) { printf("there wasn't enough memory fufill connection.\n"); continue; } clientinfo->socket = new_fd; pthread_create(&thread, null, handleclientconnection, (void *) clientinfo); ... where rtspclient following typedef struct { int socket; int session_id; playbacktimer* playback_timer; cvcapture* video; } rtspclient; when try access video field in struct, getting seg faults. not allocating things correctly, wondering how can fix issue. need keep global variable clientinfo object allocated before thread started, or need allocate statically? any appreciated. rtspclient *clientinfo = (rtspclient*) malloc(sizeof(rtspclient)); creates memory clientinfo structure. need allocate memory cvcapture* video; , other pointers. (if do, please show more code how work allocated structure)...

mysql - insert URL Link in php built from sql results -

when displaying table created sql query i attempting change following line displays table row # echo $row['id']; so insert url link based on id echo "<a href="/dbtest/updaterow.php?id=$row['id']>update</a>"; when above code, not getting error in http error log (normally syntax errors see them) any doing wrong appreciated. i have tried number of iterations each change results in blank page being returned , no error displayed in logs. change line following: echo "<a href=\"/dbtest/updaterow.php?id=".$row['id']."\">update</a>";

CSS selector for sentences after first sentence -

i have question css selector. want select sentences after first sentence in container. first sentence there no problem: :first-line but can't find way select sentences "after first line". tried don't working. :not(:first-line) here fiddle selected first sentence don't solve problem. http://jsfiddle.net/zono/2bdx8/ best regards. the trick height of each line defaults 1em. setting max height , overflow hidden show first line of sentence. http://jsfiddle.net/aqalj/2/ p { max-height: 1em; overflow: hidden; } another approach use text-overflow: ellipsis. more user-friendly indicates sentence has more text , trimmed. http://jsfiddle.net/wws6l/11/ p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }

Show two countries in Google Visualization: Geochart -

i want show map 2 countries near each others, let's usa , canada. far can see, google allows me show either, world, zone(with many countries: eg north america), region, or country, want see 2 adjacent countries. thats not possible. 1 way display 2 countries seperatly play dom make them close each other

python - Why does environ['wsgi.input'].read() block even though it is allowed by PEP-3333? -

issue here simple wsgi application supposed print content-length , request body in header. def application(environ, start_response): start_response('200 ok', [('content-type','text/plain')]) content_length = int(environ['content_length']) print('---- begin ----') print('content_length:', content_length) print('wsgi.input:', environ['wsgi.input'].read()) print('---- end ----') return [b'foo\n'] if __name__ == '__main__': wsgiref import simple_server server = simple_server.make_server('0.0.0.0', 8080, application) server.serve_forever() when run application, gets blocked @ following call: environ['wsgi.input'].read() . i run application using python 3 interpreter , submit http post request using curl. lone@debian:~$ curl --data "a=1&b=2" http://localhost:8080/ the curl command gets blocked waiting output. python int...

css - CSS3 transition max-height : 0 to max-height : 99999px -

hello i trying make according tabs pure css3 , know transition doesn't work height : 0 height : auto im trying max-height : 0 max-height : 99999px . dont know why isn't work. jsfiddle try one . you have target property. if use word all , target properties. read on mdn . div { transition: <property> <duration> <timing-function> <delay>; } example : .ac-container article { -webkit-transition: 5s all; -moz-transition: 5s all; -o-transition: 5s all; -ms-transition: 5s all; transition: 5s all; } another error, forget ; @ : .ac-container input:checked ~ article{ max-height:999999px !important /* ; */ } last thing, if use big value (like 999999px ) , small transition (like 0.5s ), transition work not see it. by way, dont need keyword !important here.

Trying to reverse a string using c -

this question has answer here: program reverse string [closed] 1 answer platform : c hi, trying reverse string in following format: input string: cat output string: siht si tac the code have implemented this: int main() { char str[100]; char final[100]; int len=0; int i=0; char temp[100]; int j=0; printf("enter string"); gets(str); len = strlen(str); printf("%s",str); for(j=0,i=len-1;i>0;i--) { while(j>=len-1) { temp[j] = str[i]; final[j] = temp[j]; j++; } } printf("%s",final); putchar('\n'); getch(); } any suggestions doing wrong? #include <stdio.h> #include <ctype.h> #include <conio.h> //for getch() int main(){ char str[100]...

Looping over all files except for a certain type -

i'm creating batch file encrypts files different folder, i'm able .txt files @ moment using for %%c in (%mydir%\%1\*.txt*) ( ... i want files except files ending .aes possible ? you hide .aes files before executing loop , unhide them back. attrib +h *.aes %%c in (%mydir%\%1\*.txt*) ( ... attrib -h *.aes

php - PayPal IPN not inserting into database -

i tested paypal donation button on localhost , inserts payment amount mysql database (verified on phpmyadmin) first time. after stops working is there below prevent working? config.php <?php require "paypal_integration_class/paypal.class.php"; require "config.php"; require "connect.php"; $p = new paypal_class; $p->paypal_url = $paypalurl; if ($p->validate_ipn()) { if($p->ipn_data['payment_status']=='completed') { $amount = $p->ipn_data['mc_gross'] - $p->ipn_data['mc_fee']; mysql_query(" insert dc_donations (transaction_id,donor_email,amount,original_request) values ( '".esc($p->ipn_data['txn_id'])."', '".esc($p->ipn_data['payer_email'])."', ".(float)$amount.", ...

ios - Autofocus on subject when opening MFMailComposeViewController? -

is there way autofocus subject field when opening mfmailcomposeviewcontroller? did find 1 post on ( set first responder in mfmailcomposeviewcontroller? ) seems deprecated.

java - JavaFX image nullpointerexception -

i'm trying declare image object, nullpointerexception every time try use it. constructor: final image systemsecureimage = new image((getclass().getresource("images/notifications/systemsecure.png")).tostring()); when try use in method, throws error. example... sample.samplemethod(image); any idea i'm doing wrong? i've tried 2 other ways: image systemsecureimage = new image("images/notifications/systemsecure.png"); image systemsecureimage = new image("file://images/notifications/systemsecure.png"); the image 's constructor needs external form of resource path. final image systemsecureimage = new image((getclass().getresource("images/notifications/systemsecure.png")).toexternalform());

certificate - BouncyCastle - signature algorithm in TBS cert not same as outer cert -

i'm trying validate certificate path , signature using bouncy castle apis. and i'm getting following exception. have verified signature algorithm 'sha256withrsaencryption' same in certificates , issuer certificate. any appreciated. exception in thread "main" org.bouncycastle.jce.exception.extcertpathvalidatorexception: not validate certificate signature. @ org.bouncycastle.jce.provider.rfc3280certpathutilities.processcerta(unknown source) @ org.bouncycastle.jce.provider.pkixcertpathvalidatorspi.enginevalidate(unknown source) @ java.security.cert.certpathvalidator.validate(certpathvalidator.java:250) caused by: java.security.cert.certificateexception: signature algorithm in tbs cert not same outer cert @ org.bouncycastle.jce.provider.x509certificateobject.checksignature(unknown source) @ org.bouncycastle.jce.provider.x509certificateobject.verify(unknown source) @ org.bouncycastle.jce.provider.certpathvalidatorutilities.verify...

perl - How do I override compare_fields when using Rose::HTML::Form -

so i'm trying use rose::html::form , want fields appear based on 'rank' rather name (the default) . i've written comparator subroutine: sub _order_by_rank { ($self, $one, $two) = @_; return $one->rank <=> $two->rank; }; and referenced in form constructor: rose::html::form->new(method => 'post', compare_fields => \&_order_by_rank); but left with: can't call method "name" on unblessed reference @ /usr/lib/perl5/site_perl/5.8.8/rose/html/form/field/collection.pm line 405. it seems call comparator before i've added anything. after constructing form object, add fields , call init_fields: $form->add_fields( id => { type => 'hidden', value => "", rank => 0 }, number => { type => 'int', size => 4, required => 1, label => 'plant number', rank => 1 }, name => { type => 'text', size => 25, required => 1, la...

ruby on rails - :class => "Insert Random Class Name Here" -

what point of doing this? class user has_many :students, :class_name => "coachstudent", foreign_key: "coach_user_id" end class coachstudent belongs_to :student, :class_name => "user", :foreign_key => "student_user_id" end why? why not user has many students, , student belongs user? that's traditional way, yes? edit my befuddlement stems fact there no student class per se. it's listed in code above. hence question. ps. feel free rename post @ loss on how title it. :class_name gives flexibility name associations whatever want , make code more readable , reusable. :foreign_key attribute again allows decide field want foreign key. if go usual convention: class user has_many :students end class coachstudent belongs_to :student end activerecord default, use _id foreign key , try find class student associations. in case, want use :students association name , map coachstudent . flexibil...

php - Passing a JavaScript variable to the view through a HTML form -

i'm having issue passing javascript variable through form correctly controller. i'm not sure how since it's first time working javascript. appreciated. my code can found below: <script> function finddoc(e){ ... var id = grid._data[rindex].document_id; } ... {title: grab, template: "<form action = '<?php echo $exepath;?> docs/grab' method = 'post'><input type = 'submit' value = 'id'></form>", width: 90} </script> if attempting concatenate value of id javascript variable string in code have use javascript's string concatenation operator : {title: grab, template: "<form action = '<?php echo $exepath;?> docs/grab' method = 'post'><input type = 'submit' value = '"+id+"'></form>", width: 90} also, don't think want space in action url between php echo , docs/grab ...

android - determine which button clicked inside of a service -

have simple service running, , have buttons each different thing (i want them too). im not sure how let service know button pressed. when press button want service start regardless depending on button pressed needs different. service class import android.app.notificationmanager; import android.app.pendingintent; import android.app.service; import android.app.taskstackbuilder; import android.content.context; import android.content.intent; import android.os.ibinder; import android.support.v4.app.notificationcompat; import android.util.log; import android.widget.toast; public class myservice extends service { notificationcompat.builder mbuilder; private int = 1; public myservice() { } @override public ibinder onbind(intent intent) { // todo: return communication channel service. throw new unsupportedoperationexception("not yet implemented"); } @override public void oncreate() { toast.maketext(this, "t...

html - Background inner fade -

i have background image here sidebar. want make background using css, possible? height of sidebar, changing depending on content <div> that's why can't use background image. you can use box-shadow effect. background-color:#880600; -webkit-box-shadow:inset 0px 5px 20px 5px black; -moz-box-shadow:inset 0px 5px 20px 5px black; box-shadow:inset 0px 5px 20px 5px black; http://jsbin.com/bapawoho/1/ hope helps :)

c# - How to implement an Expandable ListBox item use as header to show more list items using Silverlight on Windows Phone7 platform -

i hope share idea on how implement collapsable items in listbox control silverlight on windows phone platform. basically, want achieved following behavior: (note: (v) represents down arrow icon collapsable items (^) represents arrow icon uncollapsed header items) original/unexpanded list item headers: (v) header1 (v) header1 (v) header2 (v) header3 (v) header4 (v) header5 expanded header1 additional list items (^) header1 string1 string2 string3 (v) header2 (v) header3 (v) header4 (v) header5 expanded header2 additional list items (v) header1 (^) header2 string4 string5 string6 (v) header3 (v) header4 (v) header5 can achievable silverlight on windows phone? suggestions highly appreciated. regards, aj

c# - Rendering of controls in a moving panel -

i wonder why example below acts does. when click button panel moving properly, buttons in appears after panel have finished movement. why acting way? flaw of panel, or code? edit: also, panel seems recolor things lying behind. there way recolor components doesn't? using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace testmeny { public partial class form1 : form { panel menu; int menuspeed = 1; boolean menuhidden = true; public form1() { initializecomponent(); this.formborderstyle = formborderstyle.none; menu = new panel(); menu.size = new size(100, 500); menu.location = new point(-100, 0); menu.backcolor = color.bisque; controls.add(menu); point loc = new point(10, 10); (int = 0; < 3; i++) { ...

sql server - SQL Exception Code -

i have been catching sql exception codes in c# using: catch (sqlexception x) { console.writeline(x.message.tostring()); program.mylogfile("sql upload failed sql exception ", x.errorcode.tostring() +" ", today); } catch (exception ex) { console.writeline(ex.message.tostring()); program.mylogfile("sql upload failed exeption ", ex.message.tostring() + " ", today); email(); } it gives me following number in text file. how can tell means? error code: -2146232060 using sql 2012 consider using sqlexception.number property shown here: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlexception.number.aspx also give better understanding of error message if query in sql server if want work 1 particular error code , something: select * sysmessages if @ error:104 above query , then: example if theres error unio...

qt creator - How to prevent the console window from showing when building a Qt application? -

i have question. generated exe project.and put dll in exe's folder.my exe fine, runs on computer. app has gui, black terminal occured when run .exe ...but don't want create it.is situation normal state? put pro file: config -= console

java - unmarshel from XML of hiearchy object -

i have follow xml structure: a aaa ccc bbb ccc bbb ddd ccc bbb ccc how unmarshell such structure jaxb, possible? this structure works fine @xmlrootelement public class aaa { @xmlelements({ @xmlelement(name = "bbb", type = abstractbc.bbb.class), @xmlelement(name = "ccc", type = abstractbc.ccc.class) }) public list<abstractbc> tables; }

c++ - Trying to sort a vector of objects by any class member -

i trying figure out how sort vector of city objects. each object has cityname member , citycode member. i'd accessor functions automatically sort vector display on screen in proper sorted order. think i'm close, can please tell me i'm doing wrong? much. //specification file city class #ifndef city_h #define city_h #include <string> using namespace std; class city { protected: string cityname; string citycode; public: //constructor city(); city(string name, string code); //setter void setcityname(string name); void setcitycode(string code); //getter string getcityname(); string getcitycode(); bool sortbycityname(const city & c1, const city & c2) { return c1.cityname < c2.cityname; } bool sortbycitycode(const city & c1, const city & c2) { return c1.citycode < c2.citycode; } }; #endif //implementation file city class #include "city.h...

javascript - how to defer resolve tasks in nodejs -

i new nodejs, not sure how arrange tasks in order such behave correctly. below 2 examples arr.foreach(function(elem){ //do many many things }); console.log('done, take ur pick'); stdin.on('input', function action(){ ... }) how can set stdin.on fire after arr.foreach. , question 2 think if do fn1(); fn2(); function fn1(){ //long long code } function fn2(){ console.log('fn2 done!') } and runs above, execution in thread of fn1 fn2 fn1 fn1 fn1, right? how prevent this? functions in node.js either synchronous or asynchronous. synchronous code runs in single thread, , behaves code you're used to: fn1(); fn2(); fn3(fn4()); will run fn1 , fn2 , fn4 , fn3 (passing in result of fn4 parameter). asynchronous code fires off action, , takes parameter function execute when it's done (which might, in turn, fire off asynchronous action). control immediately. example: dosomeasyncthing(function () { console.log(...

linux - Redirect Apache from Default path to specified Directory in Ubuntu Server -

i have ubuntu server has apache2 running in default path. when searched apache2 showed me these paths /opt/openerp-7.0-12/apache2/ /etc/init.d/apache2 /etc/logrotate.d/apache2 /etc/default/apache2 /etc/apache2 /usr/sbin/apache2 /usr/lib/apache2 /usr/lib/apache2/mpm-event/apache2 /usr/lib/apache2/mpm-itk/apache2 /usr/lib/apache2/mpm-worker/apache2 /usr/lib/apache2/mpm-prefork/apache2 /usr/share/bug/apache2 /usr/share/doc/apache2.2-common/examples/apache2 /usr/share/doc/apache2 /usr/share/apache2 /var/log/apache2 /var/lib/update-rc.d/apache2 /var/cache/apache2 /run/apache2 /run/lock/apache2 now have bitnami version of openerp in path "opt/openerp-7.0-12" in have apache2 @ "opt/openerp-7.0-12/apache2/". in path " opt/openerp-7.0-12/" have other files postgresql,python,bitnami,openerp. how redirect apache2 running in default path " opt/openerp-7.0-12/apache2/" can access files in " opt/openerp-7.0-12/". sorry, did not que...

DataTables on an ajax response -

i'm using datatable.net script on site , have standard loaded table , works expected. i have additional query filters use re-load table. something this $.get(ajaxurl, save_scope, function(response) { table.html(response); table.datatable(); }); the response loads correctly, datatable() function doesn't seem work @ on newly loaded table. there type of argument need pass causes datatable script re-apply on page? what error receiving? datatable() cannot applied 2 times same table. 1 possible solution first remove table: //delete datable object first table.fndestroy(); //reload table content table.html(response); //create table object table.datatable();

javascript - Slide div element to another element JQuery -

i have array grid contains . how how create grid[row][col] = $('<div>') .css({ top : row * 100 + 'px', left : col * 100 + 'px' }) .text(number) .addclass('box') .appendto($('#grid')); this function merge move 1 div another. want make animation slide grid[row1][col1] div grid[row2][col2] div. function merge(row1, col1, row2, col2) { grid[row2][col2].remove(); grid[row2][col2] = grid[row1][col1]; grid[row1][col1] = null; var number = grid[row2][col2].text() * 2 ; grid[row2][col2] .css({ top : row2 * 100 + 'px', left : col2 * 100 + 'px' }) .text(number); return true; } any idea please how this. instead of css() can try animate() : grid[row2][col2].text(number); grid[row2][col2].animate({ top : row2 * 100 + 'px', left : col2 * 100 + 'px' }) ...

php - avoid duplicates in flash based messaging -

i using php session-based flash messenger available here. issue multiple messages of same type when generate errors, display messages, on , fourth. due ajax issues. assuming wanted apply fix in display code here: public function display($type = 'all', $print = true) { $messages = ''; $data = ''; if (!isset($_session['flash_messages'])) { return false; } // print type of message? if (in_array($type, $this->msgtypes)) { foreach ($_session['flash_messages'][$type] $msg) { $messages .= $this->msgbefore . $msg . $this->msgafter; } $data .= sprintf($this->msgwrapper, $this->msgclass, $this->msgclassprepend.'-'.$type, str_replace('messages', 'autoclose',$this->msgclassprepend.'-'.$type), $messages); // clear viewed messages $this->clear($type); // print queued messages } elseif ($type == 'all'...

numerical - Using MPFR And Adding - How many Digits are Correct? -

i have pretty easy question (i think). as i've tried, can not find answer question. i creating function, want user enter 2 numbers. first the number of terms of infinite series add together. second number of digits user truncated sum accurate to. say terms of sequence a_i. how precision n, required in mpfr ensure result of adding these a_i i=0 user's entered value needed guarantee number of digits user needs? by way, i'm adding a_i in naive way. any appreciated. thanks, rick you can convert between decimal digits of precision, d , , binary digits of precision, b , logarithms b = d × log(10) / log(2) a little rearranging shows why b × log(2) = d × log(10) log(2 b ) = log(10 d ) 2 b = 10 d each term of series (and each addition) introduce rounding error @ least significant digit so, assuming each of t terms involves n (two argument) arithmetic operations, want add extra log( t * ( n +2))/log(2) bits. you'll need round ...

bash - How to echo content to each file in subfolders in Linux? -

i've directory structure this: /posts | | posts/page1 -- index.html posts/page2 -- index.html posts/page{3..100} -- index.html i've figured out how create 100 different page# directories, , i've touched index.html each of them. however, need echo basic html each of index.html files in each of page# directories. f in `find . -type d`; echo "hello" >> f; done but echo 100 hello s file named f f in `find . -type d`; echo "hello"; done simply echos hello 100 times. and for f in `find . -type d`; echo "hello" >> index.html; done just echos hello 100 times within posts/index.html anyway, i'm @ loss how this. how without having manually it? theoretically open each folder in sublime , copy html ctrl+v + ctrl+s + ctrl+w each instance, there's gotta easier way this. you need use $f refer items in find result, instead of f . , also, include /index.html path: for f in $(find . -type d); e...

flash - MediaElement.js not displaying video in Firefox with Linux -

i'm programing video visor mediaelement.js the web retrieves video path, in server side im using php that. it works in ie, firefox or chrome (either windows or mac). in firefox linux (ver 24.0) it's displaying time gray box famous message no video supported format , mime type found . i tried installing codecs @ centos or installing opera (failed well, in windows). added @ htaccess mime types required. i don't know what's going on. <div id="div_video"> <video id="video1" width="640" height="360" controls="controls" > <source src="videos/<?php echo $client.'/'.$main_video[2]?>" type="video/mp4" title="mp4" /> </video> </div> what realize when i'm reproducing video demo in firefox, ie or chrome (windows) says native when i'm reproducing video in opera (windows) says flash , never working @ all. hope can me! tha...

Display Loading Icon or Loading Progress Bar using angularjs -

how display loading icon or loading progress bar using angularjs. mean used in jquery $("body").addclass("loading"); , $("body").removeclass("loading"); , saw links progress bar of youtube loading bar don't want want simple progress bar or loading iage or loading icon or loading bar show bar moving module module, tabs tabs. there link or function explain how use it. if dont want implement yourself, below few links. angular-spinner or angular-sham-spinner also read blog details how spinner works angularjs edit per comments app.directive("spinner", function(){ return: { restrict: 'e', scope: {enable:"="}, template: <div class="spinner" ng-show="enable"><img src="content/spinner.gif"></div> } }); i havent tested code directive wont more complex this...