Posts

Showing posts from September, 2014

java - Copy entire C structure using Unsafe? -

i've been exploring java unsafe library, , far can see how can copy individual fields of structure serialized byte stream (for example using getint() etc.), if have following (packed) structure serialized: struct foo { int a, b, c; short d, e, f; }; can single copy memory address (in case netty bytebuf instance.)? use jnr if required, though can't quite see how connect 2 yet.

c# - Access other files in VS Language Service (Visual Studio Extensibility) -

i'm writing custom language service described in https://msdn.microsoft.com/en-us/library/bb166533.aspx now i'm writing code authoringscope ( https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.package.authoringscope.aspx ) problem in getdeclarations method. i have access text of current file via parserequest.text property. allows me list methods , variables in file how can access other files content? need access other file content building ast tree of file don't know how can this. personally find mpf "helper" classes (like authoringscope ) bit restrictive, , implement manually (which, admit, take more time, lot more flexible in end). in case, sounds language (like most!) has dependencies between files @ semantic parsing level. means you'll either have to: a) reparse lot of text time, slow in large projects or b) maintain global aggregate parse of project's files, , update dynamically when files (or project's properti...

Is there a way to call Java class with main() from JSP and print the value in the console or JSP page -

i have doubt: is possible call java class main() in jsp , print value in console or jsp page (without use of servlet class)? similarly print value in jsp page java class main() (without use of servlet class)? please need explanation. since typical main() method has return type void , cannot done: public staic void main(string[] args) { ... } but call static method on class , return string , output jsp: class public class util { public static string dosomething() { // , generate string return "helloword"; } } jsp : <%= util.dosomething() %> this prints out return value of static dosomething() method @ jsp output tag included.

writer - Writing to .txt skipping lines and leaving white spaces java -

string newpurchaseorder = datestr + "#" + customerid + "#" + productcode + "#" + qty; try { string filename = "purchaseorderdatafile.txt"; filewriter fw = new filewriter(filename, true); //the true append new data bufferedwriter bw = new bufferedwriter(fw); filereader fr = new filereader("purchaseorderdatafile.txt"); bw.write("\n" + newpurchaseorder); bw.close(); } catch (ioexception ioe) { system.err.println("ioexception: " + ioe.getmessage()); } trying prevent skipping lines when inputting .txt file 08/12/13#pmi-1256#dt/9489#8 16/12/13#ene-5789#pv/5732#25 27/12/13#pea-4567#pv/5732#3@ 09/01/14#pea-4567#dt/9489#1 16/01/14#emi-6329#pv/5732#8 16/07/13#ese-5577#zr/7413#6 input skips lines such above what mean "skipping lines"? bw.write("\n" + newpurchaseorder); first...

how to replace a \' with '' using sed -

i have file test.sql: 'here is' , \' other 'you' and replace \' (escaped single quote) '' (2 singles quotes) postgres , leave other single quotes alone. how this. have tried: mon mar 16$ sed -i.bak s/\'/''/g test.sql but takes out single quotes. your enemy in shell quoting. string s/\'/''/g is mangled shell before given sed. shell, '' empty string, , \' suppresses special meaning of single quotes (so quote actual single quote character). sed sees after processing is s/'//g ...wich removes single quotes. there several ways work around problem; 1 of them is sed -i.bak "s/\\\\'/''/g" test.sql inside doubly-quoted shell string, backslashes need escaped (exceptions exist). means "s/\\\\'/''/g" in shell command translates s/\\'/''/g argument sed. in sed regexes, backslashes need escaping, is, i...

ios - get file name when using writeImageToSavedPhotosAlbum -

in ios swift application, using writeimagetosavedphotosalbum save uiimage on iphone let assets : alassetslibrary = alassetslibrary() let imgref : cgimage = myimage!.cgimage let orientation : alassetorientation = alassetorientation(rawvalue: myimage!.imageorientation.rawvalue)! assets.writeimagetosavedphotosalbum(imgref, orientation: orientation, completionblock: nil) is there way can saved image filename? or maybe set myself? thank help if @ spec of method you're using see completion block aren't using of type alassetslibrarywriteimagecompletionblock , has parameters nsurl *asseturl, nserror *error . so specify completion block , asset url can derive information.

How to place labels correctly and use cross-reference in latex to be able to convert to html(5) using pandoc? -

introduction i'd create source code in latex in order produce pdf via pdflatex , html page(s) via pandoc. use following source \documentclass[12pt,a4paper]{article} \usepackage[t1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[magyar]{babel} \usepackage{hyperref} \begin{document} \begin{enumerate} \item \label{itm:thefirst} first example point \end{enumerate} example demonstrate how \textbackslash label\{\} , \textbackslash ref\{\} not working pandoc. here should reference first example: \ref{itm:thefirst} \end{document} this can compiled pdflatex without error or warning. problem i create html page via pandoc using following code: pandoc -f latex sample.tex -t html5 -o sample.html -s --toc -s but creates unsatisfactory results around label , reference: <body> <ol> <li><p>[itm:thefirst] first example point</p></li> </ol> <p>this example demonstrate how \label{} , \ref{} not working pandoc. here should referenc...

accessibility - Is there any documentation on how screen readers should act? -

i'm reviewing , recommending changes/fixes small web application enhanced more accessible. the problem keep running there doesn't seem details how screen readers should (or do) work. for instance, if @ accessible rich internet applications (wai-aria) 1.0 specification tabpanel , authoring practices guide state basic definition , how works, doesn't answer question "should screenreader speak contents of tabpanel when becomes visible?" that example problematic in need convince business requirements shouldn't spoken, yet nothing says 1 way or other. (the best can point out examples authoring practices guide not spoken.) for that, , half dozen other issues nice have guide says "this screen reader (or should do) when encounters element/role." does exist? there simple principles: screen readers default start reading page in dom order beginning end. preceded basic stats of page such title , number of links, headings etc. users not...

java - JSON Exception when trying to retrieve object string -

i'm trying retrieve "maxspeed" string json below. iterates through array, when reaches "tag" object , tries retrieve "maxspeed" value, returns exception(below). would know why happening? appreciated. thanks. exception: org.json.jsonexception: no value maxspeed java: jsonobject parentobject = new jsonobject(result); jsonarray speedjson = parentobject.getjsonarray("elements"); (int = 0; < speedjson.length(); i++) { jsonobject element = (jsonobject) speedjson.get(i); if (!element.isnull("tags")) { //jsonobject tags = (jsonobject) speedjson.getjsonobject(i).get("tags"); string maxspeed = element.getstring("maxspeed"); txtspeed.settext(maxspeed+" here"); } else { //your error handling here... ...

javascript - How to make ng-repeat work with a function returning a new object? -

in html, have following element: <button ng-click="console.log(key)" ng-repeat="(key, value) in getlskeys() track $index"> and in js have: $scope.getlskeys = function(){ return localstorageservice.get('accountkeys'); }; the local storage value can seen here: http://codebeautify.org/jsonviewer/daf62c no matter do, error: uncaught error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in last 5 iterations: [["fn: $watchcollectionwatch; newval: 121; oldval: 118"],["fn: $watchcollectionwatch; newval: 124; oldval: 121"],["fn: $watchcollectionwatch; newval: 127; oldval: 124"],["fn: $watchcollectionwatch; newval: 130; oldval: 127"],["fn: $watchcollectionwatch; newval: 133; oldval: 130"]] i understand ng-repeat tries match exact object, different every time , getlskeys creates , returns new object. not understand why "track $index" not fix problem; u...

sql - MySQL syntax error check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 -

$info_set = mysqli_query($connection, "select * informatie order position asc") or die(mysqli_error($connection)); while ($info = mysqli_fetch_array($info_set)){ echo "<li>{$info["menu"]}</li>"; } $pagina_set = mysqli_query($connection, "select * paginas, informatie paginas.inf_id = informatie.id") or die(mysqli_error($connection)); echo mysqli_fetch_array($pagina_set); while ($info = mysqli_fetch_array($pagina_set)){ echo "<ul class=\"pages\">"; echo "<li>{$info["menu"]}</li>"; echo "</ul>"; } ?> there error in line: $pagina_set = mysqli_query($connection, "select * paginas, informatie paginas.inf_id = informatie.id") or die(mysqli_error($connection)); after hours of trying still not able find error... :( please help?

sql server - Is it necessary to use a transaction if other statements are dependent on the first? -

for long, i've omitted using sql transactions, out of ignorance. but let's have procedure this: create procedure createperson begin declare @newperson int insert persontable ( columns... ) values ( @parameters... ) set @newperson = scope_identity() insert anothertable ( @personid, createdon ) values ( @newperson, getdate() ) end go in above example, second insert depends on first, in fail if first 1 fails. secondly, , whatever reason, transactions confusing me far proper implementation. see 1 example here, there, , opened adventureworks find example try, catch, rollback, etc. i'm not logging errors. should use transaction here? worth it? if so, how should implemented? based on examples i've seen: create proceure createperson begin transaction .... commit transaction go or: create procedure createperson begin begin transaction commit transaction end go or: create procedure createperson begin begin try begin transaction ...

GoodData SSO URL to use in iFrame when using White Labeling -

should iframe src still " https://secure.gooddata.com/gdc/account/customerlogin?blahblahblah " when using white labeled account. or should use custom domain? e.g. " https://analytics.yourcompany.com/gdc/account/customerlogin?blahblahblah " talked support, , said "if portal whitelabeled communication should aligned it." interpret yes.

jpa - Entity Class name is transformed into SQL table name with underscores -

i have following entity defined: @entity @table(name = "emailtemplate") public class emailtemplate { despite table annotation, receive java.sql.sqlexception: invalid object name 'email_template'. how can prevent entity class such emailtemplate being transformed email_template table name? edit: i'm using spring boot: start jpa. build.gradle file, compile("org.springframework.boot:spring-boot-starter-data-jpa") spring default uses org.springframework.boot.orm.jpa.springnamingstrategy splits camel case names underscore. try setting spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ejb3namingstrategy in application.properties . check out this , this more info.

linux - How to create a cronjob that runs every 5 minutes from 8:30 AM to 9:30 PM? -

i trying run cron job every 5 minutes 8:30 9:30 pm. i've been searching around web , here came with: 30,35,40,45,50,55 8 * * * /path/to/whatever.sh >> /var/log/whatever.log 2>&1 */5 9-21 * * * /path/to/whatever.sh >> /var/log/whatever.log 2>&1 5,10,15,20,25,30 22 * * * /path/to/whatever.sh >> /var/log/whatever.log 2>&1 i have looked @ cron job generators not seem address requirement start/end on half-hour. have better or more concise solution? 30-59/5 8 * * * /path/to/whatever.sh >> /var/log/whatever.log 2>&1 */5 9-20 * * * /path/to/whatever.sh >> /var/log/whatever.log 2>&1 0-30/5 21 * * * /path/to/whatever.sh >> /var/log/whatever.log 2>&1 should work, , easier read.

ios - Saving in game progress -

i've working on game in swift ios 8 in xcode 6 , need advice on how save in-game progress. when close out app, , restart again, want game remember left off, rather starting way @ beginning each time open it. how can this. game center? external files? it seems nsuserdefaults work you. easiest way save small amount of data between sessions. nsdata, nsstring, nsnumber, nsdate, nsarray , nsdictionary supported.

ruby - Scanning through a hash and return a value if true -

based on hash, want match if it's in string: def conv str = "i have one, 2 or maybe sixty" hash = {:one => 1, :two => 2, :six => 6, :sixty => 60 } str.match( regexp.union( hash.keys.to_s ) ) end puts conv # => <blank> the above not work matches "one": str.match( regexp.union( hash[0].to_s ) ) edited: any idea how match "one", "two" , sixty in string exactly? if string has "sixt" return "6" , should not happen based on @cary's answer. you need convert each element of hash.keys string, rather converting array hash.keys string, , should use string#scan rather string#match . may need play around regex until returns everyhing want , nothing don't want. let's first @ example: str = "i have one, 2 or maybe sixty" hash = {:one => 1, :two => 2, :six => 6, :sixty => 60} we might consider constructing regex word breaks ( \b ) before , afte...

ios - Swift give back a value to tableview controller -

i have 2 tableview controllers. when click on cell come second one. clicking cell in second tableview, want give value of cell first tableview controller. have code in second tableview. let view = self.storyboard?.instantiateviewcontrollerwithidentifier("overviewfine") finesoverviewtableviewcontroller view.s_choosenplayer = a_players[actualindicator].playername then reload data in first tableview controller. override func viewdidappear(animated: bool) { self.tableview.reloaddata() } but now, variable "s_choosenplayer" has value "". mistake? in advance. the usual way delegation. when segue first second controller, implement prepareforsegue, , set (the first controller) delegate of second controller there. second controller needs define delegate protocol, , call method on delegate when click cell there. don't instantiate new controller when go -- either dismiss or pop depending on forward segue was.

python - How do I save the output I have to a new text file? -

so basically, have super long output, , want able save output brand new text file, without changing old file. code far, need know out_file variable. thanks future help. txt_list = [] open("x:\- photogrammetry\python correct dxf colors\involvedpontiac.dxf", "r") in_file, open("x:\- photogrammetry\python correct dxf colors\involvedpontiacfixed.txt", "w+") new_file: line in in_file: line = line.rstrip() txt_list.append(line) entity = 0 = 0 while < len(txt_list): if txt_list[i] == "entities": entity = 1 if txt_list[i] == " 62" , entity == 1: txt_list[i+1] = " 256" += 1 layer = 0 j = 0 while j < len(txt_list): if txt_list[j] == "layer" , txt_list[j+2] != " 7": userinput = input("what color layer " +txt_list[j+2] + "? type 0 black, 1 red, 3 green, 4 light blue, 5 blue, 6 magenta, 7 white, 8 dark grey, 9 medium gr...

IPython Modify Plot with Container Widget -

Image
i'm working ipython widgets modify dynamically plotted data, result seen in image; dont arrangment of widgets (sliders , float boxes) have tried align them horizontally box , here trouble because don't know how pass arrangment function, how obtain see in image #i'm going put 2 sliders x= floatslider(0,1000) y= floatslider(0,1000) interactive(function,xo=x,yo=y) if try x= floatslider(0,1000,10) y= floatslider(-1,1,0.1) #this gives me desired arrangment co = hbox(children=[x,y]) interactive(function,xo=co.children[0],yo=co.children[1]) this gives me same unordered result, , here got stuck, don't know how input container make work plot. error? can do? the following might solution problem: from ipython.html.widgets import * x = floatslider(value = 500.0, min=0.0, max=1000.0, step=10) y = floatslider(value = 0.0, min=-1.0, max=1.0, step=0.1) plt.xlim(0,1) plt.ylim(-1,1) def function(x, y): plt.plot([0.0, 1.0], [-1.0, 1.0], 'b.') ...

sorting - java.lang.NullPointerException at com.sun.faces.context.PartialViewContextImpl.createPartialResponseWriter -

i have in jsf 2 app on jboss 7.1 primefaces 5.1 datatable lazy loading , sorts on page load, know sorting implementation works, when click column sort throws below exception. 17:48:34,855 error [org.apache.catalina.core.containerbase.[jboss.web].[default-host].[/feenix].[faces servlet]] (http-/0:0:0:0:0:0:0:0:8080-6) jbweb000236: servlet.service() servlet faces servlet threw exception: java.lang.nullpointerexception @ com.sun.faces.context.partialviewcontextimpl.createpartialresponsewriter(partialviewcontextimpl.java:469) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3] @ com.sun.faces.context.partialviewcontextimpl.access$300(partialviewcontextimpl.java:76) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3] @ com.sun.faces.context.partialviewcontextimpl$delayedinitpartialresponsewriter.getwrapped(partialviewcontextimpl.java:603) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3] @ javax.faces.context.partialresponsewriter.startdocument(partialresponsewriter.java:115) [jbo...

google chrome extension - How to follow a redirect in Javascript? -

i'm working on chrome extension has conditional context menu. menu should appear if right click on link "youtube.com" hostname. it works of time, except when using social media facebook or twitter. facebook , twitter redirect internally, causing code not recognize url, , not display context menu. here code looks like: var contexts = ["selection","frame","page","editable", "link", "video"]; var acceptedurls = ["*://*.youtube.com/*", "*://youtube.com/*","*://*.soundcloud.com/*","*://soundcloud.com/*"]; var title = "add queue"; chrome.contextmenus.create({"title": title, "contexts": contexts, "documenturlpatterns": acceptedurls}); is there way figure out whether url redirect within chrome extension?

PHP redirect based on IP addresses -

i need show content specific range of ip addresses , others want redirect. i have found code checking ip address: <?php $ip_ban = array(); $ip_ban[] = "10.10.*.*"; $ip_ban[] = "10.111.111.10"; if(in_array($_server['remote_addr'],$ip_ban)) { header("location: http://www.yahoo.com/"); } else { //do loop through bans: foreach($ip_ban $ban) { if(eregi($ban,$_server['remote_addr'])) { header("location: http://www.yahoo.com/"); } //finished loop } } ?> the code works, redirects yahoo, need show content instead of redirection. , redirect other ip addresses. how can modify script? your approach strange. in_array matches against wildcard ips nothing. think of ips preg patterns. <?php $ip_ban = [ "10\.10\.\d\.\d"; "10\.111\.111\.10" ]; foreach($ip_ban $ban) { if(\preg_match("/$ban/", $_serve...

Java Socket.setSoTimeout() doesn't timeout on connect -

i have problem have used setsotimeout(500) set timeout of 0.5 second on connection , read time delays, not working , instead timeouts after 10 seconds kind of exception. , yes, ip valid in situation. java.net.connectexception: connection timed out: connect here code : try { socket sock = new socket(ip, 42042); sock.setsotimeout(500); bufferedinputstream = new bufferedinputstream(sock.getinputstream()); thenames = thenames + is.read() + ";"; printwriter os = new printwriter(sock.getoutputstream()); } catch (ioexception e) { system.out.println(e + " | le serveur " + ip + " ne reponds pas."); } socket.setsotimeout sets read timeout. has nothing connect timeouts. if want lower default connect timeout: socket sock = new socket(); sock.connect(new inetsocketaddress(ip, 42042), timeout); where timeout in milliseconds. note: javadoc says 'a timeout of 0 interpreted infinite timeout,' not correct: interpr...

linux - Passwordless SSH works only in debug mode -

i have 2 machines, identical users, need passwordless ssh between them, have 2 users medya , orainst medya home /home/medya/ orainst home /tools/appsw/oracle/orainst i have set passwordless both of them ( yes swear did permissions, religiously ). it works user in normal home directories (medya) not orainst. and weirdest thing is, if run ssh server in debug mode, works both of users fine !!! here log both ssh starting service , ssh starting debug here fails : debug1: trying public key file /tools/appsw/oracle/orainst/.ssh/authorized_keys debug1: not open authorized keys '/tools/appsw/oracle/orainst/.ssh/authorized_keys': permission denied debug1: restore_uid: 0/0 debug1: temporarily_use_uid: 500/500 (e=0/0) debug1: trying public key file /tools/appsw/oracle/orainst/.ssh/authorized_keys here full log: [root@ip-10-16-4-114 oracle]# service sshd start starting sshd: debug1: sshd version openssh_5.3p1 debug1: read pem private key done: type rsa debug1: private...

simd - using restrict qualifier with C99 variable length arrays (VLAs) -

i exploring how different implementations of simple loops in c99 auto-vectorize based upon function signature. here code: /* #define pragma_simd _pragma("simd") */ #define pragma_simd #ifdef __intel_compiler #define assume_aligned(a) __assume_aligned(a,64) #else #define assume_aligned(a) #endif #ifndef array_restrict #define array_restrict #endif void foo1(double * restrict a, const double * restrict b, const double * restrict c) { assume_aligned(a); assume_aligned(b); assume_aligned(c); pragma_simd (int = 0; < 2048; ++i) { if (c[i] > 0) { a[i] = b[i]; } else { a[i] = 0.0; } } } void foo2(double * restrict a, const double * restrict b, const double * restrict c) { assume_aligned(a); assume_aligned(b); assume_aligned(c); pragma_simd (int = 0; < 2048; ++i) { a[i] = ((c[i] > 0) ? b[i] : 0.0); } } /* undetermined size version */ void foo3(int n, d...

submit - To configure this app as an iOS routing app, the app's Info.plist must contain the MKDirectionsApplicationSupportedModes key -

i trying submit update app app store error. "to configure app ios routing app, app's info.plist must contain mkdirectionsapplicationsupportedmodes key." i have never gotten before nor need routing app know how fix this? use xcode's "find in workspace" keyword "mkdirectionsrequest". xcode seems love inserting in difficult find places. remove info.plist , resubmit.

Preg_replace in php - multiple replace -

i have $string, contains: this example and have these 3 expressions: $pattern = array('/aa*/','/ii*/'); $replacement = array('<i>$0</i>','<b>$0</b>'); preg_replace($pattern, $replacement, $string); where, preg_replace returns: th<b>i</b>s ex<<b>i</b>>a</<b>i</b>>mple and need output this: th<b>i</b>s ex<i>a</i>mple which means, want replace characters in original string. possible? this trick in testing $pattern = array('/([a-z|^|\s])(aa*)/', '/([a-z|^|\s])(ii*)/'); $replacement = array('$1<i>$2</i>','$1<b>$2</b>');

Android ListView scrollable with TextView -

i have textview on top , listview on bottom. i want when i'm scrolling list textview scrolling , down. scrolling list fragment want scroll parent fragment. how fix it? <relativelayout android:layout_width="match_parent" android:layout_height="match_parent" <linearlayout android:layout_above="@+id/frame_add" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <linearlayout android:paddingleft="16dp" android:paddingright="16dp" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <textview android:textsize="10sp" android:layout_width="0dp" android:layout_height="wrap_content" android:lay...

tortoiseSVN Authorization Failed svn:// protocol -

i using svn:// protocol , have auth-access = write. svn setup on linux server , repository has been created. when use tortoise link on windows , open repo-browswer , enter url: svn://user@website/repopath can navigate. when create folder in repopath tortoisesvn authorization failed. any insight appreciated. checked authz file again , realized did not have path setup [/] not entered above users.

javascript - multiple elements in one carousel page bootstrap -

i using carousel in web page, have multiple items in window each time carousel turns, amazon's recommended items section. << item1 item2 item3 item4 >> can click on items. there easy way modify bootstrap's carousel work this? try this: $(document).ready(function() { $('#mycarousel').carousel({ interval: 10000 }) }); .carousel-control { padding-top:10%; width:5%; } <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <div class="container"> <div class="col-xs-12"> <h1>bootstrap 3 thumbnail slider</h1> <div class="well"> <div id="my...

c# - SSRS Local Mode ReportViewer control Scheduling reports -

this regarding reports produced reportviewer control in asp.net need schedule reports run @ specified times , intervals. information set in database tables , reports have run using reportviewer control background jobs. can think of having webpage reportviewer control , page polling schedule table , running required reports. inconvenient keep page running wondering if there way batch job in background if have access server , not webserver, suggest writting vbscripts or equivalent call .rss files run reports. can schedule them in windows schedule , have them save directory, email or print (although printing more difficult, use ghostscript). link has pretty description of process: how automate report deployment using ssrs web service

html - Javascript get characters in documents including css and javascript -

i looking length of entire document (as in str.length) , other files document may use. question ( how entire document html string? ) helpful, gives characters in current document not taking account linked js or css files. suggestions? this entirely pseudocode, should you. while impossible guarantee accuracy of said length - due amount of variations in coding html, , how depth there page-to-page linking. this use jquery. var length = 0; $(document).ready(function() { //do whatever need to, current document link (using link provided above) length = currentdocument.length; //iterate through each link href //do same script , src $(document).find("link").each(function() { var attr = $(this).attr("href"); //if accesses different server own, prolly fail if (attr != null) { $.ajax({ url: attr, async: false, success: function (data){ ...

c++ - Changing scenes in Minko -

is there standard way change between scenes in minko? specifically, i'm imagining each scene different level, , when user completes task entire level changes. i know update meshes , whatnot feels poor; there way can build root node new scene , switch canvas using root node instead (as force rererender, since objects have changed)? your second idea fine. can create separate root node own scenemanager sharing canvas . add new scene node . when you're ready switch, change scenemanager use in enterframe signal render. should trigger re-render, upload textures, calls component added signals... in minko, there no global singleton or prevent having separate scenes. each scenemanager reference own assetlibrary . way, if switch scenes , remove references previous scenemanager , assets released memory.

swift - UICollectionView not refreshing -

i downloading images , inserting them uicollectionview these class members var myitems:[uiimage] = [] var myview: uicollectionview? i have timer function receives img:uiimage object. insert uicollectionview this self.myitems.insert(img, atindex: self.myitems.count) var count:int? = self.myview?.numberofitemsinsection(0) var index:nsindexpath = nsindexpath(forrow: count!, insection: 0) self.myview?.insertitemsatindexpaths([index]) i have function: func collectionview(collectionview: uicollectionview, numberofitemsinsection section: int) -> int { return self.myitems.count; } and one: func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell { let cell = collectionview.dequeuereusablecellwithreuseidentifier("cell", forindexpath: indexpath) mycollectionviewcell cell.backgroundcolor = uicolor.orangecolor() cell.textlabel.text = "text \(i...

javascript - How to send data as an object through .post() in jQuery? -

when make .post() request such as var data = $(this).serialize(); $('form').on('submit', function(event) { event.preventdefault(); $.post('server.php', data, function(data) { $('#data').append('<p>' + data + '</p>'); }); }); everything's working - name database appends #data element withing p tags. but, when try pass data object this var data = $(this).serialize(); $.post('server.php', {id: data}, function(data) { $('#data').append('<p>' + data + '</p>'); }); than doesn't work. tried changing argument of function within .post() id , every combination of names .post()'s arguments , variables within php file also, without success. here's working intact php file compatible first version of .post() request in question: <?php $id = $_post['id']; $connection = new mysqli('localhost', 'root', '...

I have created a method, but Java doesn't see it - Java -

i have been learning programming while thenewboston , in 80th tutorial hew writing files. followed code word word, eclipse says method undefined the type "creatfile". have checked on , on see, can't see problem. here code. creatfile.java import java.util.formatter; public class creatfile { private formatter x; public void openfile(){ try{ x = new formatter("chinese.txt"); } catch(exception e){ system.out.println("you have error"); } public void addrecords() { //there error on "void" , "addrecords" x.format("%s%s%s", "20 ", "jacob ", " peterson"); } public void closefile(){ //error here x.close(); } } } apple.java (my main class) import java.util.*; public class apples { public static void main(string[] args) { creatfile g = new creatfile() { g.openfile(); g.addrecords(); g.closefile...

How to select the items that have an association with any user in Rails -

i have relation between user , hobby, relation in user has_and_belongs_to_many , 1 hobby has_and_belongs_to_many . i'm trying list of hobbies users have chosen. example if 1 user selected soccer , selected basketball, want have query shows me "soccer, basketball". how can join in query? right i'm grabbing hobbies each user via user.find(id).hobbies you inner join hobbies users hobbies chosen users. hobby.joins(:users).uniq

How do I 'leverage browser caching' for Google fonts? -

Image
i tested site via pingdom , got this: i searched couldn't find solution this. know how can 14 100? since cannot control googles headers (including expiration headers), can see 1 solution – download these 2 stylesheets , fonts own hosting server, change html tags accordingly. then, can set expiration headers (what pingdom called 'lifetime') wish. for example, open first link : /* latin */ @font-face { font-family: 'montserrat'; font-style: normal; font-weight: 400; src: local('montserrat-regular'), url(http://fonts.gstatic.com/s/montserrat/v6/zhcz-_wihjsqc0ohj9tcyazydmxhdd8saj6oajtfsbi.woff2) format('woff2'); unicode-range: u+0000-00ff, u+0131, u+0152-0153, u+02c6, u+02da, u+02dc, u+2000-206f, u+2074, u+20ac, u+2212, u+2215, u+e0ff, u+effd, u+f000; } download .woff2 file , save anywhere on webserver. copy & paste piece of stylesheet of own css files or html. change link fonts.gstatic.com new url. google serves ...

javascript - regex jquery to replace number with link -

i have page of database results users type in reference post. (the database day event tracker scheduling office). the reference other post posts id (format of 001234). uses these match events dockets , other paperwork truck drivers. 6 digit number on own. <div class="eventswrapper"> data db output here using php in foreach loop. presents data in similar fashion facebook example. </div> what need once data in above div loaded, go through , replace every whole 6 digit number (not part of number) number hyperlink. it important looks number space either side: eg: ref 001122 <- - not -> ignore ab001122 once have hyperlink tag can make reference number clickable take users directly post. i not regex think like: \b(![0-9])?\d{6}\b i have no idea how search div , replace regex hyperlink. appreciate help. (?:^| )\d{6}(?= |$) you can use , replace <space><whateveryouwant> .see demo. https://regex101.com/r/bw3ar1/7 \b ...

How to know current logged in user on OpenLDAP 2.3 server? -

how know current logged in users on openldap 2.3 server? have configured openldap 2.3 slurpd replication , requirement know logged in systems using ldap account. you can't. users bound (not logged-in) ldap server quite short periods of time while establishing own identity. of time applications logged ldap server, search it, user's permissions, etc, connections quite short-lived well, although typically prolonged bit client-side connection pooling. you shouldn't using 2.3: many years out of date. current version of openldap 2.4.40, , 2.4.26 released 3 years ago. can't find how old 2.3 is. shouldn't using slurpd replication: it's been obsolete many years too. should using syncrepl.

ios - Indoor Navigation using I-Beacon- Accuracy is changing rapidly -

i doing indoor navigation application using i-beacon. using accuracy given beacon. changing rapidly. since value changing, x , y coordinates of user location, has calculated varying when static. please me make accuracy constant when m not moving. thanks in advance i suggest read following article experience 2 positioning algorithms trilateration , nonlinear regression: r/ga tech blog you find complete ios app implements both algorithms these guys on github the app helpful understand difficulties of requirement of indoor navigation , experiment it. also please note: apple did announce indoor positioning on wwdc 2014 core location framework in ios8, after couple of month stopped program. there lot of rush new feature. apple decided offer program big companies. can register here . it important understand apple strategy: ibeacons technology proximity , advertising in contrast core location framework indoor positioning features in ios8. first 1 addition second one, n...

java - NullPointerException when using inheritence -

i have scenario can best illustrated following toy example. suppose have 4 classes: public class animal { public animal(string a_name){ this.name = a_name; } public string name; } public class mammal extends animal{ public mammal(string a_name, string a_nickname) { super(a_name); this.nick_name = a_nickname; } string nick_name; } public class animal_groomer{ public animal_groomer(animal an_animal){ this.the_animal = an_animal; } public void print_name() { system.out.println(the_animal.name); } public animal the_animal; } public class mammal_groomer extends animal_groomer{ public mammal_groomer(mammal a_mammal){ super(a_mammal); } public void print_nickname(){ system.out.println(the_animal.nick_name); } public mammal the_animal; } now if main routine mammal a_mammal = new mammal("tiger", "bob"); mammal_groomer mg = new mammal_groomer(a...

c# - Convert a string date format "dd/MM/yyyy" into "dd-month-yyyy" -

here, shift.frmfromdate ='{1/1/2015 12:00:00 am}'. but, want format 1-jan-2015 protected void txttodate_textchanged(object sender, eventargs e) { shift.frmfromdate = convert.todatetime(txtfromdate.text); shift.frmtodate = convert.todatetime(txttodate.text); gvshiftschdule.datasource = shifthandler.shiftview(shift); gvshiftschdule.databind(); } convert string requirements. here dt contains input date. month/day numbers without/with leading zeroes string.format("{0:m/d/yyyy}", dt); // "3/9/2008" string.format("{0:mm/dd/yyyy}", dt); // "03/09/2008" day/month names string.format("{0:ddd, mmm d, yyyy}", dt); // "sun, mar 9, 2008" string.format("{0:dddd, mmmm d, yyyy}", dt); // "sunday, march 9, 2008" two/four digit year string.format("{0:mm/dd/yy}", dt); // "03/09/08" string.format("{0:mm/dd/...

html - how to implement jquery.FloatThread plugin in my code -

please me instructions using jquery.floatthread plugin in below code #container{ } <div id="container"> <table border="1"> <tr> <th width=100 >a</th> <th width=100>b</th> <th width=150>c</th> </tr> <tbody > <tr> <td width=100>&nbsp;dfg</td> <td width=100>&nbsp;dfg</td> <td width=150>&nbsp;fg</td></tr> <tr> <td>&nbsp;ere</td> <td>&nbsp;fgrty</td> <td>&nbsp;dfd</td></tr> <tr> <td>&nbsp;dfd</td> <td>&nbsp;dfet</td> <td>&nbsp;dfdf</td></tr> <tr> <td>&nbsp;xzcvc</td> <tr> </table> </div> i didn't implement 'table.demo' found in below code in code var $table = $('table.demo'); $table.floatthead(); put row cont...

c# - Authentication with Active Directory by multiple clients -

a client work have existing active directory employee information, want create application can log in using information stored in active directory. application should have web (.net), mobile (android , iphone), , optional desktop interface. i haven't worked active directory before. did study on active directory, , here's understand far: there 2 ways authenticate active directory: by ldap : .net, can use system.directoryservices (and system.directoryservices.accountmanagement ) namespace classes to perform authentication. android, iphone, guess have some libraries in platform ldap query active directory (any suggestion?) by adfs identity provider: understand, adfs extension ad provides sso feature, , can configured identity provider, correct? , .net, android, iphone clients can use libraries oauth/openid authentication active directory through adfs is understanding above correct? , way better? why should 1 use 1 not other? how azure ad come picture? ...

sql - How to set a cast value in a bracket? -

i trying cast 2 datas. want cast data within bracket. have tried this: select empcode, (cast(name varchar(50))+' '+cast(empcode varchar(50))) name shiftallocation it gives output name , empcode tom varghees 12345 but want 12345 (empcode) in bracket. expected output is tom varghees [12345] what changes should in sample querym you can use quotename . select empcode, (cast(name varchar(50)) + ' ' + quotename(cast(empcode varchar(50)))) name shiftallocation if don't have ability use quotename can go in following: select empcode, (cast(name varchar(50)) + ' [' + cast(empcode varchar(50)) + ']') name shiftallocation

itext - How can I add titles of chapters in ColumnText? -

Image
please, how can add titles of chapters in columntext? need make pdf this: | columntext column1 | columntext column2 | | pdfptable content | pdfptable content | | | chapter 2 title | | chapter 1 title | | and add toc document. make document columntext , table in it. can't add chapter in table. can add chapter document body, in case title of chapter not in columntext. image of 1 page of result document here your question isn't clear in sense don't tell if want toc this: if case, using wrong terminology, see in bookmarks panel can referred outlines or bookmarks. if want toc, want this: i mention both, because talk chapter (a class should no longer use) , class creates bookmarks/outlines, not toc. i have create pdf file has both, bookmarks , toc: columns_with_toc.pdf . please take @ createtocincolumn example find out how it's done. just you, crea...