Posts

Showing posts from June, 2013

java - String search with "startsWith()" -

i've been working on email directory program past couple of day , in 1 of methods i'm trying make search function searches email based off character inputs of user. i'm trying make method loops , user types in email 1 character @ time until 1 email in array constructed method. heres code: private void searchcontact() { string[] newrecords=new string[emailrecords.size()]; //temp array searching arraylist<string> searchrecords=new arraylist<string>(); //to passed insertion sort newrecords=emailrecords.toarray(newrecords); for(string records: newrecords) { scanner search=new scanner(system.in); //setup user input string letter; string searchval; system.out.println("please enter first letter of email you're trying find."); letter=search.nextline(); if (searchrecords.size()!=1) { (int i=0; i<newrec

c# - Form still closing when I choose no -

i have following code private void form1_formclosing(object sender, formclosingeventargs e) { if (cmd.cetaktanya("are sure want exit ?")) { cmd.cetaksukses("thank using " + cmd.title); starturl(); } } public bool cetaktanya(string message) { bool status = false; dialogresult dialogresult = messagebox.show(message, title, messageboxbuttons.yesno, messageboxicon.exclamation); if (dialogresult == dialogresult.yes) { status = true; } else if (dialogresult == dialogresult.no) { status = false; } return status; } why form still closed though choose "no" @ confirmation dialog? use cancel property cancel event if "no" clicked. private void form1_formclosing(object sender, formclosingeventargs e) { if (cmd.cetaktanya("are sure want exit ?")) { cmd.cetaksukses("thank using " + cmd.title); starturl(); } el

android - How can I tell if a Dialog is being Stopped by it closing or by the application being minimized? -

i implement dialog should update calling activity when closed. however, i've found updating activity when entire application minimized, not acceptable purposes. the update activity occurs in dialog's onstop() method, called either when dialog closed or application stopped. how can handle things differently based on whether dialog closed or application stopped? thanks! for more context, here piece of dialog's onstop() , resumes timer of underlying activity. don't want timer resumed if user leaving app. if (activity instanceof quizactivity) { if( ((quizactivity) activity).gettimer() == null) { ((quizactivity) activity).resumetimer(); } } i think solved this. dialog's onstop() being called manually activity's onstop() . put call pausetimer() method after calling dialog's onstop() in activity's onstop() . effectively, dialog resuming timer , activity pausing again part of onstop() me

ios - use of undeclared identifier objective-c -

i getting use of undeclared identifier 'data' in didreceiveresponse method. have imported model header file has array , data declared. found if declare them inside viewcontroller.h file error goes away. cause of problem? #import "viewcontroller.h" #import "detailviewcontroller.h" //#import "model.h" #import "model.h" @interface viewcontroller () @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; [uiapplication sharedapplication].networkactivityindicatorvisible = yes; nsurl *url = [nsurl urlwithstring:@"https://s3.amazonaws.com/jon-hancock-phunware/nflapi-static.json"]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; [[nsurlconnection alloc] initwithrequest:request delegate:self]; // additional setup after loading view, typically nib. } - (void)didreceivememorywarning { [super d

Django admin popup links are broken -

i'm having problem django admin popups: on creating new object related 1 i'm working on (e.g., user model , groups belongs to), clicking on plus sign near form field expect browser open popup served add view of related model instead experience serving of add view inside page itself. practically speaking, popup not working should be. the link on plus sign (from standard user model admin page, group field) following: /admin/auth/group/add/?_to_field=id&_popup=1 the same behaviour happening on other models, , suggest me wrong settings file (maybe missing javascript handler...) do have idea of can wrong ? i'm using django 1.8 django grappelli interface. here setting file (the core part): import os project_root = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) media_root = '/webapps/example/media/' media_url = '/media/' static_root = '/webapps/example/static/' static_url = '/static/' staticfiles_dirs = ( os.pa

android - Does Interstitial ads help us to get more earning than Banner ads? -

i adding google admob first android application. wondering whether should use interstitial ads or not. my question is: interstitial ads more earning banner ads? my app education app. reason use interstitial ads? thank you! the answer is.... depends.... know, know, it's kind of cop out answer, does. instance, might make more on interstitials per view if user engagement drops severely or leads higher uninstall rate because of them, net negative outcome. it depends on how sophisticated app , how large user population is. if partner ad partners serve ads/offers target demographic make cpm while annoying users less. banners typically less intrusive interstitials , ruin users experience less. i'd think other ways monetize app (which i'm guessing have) through affiliate sales or offering more valuable content charge for. that scratches tip of things, hope helped.

Lync chat with multiple contacts from windows command line -

i can start chat specified contact command line like: start sip:abc@abc.com but when want chat multiple contacts using command line like: start im:<sip:a@abc.com><sip:b@abc.com> a command syntax error appear. tried many ways found no solution this. how can fix it? forwardly. quotes fixed me. this: start im:"<sip:a@abc.com><sip:b@abc.com>"

c# - Trying to convert object to integer to show as a percentage, but it only shows 0 -

i have object value in data type decimal(18,2) . try convert integer data value show 0 although 6. i want show value 0.06 6. can me why still shows 0? <td class="line_table_td" style="text-align: center;"> <%#getpercentage(eval("value"))%>&nbsp; </td> public decimal getpercentage(object value) { var perc = convert.toint32(value); return(perc); } if should decimal value, converting integer drop fractional portion. convert decimal first, multiply 100 "percentage" representation. public decimal getpercentage(object value) { var percentage = convert.todecimal(value) * 100; return percentage; }

.htaccess - How to stop processing if htaccess HTTP Auth fails -

i trying use http authentication in website root ( public_html ) has rewritecond , rewriterule . when visit website, gives me prompt, when cancel, prompts me again, several times. finally, stops prompting , gives me home page html linked resources i.e. images, js, css etc. unavailable. i have feeling http authentication failure did not cause htaccess script stop processing further, hence rewriterule still generated content. how can tell htaccess "stop processing further if auth failed"? # manually added options +followsymlinks rewriteengine on # added cpanel password protect directory authuserfile "/home/username/.htpasswds/public_html/passwd" authtype basic authname "stage" require valid-user # manually added rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule . index.php [l] i think need additional rewritecond on rewrite, proceed if have valid user. example: rewritecond %{la-u:remote_user} !^$ rewrit

ios - Calling a func from one class in another class - swift -

i have class viewcontroller . in class, sigviewcontroller , have function captures image of signature. call function in viewcontroller class (specifically in ibaction). in viewcontroller have following. @ibaction func sigsave(sender: anyobject) { sigviewcontroller().getsignature() } in sigviewcontroller function is... func getsignature() ->uiimage { uigraphicsbeginimagecontext(cgsizemake(self.bounds.size.width, self.bounds.size.height)) self.layer.renderincontext(uigraphicsgetcurrentcontext()) var signature: uiimage = uigraphicsgetimagefromcurrentimagecontext() uigraphicsendimagecontext() println("saved image") return signature } the viewcontroller returning error `use of unresolved identifier sigviewcontroller. thanks help. getsignature() instance function need make instance of sigviewcontroller class call it. can call class functions in class using syntax classname.functionname() if mark function clas

c# - How can I make that approach's opposite -

how can passing values form 1 directly? receiver form showing on screen , listening passing values sending main form. i know way delegate , event mine not desired one. need opposite way. below can code lines. able form2 passes value form1 (main form). need approach's opposite. so, form1 sender form2 receiver, , transmit in real-time while showing on screen. public partial class form1 : form { public form1() { initializecomponent(); } private void button1_click(object sender, eventargs e) { form2 f = new form2(); f.identityupdated += new form2.identityupdatehandler(form2_buttonclicked); f.show(); } private void form2_buttonclicked(object sender, identityupdateeventargs e) { textbox1.text = e.firstname; } } public partial class form2 : form { public delegate void identityupdatehandler(object sender, identityupdateeventargs e); public event identityupdatehandler identityupdated; public

Query for when my service will be run in Android? -

i have service fires off every 5 minutes or so... how query android see when service scheduled go off programatically? <!-- send census service --> <service android:name="services.scheduled.sendcensusscheduledservice" android:icon="@drawable/ic_launcher" android:label="syncserverdatascheduledservice" /> <receiver android:name="services.receivers.sendcensusscheduledservicereceiver" > <intent-filter> <action android:name="receiptbucketclient.android.action.broadcast"/> <action android:name="android.intent.action.boot_completed" /> </intent-filter> </receiver> <receiver android:name="services.receivers.startsendcensusscheduledservicereceiver" /> check pendingintent : pendingintent intent = pendingintent.getbroadcast(context, 0, new intent("receiptbucke

sql - Difficulty with join 3 tables in a query in php -

my database has 3 tables wish access in select query cannot seem work. selecting 2 tables works fine know else working apart code selecting 3 tables. database has been created on phpmyadmin the tables follows: forum_replies reply_id topic_id user_id reply_text reply date forum_topics topic_id category_id user_id topic_title topic_description topic_date users user_id username this code have tried use , shows fields wish select: $queryreply = "select forum_replies.reply_id, forum_replies.topic_id, forum_replies.user_id, forum_replies.reply_text, forum_replies.reply_date, users.user_id, users.username forum_topics.topic_id,forum_topics.topic_title, forum_topics.topic_date forum_replies join forum_topics on forum_replies.topic_id = forum_topics.topic_id join users on forum_replies.user

Use eval() in a Chrome chrome-extension:// page -

i know may me being stupid, in chrome tab has page loaded url begins chrome-extension:// , can scripts online or use eval(); ? know browser or page actin oopups or app windows can't use it. part of extension opens normal new tab page uses eval(); . all pages running @ chrome-extension:// origin subject default content security policy described here , specifically: script-src 'self'; object-src 'self' a popup considered such page, too, invisible background page. if open file extension, subject too. you can either: relax (or tighten) default policy pages manifest: "content_security_policy": "[policy string goes here]" this way can allow eval , friends adding 'unsafe-eval' script-src . you can allow loading external scripts adding origin policy; however, https origins allowed mitm protection reasons. however, it's important remember 'unsafe-inline' ignored regardless of custom policy. relax (or

inheritance - Boost Python Runtime error when passing object of derived type from python to C++ function expecting a shared_ptr to base type -

i have function takes std::shared_ptr, , want pass object of derived type function python. here's class definitions: struct abstractbase { virtual void foo() = 0; }; struct derived : public abstractbase { virtual void foo(){ std::cout<<"derived's foo!"<<std::endl; } }; struct unrelated { void bar(std::shared_ptr<abstractbase> base_shared_ptr) { base_shared_ptr->foo(); } }; #endif /* classes_h */ a simple pure c++ example want: int main() { std::shared_ptr<derived> d(new derived); unrelated u; u.bar(d); } output: derived's foo! here boost.python wrapper code: #include <boost/python.hpp> #include "classes.h" boost_python_module(shared_ptr_test) { using namespace boost::python; class_<abstractbase,std::shared_ptr<abstractbase>,boost::noncopyable>("abstractbase",no_init); class_<derived,std::shared_ptr<derived>,base

opencart2.x - How to show total user online OpenCart 2.0x -

Image
i'm new, want show how many users (customer & visitor) online. find commercial extension , it's older version. can point right direction on ? edit 2: add function in opencart22\catalog\model\catalog\category.php public function gettotalcustomersonline($data = array()) { $sql = "select count(*) total `" . db_prefix . "customer_online`"; $query = $this->db->query($sql); return $query->row['total']; } and add code in \opencart22\catalog\controller\common\header.php $customer_total = $this->model_catalog_category->gettotalcustomersonline(); echo "customer online".$customer_total; edit 1 opencart have function show online visitor/customer (on admin dashboard) you can edit code , display on website tell me if u didn't understand

How to check if closed captioning is selected on Android accessibility settings -

is possible check if closed captioning enabled user in settings --> accessibility section of android phone? want check if closed captioning enabled/disabled in accessibility. yes it's possible (since api level 19). you can check captioning state isenabled() method of captioningmanager . captioningmanager captioningmanager = (captioningmanager) context.getsystemservice(context.captioning_service); if(captioningmanager.isenabled()){ //do stuff }

java - Android Gson Json parse when key number is undefined -

i have following json response { "time": { "1427817600000": 90, "1427904000000": 134, "1427990400000": 155, "1428076800000": 167 } } and number of items in "time" undefined. for example, at time "1427817600000", count 90 at time "1427904000000", count 134 ... ... how can parse in android (java) thanks. you can iterate each , every key of "time" json using org.json library e.g. string data = "{\"time\": {\"1427817600000\": 90,\"1427904000000\": 134,\"1427990400000\": 155,\"1428076800000\": 167}}"; jsonobject json=new jsonobject(data); jsonobject timejson=json.getjsonobject("time"); iterator<string> keys=timejson.keys(); while (keys.hasnext()){ system.out.println(timejson.get(keys.next())); }

spring - Design an application using to support both synchronous and asynchronous calls -

we designing api application clients (external) can interact synchronously say: a) request plan b) cancel plan etc however once plan made, decision whether plan approved or disapproved done asynchronously. application can send other notifications clients asynchronously. part has been implemented using spring's stomp on websocket framework. work fine. now, coming synchronous part of api, plan provide restful interface interaction. if done way, clients have build 2 different client api's, 1 using http making restful calls , using stomp client consume notifications. should rather make accessible via 1 interface? i not convinced of using stomp synchronous calls since think rest framework address use case well. concerned need clients both, although different functionality. will okay support both? design practice. can please advice? http based clients a) send requests ('simple polling), in long intervalls limit bandwidth usage, or b) use http long

javascript - php can not get the data send by ajax -

this js code, ajax has 2 arguments, first url, 2nd object contains type data , onsuccess. (i didn't use jquery function define myself, code @ end of question) want send 'text' string php, there problem this? have tried change data data: {searchinput:"text"}, still don't work. ajax( 'http://localhost/test.php', { type: 'post', data: "searchinput=text", onsuccess: function (responsetext, xhr) { console.log(responsetext); } } ); this php code, sorry changing code wrong while pasting on. $searchinput = $_post["searchinput"]; @ $db = new mysqli('localhost', 'root', '', 'text'); if (mysqli_connect_errno()) { echo "error:can not connect database"; } $query = "select * text data like'".$searchinput."%' "; $result = $db->query($query); then error is und

How to place textviews center with near imageview and textview android? -

Image
hi want achieve desired output similar screenshot attached below. view line separation need place textview @ center , near textview image , text size , color. how achieve it? my code follows: i used view line @ top , bottom , used textview doesn't achieve exact output. how solve issue? please me. thanks.. <view android:id="@+id/view2" android:layout_width="wrap_content" android:layout_height="1dp" android:layout_below="@+id/offers_price_layout" android:layout_centervertical="true" android:layout_margintop="5dp" android:background="#cfcfcf" /> <relativelayout android:id="@+id/size_color_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/view2" android:orientation="horiz

android-how to stop services in android -

i want stop service when come activity . activity code : stopservice(new intent(this, services_chat.class)); on call on mainactivity , in oncreate method . called . this service code: public class services_chat extends service { @override public ibinder onbind(intent intent) { // todo auto-generated method stub return null; } @override public int onstartcommand(intent intent, int flags, int startid) { new timer().scheduleatfixedrate(new timertask() { @override public void run() { log.v("this","caa"); } }, 0, 1000);//put here time 1000 milliseconds=1 second return start_not_sticky; } @override public void ondestroy() { super.ondestroy(); } } as can seen log , run code every second , after running app , calls stopping service , doesn't stop , still runs . how can stop service ? thanks write method in

mysql - database grouping data in tables -

i have database 3 main tables, , every of table has first 7 of 20 fields same. for example: table1 - a,b,c,d,e,f,g,x,y,z,df,gt,er,re,re table2 - a,b,c,d,e,f,g,q,w,c,v,t,v,b,t,l,f table3 - a,b,c,d,e,f,g,b,n,m,j,h,g,d,f,r,e first fields (a,b,c,d,e,f,g) same , other different. my question is: is make 1 table fields , branching? together_table:a,b,c,d,e,f,g table1 - together_table_id,x,y,z,df,gt,er,re,re table2 - together_table_id,q,w,c,v,t,v,b,t,l,f table3 - together_table_id,b,n,m,j,h,g,d,f,r,e or muste like: table1 - a,b,c,d,e,f,g,x,y,z,df,gt,er,re,re table2 - a,b,c,d,e,f,g,q,w,c,v,t,v,b,t,l,f table3 - a,b,c,d,e,f,g,b,n,m,j,h,g,d,f,r,e i using mysql together_table:a,b,c,d,e,f,g table1 - together_table_id,x,y,z,df,gt,er,re,re table2 - together_table_id,q,w,c,v,t,v,b,t,l,f table3 - together_table_id,b,n,m,j,h,g,d,f,r,e this much, better. normal form. databases designed in 3rd normal form (also written 3nf). there, s

c# - Readonly field vs abstract getter-only property -

what advantages , disadvantages of having readonly field compared having inheritors implement abstract getter-only property (using c# example here, guess doesn't matter much). here both ways this: readonly field; inheritors have inject value in constructor interface iface { public int field { get; } } abstract class base : iface { private readonly int field; protected base(int field) { this.field = field; } public int field { { return this.field; } } } class impl { public impl() : base(1) { } } abstract getter-only property; inheriters have implement property interface iface { public int field { get; } } abstract class base : iface { // default constructor can used public abstract int field { get; } } class impl { public override int field { { return 1; } } } both implementations expose public int field getter-only property not change. however, can see following differences: the value of field bound each instance , there'

c# - How to send custom object to web service & Convert it to custom object -

i new webservice have webservice. need send custom object(tbatch) object webservice & webservice need convert object custom object(tbatch). how achieve getting following error. there error genreating xml document. please find following code: web service [webmethod] public string splitbatchobj(object batchobj, string scanstationid) { string s = "test"; tbatch m_ctbatch = (tbatch)batchobj; return s; } calling web service public int callservice(tbatch obj) { object objbat = (tbatch)obj; //call service method; string s = srv.splitbatchobj(objbat, "test string"); } your original assumption incorrect. don't have send tbatch instance object. following instead: define tbatch class in separate dll (class library). reference library in client , server projects. can change web service signature argument of type tbatch

javascript - How to update object properties within a loop? -

i have found behavior did not expect when trying use loop in order change value set property in object. basically, declare object outside loop. loop on array of numeric values, values used update object property. inside loop, store current object state inside external array. the result instead of having array containing series of objects different numeric values, end having same numeric values in each object stored. here fiddle http://jsfiddle.net/faypl/1/ jquery(function(){ var object_container = []; var numeric_values = [1, 2 , 3, 4]; var my_object = {}; jquery.each(numeric_values, function(index, value){ my_object['value'] = value; object_container.push(my_object); }); jquery.each(object_container, function(index, value){ jquery('#content').prepend(value['value']); }); }); i expect 1 2 3 4 values stored in each object, however, 4 4 4 4, not make sense me. any hint on behavior more wel

.net - EF6 Automapper Inheritance/Abstract Class Errors -

i'm building .net web api using entity framework 6 automapper map entities dtos. when try introduce tph (table per hierarchy) abstract base class, long , useless (to me @ least) error. error below, i'm not sure actual error is. i've tried googling various sections of no avail. this mapping: mapper.createmap<parentclass, parentclassdto>() .include<classa, classadto>() .include<classb, classbdto>(); mapper.createmap<classa, classadto>(); mapper.createmap<classb, classbdto>(); if remove abstract parentclass , error goes away automapper not use child dto classes, uses parentclassdto. if remove mapping , return entities through api, there no errors , works expected. i don't know start error below, how start debugging (web api running in debug mode still outputs error screen), or responsible error. i've simplified code as possible , tried other various things, can't seem a

How to check existence of large number of remote images in php -

i displaying large number of remote images in php webpage , need check if image exists in-order-to handle no image condition. process takes heavy load check condition each remote file. please suggest views handle this. thanks in advance. i think there several solutions if display remote images (those images not located @ server) on webpage, can check if image exists javascript. mean create image , check if loaded. handle exception javascript. you can check image existence before displaying them users. example while adding them website. once, store results in database, , display images know exist. there php function curl_multi_exec. allows perform several http requests simultaneously. you better copy images server. if do, sure images still exist , not modified.

STM32 Eclipse + ARM GNU toolchain error linker. -

i use eclipse + arm plugin build projects. when needed use in project stemwin library, configured ide use external library. set preferences->c/c++ general-> pahs , symbols add in "library paths" link folder includes library. secondly add name of library in tab "library" checked settings in compiler tab, , ascertained should good. when tried build project error linker. cannot find -lmylib.a hello c/c++ problem i checked name of library , link, correct. output of linker: arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -l"c:\lib" -t"c:\arm_toolchain\stm32_workspace\hello\linkerscript.ld" -wl,-map=output.map -wl,--gc-sections -o "hello.elf" @"objects.list" -lmylib.a maybe have same problem. best regarts. i faced same problem before... -l:stemwin526_cm4_gcc.a -l"c:\edu_workspace\stm32f4\stm32f4_bsp_template\drivers\middlewares\st\stemwin\lib" above working settings.

python - Error while browsing MBeans in WLST -

trying access oam identity asserter through wlst. i use cd command navigate through security, authentication providers list of providers. try cd oam identity asserter , produces following error: error while browsing mbeans : java.lang.classnotfoundexception: oracle.security.wls.oam.providers.asserter.oamidentityassertermbean after further research think may know why occuring.. found information tells me jar file named oamauthenprovider.jar should exist within server directory @ /lib/mbeantypes, not exist. think what’s causing class not found exception.

How to set Default value in GridView Yii2 -

i'm new in yii2, , need little bit gridview yii2 gridview yii2 http://i60.tinypic.com/35l91g1.png i have tried make conditional here : <?= gridview::widget([ 'dataprovider' => $dataprovider, 'filtermodel' => $searchmodel, 'columns' => [ ['class' => 'yii\grid\serialcolumn'], /*........other attribute here..........*/ [ 'attribute' => 'status_dosen', 'value' => "status_dosen"==1 ? "approved": "status_dosen"==null ? "pending": "rejected", ], [ 'attribute' => 'status_asrama', 'value' => "status_dosen"==1 ? "approved": "status_dosen"==null ? "pending": "rejected", ], ], ]); ?> but got error : error http://i62.tinypic.com/2vxos1z.png u

c++ - How to specify shared template variable with two template template parameters? -

i'm trying build mini test framework. have 1 function takes in 2 list-like variables composed of same type , plan on using template template parameters part of interface. far, have this, template <typename c, template <class> class a, template <class> class b> static inline void assertequals(const a<c>& expected, const b<c>& actual) { auto success = 0, failure = 0; (auto iter1 = expected.cbegin(), iter2 = actual.cbegin(); iter1 != expected.cend() && iter2 != actual.cend(); ++iter1, ++iter2) { if (test::assertequals<c>(*iter1, *iter2)) { ++success; } else { ++failure; } } cout << "success: " << success << endl << "failure: " << failure << endl; } the assertequals in if condition function. question is, interface correct? secondly, how use it? i've tried no avail,

javascript - Placing logo inside multiple areas; header, body, content -

Image
i don't know how explain this, maybe in case picture tells story instead of me: shortly if cannot see it. i'm trying place logo inside multiple areas (header, body, content) global image. is possible css, javascript, html, php? and if is, guides or tips? you can place logo inside of nav (in case) section. logo must absolutely positioned , doesn't mess other element's alignment, , nav section must relatively positioned , logo gets placed in relation nav container (even if it's absolute!). didn't provide html/dimensions, we're pretty left guess, here's how look, picking arbitrary dimensions. .nav { position: relative; height: 100px; } /* .logo child of .nav */ .logo { position: absolute; top: -50px; height: 200px; width: 200px; left: 0; } take look: body { color: #fff; text-align: center; } .header { height: 100px; background: red; } .nav { position: relative; height:

php - Why file_put_contents() not always rewrites a file? -

i wonder, why php file_put_contents() function works in weird way. i used in loop write logs file , fine (new lines appended if no flag specified). when started script again, re-created file. from php doc: if filename not exist, file created. otherwise, existing file overwritten, unless file_append flag set. ok, question is: why (when used in 1 loop) doesn't overwrite file (without file_append flag of course)? bug or feature? :) edit: example context of use when happened: $logfile = dirname ( __file__ ) . '/example.log'; foreach($something1 $sth1) { $logdata .= "something\n"; foreach($something2 $sth2) { if($something_else) { $logdata .= "line: \t" . $sth2 . "\n"; file_put_contents($logfile, $logdata); } } } as has been mentioned in this link under flags content(which should have read) states if file filename exists, append data file instead of overwriting it(w

c# - MVVM WPF ListBox Entry not updating -

i started learn mvvm pattern , created simple application test few things. i have simple view with: listbox holding observablecollection of items delete button new button textbox item description textbox item value everything works except fact that, if i'm updating item description listbox entry isn't updating. read articles this, think has collectionchanged isn't called. tried possible solutions problem, none of them worked. maybe there wrong approach. hopefully can me problem. model/item.cs internal class item : inotifypropertychanged { #region fields private string value; private string description; #endregion #region constructors public item() { } public item(string value, string description) { this.description = description; this.value = value; } #endregion public string value { { return value; } set { this.valu

symfony - Symfony2 and ClankBundle: cannot share session -

i using symfony2 clankbundle websocket funciontality. followed instructions reported here (pdosessionhandler) , here (clank session sharing) , still not able information store inside session. i still using built-in debug server provided symfony runs on http://127.0.0.1:8000 my parameters.yml parameters: clank_host: 127.0.0.1 clank_port: 8080 my config.yml framework: session: handler_id: session.handler.pdo clank: web_socket_server: port: "%clank_port%" host: "%clank_host%" session_handler: session.handler.pdo in controller: $session = $this->get('session'); $session->set('user_token', $user->getid() ); in topic service: public function onsubscribe(conn $conn, $topic) { file_put_contents('debug.txt', "onsubscribe" .$conn->resourceid . " connected" . " ".$conn->session->get('user_token'). php_eol, file_append |

Regex for validating and sanitizing all english and non-english unicode alphabet characters in PHP -

while there have been many questions regarding non-english characters regex issue have not been able find working answer. moreover, there not seem simple php library me filter non-english input. could please suggest me regular expression allow all english alphabet characters (abc...) all non-english alphabet characters (šýüčá...) spaces case insensitive in validation sanitization. essentially, want either preg_match return false when input contains else 4 points above or preg_replace rid of except these 4 categories. i able create '/^((\p{l}\p{m}*)|(\p{cc})|(\p{z}))+$/ui' http://www.regular-expressions.info/unicode.html . regular expression works when validating input not when sanitizing it. edit: user enters 'český [jazyk]' input. using '/^[\p{l}\p{zs}]+$/u' in preg_match, script determines string contains unallowed characters (in case '[' , ']'). next use preg_replace, delete unwanted characters. regular expression should

yammer - Web scraping password protected website using R -

i web scrap yammer data using r,but in order first il have login page,(which authentication app created). https://www.yammer.com/dialog/authenticate?client_id=ivgck1tohbzgs7zc8dpjg i able yammer data once login page in browser standard yammer urls ( https://www.yammer.com/api/v1/messages/received.json ) i have read through similar questions , tried suggestions still cant through issue. i have tried using httr,rselenium,rvest+selector gadget. end goal here in r (getting data,cleaning,sentiment analysis...the cleaning , sentiment analysis part done of getting data part manual , automate handling r) 1.trial using httr: usinghttr<- get("https://www.yammer.com/dialog/authenticate?client_id=ivgck1tohbzgs7zc8dpjg", authenticate("username", "password")) corresponding result : response [ https://www.yammer.com/dialog/authenticate?client_id=ivgck1tohbzgs7zc8dpjg] date: 2015-04-27 12:25 status: 200 content-type: text/html; charset=

python - Start function on a button in frame tkinter -

i have code open frame. in main frame have button open frame2 (page01). on page01 button make call "function1" defined on top (and it's started when open program, don t want this) , in function1 want call function2 defined in page01. code import tkmessagebox import tkinter tk tkinter import * functools import partial import ttk large_font= ("verdana", 12) def function1(): print "function 1 started" #function2() class changepages(tk.tk): def __init__(self, *args, **kwargs): tk.tk.__init__(self, *args, **kwargs) container = tk.frame(self) container.pack() container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) self.frames = {} f in (mainpage, page01): frame = f(container, self) self.frames[f] = frame frame.grid(row=0, column=0, sticky="nsew") self.show_frame(mainpage) def show_frame(se

c# - Passing Textbox value to Crystal Report textbox -

hello have problem passing textbox value textbox object in crystal report. so far these following codes have tried: textobject yr = (textobject)cy.reportdefinition.sections["section1"].reportobjects["gender1"]; yr.text = txtgender.text; it prompts error message saying: index outside bounds of array. cy.setparametervalue("gender1", txtgender.text); this 1 prompts: invalid index this code loading records. works except passing value of textbox. legend: dt1 = dataset crpt.rpt = crystal report file sqlconnection conn = constring.getcon(); reportdocument cy = new reportdocument(); conn.open(); cy.load(application.startuppath + @"\crpt.rpt"); textobject gr = (textobject)cy.reportdefinition.sections["section1"].reportobjects["gender1"]; gr.text = txtgender.text; sqldataadapter da = new sqldataadapter("exec

r - Why doesn't this returning of multiple values of work? -

return_sum_diff <- function(a,b){return(list(a+b,a-b))} list[t1,t2] = return_sum_diff(1,2) it fails error error in list[t1, t2] <- return_sum_diff(2, 2) : object 't1' not found i trying implement solution here returning multiple arguments. i guess in r cant assign that. assign a <- return_sum_diff(1,2) here list 2 values. if u want named list, modify function follows return_sum_diff <- function(a,b){return(list(t1 = a+b, t2 = a-b))}

c - WHY the following program is not giving error? -

#include<stdio.h> void main () { int a=4; const int *p=&a; *p--; } in above line means can not change value via p, in decrement statement should give error not giving error. can explain why?? *p-- decrements p not contents of p . if (*p)-- compilation error error: decrement of read-only location ‘*p’

javascript - Passing urls to relational collections in backbone -

i'm using backbone relational , it's great. problem have run when need backend provide url models attach to. this isn't such problem when using one-to-one relationships because model can hold onto url attribute of itself. the collection on other hand creates separate model within itself. what best way bind these together. examples below { "user": { "url": "http://example.com/api/user/1" }, "permissions": { "url": "http://example.com/api/user/1/permissions" } } in above example, want user model url provided, , permissions collection, url provided. what have tried collection working following: { "permissions": { "url": "https://example.com/api/user/1/permissions" "data": [] } } but wasn't able run parse extracts variables out. if have not set {parse: true} on relation definition ( documen

xcode - Rotate UIImageView 1 degree -

i have code rotate image view: func rotateagain(){ uiview.animatewithduration(1.0, delay: 0.0, options: .curvelinear, animations: {self.imageview.transform = cgaffinetransformrotate(self.imageview.transform, 1.degreestoradians)}, completion: {finished in if self.rotating { self.rotateonce() }}) } what wrong in code? the second argument cgaffinetransformrotate angle, in radians, if want transform radians degrees, have multiply angle in degrees 0.0174532925 example rotating 240 degrees: cgaffinetransformrotate(self.imageview.transform, 240 * 0.0174532925)

hadoop - Is there any function like setup in pig udf -

i want add mapdb file use mappers in pig udf. how can 1 time setup of mapdb object? have function called once when pig udf instantiated? thanks. in pig 1 has extend evalfunc udf called everyline of record . the class evalfunc has been extended can instantiated defining in beginning of pig-script . define ex_arg my.udfs.extract('true'); this causes instantiation of class .

php - combine all 3 $_post to 1 variable -

jsfiddle i wanted combine 3 $_post 1 variable month day wont show up, how come? here code: <div id="register-birth-date"> <input type="number" name="register-day" placeholder="date"> <select id="register-month"> <option value="00">mouth</option> <option value="01">january</option> <option value="02">february</option> <option value="03">march</option> <option value="04">april</option> <option value="05">may</option> <option value="06">june</option> <option value="07">july</option> <option value="08">august</option> <option value="09">september</option> <option value="10">october</option> <o

symfony - Doctrine - A new entity was found through the relationship -

since 2 weeks, having problem while trying flush new elements: critical: doctrine\orm\orminvalidargumentexception: a new entity found through relationship 'comment#capture' not configured cascade persist operations entity but capture in database, , getting findoneby , if cascade persist it, or persist it, a table constraint violation: duplicate entry. the comments created in loop differents captures, new, , required field set. with of entities persisted , / or got findone (and valid), flush still fails. i'm on issue since while, please me i had same problem , same entitymanager . wanted insert object related manytoone . , don't want cascade persist . example : $category = $em->find("category", 10); $product = new product(); $product->setcategory($category) $em->persist($product); $em->flush(); this throws same exception me. so solution : $category = $em->find("category", 10); $prod

java - How to get session id in spring-data-rest -

i newbie spring-data-rest. here developing shopping cart application using spring-data-rest. need session id in response post request made in postman client. so, when post cart details postman client in response getting empty page indicated success. instead of need session id. how can session id cart, can make direct call cart using session id in response? here cart bean class: @entity @table(name="cart", catalog="db_sports" ) // define named queries here @namedqueries ( { @namedquery ( name="cart.countall", query="select count(x) cart x" ) } ) @component @scope(proxymode=scopedproxymode.target_class, value="session") public class cart implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy=generationtype.auto) @column(name="id", nullable=false) private integer id ; private date date ; //-----------------------------

android - Error shows: FATAL EXCEPTION: AsyncTask #1 -

error shows: fatal exception: asynctask #1 public class newproductactivity extends activity { private progressdialog pdialog; jsonparser jsonparser = new jsonparser(); edittext inputname; edittext inputprice; edittext inputdesc; private static string url_create_product = "http://127.0.0.1/android_connect/create_product.php"; private static final string tag_success = "success"; static list<string> citations = null; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.add_product); inputname = (edittext) findviewbyid(r.id.inputname); inputprice = (edittext) findviewbyid(r.id.inputprice); inputdesc = (edittext) findviewbyid(r.id.inputdesc); button btncreateproduct = (button) findviewbyid(r.id.btncreateproduct); btncreateproduct.setonclicklistener(new view.onclicklistener() { @ov