Posts

Showing posts from April, 2013

runtime analysis of bubble sort similar algorithm -

i'm having lot of trouble finding running time of following algorithm. thank if me solve explicitly line per line corresponding cost , amount of times executed. biggest problem calculating amount of times while-loop executed. algo: (a,n) tmp = 0; ready = 0; = n-1 1 if a[i-1]>a[i] temp=a[i-1]; a[i-1] = a[i]; a[i] = tmp; ready = 1; = 1 n-1 if a[i-1]>a[i] temp=a[i-1]; a[i-1] = a[i]; a[i] = tmp; ready = 1; while ready = 1; thank much the worst case bubble sort o(n^2). the problem bubble sort n times iterate whole array. the amount of times , rest sounds home me.

java - JFrame-JDialog comunication -

i have jframe main window wich has register button on in.click register button , jdialog windows pops out. public void mouseclicked(mouseevent e) { reg new1=new reg(users); new1.setvisible(true); } the jdialog window has 2 buttons->register,cancel.both of them must , close dialog window. this tried. in reg(dialog window)---> btncancel: public void mouseclicked(mouseevent e) { dialog.dispose(); system.out.println("reg disposed cancel button"); } this closes d window when run d window guess when executed main window(button clicked) still exists object in main fraim"class" , doesn't close.what should ?how make close ? you need way frame determine how dialog closed // why using `mouselistener` on buttons?? // user use keyboards to, use actionlistener instead public void mouseclicked(mouseevent e) { reg new1=new reg(users)...

PHP mySql isnt inserting into Database -

$insert = $pdo->prepare('insert user set fname=:fname, lname=:lname, uname=:uname, email=:email, password=:hashpass'); $insert->bindparam(':fname', $fname); $insert->bindparam(':lname', $lname); $insert->bindparam(':uname', $uname); $insert->bindparam(':email', $email); $insert->bindparam(':hashpass', $hashpass); $insert->execute(); it not inserting database. variables have values , other mysql statements working cant seem insert data table? using pdo::errorcode() returns 00000 as far see query mixed insert , update statements syntax. instead of: prepare('insert user set fname=:fname, lname=:lname, uname=:uname, email=:email, password=:hashpass'); try one: prepare('insert user (fname, lname, uname, email, password) values (:fname, :lname, :uname, :email, :hashpass');

c# - Accessing a variable's name by using index of for loop -

let's have 4 strings. private string string_1, string_2, string_3, string_4; then let's have loop. how can access variable name index of loop? here's idea of i'm talking about: for(int = 0; < 4; i++) { string_ + = "hello, world! " + i; } i understand doing above not compile. thanks help. you can't you're asking - @ least directly. you start putting strings array , work array. string[] strings = new [] { string_1, string_2, string_3, string_4, }; for(int = 0; < 4; i++) { strings[i] = "hello, world! " + i; } console.writeline(string_3); // != "hello, world! 2" console.writeline(strings[2]); // == "hello, world! 2" but original string_3 unchanged, although slot in array correct. you can go 1 step further , way: action<string>[] setstrings = new action<string>[] { t => string_1 = t, t => string_2 = t, t => string_3 = t, t =...

sorting - Comparisons in merge-sort -

i have homework problem asking asymptotic worst case of comparisons merge-sort when sorting 0s , 1s. this confusing me because looks merge-sort has same number of comparisons whatever placed in n elements. don't understand merge-sort. can enlighten me? the worst case according me when 0's , 1's come alternatively , when total number of elements factor of 4. because merging takes max time because of this. way merge sort has o(nlogn)

encryption - Using SymmetricEncryption with Rails 4 -

i using symmetricencryption rails 4 encrypt attributes of model. worked in development environment not work in production. error openssl::cipher bad decrypt when dercypting value in database. different thing in production, have unicorn server running 8 slaves. want understand how openssl cipher works. found out 1 gets error when used different key , iv. have 1 set same. other situations can cause such error?

html - How can I responsively place a link over an image that stays in place even though the screens change? -

i attempting overlay link on div background image, link stay in place test screen widths taking mouse , narrowing screen. url http://jandswebsitedesigns.com/test/index.html . can see "a link here" link , stays there. seems me there has better way way set txt-link class. <style> .fixed { -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: contain; background-repeat: no-repeat; } .txt-link { font-size: 25px; color: #ffffff; position: absolute; z-index: 2; top: 55%; left: 45%; } </style> <img class="fixed" src="images/rfyl-mainpagebanner.jpg"> <div class="txt-link"> <div>a link here</div> </div> add id image image add id linkcontent the div contais link taht want stay on image add code page $(window).resize(function()...

java - Why am i getting null object after i filled it? -

i´m getting inputstream website(viz. http://developer.android.com/training/basics/network-ops/connecting.html ) have xml parser , in 1 class i´m making own object xml parsing stream. if check there fine. after try object class getter i´m getting null pointer exception , don´t see why. first class public class connection { private final string urlstring = "http://blabla.html"; private xml xml; private context context; private string result; private boolean connection; public xml getxml() { return xml; } public void setxml(xml xml) { this.xml = xml; } public string getresult() { return result; } public void setresult(string result) { this.result = result; } public boolean getconnection() { return connection; } public void setconnection(boolean connection) { this.connection = connection; } public connection(context context) { this.context = context; } public void connect() { connectivitymanager connmgr = (connectivitymanager) ...

c# - How to easily traverse a deserialized Xml document? -

i trying make importer collada(.dae) files, based on xml. have xml file deserialized objects can access. example, .dae file may have setup this... <library_geometries> <geometry id="cube1s_008-mesh" name="cube1s.008"> <mesh> <source id="cube1s_008-mesh-positions"> <float_array ...... /> </source> <source id="cube1s_008-mesh-normals"> </source> <vertices id="cube1s_008-mesh-vertices"> <input semantic="position" source="#cube1s_008-mesh-positions"/> </vertices> </mesh> </geometry> <geometry> .... </geometry> </library_geometries> it deserialized (with xmlserializer.deserialize) in similar fashion. access second "source" in "mesh" library_geometries.geometry[0].mesh.source[1]; all there, problem running traversing deserialized xml document. for example,...

hibernate - SQL query.setParameter() not getting single quoted string in Java -

i trying run 1 sql query using indexed query as, list.add("'%" + some_string + "%'"); , set in query(sample) : query=select * table name ?1; i setting parameter : query.setparameter(1, list.get(0)); it doesn't work, instead if put value directly in query, : select * table name '%"+some_string+"%' it works. using jpa hibernate , postgres database. is there internal parsing of single quotes while setting parameter query.setparameter(); drop '' quotes placeholder value being added list . list.add("%" + some_string + "%"); now query.setparameter(1, list.get(0)); should work expected because string value being bound ? placeholder not require quoted.

How to differentiate different Collection in java? -

please explain how different collection used under different scenario. by mean how can differentiate when use list , set or map interface. please provide links examples can provide clear explanation. also if insertion order preserved should go list. if insertion order not preserved should go set. what "insertion order preserved" means? insertion order insertion order preserving order in have inserted data. for example have inserted data {1,2,3,4,5} set returns {2,3,1,4,5} while list returns {1,2,3,4,5} .//it preserves order of insertion when use list, set , map in java 1) if need access elements using index, list way go. implementation e.g. arraylist provides faster access if know index. 2) if want store elements , want them maintain order on inserted collection go list again, list ordered collection , maintain insertion order. 3) if want create collection of unique elements , don't want duplicate choose set implementation e....

Unable to point website domain to rails app via virtual host + centos + apache -

i have dedicated server web hosting in hostgator. - centos 6 64bit - dedicated server - apache had dedicated host ip have created "a" record ip(domain hosting in godaddy). my problem creating virtual host point rails app domain. trying configure domain. didn't find conf file default document root configured. tried changing conf file in etc/httpd/conf/httpd.conf, no use. default document root(/usr/local/apache/htdocs) page rendering. need find document root virtual configuration , need point domain that. need regarding this. here default virtualhost setting in httpd conf file: namevirtualhost * # default vhost unbound ips <virtualhost *> servername examle_server_name documentroot /usr/local/apache/htdocs serveradmin root@example_server <ifmodule mod_suphp.c> suphp_usergroup nobody nobody </ifmodule> </virtualhost> even if change server name domain name there no chnage. if remove lines, showing default page in...

objective c - iOS didRegisterForRemoteNotifications returns different tokens when run from test flight -

i'm developing iphone application uses apple's push notifications. i've followed steps listed here: https://parse.com/tutorials/ios-push-notifications , device receives notifications when run app connecting device through xcode. but, when upload app test flight, app fails receive notifications. upon further investigation, found token returned nsstring * token = [nsstring stringwithformat:@"%@", devicetoken]; is different when app run through xcode, , different when it's run test flight. why that? , how can fix it? i'm using apns send push notifications. you need check certificates. when register bundle id, options generate 2 provisioning profiles , corresponding 2 push notification certs, dev , production. when run app in dev mode xcode i.e. when xcode target running configured pick development provisioning profile specified, server needs use dev/sandbox certs returns token apple's sandbox servers (this happening in case). when sign ...

php - Inserting data to database returning as <br /> <font size='1'><table class='xdebug-error -

hi having problem whenever execute submit of form database. submit data form error instead of data inserted. index.php <div id="postform"> <!-- username of user posting language learning object --> <div id="postusername" data-role="field-contain"> <label for="username of user">username of user </label> <input type="text" name="post_username" value="<?php echo $_session['post_username']; ?>" readonly="readonly" id="post_username"/> </div> <!-- word of language learning object --> <div id="postword" data-role="field-contain"> <label for="word language learning object">word language learning object </label> <input type="text" name="post_word" id="post_word" /> </div> <!-- descripti...

opengl - Can't release textures created by a shared context -

i met problem using shared contexts: i have 2 threads , each has 1 context, thr1(thread1) ctx1(context1) , thr2 , ctx2. ctx2 created sharing ctx1. then, in thr2, create textures ctx2 current context, , rendering. after that, destroy ctx2 , finish thr2. now problem arised: after destroy ctx2, textures created under ctx2 not released(some of then, not all). use gdebugger profile program, , see that, these textures not released, , listed under ctx1. as repeat create thr2/ctx2 , create textures , destroy thr2/ctx2, textures getting more , more, memory. what have tried: delete textures in thr2 before destroy ctx2; in thr2 make ctx1 current , try delete textures, before ctx2 destroy; this sounds expected behavior. to explain lifetime of objects multiple contexts, i'm going use word "pool" describe collection of textures. don't think there's universal terminology concept, anything. while may picture textures being owned context, in fact own...

java - How does serialization tool skip unknown fields during deserialization? -

how serialization tool(i.e. hessian) deserialize class of different version same serialversionuid ? in cases, can skip unknown(not found in class loader) fields , keep compatible. last time, tried appending new field of map<string, object> , put unknown object map, threw classnotfoundexception . why can't skip map others? is problem associated tool's implementation or serialization mechanism? this depend on tool itself. serialversionuid intended use java's built-in serializer ( objectoutputstream ) which, best can tell reading hessian source, not used hessian. for hessian specifically, best source can find mentions these kinds of changes this email : at least hessian, it's best think of versioning set of types of changes can handled. specifically hessian can manage following kinds of changes: 1) if add or drop field, side doesn't understand field ignore it. 2) field type changes possible, if hessian can convert...

r - WEIRD: sapply not working on dplyr::tbl_df() local data.frame -

i haven't seen post error resulting using dplyr in conjunction sapply before, thought i'd ask if knows why occurs. it's not major issue per se work-around easy, may spare of hassle of wondering on earth going on. sample data's taken here , , i've made variation of code given jbaums in same post. sample data mydata <- data.frame(matrix(rlnorm(30*10,meanlog=0,sdlog=1), nrow=30)) colnames(mydata) <- c("categ", "var1","var2", "var3","var4", "var5", "var6", "var7", "var8", "var9") mydata$var2 <- mydata$var2*5 mydata$categ <- sample(1:2) mydata looped function making multiple boxplots sapply(seq_along(mydata)[-1], function(i) { y <- mydata[, i] names <- colnames(mydata)[i] plot(factor(mydata$categ), log(y + 1), main=names, ylab="foo",outpch=na, las=1) }) that works perfectly. now error occurs after using tbl_df() ...

python - Joining multiple CSV Files -

i have folder multiple csv files. every file consists of date , value column. merge files 1 first column consists of value date (which same each file) , other columns populated values of each single vile i.e. (date, value_file1, value_file2...) any suggestions on how achieved via simple python script or maybe evan through unix command? thank help! i'd recommend using tool csvkit's csvjoin pip install csvkit $ csvjoin --help usage: csvjoin [-h] [-d delimiter] [-t] [-q quotechar] [-u {0,1,2,3}] [-b] [-p escapechar] [-z maxfieldsize] [-e encoding] [-s] [-v] [-l] [--zero] [-c columns] [--outer] [--left] [--right] [file [file ...]] execute sql-like join merge csv files on specified column or columns. positional arguments: file csv files operate on. if 1 specified, copied stdout. optional arguments: -h, --help show message , exit -d delimiter, --delimiter delim...

java - How to define destructors? -

public class { double wage; a(double wage){ this.wage=wage; } } //in code supposed define constructors destructors. what code defining destructor? in java, there no destructors can use method object#finalize() work around. the java programming language not guarantee thread invoke finalize method given object. guaranteed, however, thread invokes finalize not holding user-visible synchronization locks when finalize invoked. if uncaught exception thrown finalize method, exception ignored , finalization of object terminates. class book { @override public void finalize() { system.out.println("book instance getting destroyed"); } } class demo { public static void main(string[] args) { new book();//note, not referred variable system.gc();//gc, won't run such tiny object forced clean-up } } output: book instance getting destroyed system.gc() runs garbage collector. calling gc m...

javascript - Do I need to use iOS default controls in html? -

i'm building cordova app, i'd rather not use default popups such spinner happens when focus on <select></select> (i'll make own dropdown works in mobile) , want build own numpad when focus on textarea (which i'll make div pops own numpad), not use ios keyboard. basically, don't want use of native controls popup. instead want in html. is there in user experience guidelines can't when submitting app store? as far know there nothing permitts send such apps store. apple has guideline developers/designers. recommend you, have it. can find here: apple design guidelines - ui elements . doesn't say, apple allows that. every app submit store reviewed. if apple permitts said (html/css) think native keyboard fits needs. since ios8 possible build "own" keyboard need it. don't know how implement cordova application. have on here 16 keyboards build ios8: 16 great ios8 keyboards

objective c - How to convert CVPixelBufferGetBaseAddress call to Swift? -

maybe i'm first person doing in swift there seems nothing on net using &/inout uint8_t in swift. translate please? relationship bitwise? objective-c uint8_t *buf=(uint8_t *) cvpixelbuffergetbaseaddress(cvimgref); swift attempt let inout buf:uint8_t = here cvpixelbuffergetbaseaddress(cvimgref) cvpixelbuffergetbaseaddress() returns unsafemutablepointer<void> , can converted uint8 pointer via let buf = unsafemutablepointer<uint8>(cvpixelbuffergetbaseaddress(pixelbuffer)) update swift 3 (xcode 8): if let baseaddress = cvpixelbuffergetbaseaddress(pixelbuffer) { let buf = baseaddress.assumingmemorybound(to: uint8.self) // `buf` `unsafemutablepointer<uint8>` } else { // `baseaddress` `nil` }

sql - Basic MySQL Select Query -

i need return full names of who's last name starts m-z. uppercase correct case. select full_name customer lastname '[m-z]%' order lastname; there wrong syntax on third , cant figure out is. you can regular expression. select full_name customer lastname regexp '^[m-z]' order lastname;

sorting - C++ substr() method seems to return 0 when used -

i'm writing program read in file of 5 buddy holly albums, sort them alphabetically, sort songs within each album alphabetically, , print album name, year came out, , sorted list of songs. catch here i'm supposed keep number next song comes out so: buddy holly 1958 10. baby don't care 7. everyday 1. i'm gonna love 4. listen me 12. little baby 3. @ me 8. mailman, bring me no more blues 2. peggy sue 11. rave on! 6. ready teddy 5. valley of tears 9. words of love the problem comes when try sort songs. professor recommended use substr() method skip past first 4 characters in string start comparison @ first letter, when use it, keeps giving me error: terminate called after throwing instance of 'std::out_of_range' what(): basic_string::substr: __pos (which 4) > this->size() (which 0) i went , tried .size()/length() method see if got positive values(i did), , set int equal value, tried if statement see if int greater 0. no...

javascript - Kendo grid not show sum in footer template -

i used kendo grid load data, have problem. aggregate sum not working correct json data below,total value last row cell value. if change json data working. var ds = [ { "subname": "to pn 01-001", "subid": "1", "partner": "93", "infdivname": "phuong nam-01", "vigor2910wifi": "28" }, { "subname": "to pn 01-002", "subid": "2", "partner": "93", "infdivname": "phuong nam-01", "vigor2910wifi": "3" }, { "subname": "to pn 01-010", "subid": "10", "partner": "93", "infdivname": "phuong nam-01", "vigor2910wifi": "5" } ]; var cls = [ new extcolumn("vigor2910wifi", ...

java - Trouble with switch statements? -

i trying write program generates random year between 2000 , 2010, reads off space exploration fact occurred in year. code have written, when run it, no matter year generated, prints last case (2010). how fix this? import java.util.random; public class spaceexploration { public static void main(string[] args) { int year =(int)(math.random()*11) + 2000; string eventstring = ""; switch (year) { case 2000: eventstring = "2000: first spacecraft orbits asteroid"; case 2001: eventstring = "2001: first spacecraft lands on asteroid"; case 2002: eventstring = "2002: n/a"; case 2003: eventstring = "2003: largest infrared telescope released"; case 2004: eventstring = "2004: n/a"; case 2005: eventstring = "2005: spacecraft collies comet"; case 2006: eventstring = "2006: spacecraft returns collections comet"; case 2007: eventstring = "2007: n/a"; case 2008: ...

python - UDP file transfer with channel -

please me; don't know how process packet rate loss in python 0-10%. i need write sender.py , receiver.py connect channel , modifiy channel can send picture. here code channel.py: # import random import socket socket import * #vary channel loss rate between 0-10 lossrate = 0 #create udp sockets sender , receiver sendersocket = socket(af_inet, sock_dgram) receiversocket = socket(af_inet, sock_dgram) # assign ip address , port numbers sockets sendersocket.bind(('127.0.0.1', 5001)) receiversocket.bind(('127.0.0.1', 5002)) receivermessage, receiveraddress = receiversocket.recvfrom(1600) print "receiver ready" while true: # receive messages sender sendermessage, senderaddress = sendersocket.recvfrom(1600) #forward frame receiver random loss rand = random.randint(0,99) if rand > lossrate: receiversocket.sendto(sendermessage, receiveraddress) #receive ack receiver receivermessage, receivera...

c++ - Read data from file and store into an array of structs -

so need creating program open file , read data file array of structs , calculate variety of things highest, lowest, average , standard deviation. right now, more concerned how read actual file , place array of structs. here instructions assignment: -you read input data input file scores.txt (will posted in etudes); , data in format (studentid, first name, last name, exam1, exam2 , exam3). -each line of data 1 student read file , assigned struct variable. consequently, need array of structs store data read input file. 1-dimensional array. -once read data file array, required calculate , display following statistics each exam. here data file: 1234 david dalton 82 86 80 9138 shirley gross 90 98 94 3124 cynthia morley 87 84 82 4532 albert roberts 56 89 78 5678 amelia pauls 90 87 65 6134 samson smith 29 65 33 7874 michael garett 91 92 92 8026 melissa downey 74 75 89 9893 gabe yu 69 66 68 #include "stdafx.h" #include <iostream> #include <string> #i...

ios - SpriteBuilder timeline autoplay animation not running -

i trying understand spritebuilder . i facing problem of autoplay animation; behaves strangely. sure missing steps. it running in 1 case while in other when load .ccb file not running. how can track why autoplay animation not running in .cbb file when load it? doing wrong? and in same way, code of [self.animationmanager runanimationsforsequencenamed:@"waitingforopponent"]; is not working in same way. though works time. edit actually, found it; stops working when invitation via game centre playing game. in short, if uialertview game centre animations of sprite builder stops working. don't know how tackle situation. thanks. well got answer how can achieve it, when game centre push notification cocos2d: animation stopped ** message , after message **cocos2d: animation started frame interval: 4.00 . but not starting animation what did in applicationdidbecomeactive put code [super applicationdidbecomeactive:application]; , solved proble...

linux - Uncompress tar.gz with appending a suffix to each files name -

i wanted uncompress tar.gz, appending suffix each of file name. so, example abc.tar.gz contains files 'first' , 'second', so, after extracting, if want append suffix '.append'the file name of each files should 'first.append' , 'second.append'. there command or way this? note: files name 'first' , 'second' there, , wanted decompress without affecting available files. one thing can think of uncompress in temp dir , then, copy files 1 one. but, wanted in 1 shot, if possible, that, save time. thanks in advance. try this: #!/bin/bash compress_f=abc.tar.gz if [ $# -ne 0 ]; compress_f=$1 fi in `tar -tf "$compress_f"`; if [ -f $i ]; echo "mv ${i} ${i}.orig" mv ${i} ${i}.orig fi done in `tar -xvzf "$compress_f"`; echo "mv ${i} ${i}.append" mv ${i} ${i}.append if [ -f ${i}.orig ]; echo "mv ${...

android - I can't get my SDK manager to run. Can someone please give a solution please? -

i text in cmd when open android.bat in sdk/tools/android.bat i using android studio . had eclipse- helios while back, not able run sdk manager via both or exe file of sdk itself. have tried change paths of java environment lot of times , tried edit android.bat file, nothing worked. what happens in android studio that, progress bar shows showing sdk manager loading, nothing happens after that. exception in thread "main" java.lang.unsatisfiedlinkerror: no swt-win32-3550 or swt-win32 in swt.library.path, java.library.path or jar file @ org.eclipse.swt.internal.library.loadlibrary(unknown source) @ org.eclipse.swt.internal.library.loadlibrary(unknown source) @ org.eclipse.swt.internal.c.<clinit>(unknown source) @ org.eclipse.swt.widgets.display.<clinit>(unknown source) @ com.android.sdkmanager.main.showsdkmanagerwindow(main.java:402) @ com.android.sdkmanager.main.doaction(main.java:390) @ com.android.s...

c# - Application builds yet execution fails on Any CPU build -

so there couple of questions asked on matter. there's x86, x64 secondary project references project created on x86 , based on third party .dll built on x86. the entire dllimport , marshal call com wrapper created using upgrader tool. upgraded vb6.0 .net code. final .exe installed , run in every pc long release d using x86 build. fails when build on anycpu configuration. when anycpu build done , programme executed code keeps throwing error on third party .dll , complaints can't find .dll. none of these issues persists when build on x86. practical issue application meant device on windows embedded standard os , windows oss windows xp onwards. error : system.dllnotfoundexception unhandled hresult=-2146233052 message=unable load dll 'posltd.dll': specified module not found. (exception hresult: 0x8007007e) source=projectone typename="" stacktrace: @ porjectone.pinvoke.unsafenative.posltd.connecttodevice(int32 nmachineno, string...

ios - Manipulating xcode schemes from the console -

in xcode, possible create new schemes and/or add files existing scheme command line ? there's no officially supported way create or manage xcode projects scripts, can use community project that, example cocoapods' gem: https://github.com/cocoapods/xcodeproj

python - AWS Boto instance tagging -

all struggling add name tags newly created ec2 instance, is there way in aws identify last created instance? reservations = ec2.get_all_instances() instance = reservations[0].instances[0] create_tags([instance.id], {"name": tag}) this isn't setting tags deployed instance. to name newly created instance, add name tag after creating vm: import boto.ec2 conn = boto.ec2.connect_to_region("eu-west-1",aws_access_key_id='key',aws_secret_access_key='sectret') reservations = conn.run_instances("ami-a10897d6", min_count=1, max_count=1, key_name="key", security_group_ids=["sg-123"], instance_type="t2.micro", subnet_id="subnet-123") instance = reservations.instances[0] conn.create_tags([instance.id], {"name":"foo"}) alternatively, if know excactly start time, can use filters parameter * wildcard. more dynamic example may be: from datetime import datetime = datet...

osx - Poco C++ Static Library (Crypto and SSL) Linker Error on OS-X -

i have compiled poco static library used in xcode6.1.1 project. see linking error libraries: libpococrypto.a , libpoconetssl.a: i have verified these libraries built x86_64 architecture: input file libpococrypto.a not fat file non-fat file: libpococrypto.a architecture: x86_64 what wrong? appreciable? linker error: undefined symbols architecture x86_64: "_asn1_string_data", referenced from: poco::crypto::x509certificate::extractnames(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&) const in libpococryptod.a(x...

opengl - I can't get a simple indexed array rendered properly -

Image
i porting sample ( site ) jogl noticed wasn't perfect in image, artefacts on floor , shapes not squared, can see (dont care color, varying), floor doesnt good: therefore tried render floor first (if wanna try, pretty easy, swith sqrt_building_count 100 -> 0) , there have first problems, supposed square based on 2 triangles, see 1 of them. my vertex structure : public float[] position = new float[3]; public byte[] color = new byte[4]; public float[] attrib0 = new float[4]; public float[] attrib1 = new float[4]; public float[] attrib2 = new float[4]; public float[] attrib3 = new float[4]; public float[] attrib4 = new float[4]; public float[] attrib5 = new float[4]; public float[] attrib6 = new float[4]; attrib0-6 unused @ moment my vs inputs : // input attributes layout(location=0) in vec4 ipos; layout(location=1) in vec4 icolor; layout(location=2) in permeshuniforms* bindlesspermeshuniformsptr; layout(location=3) in vec4 iattrib3; layout(location=4) in vec...

php - How to move array elements to top if compared with string? -

i have array $result getting mysql follows array ( [0] => array ( [p_title] => apple new ipad (white, 64gb, wifi) ) [1] => array ( [p_title] => apple ipad mini/ipad mini retina belkin fastfit bluetooth wireless key ) [2] => array ( [p_title] => apple ipad air (16gb, wifi + cellular) ) ) and suppose getting sort value in $sort_by variable. ex. currently, $sort_by="apple ipad"; so want move each array elements have p_title "apple ipad" top. so output array should be; array ( [0] => array ( [p_title] => apple ipad air (16gb, wifi + cellular) ) [1] => array ( [p_title] => apple ipad mini/ipad mini retina belkin fastfit bluetooth wireless key ) [2] => array ( [p_title] => apple new ipad (white, 64gb, wifi) ) ) i ready ed...

ruby on rails - Prevent rake migrate from creating foreign key constraint -

we have case in 1 of table column name use suffix "_id". migration code : create_table :companies |t| t.integer :ref_id t.string :name end when running db:migrate, fails, because rails tried create foreign key constraint ref_id, , found there no table called "refs". in our case "ref_id" not foreign key. is there way prevent rails create foreign key constraint column? it seems have schema_plus gem. can do: create_table :companies |t| t.integer :ref_id, foreign_key: false t.string :name end

Troubles with converting PHP timestamp to local date string -

i'm trying convert linux server timestamp formatted local date string. the $timestamp 1429800741 , , expected date string "2015/4/23 14:52:21" , use date("y/n/j h:i:s", $timestamp) , result "2015/4/23 06:52:21" , it's 8 hours slower . i checked server command line "date -r" , , shows "thu, 23 apr 2015 14:55:59 +0800" . in php, function date_default_timezone_get() echo "asia/shanghai". it looks timezone has been set correctly, why formatted string wrong ? anyone please me, thanks!!! i not getting proper time on pc, believe proper approach question, maybe work out further: $datetime = new datetime(); $datetime->settimestamp('1429800741'); $datetime->settimezone(new datetimezone('asia/shanghai')); echo $datetime->format('y/n/j h:i:s p');

abstract syntax tree - How to check if given line of code is written in java? -

what right way check if given line java code? input : logsupport.java:44 com/sun/activation/registries/logsupport log (ljava/lang/string;)v expected output : false. input : scanner in = new scanner(system.in); expected output : true. i tried eclipse jdt astparser check if can create ast. here's code: public static boolean isjava(string line) { boolean isjava = false; astparser parser = astparser.newparser(ast.jls3); parser.setsource(line.tochararray()); parser.setresolvebindings(false); astnode node = null; parser.setkind(astparser.k_statements); try { node = parser.createast(null); if (node == null) return false; isjava = true; } catch (exception e) { return false; } return isjava; } but not work. ideas? thanks! try beanshell http://www.beanshell.org/intro.html java evaluation features: evaluate full java source classes dynamically isolated java methods, statements, , expressi...

java - org.apache.cxf.interceptor.Fault: org.apache.cxf.jaxrs.impl.ResponseImpl -

i getting fallowing exception when try send attributes rest full web service apache cxf using url: http://localhost:9081/mrud1/rest/tradeinfo?hti=my%20hti&dts=my%20dts &site=my%20site&dealid=13 org.apache.cxf.phase.phaseinterceptorchain dodefaultlogging application { http://services.mrud.com/ }tradeinfoservice has thrown exception, unwinding org.apache.cxf.interceptor.fault: org.apache.cxf.jaxrs.impl.responseimpl i using spring 3.1.0 release , cxf 2.7.0,websphere 8.0,jdk 6

javascript - Runtime Change of an Object in Web Browser during Automation using sahi -

i using sahi automation tool have problem identifying 1 of fields.the field gets changed during runtime , unable catch it. attaching image here. fields read , skipped both identified below properties: read _div("0[1]") _div("cell-right fg-000000[1]") _div(613) skipped _div("0") _div("cell-right fg-000000") _div(615) however array [1] gets on interchanging , getting below error everytime execute script. _sahi.setservervarforfetch('___lastvalue___1429772452227', _gettext(_div("cell-right fg-000000[1]"))); [9205 ms] [12:31:00.321] error: parameter passed _gettext not found on browser at: (c:\sahi_pro\userdata\scripts\tlmrp.sah&n=40) checkfileexist please how identify same. if understand correctly , have field id changing, use regular expression it _div(/fg-000000/)

c# - TextBox.LineCount always -1 WPF -

i created textbox code behind this: textbox txtplaintxt = new textbox(); txtplaintxt.height = 200; txtplaintxt.width = 300; txtplaintxt.textwrapping = textwrapping.wrap; txtplaintxt.text = text; int linecount = txtplaintxt.linecount; i'm trying linecount property of textbox problem has value of "-1". guess have created code behind , not in xaml becouse when create exact same textbox in xaml, works fine , correct number of lines in it. tried call updatelayout() method , tried call focus() method this: txtplaintxt.focus(); txtplaintxt.updatelayout(); txtplaintxt.focus(); txtplaintxt.updatelayout(); but still value of -1. how can solve problem? that happening because until layout gets measured, don't have actualheight , actualwidth , linecount can't calculated until happens. that means can use linecount property after layout got measured & arranged. ( updatelayout() notifies layout engine layout should update...