Posts

Showing posts from September, 2013

sql server - update on datagridview does not update local db with update statement -

i have login form should updating local db current logged on users. on form_load pulls users db hidden datagridview via tableadapter , refreshes every 5 seconds via timer. on login disables timer, changes single value on datagridview , runs table adapter.update statement. on completion enables timer again refresh datagridview. my problem is, @ runtime testing, datagridview visible , can see changes value user, once refreshes, old value. code loginbtn_click , timer1_tick below : private sub loginbtn_click(sender object, e eventargs) handles loginbtn.click if pwtxt.text = pw if datagridview1.item(4, temppos).value = false timer1.enabled = false loggedinid = tempid datagridview1.item(4, temppos).value = true me.logintableadapter.update(logindataset) menuform.show() menuform.focus() timer1.enabled = true else msgbox(trim(tempid) & " logged in. please contac

dynamic table name in redshift -

i have few tables similar names different prefixes: us_cities, ca_cities , uk_cities. each 1 of tables consist 1 column (city_name). want union tables , result that: select 'us' country, city_name us_cities union select 'ca' country, city_name ca_cities union select 'uk' country, city_name uk_cities in future have more city tables more countries , want dynamic query/view identify relevant tables (*_cities) , add them in union query. how can in redshift? you can use information_schema.tables table list of tables match naming convention. need external process replace view. select * information_schema.tables table_name '%_cities'; imho, you'd better off having single cities table , using views create country specific versions. :)

html - Bootstrap 3 checkbox doesn't align with form label -

Image
<div class="form-group"> <label for="property_feature" class="col-md-4 col-sm-4 control-label">ফিচার</label> <div class="col-md-8 col-sm-8 col-md-offset-4"> <label class="checkbox-inline"> <input type="checkbox" value="1" id="property_furnished" name="feature">আসবাবপত্রে সজ্জিত </label> <label class="checkbox-inline"> <input type="checkbox" value="2" id="property_sublet" name="feature">সাবলেট </label> <label class="checkbox-inline"> <input type="checkbox" value="3" id="property_mess" name="feature">মেস </label> </div> </div> the above code gives me following output. want disp

Can you change language of javascript error event messages? -

in our webapp log messages server via window.onerror however, if client (the web browser) using non english language message in whatever language user has web browser set to. is there way change somehow? currently unhelpful messages in multiple languages, hard search similar errors when in 12 different languages, tricky developers need translate english time figure out went wrong. [edit] adding example here window.onerror = function (message, url, linenumber, columnnumber) { // log error here server } in example, message in english of time, turns in example danish or swedish depending on client (webbrowser). short answer: you cannot change it . message descriptive message because of error code. web app should take consideration state (code) of error, not message. these messages part of browser settings, not have rights change (some of them read-only, all write-protected). mean can render user's browser useless changing program settings javascript (f

entity framework - Why is cascade delete not on by default for this relationship? -

i have 1 many relationship between labellineitem , despatchpart. can't understand why cascade delete off relationship. there no relationship defined in context using fluent api. there no labellineitems navigation collection in despatchpart, there no reference labellineitem. public class labellineitem { public int id { get; set; } public int despatchpartid { get; set; } public int labelconfigid { get; set; } public string content { get; set; } // navigation public virtual labelconfig labelconfig { get; set; } public virtual despatchpart despatchpart { get; set; } } public class despatchpart { public int id { get; set; } public int despatchid { get; set; } // navigation public virtual despatch despatch { get; set; } //... } it's understanding one-to-many relationships default cascade delete on. demonstrated in code sample above. whereas zero-or-one-to-many relationships default cascade delete off case if either:

url rewriting - API and "normal" URLs in one Yii2 application -

i have (use) in yii2 application: a standard, seo-like urls, .html @ end (thus 'suffix' => '.html' ) , api request (basing on very simple code ) without suffix. so, make application being able serve both http://127.0.0.1/app/site/index.html -like urls , http://127.0.0.1/uslabs/web/user/2 -like api calls. it possible? if so, how should configure urlmanager component this? i went through " quick start " chapter in " restful web service " section, bring no help. don't use suffixes in examples given there. i'm stuck choice of either 1 or other scheme. yii has rest url router can use associate controllers, this; 'urlmanager' => [ 'enableprettyurl' => true, 'enablestrictparsing' => true, 'showscriptname' => false, 'suffix' => 'html', 'rules' => [ ['class' => 'yii\rest\urlrule', 'con

vectorization - How to vectorize/group together many signals generated from Qsys to Altera Quartus -

in altera qsys, using ten input parallel ports (lets name them pio1 pio10), each port 12 bits. these parallel ports obtain values vhdl block in quartus schematic. in schematic bdf, can see pio1 pio10 nios ii system symbol can connect these pios other blocks in bdf. my question is, how vectorize these pio1 pio10? instead of seeing ten pios 1 line 1 line coming out nios system symbol, should in order group these ten pios see 1 instead of ten? 1 pio see, can name pio[1..10][1..12], first bracket means pio1 pio10, second bracket means bit1 bit 12 because each parallel port has 12 bits. could please let me know how that?

facebook - How to handle Multiple Social Media Logins and sessions Flow on Android? -

i have created android app has navigation drawer fragments. i started social media integrations, facebook, twitter , google plus. using official respective sdk's. not social media sessions , calls acquire data made in following activities: mainactivity : if of sessions lost or revoked, needs redirect loginactivity . done during activity lifecycle methods. loginactivity : permission granted , redirects main after success navigationdrawerfragment : navigation drawer, use display user's profile image, name , email address. in these 3 classes making calls respective sdk methods , managing sessions there lot of code duplication. also 3 sdk's have different ways of providing authentication. facebook: uses uilifecyclehelper implemented on standard lifecycle functions of activity. google plus: have implement googleplay store callbacks in activity , create googleapiclient on activities. twitter: has less of "taking on app" attitude , uses retro

ios - Can we apply gravity behavior to centre of screen? -

i using uidynamicbehavior (uigravitybehavior) . played gravitydirection not make focused on centre of screen. is there way around make gravity focused in centre on screen. basically want show views (circles) converged centre of screen move them apart. any suggestion of great help. edited: added code uigravitybehavior *gravitybehaviour = [[uigravitybehavior alloc] initwithitems:@[ballview]]; gravitybehaviour.gravitydirection = cgvectormake(0, -1.0); we can give gravity direction move along line , if want set gravity act in centre of screen. i.e if objects anywhere getting attracted centre of screen if center of screen acting origin of gravity . :)

sequelize.js - Sequelize, Many-To-Many On Non-ID Properties -

i have 1 model, target , has property/field called targetname . have second model, operation , field verb . both these models have primarykey field named id . i have third model, policy , defined association/join additional properties; policy contains targetname , verb fields. how specify in belongstomany() target , operation use fields above, instead of defaulting id field? know of through option specify actual model. what's in ellipsis section below? target.belongstomany(operation, {through: policy, ...}); , operation.belongstomany(target, {through: policy, ...}); also, specify 2 belongstomany() ? there no way foreign keys pointing non-primary keys in sequelize. see https://github.com/sequelize/sequelize/issues/2967

java - Add character to trigger JTextPane line wrapping -

i have jtextpane can display text containing nomenclature long strings of characters, numbers , dashes ("-"). have word wrapping turned on but, appears work on white space (" ", tab, etc). i'd add dash character trippers line wrap. tried adding space or tab character after each dash trigger wrap but, not non-wrapped portions. has been able trigger line wrap in jtextpane on character default ones? well found "hack solution" works but, not 1 prefer. used replaceall add "\r" character after each dash character. caveat; work in java 7 under windows 7 approach might not apply other os's or future java versions. can't endorse approach general solution question working me. addition of "\r" not show in un-wrapped text trigger wrapping other white space. text.replaceall("-","-\r");

git - How to view remote changes with TortoiseGit -

i cannot figure out how view remote changes tortoisegit. someone pushed code server. see changes before git pull. how can see remote changes tortoisegit? i tried "fetch" command, when "show log" after fetching, not show remote changes. "fetch" correct command retrieve remote changes without integrating/merging them. click on "all branches" on lower left on log dialog show branches (also remote ones). or click on branch label in upper left , select branch(es) want see in log dialog.

java - Fragments and android life cycle -

i've got strange android app. if run main activity , go through few fragments, i'll see main activity after hiding/unhiding app. if press "back", show fragment shown right before hiding. app shows me last fragment after unhiding. how can make app show last fragment everytime if it's possible? or how can make app save state? if understand, want when "back" button pressed, last fragment should displayed. can depend on addtobackstack method handle press. google code snippet @ fragments : fragment newfragment = new examplefragment(); fragmenttransaction transaction = getfragmentmanager().begintransaction(); // replace whatever in fragment_container view fragment, // , add transaction stack transaction.replace(r.id.fragment_container, newfragment); transaction.addtobackstack(null); // commit transaction transaction.commit(); note: in case newfragment last fragment.

php - Html Concatenate issue -

i have following code. echo "<label><input type='checkbox' data-path=".".".$infostatus['status'].""." id='name' class='new1' value=".$infostatus['status']."/>".$infostatus['status']."<span></span></label> </li>"; it produces this: <input type="checkbox" data-path=".deleted" without="" payment="" id="name" class="new1" value="deleted"> although trying produce this: <input type="checkbox" data-path=".deleted without payment" id="name" class="new1" value="deleted without payment"> i don't know doing wrong here, have tried everything. first echo variable, , make sure "deleted without payment". once have confirmed that, can wrap html around it. have quotes in variable's value

javascript - $.post inside html2canvas? -

Image
i have 2 functions: number one html2canvas($("#screenshot"), { onrendered: function(canvas) { $('.ha').append(canvas); } }); number two $.post("save.php",{ xcv : canvas }, function(data){ if (data == 1) { $('.cropped').empty(); $('.cropped').append('<img src="' + data + '">'); $('.cropped').append('<h2>is okay?</h2>'); } else { alert(thecanvas); } }); function number 1 takes screenshot of div-container "screenshot" , shows in div-class "ha". function number 2 should give canvas php file transform canvas pyhsical file. if successful php-file return "1" , post picture on page because "data" keeps filename. tried this: html2canvas($("#screenshot"), { onrendered: function(canvas) { $('.ha').append(canvas); $.post("save.php",{ xcv : canvas }, function(data)

git - Managing Github PR across different organizations -

i member of different organizations within our corporate github. each , every organizations have more 10 repos , each 1 have pr. find difficult keep pr across repos , organizations.. there anyway can manage pr more easily. note: not sure if right place ask question. you can bookmark search content want, show results across repos. example, here's a search open issues assigned you . (prs issues, not issues prs.) if need build more advanced queries, see github issues api .

ruby - rails duplication code user_attributes -

i have master admin can create 2 different admins [property, content_contributor]. in master admin's require params have this class masteradmins::contentcontributorscontroller < masteradmins::maincontroller .... params.require(:content_contributor).permit(:user_id, user_attributes: [:id, :activation_token, :email, :encrypted_password, :authentication_token, :sign_in_count] and in master admins property have this class masteradmins::propertyadminscontroller < masteradmins::maincontroller ..... params.require(:property_admin).permit(user_attributes: [:id, :activation_token, :email, :encrypted_password, :authentication_token, :sign_in_count] i getting duplicate found in code climate. how can avoid user attribute duplication?

python - Finding how many of a certain character in each element in a list -

i want find how many ' ' (whitespaces) there in each of these sentences happen elements in list. so, for: ['this sentence', 'this 1 more sentence'] calling element 0 return value of 3, , calling element 1 return value of 4. having trouble doing both of finding whitespaces looping through every element find 1 highest number of whitespaces. have simple list-coprehension using count >>> lst = ['this sentence', 'this 1 more sentence'] >>> [i.count(' ') in lst] [3, 4] other ways include using map >>> map(lambda x:x.count(' '),lst) [3, 4] if want callable (which function iterates through list have mentioned) can implemented >>> def countspace(x): ... return x.count(' ') ... and executed as >>> in lst: ... print countspace(i) ... 3 4 this can solved using regexes using re module mentioned below grijesh >>> import re >>>

reactjs - react-native: How to use asyncstorage with rocksdb? -

i want embed data react-native app. think have use asyncstorage. can use rocksdb storage asyncstorage. documentation not give example of this. wondering how use rocksdb. also, react-native docs mentions asyncstorage data being global. mean asyncstorage data accessible apps? asyncstorage core react-native api allows store key value pairs. it's global in accessible within anywhere in app not apps because of ios sandboxing. works on own, is, independently of other database systems. rocksdb native key-value store has native implementation. if want use in react-native project, or else have write api (bridge) can used through js. , have nothing asyncstorage. edit: apparently asyncstorage tries use rocksdb on native side if exists. otherwise, seems save data in text file. https://github.com/facebook/react-native/blob/master/react/modules/rctasynclocalstorage.m

animation - android animationing views for multiple devices -

i have small game in application, if right balloons float screen, balloons views moved 2 objectanimators in animation set, , on main debugging device works fine on other devices (including tablets) looks aweful values on place , views violently sway 1 side next. here snippet of im doing: //2 square balloons floating sb = (imageview)findviewbyid(r.id.squareballoon); sb.setvisibility(view.visible); sb2 = (imageview)findviewbyid(r.id.squareballoon2); sb2.setvisibility(view.visible); sp.play(inflate, 1, 1, 0, 0, 1); //left balloon objectanimator sqbalanim3 = objectanimator.offloat(sb,"x",-500,500); sqbalanim3.setduration(700); sqbalanim3.setrepeatcount(5); sqbalanim3.setrepeatmode(valueanimator.reverse); objectanimator sqbalanim = objectanimator.offloat(sb,"y",2000,-1800); sqbalanim.setduration(3000); sqbalanim.s

git - SourceTree connecting to a server ip -

i need something(duh). for work have connect gitrepostery. part of public key done, things got server ip, git repostery , user name. however, can't connect repostery, stating server doesnt exit. have tried filling ip, repostery , user name, i've tried protocol stuff, doens't work , i'm desperate. can guys please me? server ip looks this: 12.34.56.789 (this isn't real one, example ofc) thanks in advance , have nice day! you should use right url, , depends on protocol using. via ssh git@ip:repo_name.git if want use ssh, need set ssh key first. via https https://ip/repo_name.git

java - Sequence number using thread Synchronization -

i want print series of 1 100 number using n number of threads (lets take 10 threads this). condition 1st thread have sequence number 1, 11,21....91, 2nd thread have sequence 2,12,22.....92 , on. other threads have sequence number that. want print number in sequence 1 100. know can use synchronization, wait , notify method , using variable or flag counter don't think idea use it. want use without concurrency (like executors etc) how that. please suggest. public class printnumbersequenceusingrunnable { int notifyvalue = 1; public static void main(string[] args) { printnumbersequenceusingrunnable sequence = new printnumbersequenceusingrunnable(); thread f = new thread(new first(sequence), "fisrt"); thread s = new thread(new second(sequence), "second"); thread t = new thread(new third(sequence), "third"); f.start(); s.start(); t.start(); } } class first implements runnable { pr

delphi - TPanel does not AutoSize when containing a TPanel -

Image
i have panel inside another: the inner panel aligned altop : and outer panel set autosize=true : and sizes. if changes height of inner panel @ design time, outer panel auto sizes accommodate it: and runtime now need change height of inner panel @ runtime : procedure tform2.button1click(sender: tobject); begin pnlinner.height := pnlinner.height + 50; lblpointer.top := pnlouter.top + pnlinner.height; end; except when change height of inner panel @ runtime , autosize panel not autosize : this of course worked in delphi 5, 7, , probably xe2 - xe5 . what's fix? the workaround is, of course, bypass alignment / autosize , during various onresize events. that's distinctly not rad. i'm sure it's small bug in vcl somewhere. , since have two-dozen xe6 vcl bugs we've patched, better fix nobody else has think it. bonus chatter i love line: and, please attach sample project? it's if nobody bothered try reproduce it.

html - Font inheriting from transition -

i'm trying make transition stuff -25 degrees want transit "box", not font. thing don't understand how make :before/:after. whenever try via css ignores setting i've made specific container. .option:hover { font-style: normal !important; background-color: green; cursor: pointer; box-sizing: border-box; transition-property: background; transition-duration: .4s; left: 0; top: 0; -webkit-transform: skew(-25deg); } http://jsfiddle.net/3fndahd2/ the thing skew whole div, includes inside. there's no way exclude anything. there 2 ways around this: apply opposite skew inner elements, i.e. have additional container text skewed other way around in order straight again. wouldn't this, because may lead blurry result or artifacts. use css3 pseudo-elements: create element using ::before , give full parent size , skew one. it's outside text, that's not affected transform. in addition, use z-index place behind parent div. jsfiddle

excel - SumProduct, doesn't return me text and number. (Only Number) -

at first answer)) (it's important me :p ) i have number in a3. when there number in column (sheet1), per exemple a7 take value of cell b7. =sommeprod(('sheet1'!a3:a34=sheet1!a3)*('sheet1'!b3:b34)) i use sommeprod, it's working number, , have text , number in cell (column b). i changed format of cell doesn't work. thanks lot))) i think saying of values in column b expressed text, not number, because imported source. if case: first, convert column b numbers, then, use sumproduct. for example, first convert text values: in c3 enter =value(b3) then copy down c3 c34. then =sommeprod(('sheet1'!a3:a34=sheet1!a3)*('sheet1'!c3:c34)) should have desired effect. note sometime #n/a errors "value" function, example if there unexpected spaces. safe, rather using value alone, try this: = iferror(value(b3),0) or more creative can try: = iferror(value(substitute(b3," ","")),0) &#

javascript - How to add text from a table to a textarea input with button? -

how can text table show in textarea box when press "add" button? i don't need data go away after has been added, want "add text textarea" show in textarea box. https://jsfiddle.net/bj1sh4cq/ html <div class="table-responsive"> <table class="table table-hover"> <tr> <td><button class="btn btn-success" id="addbutton">add</a> </td> <td><span id="addtext"><strong>add text textarea.</span> </strong> </td> </tr> <tr> <td><button class="btn btn-success" id="addbutton">add</a> </td> <td><span id="addtext"><strong>add text textarea.</span> </strong> </td> </tr>

jquery - Datatable Javascript Link not working on 2nd page -

i have list of data in table , using datatable plugin pagination. however, last column link. when go 2nd page cannot click link, link opens on first page of table. when did not have datatable linked work, when added didnt work... my code: <table id="partsresultlistgrid" class="table table-striped table-bordered"> <thead> <tr> <th> @html.displaynamefor(model => model.partsrequestordernum) </th> <th> @html.displaynamefor(model => model.call_num) </th> <th> @html.displaynamefor(model => model.detailview) </th> </tr> </thead> <tbody> @foreach (var item in model) { <tr> <td> @html.displayfor(modelitem => item.partsrequestordernum) </td

Qt - draw pixmap (.png file) with QPainter from resources -

i have problems drawing image on qwidget qpainter resources. i'm sure i'm missing dont know what. if use absolute path, works fine. so question is: should if want draw .png file resources qpainter? (what missing?) here simple test code: widget.h: #ifndef widget_h #define widget_h #include <qwidget> #include <qpaintevent> #include <qpixmap> #include <qpainter> class widget : public qwidget { q_object public: widget(qwidget *parent = 0); protected: void paintevent(qpaintevent* e); }; #endif // widget_h widget.cpp: #include "widget.h" widget::widget(qwidget *parent): qwidget(parent) { } void widget::paintevent(qpaintevent *e) { qpainter painter(this); qpixmap pixmap1("c:/qt/projects/pixmaptest/image.png"); qpixmap pixmap2(":/img/image.png"); qpixmap pixmap3("qrc:/img/image.png"); painter.drawpixmap(10,10,50,50, pixmap1); // works painter.

linux - Geany: How to find and count? -

Image
i know of rather powerful feature in notepad++ can search entire document specific string , count number of occurrences. in find function (ctrl+f). e.g. data: error reading file error reading file error in line #3 error reading file error in line #5 find & count*: "line" = 2 i not seem find this* function in geany. if there plugin this, please share it. otherwise, please share on how 1 same -- without switching editor. you can check message output. after searching check "messages" tab.

python - Convert html table to dictionary without losing structure -

i'm new python (and programming) , using beautifulsoup first time. i'm trying find best way parse contents of table in html , convert dictionary - ideally in least brittle way. here example of html i'm trying parse (i've put key value numbers text i'm trying pick up). <div class="tablename"> <table border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #dddddd; border-collapse: collapse; font-family: arial, helvetica, sans-serif; font-size: 14px; margin: 0; padding: 0; width: 100%"> <thead> <tr> <th colspan="4" style="background-color: #000; border: 1px solid #616161; color: #ffffff; font-size: 14px; font-weight: bold; line-height: 20px; padding: 14px 20px 12px 20px; text-align: left">some text not needed</th> </tr> </thead> <tbody> <tr> <td style="width: 20px"> </td> <td style="borde

Writing a file. Java. Android -

final string rootpath = environment.getexternalstoragedirectory().getabsolutepath() + "/slots/"; final file file = new file(rootpath); file.mkdirs(); final file sdfile = new file(file, "profile.txt"); try { bufferedwriter bw = new bufferedwriter(new filewriter(sdfile)); bw.write(edit.gettext().tostring() + "\n"); bw.write("5000"); } catch (ioexception e) { } in code catches ioexception, file created. please! answers. try this: final string rootpath = environment.getexternalstoragedirectory().getabsolutepath() + "/slots/"; final file file = new file(rootpath); file.mkdirs(); final file sdfile = new file(file, "profile.txt"); try { filewriter fw = new filewriter(sdfile); bufferedwriter bw = new bufferedwriter(fw); bw.write("hello "+"\n"); bw.write("5000"); bw.close(); } catch (ioexception e) { log.e

android - Refresh or relayout the new convertView like first time when listview call getView() -

i have listview use gesturedetector handle swipe left. each item, layout below: [framelayout] [linearlayout] hidden_menu [/linearlayout] [linearlayout] main_layout [/linearlayout] [/framelayout] , handle ontouchlistener. when move main_layout right, hidden_menu shown [sample image] . when move other item right, or moveup or movedown listview, hide hidden_menu of old (or opened) item using objectanimator (x) , @ end animation called main_layout.invalidate(). my problem when scroll listview, reuse row layout viewholder pattern, new row wrong layout (some hidden_layout visibled). 1) ideas refresh new item when getview() called? 2) or how refresh animated item first time i hope guys can understand me ! thanks , best regards! i found solution in case: if(holder.mhiddenmenu.getleft() != 0) { holder.mhiddenmenu.settranslationx(0); }

c# - Convert color scan image to grayscale image for PDF417 decoder xzing -

i'm decoding pdf417 2d barcode in scanned image using zxing.net library. far, have found gray-scale scanned image(8bit depth) working fine , color scanned image(24 bit depth) not working. tried covert color scanned image gray-scale image using below method. private bitmapsource convertgray(bitmapsource bi) { formatconvertedbitmap newformatedbitmapsource = new formatconvertedbitmap(); newformatedbitmapsource.begininit(); newformatedbitmapsource.source = bi; newformatedbitmapsource.destinationformat = pixelformats.gray8; newformatedbitmapsource.endinit(); return newformatedbitmapsource; } but, zxing.net not detect pdf417 2d barcode in converted gray-scale image. how can convert color scanned image gray-scale image same format gray-scale scanned image.

c# - View Column Types Not Supported - Entity Framework -

update: ticket system.data.sqlite.org. link i have view similar in sqlite database select * ( select * ( select fc.filtercommandid, fc.procedureid, 1 isdynamic, substr(fc.datatype, 1, 20) || fc.sequence filter, fc.objectname ((filtercommands fc inner join dynamicfiltercommands dfc on fc.filtercommandid = dfc.filtercommandid) inner join dynamicfiltercommandfields dfcf on dfc.dynamicfiltercommandid = dfcf.dynamicfiltercommandid) inner join procedurefilterkeys pfk on fc.procedureid = pfk.procedureid group fc.filtercommandid, fc.procedureid, 1, substr(fc.datatype, 1, 20) || fc.sequence, fc.objectname order fc.sortorder ) sq union select fc.filtercommandid, fc.procedureid, 0, substr(fc.datatype, 1, 20) || fc.sequence, null filtercommands fc inner join staticfiltercommands sfc on fc.filtercommandid = sfc.filtercommandid ) the proble

Compose Functions in Scala typeclass -

i have following simple scala typeclass: sealed trait printable[a]{ def format(v: a): string } object printdefaults{ implicit val intprintable = new printable[int] {def format(v: int): string = v.tostring} implicit val stringprintable = new printable[string] {def format(v: string) = v.tostring} } object print { def format[a: printable](v: a): string = implicitly[printable[a]].format(v) def print[a: printable](v: a): unit = println(format(v)) def print2[a: printable](v: a): unit = format(v) andthen println } import printdefaults._ print.format(3) // returns "3" print.print(3) // prints 3 print.print2(3) // nothing why print.print2 not printing ? "compose" method called print allows me not have call println(format(v)) rather chain println after calling format(v) that's not how works. f andthen g returns function, not call function. calling function (f andthen g)(x) return (or have effect of) g(f(x)) . print2 compiles because

Transfer a string from list view on one activity to another in android -

this question has answer here: how pass data between activities in android application? 37 answers how possible transfer string listview on click , use string saved in variable in different activity? you can writing code calling next activity in listview's item click event intent intent= new intent(getbasecontext(),anotheractivity.class); intent.putextra("any_key", "your string value"); startactivity(intent); then in other activity's on create method value of string by string str=getintent().getstringextra("any_key");

Problems with creating large MultiIndex (10 million rows) in Python Pandas used to reindex large DataFrame -

my situation have dataframe multiindex including timestamp , number (wavelength 280-4000 nm) wavelength number spacing changes every 1 nm 5 nm. need 1 nm spacing , plan , plan linearly interpolate after reindexing dataframe. i tried create multiindex using pd.multiindex.from_product() , providing 2 lists of 4000 items in length each resulted in python using computer's ram. code looks like: mindex = pd.multiindex.from_product([times_list, waves_list], names=['tmstamp', 'wvlgth'] ) from_product() simple function don't think i'm messing think able handle larger lists i've passed it. to try around i've used pd.multiindex() , passed unique levels, indentical passed .from_product() constructed labels each using code below: times = series(df.index.get_level_values('tmstamp').values).unique() times_series = series(times) times_label_list = list() counter = 0 in times_serie

Wordpress development theme link bootstrap.css to index.php not working? -

i developing wordpress theme scratch , when link bootrap.css in index.php file , go see looks did not work. please if can help. do have link site you're working on? i'd love need see you're doing. here couple things can try: link bootstrap.css in header.php template file. long directory path correct, should able 'view source' on page , click on file link confirm file's content has been loaded. don't forget bootstrap, need load jquery ( http://jquery.com/download/ ) link bootstrap.js file. link jquery , bootstrap.js file in footer.php template file theme. you can refer basic template bootstrap provides should started. http://getbootstrap.com/getting-started/#template

c# - ReadOnly attribute does not work on TextBox -

i'm converting vs2003 vs2005 , part of conversion, need change way setting readonly attribute textbox controls. we had following code before: private void enablehistory(bool state) { textbox itbnewhistory = ultrawebtab1.findcontrol("tbnewhistory") textbox; if( itbnewhistory != null ) { itbnewhistory.enabled = state; itbnewhistory.readonly = ! state; } } new code is: private void enablehistory(bool state) { textbox itbnewhistory = ultrawebtab1.findcontrol("tbnewhistory") textbox; if( itbnewhistory != null ) { itbnewhistory.enabled = state; string hswitch = convert.tostring(!state); itbnewhistory.attributes["readonly"] = hswitch; } } also, removed readonly = "true" attribute asp.aspx code with new code, readonly property true . why happen , how can fix it. thank you the reason re

windows - How to set up / use git as (little more than) a simple backup system -

i'm single developer working on several small, unrelated projects written in c/c++. i tried using git (mostly because client asked me - think doesn't know dvcs must have heard git fashionable :) ) baffled documentation, , tutorials seemed tailored needs entirely different mine: large projects teams of programmers. i wanted start using git "backup system on steroids" first, learning new features later need them. thought setup , daily usage easy, after whole day of tutorials i've yet commit single project (and need bottle of maalox , aspirin :) ) to summarize: i'm solo programmer (no 1 else touch code). i use single windows laptop (no need work multiple pcs). no need branches (the projects small). i do need remote repository (only emergency measure against hd crashes / laptop theft. have private server can install need). i never need retrieve old versions of code (in 2014 did twice, in few minutes, using backups). the code well-commented (the

c# - How to Convert StackFrame Collection to String? -

i have ienumerable<system.diagnostics.stackframe> frames store custom stackframe. want convert string type stacktrace.tostring() format. example: @ teststacktrace.form1.button2_click(object sender, eventargs e) in d:\programming\temp\teststacktrace\teststacktrace\form1.cs:line 66 @ system.windows.forms.control.onclick(eventargs e) @ system.windows.forms.button.onclick(eventargs e) @ system.windows.forms.button.onmouseup(mouseeventargs mevent) use stateprinter framework. can turn object graphs strings , automate assert part of testing. see https://github.com/kbilsted/stateprinter/blob/master/doc/automatingunittesting.md for making string string s = new stateprinter().printobject(stackframe)

c++ - What default make tool does NetBeans use -

iv been writing small c program netbeans 8 on linux. uses configuration.xml file compile makefile together. i'v searched little there little information on tool supports file or if netbeans internal tool. how call command line etc. i hoping alternative build tool, far no scons, waf, ninja, cmake, qmake does have experience it? how looks like: <configurationdescriptor version="95"> <logicalfolder name="root" displayname="root" projectfiles="true" kind="root"> <logicalfolder name="headerfiles" ...> what default make tool netbeans use it uses make per default. default c/c++ project types generate makefiles you. can use custom makefiles instead - , other build tools (like cmake, qmake, ...). i'v searched little there little information on tool supports file or if netbeans internal tool. the configurations.xml netbeans internal only. btw. modify file only, if

r - In Shiny, how to make tabs appear one at a time without javascript, etc -

i use set of if , else statements select tabsetpanel use. idea have new tabs appear user performs prerequisite tasks. created seems try that, existing tabs reloaded, resetting state of tab, , therefore removing tab added. in example, can see second tab flash existence , disappear. how can make input in each tab persist upon recreation of tabsetpanel ? read response a similar question , not familiar javascript (or whatever code inside tags$script in answer), i'd solution requires r code. the app available on shinyapps . the code pasted below, , available on github . ui.r library(shiny) shinyui(pagewithsidebar( headerpanel("subset data before analyzing"), sidebarpanel(), mainpanel(uioutput("panels")) )) server.r library(shiny) shinyserver(function(input, output) { #this data d1 = data.frame( student = c("abe","bill","clare","abe","bill","clare"), class = c(&qu

mysql - Copy URL, Remove the '/' and '.php' and paste remaining in place of Column in Php for MySQLdb -

if site is: www.abc.com/efg.php then how can automatically paste efg in place of column name (which firstnamee in one) here coding: mysql_select_db("blahblah_abcdefgh") or die(mysql_error()); $data = mysql_query("select firstnamee qwerty") or die(mysql_error()); $result=mysql_result($data); echo $result; ?> thanks in advance one more thing efg existing column in db if site is: www.abc.com/efg.php then efg is $value = basename(__file__, '.php'); use please :) cause i'm not going add injection prone query :)

scala - How to fix the Dropping Close since the SSL connection is already closing error in spray -

i’m making call api, of time keep getting error: “ dropping close since ssl connection closing ” , “ premature connection close (the server doesn't appear support request pipelining) ”. 90% of time error, meaning: in rare occasions query return data supposed to. to make sure wasn’t api’s server issue, replicate exact same query using node.js (express , request libs) , works every time. makes me sure spray bug . here's example of code : case class myclass(user: string, pass: string) class myactor extends actor { import spray.client.pipelining._ import spray.http.basichttpcredentials import spray.http.{httprequest,httpresponse} import scala.concurrent.future import context.dispatcher def receive = { case myclass: myclass => { val credentials: basichttpcredentials = basichttpcredentials(myclass.user, myclass.pass) val url: string = "https://myapi?params=values" val request: httprequest = get(url) ~> addcredentials(cred

c++ - Graphing issues in data output -

i have program taking input external source (right now, joystick), , plotting on graph. graph displays last 60 frames of data, 1-2 seconds. here data input: nextdatapoint(double x){ if (x > max){ max = x; } if (x < min){ min = x; } datainput.enqueue(x) //datainput qqueue<double> while (datainput.size() > 60){ datainput.dequeue(); } update(); //this triggers paint event } here graphing function graph function: //this draws min line , max line qpainter painter(this); int linedist = 25; qpen mypen(qt::black, 3); qpoint maxtext(10,20); painter.drawtext(maxtext, "max"); qpoint maxlineleft(0, linedist); qpoint maxlineright(width(), linedist); painter.drawline(maxlineleft, maxlineright); qpoint mintext(10, height()-10); painter.drawtext(mintext, "min"); qpoint minlineleft(0, height()-linedist); qpoint minlineright(width(), height()-linedist); //this draws actual graph mypen.setcolor(qt::blue); mypen.setwidth(2);

PHP->Python JSON issue -

what doing wrong? python3: >>> import json >>> s = "\"{'key': 'value'}\"" >>> obj = json.loads(s) >>> obj['key'] traceback (most recent call last): file "<stdin>", line 1, in <module> typeerror: string indices must integers given json string produced json_encode() php real string: {sessionid:5,file:\/home\/lol\/folder\/folder\/file.ttt} . update : problem because transfer json string command line shell_exec in php, , read using sys.argv[1] ... quotes removed shell. php code (which runs python script shell_exec ) $arg = json_encode(['sessionid' => $session->getid(), 'file' => $filename]); shell_exec('python3 script.py ' . $arg); python code: import json, sys s = json.loads(sys.argv[1]) #fails look @ json: "\"{'key': 'value'}\"" you have string containing escaped quote, followe

javascript - Intern path error in browser client -

Image
i have conventional recommended intern directory structure: myproject ├── node_modules │ ├── intern-geezer │ │ ├── client.html ├── src │ ├── myfunction.js ├── tests │ ├── intern.js │ ├── unit │ │ ├── ps.js with simple config: useloader: { 'host-node': 'dojo/dojo', 'host-browser': 'node_modules/dojo/dojo.js' }, loader: { packages: [] }, suites: [ 'tests/unit/ps' ] and tests: define(function (require) { var tdd = require('intern!tdd'); var assert = require('intern/chai!assert'); // global function test, not amd module var parsef = require('src/myfunction.js'); var = require('tests/he'); tdd.suite('my tests', function() { //etc }); }); ```` but when open browser client loader looking test suite inside intern-geezer directory: i not setting baseurl in config (or in browser url). didn't have trouble going through reg

How to replace the <img> tag/s present in an string with another string that represents some code in PHP? -

i've 1 following string: $feed_status = nice <img src=\"http://52.1.47.143/file/pic/emoticon/default/smile.png\" alt=\"smile\" title=\"smile\" title=\"v_middle\" /> see <img src=\"http://52.1.47.143/file/pic/emoticon/default/happy.png\" alt=\"smile\" title=\"smile\" title=\"v_middle\" /> again <img src=\"http://52.1.47.143/file/pic/emoticon/default/tongue.png\" alt=\"smile\" title=\"smile\" title=\"v_middle\" />; i've array titled $emoticon_codes containing 3 elements needs placed in above string in place of <img> tags. array ( [0] => \ue056 [1] => \ue057 [2] => \ue105 ) the 3 <img> tags string should replaced above 3 strings in same order. how should achieve in optimum way? please me. in advance. my final string should after printing : nice \ue056 see \ue057 again \ue105; i tried foll

Android : display foreground (and views) in a camera preview in order to make an old camera back look -

i've got troubles camera preview (in framelayout). want achieve : https://lh4.ggpht.com/afphmlynasaajv2er2ind9dlxs61sj-v1qyyecpfgmcpy18kgdqedioywkaxolweakm=h900-rw or : https://lh4.ggpht.com/_okn-o2mb3s4vo6qosj15ctdztbic_ji8-zgg16pmvffunwpqhfazun6ofwpwohhr34=h900-rw but far, able : - full screen preview in framelayout - tiny preview misplaced (i want centered horizontally , @ 40 dp of top) here layout far : <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background_app_photo_transparent" tools:context="jmf.net.testsapp.cameraactivity" > <framelayout android:layout_width="320dp" android:layout_height="240dp" android:layout_gravity="

html - how to include php in wordpress footer and call on pages -

i putting in php code in wordpress footer. example, $a = "hi"; and on wordpress page try echo $a; blank , not "hi. there way solve this? p.s usuing wordpress's admin dashboard any appreciated thanks variables not passed between template files (header, footer, etc.). can make global. global $a; and echo it. note order : if get_footer(); si called after, can't echo before...

java - Reusability in REST services with JAX-RS -

i have simple rest-like service, implemented in jax-rs maintain foo 's. creates foos post foos , lists foos get foos , details given foo get foo/42 (where 42 given foo's id). public class fooservice { @post @path("/foos") public foo create(foo foo){ entitymanager.gettransaction().begin(); entitymanager.persist(foo); entitymanager.gettransaction().commit(); return foo; } @get @path("/foos") public list<foo> get(){ list<foo> foos = //more-or-less generic jpa querying-code return foos; } @get @path("/foos/{id}") public foo get(@pathparam("id") int id){ foo foo = //more-or-less generic jpa querying-code return foo; } } now, if have similar service maintaining bar 's, how suppose elegantly avoid code repetition? public class barservice { @post @path("/bars") public bar create(bar bar){ entitymanager.gettransaction().begi