Posts

Showing posts from June, 2014

java - ORA-01400 cannot insert null error in one to one relationship -

i have code public void guardaraspirante(aspirantedto aspirantedto) { aspirante aspirante = new aspirante(); string usuariomovimiento = aspirantecn.class.getsimplename(); date fecha = new date(); aspirante.setcodigoalumno(aspirantedto.getcodigouniversitario()); aspirante.setnombre(aspirantedto.getnombre()); aspirante.setapellidopaterno(aspirantedto.getprimerapellido()); aspirante.setapellidomaterno(aspirantedto.getsegundoapellido()); aspirante.setusuariomovimiento(usuariomovimiento); aspirante.setfechamovimiento(fecha); solicitud solicitud = new solicitud(aspirante.getsolicitudid()); solicitud.setaspirante(aspirante); solicitud.setsolicitudid(aspirante.getsolicitudid()); solicitud.setofertaid(aspirantedto.getofertaacademica()); solicitud.setperiodoid(aspirantedto.getperiodo()); solicitud.setaportacion(aspirantedto.getaportacionvoluntaria()); solicitud.setfechamovimiento(fecha); solicitud.setusuariomovimiento(usu

Trouble Converting jQuery Script to Plugin -

i'm trying convert pretty simple script takes search results twitter , outputs unordered list. first time trying write plugin , doesn't seem firing code when call it. script iteself works fine, code i've written plugin: (function($) { $.fn.tweetget = function(options) { var defaults = { query: 'from:twitter&rpp=10', url: 'http://search.twitter.com/search.json?callback=?&q=' }; var options = $.extend(defaults, options); return this.each(function() { // tweets user query $.getjson(options.url + options.query, function(data) { var tweets = []; $.each(data.results, function(i, tweet) { tweets.push('<li>' + tweet.text.parseurl().parseusername().parsehashtag() + '</li>'); }); $('#target').append('<ul>' + tweets.join(''

Get Text From Option Tag in PHP -

i want text inside option tags value. ex: <select name="make"> <option value="5"> text </option> </select> i used $_post['make']; , value (5) want get both value , text . how can using php. what this? think it's best solution because have separated fields each data. 1 hidden field updated @ each change , avoids hardcoding mappings. this inside html: <select name='make' onchange="settextfield(this)"> <option value = '' selected> none </option> <option value = '5'> text 5 </option> <option value = '7'> text 7 </option> <option value = '9'> text 9 </option> </select> <input id="make_text" type = "hidden" name = "make_text" value = "" /> <script type="text/javascript"> function settextfield(ddl) { document.getelementbyid('m

objective c - NSDictionary - List all -

in nsmutabledictionary this: [nsmutabledictionary dictionarywithobjectsandkeys: [nsstring stringwithstring:firstname], @"name", [nsnumber numberwithfloat:familyname], @"surname", nil]; how can of elements converted nsstring? requirement names , surnames arranged in string this: "name, surname, name, surname..."? this gives string names not surnames: nsstring * result = [[urlarray valueforkey:@"name"] componentsjoinedbystring:@", "]; is there way similar 1 above create string values of nsmutabledictionary? try this: nsstring *result = [nsstring stringwithformat:@"%@, %@", [urlarray valueforkey:@"surname"], [urlarray valueforkey:@"name"]]; the %@ represents objective-c object more details see apple docs

azure - Are there any publicly available mailing list/consumer address services or databases out there? -

i've got requirement turn partial person contact information potential mailing addresses (the evils of marketing: given firstname, lastname, zip find addresses in area person). short of contracting third party mailing list data vendor there publicly available datasets or services explore? i've looked on azure data marketplace , don't see anything. , google skills failing me. strikeiron has us address verification feed on datamarket might work you.

c# - Delegate Variance in c++/cli -

i in process of converting working c# code c++/cli, , i'm having trouble understanding why not compile. the error received: void mynamespace::handler::datachanged(system::object ^,system::eventargs ^)' : specified function not match delegate type 'void (system::object ^,system::data::datarowchangeeventargs ^)' looks c++/cli doesn't support parameter variance delegates c# , vb do, see this microsoft connect bug report . as work around can wrap call handler in wrapper takes datarowchangeeventargs , calls handler: public ref class myclass { .... public: void myclass::delegates(datatable ^table) { handler ^handler = gcnew handler(); datarowchangeeventforwarder& forwarder = gcnew datarowchangeeventforwarder( new eventhandler(handler, &mynamespace::handler::datachanged))); table->rowchanged += gcnew datarowchangeeventhandler (forwarder, &mynamespace::myclass::rowchangeddelegate

extjs4 - Difference between Ext.widget() and Ext.ComponentQuery.query()? -

i have component created extends ext.window.window, i've given alias of 'widget.customereditor'. once i've created shown instance of component both of following pieces of code seem getting reference same thing: ext.componentquery.query('customereditor')[0]; ext.widget('customereditor'); the problem when try execute close method on returned object. following work , closes window: ext.componentquery.query('customereditor')[0].close(); while not work: ext.widget('customereditor').close(); i'm wondering difference between 2 ways of querying? after reading api docs found answer. turns out ext.widget not query existing instance of component in dom instead creates new instances of components xtype. ext.componentquery should used find existing instances of components.

Removing NULL values from columns (MySQL) -

so have table 4 columns (c1, c2, c3 , c4) , of fields in these columns have null values. want trim/remove these null values without having remove whole column or row (i.e. null value). instance, if have: c1: 1 2 3 null null 7 9 2 null c2: null null null 4 5 3 null null i want show this: c1: 1 2 3 7 9 2 c2: 4 5 3 thanks in advance guys!

video - GData Youtube : obtaining thumbnails -

i have bunch of youtube videoids (the alfanumeric string in param watch/v=? of youtube.com url) , have obtain thumbnails each video; now, each videoid make http request following: http://gdata.youtube.com/feeds/api/videos/videoid?v=2&alt=json (s/videoid/actualvideoid/) and parse/play around json returned; approach quite expensive in terms of performance (everything running on mobile device): there way make single http connection (maybe posting videoids, instead of getting them)... thanks giupo apparently "q" parameter can work multiple video id's. example: https://gdata.youtube.com/feeds/api/videos?q="7mse-iy_tfy"|"qybufny7y8w"|"svc2xlpfw1g"&alt=json&fields=entry/id,entry/media:group/media:thumbnail however note result can give videos because 1 of you're requested id's in video's metadata. need filter results down original id list. alternatively looks might able use "batch request&qu

asp.net mvc - Jquery form post Issues -

i using asp.net mvc , having issue posting form using jquery. not posting url telling to. if use firebug, shows post happening posting index of controller everytime. cannot figure out why. have verified url of action trying post can't figure out why posting index of controller....note: view in form found index view. posting it's own action rather 1 in url telling to. great. thanks! here form <form action='' id="descriptionform"> <%=html.hidden("claimnumber", viewdata["claimnumber"])%> <%=html.hidden("partnumber", viewdata["partnumber"])%> <%=html.hidden("qty", viewdata["qty"])%> <table> <tr> <td style="text-align: right"> category: </td> <td> <%=html.dropdownlist("problemcategory", (ienumerable<selectlistitem>)viewdata["problemselect"], "-selec

logic - Avoiding a for loop in R in an attempt to evaluate percentage of true positives/negatives when using logistic regression -

Image
what got: matrix got predicted probability of outcome (from logistic regression model) , known outcome. curious got 2 regression models , independent test dataset wish compare these 2 models doing this. > head(matrixcomb) probcomb outcomb [1,] 0.9999902 1 [2,] 0.9921736 0 [3,] 0.9901175 1 [4,] 0.9815581 0 [5,] 0.7692992 0 [6,] 0.7369990 0 what want: graph can plot how prediction model yields correct outcomes (one line positives , 1 line negatives) function of cut off value probability. problem unable figure out how without switching perl , use for-loop iterate through matrix. in perl start @ probability 0.1 , in reach run of for-loop increase value 0.1. in first iteration count probabilities <0.1 , outcome = 0 true negatives, probability < 0.1 , outcome 1 false negatives probability > 0.1 , outcome = 0 false positives , probability > 0.1 , outcome = 1 true positives. the process repeated , results of each iteration pr

unix - Keep log file of shell script execution until past few days -

am appending standard output , error of shell script execution on unix bok shown below /home/mydir/shellscript.sh >> /home/mydir/shellscript.log 2>&1 now wondering way keep logs going as 30 days else log file size keep on increasing. appreciate if can provide recommendations around same. is long-running script (e.g. daemon)? or exits quickly? dynamically build log file's name based on today's date, new file gets generated time date changes: #/bin/sh now=`date +%f` /home/mydir/shellscript.sh >> /home/mydir/shellscript-$now.log 2>&1 previous=`date --date='30 days ago' +%f` rm -f /home/mydir/shellscript-$previous.log 2>&1 (added stale log removal).

Java: EOFException in networking -

i new networking , getting eofexception when trying run myclient.java . myserver.java public class myserver { public static void main(string[] args) { serversocket serversocket = null; try { serversocket = new serversocket(4321); } catch (ioexception e) { e.printstacktrace(); } while(true) { try { socket socket = serversocket.accept(); outputstream os =socket.getoutputstream(); outputstreamwriter osw = new outputstreamwriter(os); bufferedwriter bw = new bufferedwriter(osw); bw.write("hello networking"); bw.close(); socket.close(); } catch (ioexception e) { e.printstacktrace(); } } } } myclient.java public class myclient { public static void main(string[] args) { socket socket = null; try { so

java - temporary email address concept -

i similar concept on how site craigslist able create temporary email address seller in order hide seller real email address (to keep private) when wants contact seller. if send , email temporary email address, go seller’s real email box. know how done? need install email server? need implement ? any suggestions or reading material great. you have lot of things learn if you're asking broad question. install smtp server such postfix configure aliases forward mail "real" destination have application update alias configuration whenever need create or delete address. how accomplish of way beyond for.

python - How to avoid packet loss on server application restart? -

a typical situation server/web application application needs shut down , restarted implement upgrade. what possible/common schemes (and available software) avoid losing data clients sent server during short time application gone? an example scheme work is: simple web server client connects port 80, rather client connecting directly web server application, there simple application in between listens port 80 , seamlessly forwards/returns data to/from "actual" web server application (on other port). when web server needs shut down , restarted, relay app detect , buffer incoming data until webserver comes life. way there always application listening port 80 , data never lost (within buffer-size , time reason, of course). such simple intermediate buffer-on-recipient-unavailable piece of software exist already? i'm interested in solutions single application instance , not 1 there multiple instances (in case clever rolling update scheme used), in interests of havin

screen scraping - How to insert a string to a text field using mechanize in ruby? -

i know simple question i've been stuck hour , can't understand how works. i need scrape stuff school's library need insert 'ce' text field , click on link text 'clasificación'. output going use work. here code. require 'rubygems' require 'open-uri' require 'nokogiri' require 'mechanize' url = 'http://biblio02.eld.edu.mx/janium-bin/busqueda_rapida.pl?id=20110720161008#' searchstr = 'ce' agent = mechanize.new page = agent.get(url) searchform = page.form_with(:method => 'post') searchform['buscar'] = searchstr clasificacionlink = page.link_with(:href => "javascript:onclick=set_index_and_submit(\'51\');").click page = agent.submit(searchform,clasificacionlink) when run it, gives me error janium.rb:31: undefined method `[]=' nil:nilclass (nomethoderror) thanks! mu's answer sounds reasonable. not sure if strictly necessary, might try put brac

jquery - Combining Variables -

i have function: function prodsubsection(div, sec, self) { $(".prod-feat").hide(); $(div + sec).show('slide', {direction: 'right'}, 1000); $(self) .addclass('proddetailson') .parent('li').siblings().find("a") .removeclass('proddetailson'); } and here how execute it: $("#product1 li.details1 a").click(function() { prodsubsection("#product1", ".over", this); return false; }); what combine div , sec above be: $("#product1 .over").show('slide', {direction: 'right'}, 1000); any idea doing wrong? add space: $(div + ' ' + sec)

android - set the textsize of a listview -

i have custom listview , have defined style it. not able change textsize of items on listview. trying change through layout can dynamically change depending on device. styles.xml <style parent="@android:attr/listviewstyle" name="liststyle"> <item name="android:background">@android:color/white</item> <item name="android:divider">@drawable/divider</item> <item name="android:textsize">26dp</item> <item name="android:textstyle">bold</item> </style> xml layout <tvlist style="liststyle" android:id="@+id/mainview" android:layout_height="300dp" android:layout_width="wrap_content" /> i know can use settextsize in code changing font size . want change applying styles. suggestions on how go changing it? thanks the size of text within list view defined listview's adapter'

jsf 2 - Help with PrimeFaces -

i working through primefaces showcase, using netbeans 7.0, jdk1.6, primefaces 2.2.1, glassfish 3.1, jsf 2.0, win xp prof some of examples work fine, others don't work , errors component doesnt exist in library or component doesn't have specific attribute. have not done configuration , purchased lacking primefaces manual seemed suggest didn't need to i keep reading snapshots , wondering, should using snapshot: 1) need use snapshot work, if how use it? 2) there more documentation / tuts / examples/ books ... of using primefaces components above requirements have, have been tested , work. i have tried other forums no response, develop apps using primefaces, can't answers or need. on primefaces web page there " showcase 2.2.1 " , " labs showcase 3.0 ". maybe tried features of labs showcase 2.2.1 installation? if not, please give example of not working component.

iphone - Invalid conversion from const void* error -

i running following code in .mm file , error: invalid conversion 'const void*' 'const __cfdata*' i need run code in .mm. if change .m doesn't complain. why behaving this? compile iphone cfsocketnativehandle native; cfdataref nativeprop = cfreadstreamcopyproperty(thereadstream, kcfstreampropertysocketnativehandle); if(nativeprop == null) { if (errptr) *errptr = [self getstreamerror]; return no; } cfindex nativeproplen = cfdatagetlength(nativeprop); cfindex nativelen = (cfindex)sizeof(native); cfindex len = min(nativeproplen, nativelen); cfdatagetbytes(nativeprop, cfrangemake(0, len), (uint8 *)&native); cfrelease(nativeprop); cfsocketref thesocket = cfsocketcreatewithnative(kcfallocatordefault, native, 0, null, null); if(thesocket == null) { if (errptr) *errptr = [self getsocketerror]; return no; } cfreadstreamcopyproperty() returns cftyperef , typedef const void* , , c++ stricter conversions c (or objective-c). need

python - Looking for more pythonic list comparison solution -

ok have 2 lists: x = [1, 2, 3, 4] y = [1, 1, 2, 5, 6] i compare them in such way following output: x = [3, 4] y = [1, 5, 6] the basic idea go through each list , compare them. if have element in common remove element. 1 of element not of them. if don't have element in common leave it. 2 identical lists become x = [], y = [] here rather hacked , pretty lame solution. hoping other can recommend better , / or more pythonic way of doing this. 3 loops seems excessive... done = true while not done: done = false x in xlist: y in ylist: if x == y: xlist.remove(x) ylist.remove(y) done = false print xlist, ylist thanks taking time read question. xoxo it's possible data structure looking multiset (or "bag"), , if so, way implement in python use collections.counter : >>> collections import counter >>> x = counter(

Accessing fopen from a class in PHP -

for reason i'm having trouble accessing fopen() function inside class in php: <?php class compare { function __construct( ){ } private $q_scores = array(); private $q_path = "./data/questions.txt"; private $questions = fopen($q_path, 'r'); //... } ?> how access built-in php functions inside class? many thanks put line in constructor (it's made this) $this->questions = fopen($this->q_path, 'r'); and declare like: private $questions;

objective c - multiple if condition -

if ( ([mobilenumber.text hasprefix:@"8"] == no) || ([mobilenumber.text hasprefix:@"9"] == no) ) { } i wanna test if mobilenumber has prefix of 8 or 9. doing wrong here? answer: silly me, should , condition instead of or. should be if(([mobilenumber.text hasprefix:@"8"] == no) && ([mobilenumber.text hasprefix:@"9"] == no)) { /* mobile number not have 8 or 9 in beginning */ } my comment above make sure there isn't ( in front of mobile number. edit: did not quite understand after.

iphone - Error Handling - NSKeyedUnarchiver -

i using nskeyedarchiver / nskeyedunarchiver send objects on bluetooth ipad iphone remote control. works, shown here . however, if remote control receives data isn't archived (for example, random nsstring), entire application crashes. want able "if data in archive object x, unarchive , following, ignore otherwise". is there way handle errors nskeyedunarchiver? here's code: - (nsmutabledictionary *)unpackreceivednsmutabledictionaryfromdata:(nsdata *)receiveddata { nskeyedunarchiver *unarchiver = [[nskeyedunarchiver alloc] initforreadingwithdata:receiveddata]; nsmutabledictionary *receiveddictionary = [[unarchiver decodeobjectforkey:@"mykey"] retain]; [unarchiver finishdecoding]; [unarchiver release]; return receiveddictionary; } any suggestions welcome! first time posting on stackoverflow... okay, figured out after lot of debugging... releasing data earlier caused exc_bad_access. used nszombies track coming , removed

open source - transifex liked to collaboratively translate a Java project -

Image
recently, came across transifex transifex open service allowing people collaboratively translate software, documentation , other types of projects. designed hub translations of open source projects, transifex supports translations straight project's source. it cool. however, realize support .pot file produced gnu gettext ? i using java properties file - gui_en.properties in open source project. is there similar service, translate java application collaboratively? i had tried upload properties file transifex. here outcome. file trying upload not seem belong known i18n format. the head of self-host version appears have support . you'll need to, of course, self-host now, until hosted version updated.

if statement - Go Back to Start If no input is entered (Bat File) -

ok first have i'm sorry poor english :) problem i'm trying create script file multiple choices , ran problem. if don't enter input (just press enter) file displays error , shuts down. question whether there command force file go start in case no input entered? this relevant part of script :input @echo off cls echo ############################################# echo # # echo # 1 - make system folder or file # echo # 2 - restore folder or file # echo # 3 - exit # echo # # echo ############################################# set /p o=set choice , press enter: echo loading ......... ( if %o%==1 goto hide if %o%==2 goto show if %o%==3 goto exit if %o%=="" goto input ) else ( goto input ) as can see tried use "else" works partially. if enter variable not part of list given (in case 1, 2, 3) fi

windows phone 7 - parse xml return after a post method -

i use post post parameter server , result in string, how parse result , bind listbox? seems (for reason) can't output string textblock or messagebox. parse xml use xdocument (which take stream in parameter) code following: private static void getrequeststreamcallback(iasyncresult asynchronousresult) { string post = "track=love"; // post = httputility.urlencode(post); console.writeline(post); try { httpwebrequest request = (httpwebrequest)asynchronousresult.asyncstate; // end operation stream poststream = request.endgetrequeststream(asynchronousresult); // convert string byte array. byte[] postbytes = encoding.utf8.getbytes(post); // write request stream. poststream.write(postbytes, 0, postbytes.length); poststream.close(); // start asynchronous operation response request.begingetresponse(new asyncca

java - Problem with result handler -

i trying run java client through php sends xml server. typically takes 10 - 30 seconds receive response. when run php can tell there no load time thinking rest of code executes before response received. attempting have return response displayed in browser , written xml in same directory. none of happens. new xml created, empty. $output = shell_exec("java soapclient4xg http://turbolink.turbo-marketing.net:8180 getlist.xml"); sleep(30); echo $output; $filename = "getlistresult"; $filename .= ".xml"; $fp = fopen($filename, 'w'); fwrite($fp, $output); fclose($fp); i added sleep(30) give java chance finish before passing value $output doesn't help. command java soapclient4xg http://turbolink.turbo-marketing.net:8180 getlist.xml" works. have used in soap ui , through putty running in directory. output receive this, in xml / soap format: <?xml version="1.0" encoding="utf-8" ?> <env:envelope xmlns:

php - 600+ memcache req/s problems - help! -

i running memcached on server , when hits 600+ req/s becomes unstable , causes big load of problems. appears when request rate gets high, php applications @ random times unable connect memcache server, causing slow load times makes nginx , php-fpm freak out , receive bunch of 104: connection reset peer errors in nginx logs. i point out in memcache server have 'hot objects' - objects @ times receive 90% of memcache requests. noticed when many requests hit single object, adds little more load time overall page (when manages load). i appreciate problem. much! switch away using tcp sockets , going unix sockets (assuming on unix based server) start memcached socket enabled: add -s /tmp/memcached.socket memcached startup line (note, sockets disables networking support) then in php, connect using persistent connections, , new memcache socket: $memcache_obj = new memcache; $memcache_obj->pconnect('unix:///tmp/memcached.socket', 0); another recomm

upload images in the database -

i have been trying upload image table no joy @ all. have used store procedure , encrypted connection strings in appsettings , use data layer access objects. string filepath = fileupload1.postedfile.filename; string filename = path.getfilename(filepath); string ext = path.getextension(filename); string contenttype = string.empty; switch (ext) { case ".jpg": contenttype = "image/jpg"; break; case ".png": contenttype = "image/png"; break; case ".gif": contenttype = "image/gif"; break; } if (contenttype != string.empty) { stream fs = fileupload1.postedfile.inputstream; binaryreader br = new binaryreader(fs); byte[] bytes = br.readbytes((int32)fs.length); sqlcommand _sqlcom = new

c# - WCF ria services return list of complex types -

i have complex type entity public class complexentity : complexobject { private int _id; private string _name; private int _parentid; [key] [datamember] public int id { get;set;} [datamember] public string name {get;set;} [datamember] public int parentid {get;set;} } and one [datacontract] public class complexentitieslist : complexobject { [datamember] [include] [association("centities_centity","id","parentid")] public list<compelxentity> list {get;set;} [key] [datamember] public int id {get;set;} public int lkentitieslist() { list = new list<lkentity>; } and method: [invoke] public complexentitieslist getps() { return new complexentitieslist() { list = /*..some logic*/}); } on server side everything's perfect list comes empty @ client side clues? } i think include not work wit invoke-operations. take @ this question on silverlight.net , see colin blairs answer. method getps() should return normal collection

How to have a generic.xaml for Silverlight 3 and Silverlight 4? -

my main problem generic.xaml viewbox has moved assemblies. how have 1 generic.xaml file namespace location of viewbox compile in sl3 , sl4? i looked @ http://www.removingalldoubt.com/permalink.aspx/defa2a7d-b1e9-49eb-b8c8-438348be8d18 no avail... note : there 2 attributes xmlnsprefix , xmlnsdefinition can place in assembly.cs. thanks in advance. finally gave on xmlnsdefinition , xmlnsprefix not work properly...it funny in wpf application designer window can resolve referemces compiler not...go figure. i solved using cpp preprocessor blog... http://blogs.msdn.com/b/blemmon/archive/2009/04/29/using-the-preprocessor-to-share-incompatible-xaml-between-sl-and-wpf-part-1.aspx i modified preprocessxaml modify generic.xaml. <target name="preprocessxaml"> <itemgroup> <!-- convert defineconstants property itemgroup --> <xamlconstants include="$(defineconstants)" /> </itemgroup> <propertygroup> <!-- conv

c# - Where is Process on Phone 7? -

i trying create process in windows phone 7 project. have line: process process; however, visual studio can't find assembly process. have included using system.diagnostics, namespace doesn't have process. suspect class not supported on phone 7...... you can't launch or control other processes windows phone 7 application.

login with facebook in android application -

possible duplicate: on android, how switch activities programatically? i have built android application allows user login facebook.for i've used faceboook-sdk package.here how login: mfacebook = new facebook(app_id); masyncrunner = new asyncfacebookrunner(mfacebook); if(issession()){ intent = new intent(getbasecontext(), com.splashscreen.multipleoptions.class); startactivity(i); } else { log.d(tag, "sessionnotvalid, relogin"); mfacebook.authorize(this, perms, new logindialoglistener()); } and logindialoglistener : private class logindialoglistener implements dialoglistener { public void oncomplete(bundle values) { log.d(tag, "loginoncomplete"); string token = mfacebook.getaccesstoken(); long token_expires = mfacebook.getaccessexpires(); log.d(tag, "ac

javascript - Computing for the value of the last column cell -- involves dynamic table rows -

consider following html table: <table id="mytable1"> <tr id="tr1"> <td><input type="text" id="quantity1" name="quantity1" /></td> <td><input type="text" id="weight1" name="weight1" /></td> <td><input type="text" id="sub_total1" name="sub_total1" /></td> </tr> </table> what i'm trying accomplish here need update value sub_total field on every row based on values typed in quantity , weight fields on same row every time keyup() triggered. now believe manageable task if table i'm working on static only. inclusion of dynamic adding of table rows caused me troubles. jquery dynamic addition of rows: $(document).ready(function() { var counter = 2; $("#addbutton").click(function() { $('#mytable1 tr:last').after( '

java - DataInputStream sometimes reads NaN instead of a float -

bit of java newb. writing stl file viewer. i'm reading floats binary file using datainputstream randomly getting nan on values. file, when opened on pc in stl file readers seems intact, nan values i'm getting mean quite few of facets in file corrupted. circumstances lead datainputstream returning nan? my code seems work fine, these random nans driving me crazy. here's truncated version of reading code - pretty straightforward think. appreciated: public static int getfacetbinary(datainputstream in, arraylist al, arraylist aln) { <snip> // read 1st vertex fxr = in.readfloat(); f1x = swap(fxr); al.add(f1x); if (fminx > f1x) fminx = f1x; if (fmaxx < f1x) fmaxx = f1x; fyr = in.readfloat(); f1y = swap(fyr); al.add(f1y); if (fminy > f1y) fminy = f1y; if (fmaxy < f1y) fmaxy = f1y; fzr = in.readfloat(); f1z = swap(fzr); al.add(f1z);

lookup columns in sharepoint 2007 -

how reference lists columns in parent site want subsite of different parent site? how done? check sharepoint filtered lookup field project @ codeplex , don't let name fool - 1 of features is: cross-site lookup (all sites within same site collection) .

iphone - Cocos2d CCMenuItem target gives SIGABRT -

i'm trying create menu system calls method depending on pressed. problem when add target , selector ccmenuitems.it crashes sgabrt error. know problem target, should be? here .h , .m code #import "cocos2d.h" // splashmenulayer @interface splashmenulayer : cclayer { bool menubuttonsshowing; cclabelttf * splashlabel; ccmenuitemfont * puzzlemenuitem; ccmenuitemfont * racemenuitem; ccmenuitemfont * leaderboardmenuitem; ccmenu * mainmenu; } // returns ccscene contains helloworldlayer child +(ccscene *) scene; -(bool) cctouchbegan:(uitouch *)touch withevent:(uievent *)event; -(void) cctouchended:(nsset *)touches withevent:(uievent *)event; -(void) deletelabel :(id)sender; -(void) puzzlemode:(id)sender; -(void) racemode:(id)sender; -(void) leaderboard:(id)sender; @property bool menubuttonsshowing; @property (nonatomic, retain) cclabelttf* splashlabel; @property (nonatomic, retain) ccmenuitem* puzzlemenuitem; @property (nonatomic, retain) ccmenuitem* racemenuitem; @proper

css - Border radius effect with IE9 and a solid border -

i noticed address link styled button not show radius in ie9 when using css below: a.btn { background: #f00; color:#333; font-size:12px; padding: 3px 4px 3px 4px; border:1px solid #444; border-radius:3px 3px 3px 3px; -moz-border-radius:3px; -webkit-border-radius:3px; cursor:default; } css example when remove border:1px solid #444; nice curved border appears. is bug ie? in firefox works good. else seen this? seems happens when border-radius set low value. know not important on scale of things i'm interested hear if knows why radius doesn't show. it works me. check using border-radius: 20px; http://jsfiddle.net/6nr2n/1/ http://prntscr.com/2djxa

python - virtual-burrito .bashrc entry -

i installed virtual-burrito python virtualenv creator. on rebooting cannot restart virtual-burrito somehow .bashrc entry virtual-burrito missing. does know format .bashrc entry this? i tried copying pythonbrew entry not same tried source ~/.venvburrito/bin/virtualenv-burrito but did not resolve it. appreciated. source $home/.venvburrito/startup.sh

php - Line breaks with javascript and HTML -

Image
i have problem javascript , html. i'm using form user submits. if credentials wrong, script shows text message next input field. message contains email want clickable. things that: when message string, ok. when add <a href=\"mailto tag, line breaks. <div id="message_box"> <span id="msgbox" style="display:none"></span> </div> ok: $("#msgbox").fadeto(200,0.1,function() { var msg = ("ooops, number enterd not valid<br /> please contact: some@mail.com solve problem").replace(/[\r\n]/g, ''); $(this).html(msg).addclass('messageboxerror').fadeto(900,1); }); (edit)shows: ooops, number enterd not valid please contact: some@mail.com solve problem not ok: $("#msgbox").fadeto(200,0.1,function() { var msg = ("ooops, number enterd not valid<br /> please contact: <a href=\"mailto:som

ruby - Rails 2.3.2 and SHOW TABLES -

i have annoying problem show tables in rails 2.3.2 app - slowing app deep. question is, how rid of show tables usage , used in rails framework? app logs can see being used time. thank you! config/environments/production.rb: config.cache_classes = true config.action_controller.consider_all_requests_local = false config.action_controller.perform_caching = true config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp "show tables" orm-dependent sql query, fires every action provide classes reload in development mode. how time query take?

How does an Erlang process bind to a specific scheduler? -

how erlang process bind specific scheduler? currently processes not bound specific schedulers (though can force via undocumentet functions, not recommended). scheduler threads may bound logical processors using cpu topology , binding types. vm use of information enhance performance in normal scheduling scheme.

sql - How to reverse the results of this query? -

i'm using firebird 2.1. there table name folders, these fields: folderid parentfolderid foldername parentfolderid -1 if it's root folder - otherwise contains parent folder's id. the following recursive query return parents of folder, in order: with recursive hierarchy (folderid, parentfolderid, foldername) ( select folderid, parentfolderid, foldername folders folderid = :folderid union select folderid, parentfolderid, foldername folders f join hierarchy p on p.parentfolderid = f.folderid ) select list(folername, ' \ ') hierarchy the result like: child \ parent \ parent's parent how can reverse results of above query get: parent's parent \ parent \ child? thank you! the order of values returned list undefined. you may try wrapping query subselect: with recursive hierarchy (folderid, parentfolderid, foldername, rn) ( select folderid, parentfolderid, foldername, 1

c++ - How to properly convert char* into std::string? (issues while using expat / std::string(char*)) -

Image
problem description i'm using expat custom c++ wrapper, tested on other projects. i'm running problems, because original data (c_str) not converted std::string in right way. concers me, because did not change source of wrapper. it seems string gets null-terminated chars after conversion: oncharacterdata( std::string( pszdata, nlength ) ) // --> std::string( char* pszdata) how can fix this? own expat wrapper // wrapper defines class expat , implements example: void xmlcall expat::characterdatahandler( void *puserdata, const xml_char *pszdata, int nlength ) { expat* pthis = static_cast<expat*>( puserdata ); // xml_char char, therefore call contains i.e.: std::string("hello", 5) pthis->oncharacterdata( std::string( pszdata, nlength ) ); } custom parser // parser defined as: class parser : expat void parser::oncharacterdata(const std::string& data ) { // data no longer char*, std::stri

php - PDO Mysql Syntax error 1064 -

i run following code: $conn = new pdo(....); .... pdo attributes ... $limitvalue = 0; $limit = 10; $sql = $conn->prepare("select * table1 limit ?, ?"); $sql->bindparam(1, $limitvalue, pdo::param_int); $sql->bindparam(2, $limit, pdo::param_int); $sql->execute(); and get: uncaught exception 'pdoexception' message 'sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'null, 10' @ line 1' it happens particular query. else ok. btw: know may stupid prepared statements "in-code" values. example. in fact values depending on page number doesn't matter here - query giving same error too. if interested, php version is: 5.3.4rc2 , mysql's is: mysqlnd 5.0.7-dev - 091210 - $revision: 304625 $ this seems php bug : pdo ignores param_int constant , use $limit , $limitvalue variables string. quoted in q

php - Configuring Apache for Large Uploads -

i developing file uploading service company. our users sending large .zip files filled large illustrator files. files won't larger 1.5gb, need plan on handling files 4gb. obviously, causes lot of concerns around how configure apache allow such large file transfers without overloading server or opening security holes. concern 1: memory limits one feature of system users should able download files after have uploaded them. i've avoided using standard download (just link file) because of security issues - can't let other user's download each others files. solution keep uploaded files in protected directory outside of www-root, , load them in via php script. php script looks little this: $fo = fopen($uploaddir.$file_name, "r"); while(!feof($fo)) { $strang = fread($fo, 102400); echo $strang; ob_flush(); } fclose($fo); i've put fread loop , locked loading small chunks of file @ time. did because server has 4gb of ram,

sqlite3 - Creating test objects in RSpec with FactoryGirl fails with Nested Attributes -

i have workout model has many performedexercises, has many peformedsets. can't build object in test , not sure if it's sqlite3, or else (it works fine outside of testing environment). i have following factories: factorygirl.define factory :workout title 'workout one' performed_exercise end factory :performed_exercise exercise_id '2' performed_set end factory :performed_set set_number '1' end end my rspec test looks (i've made real simple rule out other issues inside test): it "is causing me lose hair" wrkt = factorygirl.build(:workout) end when run test, following error message: failure/error: wrkt = factorygirl.build(:workout) activerecord::statementinvalid: sqlite3::constraintexception: constraint failed: insert "performed_sets" ("created_at", "notes", "performed_exercise_id", "reps", "set_number", "u

actionscript 3 - How to use Stage Video (Flash Player 10.2) -

how can use stage video in project in flash professional cs5? do need flex hero it? there examples of using stage video? i've tried create flash pro gave me error - doesn't know stagevideoavailabilityevent means. being new, there aren't many tutorials out there stagevideo - here 1 should prove enlightening . if getting reference errors, means either aren't importing class properly, or aren't using latest flex sdk. believe need 4.5, can downloaded free adobe .

Possible to write directly to file with WordPress? -

i'd wordpress write directly file. know can php, wordpress deals directly database, , doesn't static publishing default. i know there many caching plugins available, may come down cache plugin recommendation. here's deal: i'm trying use wordpress generate xml files need project. so, data entry. right now, solution have template put need textarea. that's easy enough, have copy , paste text file , save it. i'd love skip step , have wordpress make files me. can recommend plugin let me easily? it's ok if comes down caching plugin, seems might overkill. simpler exist? get content of post , feed fput: $myfile = "myxml.xml"; $fh = fopen($myfile, 'w') or die("there error, accessing requested file."); fwrite($fh, get_the_content()); fclose($fh);

html - Using bottom with position relative? -

i trying series of <a> tags appear @ base of parent <li> . the problem 2 fold. if use position: relative , bottom: 0; has no effect. if use position: absolute , <li> 's have overlapping widths. i can fix first problem using top style, not ideal text size unknown, , top element measure top of both elements (so base of element not hit base unless knew font size). i can fix second defined widths, add unwanted white space on elements shorter titles. here jsfiddle of issue. try bit of css: #main-menu li a{ display: table-cell; position: relative; vertical-align: bottom; height: 111px; } jsfiddle of working style

java beginner if/else if problem -

something seems going wrong block of code tries set string variable, no matter when run program, dialog box shows otto. know i'm doing wrong here? thanks, ravin import java.awt.flowlayout; import java.awt.event.actionlistener; import java.awt.event.actionevent; import javax.swing.joptionpane; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpasswordfield; import javax.swing.jtextfield; public class smalltingz extends jframe { private jlabel item1; private jtextfield tf; private jtextfield tf2; private jtextfield tf3; private jpasswordfield pf; public smalltingz() { super("the title"); setlayout(new flowlayout()); jtextfield tf = new jtextfield("cool beans"); jtextfield tf2 = new jtextfield("uncool beans"); jtextfield tf3 = new jtextfield("hot beans"); jpasswordfield pf = new jpasswordfield("password"); add(tf);

algorithm - Search based on Second value in a map -

i have mapping of string id -> object . apart merely having insert , delete map, need find id lowest x-value (x-value member in class object instantiated). initially thought create mapping x-value -> string id this. not much, because in case of remove operation, have anyway search second map particular id (so main problem now). any suggestions efficiently? (time wise - memory not big constraint) edit: think x-value id (for removal function) , remove second map using x-value. thing here - x-value float. idea use float key in map ?? maybe using fabs , precision value trick here floating point comparisons ? edit #2: unfortunately remembered why above method might not work (i busy other stuff , forgot project while). x-value different map entries need not unique. string id primary key. need use multimap , use equal_range. your solution of using auxiliary map isn't bad post suggests. it true removal operation require lookup in second map. however, lookup c

jquery - Force invisible text fields to have a value of "0" or "" -

i know kind of cludgey, close solution had post this. i have form 2 checkboxes toggle whether or not relevant spans visible. num_bw , num_c spans contain input boxes user puts how many of 2 types of products user wants. worried, though, user might put number text field that's temporarily visible (say first one, in num_bw span), change mind , uncheck check box , put number box in num_c span instead. the way code works, num_bw field invisible- still contain number! if hits submit, user might surprised see 3 black & white products no longer wants still in shopping cart! woops! so need check if of these 2 text fields (their names orderquantitybw , orderquantityc, can add id's if need to) in span invisible (#num_bw , #num_c), , if are, turn value nothing, zero, zilch, "", whatever won't confuse shopping cart software (which isn't department, how works tad opaque me.) this in head, makes these spans invisible @ start: $(document).ready(functio

javascript - check toggle and check default -

anybody have better way write jquery method. if user comes page , checkbox checked, show else hide, if user clicks checkbox display. $('#rush').is(':checked') ? $("#rushjustificationcontainer").show() : $("#rushjustificationcontainer").hide(); $('#rush').click(function() { $("#rushjustificationcontainer").toggle(this.checked); }); use this document.ready(function(){ mytoggle($('#rush').is(':checked')); } $('#rush').click(function(){ mytoggle(this.checked); } function mytoggle(ischecked) { if(ischecked) { $("#rushjustificationcontainer").show(); } else { $("#rushjustificationcontainer").hide(); } }

ruby on rails - How can i use pik in win7? -

i using windows rails.i installed pik maintaining different versions of ruby. there possibility create gemsets in pik in rvm?if not how can install different versions of rails? please me..thanks in advance!!! pik saved life. i've been using rails 2.3.8 @ work. wanted try new rails 3.1 personal use. told me install railsinstaller. screwed rails 2.3.8 settings. here's did. i went rubyinstaller. downloaded installer versions ruby 1.8.7-p302 , ruby 1.9.2-p290 installed them. i installed both versions of ruby then installed gem pik (see https://github.com/vertiginous/pik ) now, can switch between ruby 1.8.7 , 1.9.2 using pik pik 187 (switches ruby 1.8.7) so, switched ruby 1.8.7. , installed rails 2.3.8 gem install rails -v 2.3.8 then said pik 192 switched ruby 1.9.2. said gem install rails -v 3.1.0 now use rails 2.3.8 have pik 187. not switches ruby 1.8.7 switches rails 2.3.8 i not ruby or rails expert. key remember need have right ruby version selected w

css - Adding a character after the first element of a list -

i have wordpress list 2 elements , add simple character, "-" after first element of such list. possible pseudo-elements in css? what i'd need tell css add :after :first-child of list. is @ possible? thanks in advance! alex it's possible in css: li:first-child::after { content: "-" }

oop - What javascript object pattern is this example using? -

i'm making javascript/canvas game , saw example on css tricks. here's link http://css-tricks.com/9876-learn-canvas-snake-game/#comment-100804 anyways, i'm wondering because i'm refactoring game code, , creating own objects , far looks pattern using. to me, looks revealing module pattern read on http://addyosmani.com/resources/essentialjsdesignpatterns/book/ so right? /* note: snippet example, go link see finished example */ var js_snake = {}; js_snake.game = (function () { var ctx; js_snake.width = 200; js_snake.height = 200; js_snake.blocksize = 10; var framelength = 500; //new frame every 0.5 seconds var snake; function init() { $('body').append('<canvas id="jssnake">'); var $canvas = $('#jssnake'); $canvas.attr('width', js_snake.width); $canvas.attr('height', js_snake.height); var canvas = $canvas[0]; ctx = canvas.getcontext('2d'); snake = js_snak