Posts

Showing posts from September, 2014

iphone - How to assign didSelectRowAtIndexPath in Tableview cells subview item -

Image
i have 2 problem , totally confuse. please me 1) face 1 problem want assign click listener image view inside of subview , subview in cell of uitableview . in tableview cell there 2 image-view want give them click listener , identify them image-view clicked on row etc etc. if write scrollview.userinteractionenable=yes; didselectrowatindexpath not responds. know because of subview. if change scrollview.userinteractionenable=no; didselectrowatindexpath code executes. scrollview not scroll horizontal.. what do ? want horizontal scroll plus image-view click listener on both imageview. ** solve click problem crating scrollview sub class** this customcell class cellscrollviewclass *scrollview = [[cellscrollviewclass alloc] initwithframe:cgrectmake(0.0,0.0,430,187)]; scrollview.contentsize = cgsizemake(scrollview.frame.size.width * 3,scrollview.frame.size.height); scrollview.scrollenabled=yes; scrollview.userinteractionenabled=yes; (int = 0; < 3; i++)

php - Show tooltip for dynamic content -

i have following html code shows dynamic number of rows information, , there image link click specific information clicked row based on compentence_id field.. echo "<td>".$compi['competence_id']."</td>"; echo "<td><p style='text-align: center;'>".$compi['competence_group']."</p></td>"; if(isset($compi['competence_class'])){echo "<td>".$compi['competence_class']."</td>";}else echo "<td><p style='text-align: center;'>-</p></td>"; echo "<td>".$compi['competence_description']."</td>"; echo "<td class='evaluation'>"; echo "<select class='ownlevelselect' id='ownlevelselect-.".$compi['competence_id']."' name='level-&

bug reporting - Is there a framework available to collect user feedback on an SWT GUI? -

after 2 years of development, our eclipse rcp desktop application finished. last step in development allow client provide feedback on wording , labels in application. there 10 people providing feedback, client willing consolidate before sending implementation. my first idea provide google form requires them upload screenshot , precisely specify text changed located. wondering whether framework exists automatically (i.e. press 'ctrl+alt' , can automatically draw box around offending text in application. in short: there user feedback tools designed collect feedback on wording in gui? mylyn includes facilities (almost) this. in standard eclipse, try help -> report bug or enhancement ... you use various org.eclipse.mylyn.tasks... extension points specify things product, area , bug template.

interactive facebook application Open Graph Object -

i saw @ facebook app nike run it appears @ wall interactive graph how can made 1 this? i'm torn between graph api , open graph, suggest?? most of these posts coming seems use flash , embed them in post. interaction can made use of custom open graph objects, adding following meta tags on url representing open graph object <head prefix="og: http://ogp.me/ns fb: http://ogp.me/ns/fb"> <meta property="fb:app_id" content="app_id" /> <meta property="og:type" content="game" /> <meta property="og:url" content="http://example.com/embed/" /> <meta property="og:title" content="beat gareth's high score" /> <meta property="og:description" content="gareth scored 2800, can beat it?" /> <meta property="og:image" content="http://example.com/game.png&qu

ubuntu - Apache is running but not working -

i running huge php-application on ubuntu server, using apache2, php5, mysql. sometimes (approx. once month) page ist not reachable internet ("it's down"). weird thing is, service apache2 status says apache running. solution restart apache using service apache2 restart , works fine again. the server load @ minimum , can't part of problem (i guess). i know, description not detailed should be, not have more information. any suggestions cause problem appreciated! what have done see if server running? have checked if there processes? if ports open? if can access server localhost? if there's in error logs?

entity framework - How to specify an array element for ComplexType -

so have following complextype: [complextype] public class transactionsettings { [display(name = "minimum order amount"), column(typename = "money")] public decimal minimumorder { get; set; } [display(name = "payment provider")] public paymentprovider paymentprovider { get; set; } [display(name = "provider settings")] public providersettings providersettings { get; set; } [display(name = "accepted credit cards")] public creditcards[] acceptedcreditcards { get; set; } [display(name = "taxable states")] public states[] salestaxstates { get; set; } } public enum creditcards { mastercard, visa, [description("american express")] americanexpress, discover } public enum states { [description("alabama")] al, [description("alaska")] ak, [description("arizona")] az, //. //. //. [description(&

angularjs - Angular newbie : $scope variable need to be used twice to refresh a textarea -

i try angularjs first time , i'm stuck on problem. in debugger see scope variable '$scope.xml' correctly updated, display needs second pass (second click) refresh. here plunker see problem : http://plnkr.co/edit/9pjsgedqwjc6nmzhcejv i'm looking in documentation can not find track understand did not well thank's lot ! <!doctype html> <html ng-app="testangularjs"> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script> </head> <body> <div ng-controller="testxml"> <div>xml<br/><textarea cols="60" rows="15" ng-model="xml" name="xml">{{xml}}</textarea></div> <div><button ng-click="listtypdoc()">list !</button><br/> <br/><button

What characters are NOT allowed in MongoDB field names? -

i figured out of course . , space aren't allowed. there other forbidden characters ? you can use (utf8) character in field name aren't special (contains ".", or starts "$"). https://jira.mongodb.org/browse/server-3229 https://stackoverflow.com/a/7976235/311220 it's best stick lowercase alphanumeric underscores though.

php Switch statement and 0 -

hi see code today that $i=0; switch($i){ case 'test': print "test";break; case 0: print "0";break; } the normal output seems 0 prints test . try understand , got solution here . is, when compare number string string convert number , comparison performed numerically. ok ok output test . but if set identical $i=0; switch($i){ case ($a === 'test'): print "text";break; case ($a === 0): print "0";break; } that give result test confused here. , if use == instead of === show blank. please clear me that. do have make $i numeric? let string too... $i="0"; switch($i){ case 'test': print "text";break; case '0': print "0";break; } that prints 0...

ios - Localization for a very simple app.. How to connect a button? -

i have simple app contains pickerview , uilocalnotification , uialertview , less 8 views. want is: i have main view contains 2 buttons 1 says english , other says french . what in mind is: when user hits english it'll take him project have right now, however, when user hits french it'll take him duplicated views i'd , manually change , translate it's labels french. ** question ** how translate pickerview , localnotification , alertview ? , how connect french button these translations? from i've googled , read here in can strings out , list them localizable.strings still don't know how make french button ask these strings? also, there easier , simpler way? idea? thanks, kindly try doing localization http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial for buttons use [self.yourbutton settitle:nslocalizedstring(@"your_key", @"comment") forstate:uicontrolstatenormal]; do not duplicate

db2 - SQL Constraint that one column value cannot be greater than another in a different table -

this isn't nice question blending business logic db structure, not decision so: is possible define constraint infers value of 1 column (table a, column x) cannot greater value of (table b, column y) referenced via foreign key: table_a id (primary key) x (int value) table_b a_id (foreign key table_a) y (int value) i.e. want enforce values of y, y < l l value x table_b.a_id == table_a.id i'm working db2. is possible define constraint infers value of 1 column (table a, column x) cannot greater value of (table b, column y) referenced via foreign key: no. require using select statement within check constraint, , db2 doesn't support that. if did support using select statement way, this. alter table_b add constraint table_b_y_lt_l check (y < (select x table_a table_a.id = table_b.a_id)); the select statement return single value, because table_a.id unique. but, said, db2 doesn't support select statements in check constraints

c++ - Difference in template arguments C<void ()> and C<void (*)()> -

i don't understand difference between template arguments template <class t> class c { t t; }; void foo() { c<void ()> c1; //isn't compiled c<void (*)()> c2; } what type void ()? such kind of types used in boost::function.. void() function type. void(*)() pointer type. in c++ cannot have variables of function type, t t; doesn't compile when t void() .

Do we have any option of adding suppliers and suppliers information in the magento admin? -

i'm new magento. need add suppliers along our products , supplier information should editable. please suggest me how can this. i'm using magento 1.7 thanks in advance. you need install extension that. search , found this: suppliers on magento you have send him private message know ^^

c# - Add a new line at a specific position in a text file. -

i trying add specific line of text in file. between 2 boundaries. an example of if wanted add line in between boundaries of item1: [item1] 2550 coins 995 200000 7 2550 coins 995 200000 7 2550 coins 995 200000 7 2550 coins 995 200000 7 2550 coins 995 200000 7 //add line here in between specific boundaries [/item1] [item2] 2550 coins 995 200000 7 2550 coins 995 200000 7 2550 coins 995 200000 8 2550 coins 995 200000 7 2550 coins 995 200000 7 [/item2] [item3] 2550 coins 995 200000 7 2550 coins 995 200000 7 2550 coins 995 200000 7 2550 coins 995 200000 7 2550 coins 995 200000 7 [/item3] this have tried far, near correct. keeps saying file being used reader cant edited writer, when did work cleared entire document. public void createentry(string npcname) { string line; string filename = "drops.de"; streamwriter streamwriter = new streamwriter(filename); streamreader streamreader = new streamreader(filename); line = streamreader.readline(); if (li

python - django : get the current locale inside a templatetag -

i've internationalized django (1.4) app. in app, have templatetag needs know current language. i think use django.utils.translation.get_language seems inside templatetag, returns default language , not current language. i fixed reading request.language_code context. but know if there better way language in templatetag there's few default templatetags can use {% get_current_language %} or {% get_current_language foo %} e.g. {% render_bar request foo %}

model - Rails <top (required)>: uninitialized constant -

i have model called class app::basemodel file called base_model.rb then have message.rb file on first line has following: class app::message < app::basemodel when starting server error: /path/to/app/message.rb:1:in `<top (required)>': uninitialized constant app::basemodel (nameerror) can me please? cheers for base_model.rb should => class basemodel webactivity < activerecord::base and message.rb should => class message < activerecord::base

command line - opening a batch file that opens a text file in python -

i writing script can execute batch file, needs open file in same folder first. current code is: from subprocess import popen p = popen("mad8dl.bat <runthisto.txt>", cwd=r"c:\...\test") stdout, stderr = p.communicate() where ... path folder. however, everytime run syntax error: the syntax of command incorrect any regarding syntax appreciated. first, should remove < , > angle brackets code; pass filename, without brackets, batch file. (unless filename contain < , > characters, in case want know how managed since characters forbidden in filenames in windows). second, code should like: from subprocess import popen, pipe p = popen(["mad8dl.bat", "runthistoo.txt"], cwd=r"c:\...\test", stdout=pipe, stderr=pipe) stdout, stderr = p.communicate() note list containing components of call, rather single string. note need specify stdout=pipe , stderr=pipe in popen() call if want use communicate() later

android - Xml parsing with AsyncTask slower than parsing in main Thread -

this question has answer here: asynctask, must take such performance penalty hit…? 4 answers i'm having strange behaviour in code: parsing local xml file on simulator asynctask takes longer parsing on main thread. here code asynctask: public class mostratutti extends sherlockactivity { listview lv; final list<listviewitem> items = new arraylist<mostratutti.listviewitem>(); final arraylist<string> nome = new arraylist<string>(); final arraylist<string> immagine = new arraylist<string>(); ... final int array_image2[] ={r.drawable.iodocloroidrossichinolina,r.drawable.acidoacetilsalicilico, ...}; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.mostra_tutti); lv = (listview) findviewbyid(r.id.listview); getsupportactionbar().

Calculate Number of days between two dates excluding sundays and an array of holidays in Javascript -

how calculate business days between 2 dates in javascript. say date 1 : 04-25-2013 date 2 : 05-10-2013 holidays : ["04-27-2013","05-03-2013"] i want total number of days excluding holidays if exists between these 2 dates , excluding sundays if any. i have tried can't able holidays array. diff=enddate-startdate; var holidays=new array("04-28-2013","05-22-2013","06-28-2013"); idx_holidays=0; num_holidays=0; while(idx_holidays < holidays.length) { holiday=new date(holidays[idx_holidays]); if(diff>holiday-startdate) num_holidays++; idx_holidays++; }

cordova - Phonegap vs Android Native SDK for supporting multiple languages -

i want parse planet feed has multiple rss supports multiple languages spanish, german, etc my question should go phonegap or native android sdk. not sure 1 better can support requirement. depends on skill set. if have learn javascript , java doesn't matter. pick 1 , learn how it. if know javascript or java, pick 1 know better/like , go it. the native sdk offers localization : see here . using phonegap, you'll have define own javascript localisation methods. not complicated, have done before , i'm not expert in javascript. you have consider other things like: is app android or you'll support other platforms? how "heavy" app? render heavy graphics or has fancy animations? in epxerience phonegap gets bit laggy on those. search differences, pros , cons of doing both. to started.

java - How to build Main Project And Dependent Projects in one Go -

i have number of projects linked main project libraries in netbeans 7.1. e.g. main project1 depproject1.lib depproject2.lib depproject3.lib when made changes in dependent projects(e.g depproject1) have clean build dependent project , paste in libraray folder of main project , clean build main project also. there way if build main project dependent projects build automatically , library of main project updated automatically. instead of adding library jar directly project, shown here , add library containing other projects, shown here .

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

windows 7 - Loading specific PyQt4 modules with multiple python versions -

i have problem multiple python install on win7 system. have python2.6.4 , python3.1. each of them have different pyqt4 version installed in site-packages directories. more specific: python2.6.4 pyqt4 4.7.3 python3.1 pyqt4 4.8.2 the problem cant seem import pyqt4 within of these versions. problem of path conflict. i removed path path environment variable , tried set them each python versions via : [.pth] files in each version site-packages folders adding manually pyqt4 folder in sys.path within scripts before importing none worked the way found makes work add pyqt4 folders in system env path not convenient have change manually each time switch of python version. what doing wrong ?

jquery - Sorry, an error occurred while processing your request C# and Ajax -

i making ajax call, , in local environment works, when go server starts giving problem. the error appears: sorry, error occurred while processing request f-12 google chrome appears: failed load resource: server responded status of 500 (internal server error) jquery: function converter(origem, destino, tipo) { $.ajax({ type: "get", url: "@url.action("converter", "home")", data: {acoordenada: origem.val(), atipo: tipo}, success: function (msg) { destino.val(msg); } }); }; controller: public jsonresult converter(string acoordenada, string atipo) { var orientacao = ""; acoordenada = acoordenada.replace(".", ","); decimal coordenada = convert.todecimal(acoordenada); coordenada = math.abs(coordenada); int coorhora = (int)coordenada; coordenada = (coordenada - coorhora) * 60; int coormin = (int)coordenada; coordenada = (coordenada - c

Need to implement slider in android -

i want implement slider automatic slider after time , slider user touch (like running in web sites). i had try many things not use full me. what i'm trying: <linearlayout =1 /> <linearlayout =2 /> <linearlayout =3 /> i'm inflating layout 2 below xml <linearlayout> <imageview> <webview> </linearlayout> inflating xml depend web service data come server. and need implement slider functionality in layout 2. so need way hoe achieve task in android had try many thing not use full top me.

Maven adding dependencies not in pom file -

i defining module 2 dependencies in pom file, generated .classpath file(using mvn eclipse:eclipse) contains other dependencies also. i checked dependencies of modules added in pom, not of them added. so scenario is: project depends on project b project b depends on projects x, y , z when run mvn eclipse:eclipse on project a, .classpath file contains project b , projects x , y, not z. this not causing problems, expected behavior? yes, expected behaviour. project b needs x, y , z work properly, these dependencies (called transitive dependencies ) part of project. see this detailed explanation of maven dependency resolution. you can call mvn dependency:tree or mvn dependency:list command line see dependencies, including transitive ones. if know depending on artifact, available @ runtime, case java ee libraries on application server, can mark them provided in pom : <dependency> <groupid>group</groupid> <artifactid>artifact&l

mpeg - MPEG2 TS end-to-end delay -

i need calculate end end delay (between encoder , decoder) in mpeg 2 ts based on time stamps information (pts pcr dts). time stamps enough calculate delay? these time-stamps inserted transport stream encoder, , used decoder - such syncing between audio , video frames, , in general locking original clock display video correctly. the delay between encoder , decoder, on other hand, asking delay between transmitting data source , receiving in destination. not determined data (i.e. transport stream , data within such time stamps) network conditions.

actionscript 3 - game wmode issue when dealing with divs on top -

i using starling rendering must use wmode=direct in application work. having said need show box on top of flash under circumstances. when show box appears on because of wmode (works fine opaque). is there way can show content on top of flash while in wmode=direct? you can try showing box within swf on 2d level, level design above stage3d content.

C# return Dictionary in generic method -

public abstract baseclass { public abstract dictionary<t, v> extractsummaryinfo<t, v>() v : product; } public myclass : baseclass { public override dictionary<t, v> extractsummaryinfo<t, v>() { dictionary<t, v> products = new dictionary<t, v>(); string id = "hrm"; product product = new product("product 1"); products[id t] = product v; return products; } } it seems me line of code (products[id t] = product v;) wrong, tell me please how implement method?

php - Getting list of all tables in the database and the column information -

i'm trying information current configured database in zf2. can queries. eg.: select * information_schema.tables table_schema = '<databasename>' .. , on. what want, use pdo provide me info ( $db->fetchall(\pdo::fetch_column) ). because want work different type of databases ( mysql, sqlite, etc... ). is there way using zend's dbadapter, or accessible zend 2 framework ? researching how pdo instance , using it, won't happen i`ve seen included in zf2 package.

instance - Android Fragment and reload application -

i have fragmentactivity : public class fragmentactivity extends fragmentactivity { // ... protected void oncreate(bundle savedinstancestate) { if (savedinstancestate != null) { myfragment = (myfragment) getsupportfragmentmanager().getfragment( savedinstancestate, myfragment.class.getname()); } else { myfragment = new fragment(myobject); } } } and in fragment : public class myfragment extends fragment { public myfragment(myobject) { super(); this.myobject = myobject; setretaininstance(true); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { mydao mydao = new mydao (myobject); } } everything working except when close application, stuff (my application enters in background) , relaunch application. nullpointerexception on mydao mydao = new mydao (myobject); where

asp.net - Hyperlink not displayed properly -

i want display data on page dynamically database. i have added news box , displaying events list in repeater database. hyperlink , marquee used. hyperlink not displayed properly. the code given below: <asp:hyperlink id = "hyperlink1" runat = "server" navigateurl = "/events/events.aspx?id=<%#eval('event_id') %>"> <asp:label id = "label1" runat = "server" text = '<%# eval("event_title") %>' ></asp:label></asp:hyperlink><br/> change code <asp:hyperlink id="hyperlink1" runat=server navigateurl='<%# databinder.eval(container.dataitem, "event_id", "/events/events.aspx?id={0}") %>'> <%# databinder.eval(container.dataitem, "event_title") %>' </asp:hyperlink>

c++ - Slow iterating over string using pointers -

i love see why 1 of following solution slower other. lets concider following code: // create long string int x,y; bool b; char c[10000]; (x=0;x<10000;x++) c[x]='a'; string s(c); now want iterate on string , compare each character other. first solution completes task in 5 seconds: for (y=0;y<100000;y++){ (x=0;x<10000;x++){ b = (s[x]=='a'); }} and second in 21 seconds: string::iterator begin = s.begin(); string::iterator end = s.end(); string::iterator i; (y=0;y<100000;y++){ (i=begin;i<end;i++){ b = (*i=='a'); }} why second slower? it having dereference pointer every time comparing iterator 'a', instead of comparing actual char value. negligible difference in cases, doing 1,000,000,000 iterations noticeable.

c++ - is it necessary to explicitly limit the number of threads -

when running multithreaded application, necessary explicitly specify maximum number of threads used application, or linux administrate itself? if linux handles itself, expect "social", in sense cpu divided between users. maybe wrong this? some systems have maximum number of threads system can cope with, systems run out of memory [of kind] before happens. if threads "not doing much", can have many (although handling several thousand threads may cause things run slower because every , again, system have "walk" every thread in system). if threads heavy in calculations , such, it's "nice" other processes in system leave spare cpu capacity processes. so, isn't set in stone, depends on trying achieve. , of course, overall system intended - if task model aerodynamics of new car bmw, using 99.999% of cpu aerodynamics calculation fine. if machine dedicated web-server, using 99.99% of cpu serve web-pages perectly fine. if it's

backend - Magento, see if back-end user is online? -

i have magento website. there admin user, thats me, , other user. how can see if other user logged in (back-end) ? edit thanks sandeep have this: <?php $session = mage::getsingleton('admin/session'); $userdetails = mage::getsingleton('admin/session'); // data session $userid = $userdetails->getuser()->getuserid(); // user id $userid = $userdetails->getuser()->getemail(); // use 'admin/session' object check loggedin status if ( $session->isloggedin() ) { echo "ingelogd"; } else { echo "niet ingelogt"; } ?> $session = mage::getsingleton('admin/session'); // use 'admin/session' object check loggedin status if ( $session->isloggedin() ) { echo "logged in"; } else { echo "not logged in"; }

python - Clustering Using Latent Symantic Analysis -

suppose have corpus of documents , run lsa algorithm on it. how can use final matrix obtained after applying svd semantically cluster words appearing in corpus of documents? wikipedia says lsa can used find relation between terms. there library available in python can me accomplish task of semantically clustering words based on lsa? try gensim ( http://radimrehurek.com/gensim/index.html ), install following these instruction: http://radimrehurek.com/gensim/install.html then here code sample: from gensim import corpora, models, similarities documents = ["human machine interface lab abc computer applications", "a survey of user opinion of computer system response time", "the eps user interface management system", "system , human system engineering testing of eps", "relation of user perceived response time error measurement", "the generation of random

c# - How to calculate size of Nullable<T> datatypes -

this question has answer here: what memory footprint of nullable<t> 5 answers actually, willing know how memory being consumed following datatypes int? = memory size? double? = memory size? bool? = memory size? can give me information storage or method calculate size do want know memmory consumption of e.g. int? x ? msdn says: ... common language runtime assigns storage based on characteristics of platform on application executing. in circumstances packs declared elements closely possible; in other cases aligns memory addresses natural hardware boundaries. also, storage assignment different on 64-bit platform on 32-bit platform. the same considerations apply each member of composite data type such structure or array. furthermore, composite types have additional memory requirements. example, array uses memory array , e

tfs - How can I collect name of dlls, which have already built during a running build. -

i have tfs 2012 build agent , buld controller. if start build, time consuming, write log file names of dlls have been built (like build window). if part of build (dll) has failed, log reason error too. have ibuilddetail object don't find relevant properties. the tfs build kicks off msbuild tool perform actual compilation. default tfs capture msbuild log (which contains info built, errors, warnings, etc). msbuild log included in build drop , linked tfs build summary , details page. i don't think ibuilddetail have of information, aside build warnings , build errors should propagate tfs build info. other parsing msbuild log extract data want, don't think there's other easier ways. trying accomplish, maybe can suggest better approach?

redundancy - Simplifying the regex "ab|a|b" -

(how) following regex simplified: ab|a|b ? i'm looking less redundant one, i.e. 1 a , 1 b . possible? some tries: a?b? # matches empty string while shouldn't ab?|b # still 2 b note real regex has more complicated a , b parts, i.e. not single char inner subregexes let's say. if using perl or pcre engine (like php's preg_ functions), can refer previous groups in pattern, this: /(a)(b)|(?1)|(?2)/ the main purpose of feature support recursion, can used pattern reuse well. note in case cannot around capturing a , b in first alternation, incurs (possibly) unnecessary overhead. avoid this, can define groups inside conditional never executed. canonical way use (?(define)...) group (which checks if named define group matched anything, of course group doesn't exist): /(?(define)(a)(b))(?1)(?2)|(?1)|(?2)/ if engine doesn't support ( edit: since using java, no feature not supported), best can in single pattern indee

c - How to initialize void* data struct member with another struct member in C99? -

let's assume have below struct definitions: typedef struct { uint8_t ; } deepest_t ; typedef struct { deepest_t* deepest_ptr ; } deeper_t ; typedef struct { deeper_t* deeper_ptr ; } deep_t ; typedef struct { void* data ; } data_container_t ; and following initializations: deepest_t deepest = { .a = 5, } ; deeper_t deeper = { .deepest_ptr = &deepest, } ; deep_t deep = { .deeper_ptr = &deeper, } ; and question, please tell me how initialize void* data usage of designated initializer in order void* data point deepest_t deepest . i've tried such solution, compiler screaming not const value : data_container_t data_container = { .data = &(((deeper_t*) deep.deeper_ptr)->deepest_ptr), } ; in here believe keeping address of deepest_ptr .. data_container_t data_container = { .data = &(((deeper_t*) deep.deeper_ptr)->deepest_ptr), } ; so retrieve it, can .. deepest_t * d = *((deepest_t**)(data_contain

How to notify an item has selected from data grid in wpf and using mvvm? -

i trying notify item selected data grid because opening modal window while selecting item data grid. editing selected item in modal window , due not want raisedpropertychanged mechanism selected item because when try modify selected item, opens modal window. trying use event trigger fix issue getting errors. below related code: viewmodel: public observablecollection<student> sitems { { return ssitems; } set { ssitems = value; raisepropertychanged( "sitems" ); } } private studentsinformation studentinformation; public studentsinformation studentinformationobject { { return studentinformation; } set { studentinformation = value; raisepropertychanged( "studentinformationobject" ); } } public relaycommand<student> selectionchangedcommand { get; set; } these lines of code in constructor: selectionchangedcommand = new relaycommand<student>( item =&

sql server 2008 - How to use `LIKE` operator as a column in `SQL`? -

i want use like operator column such: select name, (name '%flow%') bool1 table1 ... and result such: name bool1 -------------- ---------- on flow 1 stack on flow 1 stack on 0 select name, case when name '%flow%' 1 else 0 end bool1 table1 where...

java - How to customize JLabel abbreviate text -

when text in label long jlabel abbreviate , add ... end. how can customized text ? i have method abbreviate long text , dont know how can pass jlabel: public static string abbreviatemiddle(string str, string middle, int length, int lengthsuffix) { if (stringutils.isempty(str) || stringutils.isempty(middle)) { return str; } if (length >= str.length() || length < (middle.length() + 2) || lengthsuffix > length || str.length() < lengthsuffix || length - middle.length() < lengthsuffix) { return str; } int targetsting = length - middle.length(); int endoffset = str.length() - lengthsuffix; int startoffset = targetsting - lengthsuffix; strbuilder builder = new strbuilder(length); builder.append(str.substring(0, startoffset)); builder.append(middle); builder.append(str.substring(endoffset)); return builder.tostring(); } as shown here , label's ui delegate adds ellipsis required i

Java PDFBox, extract data from a column of a table -

i find out how extract pdf(ex. image) http://postimg.org/image/ypebht5dx/ for example, want extract values ​​in column "tensione[v]" , if encounters blank cell enter letter "x" in output. how do? the code used this: pddocument p=pddocument.load(new file("a.pdf")); pdftextstripper t=new pdftextstripper(); system.out.println(t.gettext(p)); and output: http://s23.postimg.org/wbhcrw03v/immagine.png these guidelines. use them upon use. not tested either, solve issue. if have question let me know. string text = t.gettext(p); string lines[] = text.split("\\r?\\n"); // give lines separated new line string cols[] = lines[0].split("\\s+") // gives array separated whitespaces // cols[0] contains pins // clos[1] contains tensione[v] // cols[2] contains tollrenza if not present empty

How do I unmap only when a mapping exists in Vim -

as follow-on accepted answer in how override gf vim-rails , editing same file multiple times results in following error: error detected while processing user auto commands "rails.javascript.coffee*": e31 : no such mapping the offending line in vimrc is :autocmd user rails.javascript.coffee* nunmap <buffer> gf how can avoid error unmapping if mapping exists? (note: editing same file multiple times may seem strange thing do, believe happens side effect of searching ack.vim or ag.vim) you check mapping if ! empty(maparg('gf', 'n')) ... , usual solution suppress error prepending silent! before nunmap <buffer> gf command.

c# - Attempting to upload to FTP: System.Net.WebException: System error -

i have api takes in xml , uploads files based on information in xml. uploads on schedule (also xml), , have tested surrounding , know works. i getting error 40% of time on first file attempt upload in each time cycle (time cycle = 45 minutes files, 30 minutes others). here code upload: try { loggerftp.log("uploading file: " + filename, false); // create request. ftpwebrequest request = (ftpwebrequest)webrequest.create(appsettingsftp.ftpurl + @"/" + filename); request.method = webrequestmethods.ftp.uploadfile; request.timeout = 6000000; //set 100 minutes //request.timeout = -1; //set infinite // add login credentials. request.credentials = new networkcredential(appsettingsftp.ftplogin, appsettingsftp.ftppassword); // grab file contents. streamreader sourcestream = new streamreader(appsettingsftp.uploadfiledirectory + filename); byte[] filecontents = encoding.utf8.getbytes(sourcestream.readtoend()); sourcest

Delphi, application scaling, Windows 7 -

good day everyone. i have problem delphi 7 application being used windows 7. it works perfect older windows xp, on win7 form scaled higher dpi breaks on form. so, question - there way fix work correctly on win7, or somehow disable scaling? i tried search, couldn't find work me, , appreciate help. i saw phenomenon (as hired consultant) on xp large fonts on (then) big 22" 2003: buttons on ms c++ application disappeared right outside form. @ time, developers (500 kms away) had never seen phenomenon before. i solved similar problem in d7 by: setting large fonts on old developer machine , fiddling (rather medium) form size accomodate visible components. however, setting large fonts made old win2000 crash , never recover... on more modern machine (xp d7), set scaling property false on form1 results, i.e. fonts smaller. program(s) in question run on couple of wall mounted touchscreen pcs preinstalled win7 incredibly large fonts (because it's touchscreen

c++ - Vector Erase Error -

i have following code in c++: #include <iostream> #include <cstdlib> #include <ctime> #include <vector> int main () { srand(time(0)); int noofelements = 9; (int = 0; < 9; a++) { std::vector<int> poss; (int = 1; <= 9; a++) poss.push_back(a); (int b = 0; b < 9; b++) { int random = rand() % 9; std::cout << poss[random]; poss.erase(random); noofelements--; } std::cout << "\n"; } } yet when run it, returns this: error: no matching function call 'std::vector<int>::erase(int&)' for line 13. why , how can correct it? you cannot erase values vector directly (vectors sequence containers, not associative containers): need provide iterator element want erased. in order iterator, may either: find element based on value (e.g. using std::find() ) , provide returned ite

asp.net - Adding additional attributes to CheckBoxList on DataBind -

i have checkbox list bound values database, follows chktoplanguages.datasource = dssitelanguages; chktoplanguages.datatextfield = "language"; chktoplanguages.datavaluefield = "languageid"; chktoplanguages.databind(); however, need add value (altlanguage) custom attribute can access value in instances. how can add additional value attribute checkbox items on databind? you're not going this, when faced issue before way see doing in pure .net following: // create field on data source objects public languagefield { { return languageid + "_" + altlanguage; } } chktoplanguages.datasource = dssitelanguages; chktoplanguages.datatextfield = "language"; chktoplanguages.datavaluefield = "languagefield"; chktoplanguages.databind(); then, when values, split value "_" , can grab both values.

Error on stream media on android -

i have code play radio stream on internet, code :- package com.example.kam; import java.io.ioexception; import android.os.bundle; import android.app.activity; import android.view.menu; import android.media.audiomanager; import android.media.mediaplayer; public class mainactivity extends activity { public mediaplayer mp; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } protected void onresume (){ super.onresume(); mp = new mediaplayer(); try { mp.setdatasource("http://radio.arabhosters.com:8015/"); } catch (illegalargumentexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (securityexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (illegalstateexception e) { // todo

C++ Qt: can't find methods of dynamic library -

i'm working on application in qt has plug-able. i've looked around while , came upon example plugins in qt: http://doc.qt.digia.com/4.6/tools-echoplugin.html i've changed little classes. i've added random number generator: randomgenerator.h: #ifndef randomnumber_h #define randomnumber_h class randomnumber { public: ~randomnumber(); randomnumber(); int getnumber(); }; #endif // randomnumber_h randomgenerator.cpp: #include "randomnumber.h" #include <stdio.h> #include <stdlib.h> #include <time.h> randomnumber::randomnumber() { srand(time(null)); } int randomnumber::getnumber(){ return rand() % 20; } then made small adjustment in plugin: echoplugin.cpp: #include <qtgui> #include "randomnumber.h" #include "echoplugin.h" qstring echoplugin::echo(const qstring &message) { randomnumber* rn = new randomnumber(); qstring a; a.setnum(rn->getnumber()); return a;

xml - Is it possible to use XSD to define incrementally specified tree structure? -

Image
let's have element either leaf (containing value) or composite (a usual composite pattern). want model tree instances expected refined other instances example filling composite node new elements. want able decide whether 1 tree instance conforms instance structure. possible model instance xsd , implement conformance xsd conforming other xsds? note there more 2 levels - each structure can serve meta-structure. appendix: better picture of intent here possible rules. "this composite not extensible (is fixed)." "you can add elements @ end of composite." "this composite contains optional leaf 1 , mandatory leaf 2." "this composite contains arbitrary number of occurrences of composite." examples: structure 1: composite 0..1 "abc" 1..n "def" 0..n extensible composite "c1" 1..1 "ghi" 0..1 composite "c2" 1..1 "jkl" structure 2: composite 1