Posts

Showing posts from August, 2011

Grails MissingMethodException: createCriteria in WAR, Runs Locally -

i have grails app pretty vanilla. domain objects on controllers. runs fine when using locally using run-app or run-war. when create war file using grails war , deploy tomcat 7.0.25 webapps directory, following: error 500: internal server error uri/apps2/mrimetricadjustment/teamresultadjustment/list classgroovy.lang.missingmethodexception messageno signature of method: com.thrivent.mriadjustment.domain.teamresultadjustment.withcriteria() applicable argument types: () values: [] possible solutions: withcriteria(groovy.lang.closure), withcriteria(java.util.map, groovy.lang.closure), createcriteria() withcriteria() domain method , error on domain objects. have tried manner of clean, refresh dependencies, various environment switches on war build (as in grails prod war). i've totally blown away app on tomcat , redeployed. nothing. i'm working in groovy grails tool suite 3.1.0, grails 2.1.1. appreciated. adding stack trace , code issue gets hit. same plac

android - Improper placing of relativelayout fields -

only textview1 appearing on screen, button , edittext box not appearing. please check code. new android development. believe placement of edittext , button incorrect. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/textview1" /> <edittext android:id="@+id/edit_message" android:layout_width="match_parent" android:layout_height="10dp" android:layout_alignparentleft="true"

jsf - JPA update one to one association object leads to duplicate entry exception -

i using jsf 2.0, tomcat 7.x , eclipselink jpa-provider. want update entity instance onetoone association, more precisely booking got user property named booker. unfortunately if invoke updatebooking() api-method, eclipselink want create new booker instead of using exisiting user. eclipse console stacktrace , relevant code snippets added - in advance hints! stacktrace: caused by: exception [eclipselink-4002] (eclipse persistence services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.databaseexception internal exception: com.mysql.jdbc.exceptions.jdbc4.mysqlintegrityconstraintviolationexception: duplicate entry '1' key 'email' error code: 1062 call: insert user (email, name, password) values (?, ?, ?) bind => [3 parameters bound] query: writeobjectquery(logstring user - id: 1; name: 1; email: 1;) @ org.eclipse.persistence.exceptions.databaseexception.sqlexception(databaseexception.java:324) @ org.eclipse.persistence.internal.databaseaccess.datab

python - RedisQueue working running with a Flask Application -

i'm trying use redisqueue simple way run async job processing application. however, when worker tries run job in flask application, barfing running outside of app context i.e. working outside of application context def your_task(): app.test_request_context(): #your code

silverlight 5.0 - How can I export to excel when creating an application that works in the browser for Lightswitch? -

how can export excel when creating application works in browser lightswitch? there libraries can use export browser application. try out aspose , example.

visual studio 2012 - single intellisense file for multiple js function files? -

i have functions1.js, functions2.js , functions3.js. each has function, funca, funcb , funcc respectively. created file called "functions.intellisense.js" , added _reference.js. added reference _reference.js in test.js file. why doesn't intellisense work? functions.intellisense.js intellisense.annotate(funca, function () { /// <signature> /// <summary>function a</summary> /// </signature> }); intellisense.annotate(funcc, function () { /// <signature> /// <summary>function a</summary> /// <param name="message">message</param> /// </signature> }); _reference.js /// <reference path="functions.intellisense.js" /> functions1.js function funca() { alert("this function a"); } functions3.js function funcc(message) { alert("this function c " + mesage); } test.js /// <reference path="scripts/_reference.js

java - How to write files from Android to PC and back? -

the situation: client has android phone not activated use cellular services , office not have wifi. wants me write him simple customized contact list can view names , phone numbers of people(already completed). however, wants desktop client (done in java) can update contacts, bit older , prefers using standard sized keyboard instead of slider keyboard on phone.(this completed well). i need complete class app read file on pc's local hard drive , update contacts file on sd card. options: far can tell, option in case use usb port phone. have desktop client write contacts file sd card on android device. question: can use usbmanager class have app: 1. xml contact file on pc. 2. read file on pc , update file on sd card. additional information: client's phone model: motorola droid ii global android os version: 2.3.4 perhaps may easier have desktop client access sdcard , write files android device. willing review concepts , ideas process. thank you. if

How do I setup a 'type' table association in Rails? -

i'm sure has been asked (and answered) in numerous locations, , it's don't know how ask properly. here's issue, i'm trying setup simple product producttype association. i'm new ror, , since there's many builtin helpers in rails i'm looking solution instead of building out hand. this have models (i'm quite confused how/when use singular/plural descriptors in rails). product.rb class product< activerecord::base attr_accessible :name has_one :product_tpe end pruduct_type.rb class producttype< activerecord::base attr_accessible :name belongs_to :product end this wrong (i think don't understand belongs_to: method enough). in usual sql relationships product table linked many 1 relationship product_types table. i'm getting error: sqlite3::sqlexception: no such column: product_types.product_id: select "product_types".* "product_types" "product_types"."product_id" = 1 limit 1 si

c - Segmentation fault when checking if (char == '\n') -

i have been struggling on hour , can't seem find out why error. int inp, count; char numbuff[21]; count = 0; while((inp=getchar()) != eof) { // value (last field) printf("input '%c'\n", inp); if (inp == '\n') break; if (inp == ' ') { continue; } numbuff[count++] = inp; printf("go through loop\n"); } printf("out!"); numbuff[count] = '\0'; if input 1013 following input '1' go through loop input '0' go through loop input '1' go through loop input '3' go through loop input ' ' segmentation fault (core dumped) the thing can gather is failing when check if inp == '\n' why? moved go through loop printf after check if inp == '\n' , never reached 1 either know occurring there. you gather error in loop, how know? did try using debugger - useful tool pinpoint crash occurs , allow examine state of program. dollars donut

javascript - Return void(0); vs return; interrupting functions -

this question has answer here: what “javascript:void(0)” mean? 11 answers i ran across code interrupts function return void(0); . i believe being used return undefined can done writing return; . does return void(0); serve additional purpose, or 2 different ways interrupt function? return void(0); doesn't special. returns undefined , albeit in silly way. it's case of original developer not understanding javascript fully.

windows - Create a new WinRT Projection? -

i wondering if knows of resources for, or has experience creation of winrt language projection. doing research on take create projection haskell. have found blogs , videos on existing projections , mention concept of creating new projections other languages, have not been able find on start in creating one. understand bit of how com works , have been getting familiar winrt api exposed c++/cx. thanks.

Sql Stored Procedure while loop -

example of data: id name parentid 1 parent-1 null 2 parent-2 null 3 sub 1 4 child-1-1 3 5 child-1-2 1 6 child-2-1 2 now if search name '%child-1%', want following records: row-1, row-3, row-4 , row-5 in above data. kind if stored procedure can write returns me disctinct rows? my idea if search text, continue selecting records table until parentid null. if search 'child-1', basic sql query returns row-4 , row-5. procedure shud check in loop row-4 has parentid not null, gets row id= parentid of row-4 3. gets row id = parentid of row-3 1 , gets row-1. parentd of row-1 null stops. i using stored procedure implement search functionality in tree view in want keep parent-child hierarchy after search. so far have tried new stored procedures: use dbname go declare @parentid int declare @myresultset cursor set @myresultset = cursor select parentid mytable name 'child-1%' open @myresultset fetch next @myresultset @parentid

android - Intent within onUtteranceCompleted method not working -

i trying implement intent take user home screen once texttospeech function completes, isn't working, , i'm not sure why. here code: public void playtext(){ string text = typenewmessageedittext.gettext().tostring(); hashmap<string, string> myhashrender = new hashmap<string, string>(); myhashrender.put(texttospeech.engine.key_param_utterance_id, "completed"); tts.speak(text, texttospeech.queue_flush, myhashrender); } @override public void onutterancecompleted(string utteranceid) { if (utteranceid.equals("completed")){ intent displaymainactivity = new intent (this, mainactivity.class); startactivity(displaymainactivity); } }

css - Fade input text jquery -

i'm trying create elegant reset feature on site such when user presses reset button, input boxes fade out user input text , fade in placeholder text, ready text re-entered. $.each($('input.search-box'), function () { var $input = $(this); // fade out text - fades whole element.. don't want $input.animate({ opacity: 0 }, 1000, function () { // reset default value $input.val(""); // fade text in $input.animate({ opacity: 1 }, 1000) }); }); the above shows trying achieve.. fades whole input out in. please tell me how achieve effect on text? many thanks, cam. i thinking in animate value text color background input color jquery doesn't support color animations you'll need color plugin or, jquery ui . both allow use syntax you're using properties background-color , color. like seen on here

Remove dropdown selector from MIT jQuery clock -

i found jquery clock online (it's brilliant, should grab it!) i'd display time without having select dropdown (see example at: http://www.robertmeans.com/clock ). know absolutely nothing jquery. how might go modifying clock displays time without having make selection? i'd able put whatever utc offset want , make clock print time. <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js</script> <script type="text/javascript" src="scripts/jclock.js"></script> <link rel="stylesheet" href="css/homepage.css" /> <script type="text/javascript"> $(document).ready( function() { $("#zones_australia").change(function(){ if ($('#time-cont .time').length>0){ $('#time-cont .time').remove();} var offset = $(this).val(); if (offset == '') return;

arrays - How to use variable from class inside method in java -

so have write minesweeper game assignment. if made class board, containing 2 2d-arrays, 1 board value , 1 holding whether user had clicked there or not clicked. wrote methods arguments of 2 2d-arrays. how call arrays in main class? public class board { int x; int y; public char[][] board; public char[][] reveal; board(int x, int y){ board = new char[x][y]; reveal = new boolean[x][y]; } } public class mine{ public static void main(string[] args){ board gameboard; gameboard = new board(5, 5); ??? board.printboard(board, reveal); } } public void printboard(char[][] board, boolean[][] test){ for(int i=0; i<=board.length; i+=1){ for(int j=0; j<board[i].length; j+=1){ if (test[i][j]==true){ system.out.print(board[i][j]); } else { system.out.print('?');

virtualization - virtual clock speed throttling on linux -

throttling @ execution , display speed of particular process, example, game, flash game, or opengl game. want able slow down 20% or 0.5%. not possible on host space in linux. but linux supports 2 kernel-level virtualisation environments: kvm , lxc . question: possible provide fake system clock virtual lxc or kvm machine flash game running in guest not run faster set run? some choices: qemu brake patch (will require work apply no doubt.) bochs has ips=nnnn define cpu "instructions per second". cpulimit tool limiting cpu usage of process (does not require virtualization.) update: want this: https://superuser.com/questions/454534/how-can-i-slow-down-the-framerate-of-a-flash-game

javascript - Customize text for invalid fields in HTML -

i trying display customized message when text entered not match pattern. following code have used. <input pattern="[a-za-z0-9]" name="firstname" id="firstname" required="" type="text" /> when enter valid text 'akshay'; showing me invalid message 'please match requested format' also, want change message customized one. tried using code given above not working. below code have used below: <script> document.getelementbyid("firstname").addeventlistener("invalid", function (e) { var elem = e.target; if (elem.value != "") { e.target.setcustomvalidity('cannot contain special characters'); } }); </script> please me code. try use oninvalid method in input tag <input pattern="[a-za-z0-9]*" name="firstname" id="firstname" required="required" type="text" oninvalid="oninvalid="this.setcu

html parsing - XPATH exclude more than one element/tag -

i having issues trying extract text between 2 div tags in xml. imagine have following xml: <div class="default_style_wrap" > <!-- body starts --> <!-- irrelvent data --> <div style="clear:both" /> <!-- irrelvent data --> <div class="name_address" >...</div> <!-- irrelvent data --> <div style="clear:both" /> <!-- irrelvent data --> <span class="img_comments_right" >...</span> <!-- text want --> 2 members of expedition 35 crew wrapped 6-hour, 38 minute spacewalk @ 4:41 p.m. edt friday deploy , retrieve several science experiments on exterior of international space station , install new navigational aid. <br /> <br /> spacewalkers' first task install obstanovka experiment on station's zvezda service module. obstanovka study plasma waves , effect of space weather on earth's ionosphere.

php - Wordpress - Trying to remove stubborn title -

i have tried removing title methods find on stackoverflow , wordpress support such pacing css rule , finding get_title in page, single , template php files. title doesn't seem want go away. the way have had success using plugin removes title faced problem spacing remains title once was. here picture showing mean: http://i.imgur.com/vj0vbc7.jpg thanks in advance help! you need go template file , remove title being outputted. i checked source code on site , looks theme files not in regular place. this. go ftp client , open up: /assets/956/themes/header.php it might named different. now within theme locate h1 tag. @ point recommend removing it, saving it, , making sure have desired change. should gone page. if it's not, perhaps h1 tag located in file? check other template files till find right one. you can remove or surround in div id='homepg-h1' rule in css: #homepg-h1 { display:none; } hope helps, let me know if have questions.

ios - Smooth scaling of vector graphics in UIView -

so have subclassed uiview , added drawing code. scaling resulting view , down. view resolution independent legible @ size, , won't need manage multiple images etc. etc. as test made bit of drawing code looks this. creates concentric ovals fit within whatever frame size uiview has. outside ring little smaller frame isn't clipped. fine this. actual graphic more complex , contain text must readable @ small sizes , things of nature. - (void)drawrect:(cgrect)rect { uicolor* color = [uicolor colorwithred: 0.833 green: 0.833 blue: 0.833 alpha: 1]; float width = self.bounds.size.width; float height = self.bounds.size.height; float scalepercent = 0.8; for(int = 0; < 10; i++){ width = width * scalepercent; height = height * scalepercent; float x = (self.bounds.size.width - width) / 2; float y = (self.bounds.size.height - height) / 2; uibezierpath* ovalpath = [uibezierpath bezierpathwithovalinrect: cgrectmake(x,

Rails, Failed assertion, no message given -

when trying write unit test models keep getting same error , cant seem fix it. this test: require 'test_helper' class producttest < activesupport::testcase test "product attirbutes must not empty" product = product.new assert product.invalid? assert product.errors[:title].any? assert product.errors[:description].any? assert product.errors[:price].any? assert product.errors[:image_url].any? end test "product price must positive" product = product.new(title: "my book title", description: "yyy", image_url: "zzz.jpg") product.price = -1 # line number 19 below assert product.invalid? assert_equal ["must greater or equal 0.01"], product.errors[:price] product.price = 0 assert product.invalid? assert_equal ["must greater or equal 0.01"], product.errors[:price] pro

MySQL to read relational algebra? -

i'm trying mysql take relational algebra input not accept projections , forth symbols. for example Πstarter, ender, pointsstarter, pointsender, debatedate (contest) i errors projection not accepted. i have (Πstarter, ender, pointsstarter, pointsender, debatedate(σpointsstarter>=pointsender(contest))) |> contest.starter=debater.name (σclub=’plato’(debater)) mysql not accept it, thoughts? valid mysql input in form of sql queries, not relational algebra expressions. although, if did, quite interesting. edit: ra piece of java software converts relational algebra sql queries, if you'd go down path.

data structures - java file input pair of numbers linkedlist -

i've been looking around , can't seem find best answer problem i'm doing. have .txt file need read in, looks little this: 1,10 5,16 2,7 4,12 3,19 now i'm supposed create linked list fine, biggest problem i'm not sure how read in pair, first number represents process id , second amount of time takes before termination. want parseint string , grab each 1 separately before , after comma, or there easier way @ doing this. can't use arraylists either. scanner fin = new scanner(new filereader(file)); while(fin.hasnext()){ int s = fin.nextint(); this have got far reading file in is need? scanner fin = new scanner(new filereader(file); string pattern = ","; fin.usedelimiter(pattern); while (fin.hasnext()) { string s = fin.nextline(); string[] arr = s.split(pattern); int processid = integer.parseint(arr[0]); int time = integer.parseint(arr[1]); }

java - Which one is better in calling a function: two times or storing the result in a variable? -

i have got doubt many times, didn't figure out correct soltion. time want clear off. have situation like 1. string snumber="ksadfl.jksadlf"; if(snumber.lastindexof('.')>0) //do ... ... if(snumber.lastindexof('.')>1) //do ... 2. int index = snumber.lastindexof('.'); if(index>0) //do ... ... if(index>1) //do ... what trade offs between first way , second way? 1 better in storing result in variable or calling function 2 times? in example, 2nd form better (in plausible situations 1 ) performance perspective, , (imo) more readable. in general, there couple of trade-offs consider: is readability more important efficiency? how of "performance hit" call method twice versus once? also, need consider cases method may have side-effects, , whether may give different answer on 2 successive calls. in cases, calling method twice semantically different calling once , storing result in temporary variable. 1

PHP Session Variable Bug? -

i have run bizare issue php sessions driving me nuts. here gist of doing $tout = time(); session_start(); $_session['dna'] = md5($_server['http_user_agent']); if (1 == $user->demo) $_session['demo'] = $user->demo; $_session['tout'] = $tout; this appears work fine. however, variant $tout = time(); session_start(); $_session['dna'] = md5($_server['http_user_agent']); if (1 == $user->demo) { $_session['demo'] = $user->demo; $tout += 900; } else $tout += 7200; $_session['tout'] = $tout; trashes entire $_session array. briefly, trying keep track of when user session stated on each subsequent interaction server establish whether session should marked being timed out , user informed accordingly. timeout should 900s in demo mode , 7200s otherwise. perhaps there issue integer arithmetic on 32 bit local wamp server though doubt since simple test script arithmetic , echo result works.

javascript - How to adjust number rows in HTML table based on window size and swap data at timed intervals? -

i have set of tuples display in table. if there more tuples fit in window, cut table short , display many tuples (rows), , swap data out @ periodic intervals (allowing data shown on projector screen example). i can monkey around javascript enough if knew start, don't have experience programming in browser. i.e. i'm not sure start looking. use tabe width , row width percentage like, <table width='100%'> <tr> <td width='10%'></td> .................. <tr> </table>

html - Display the result of a javascript function in a div element -

i have javascript function following: it takes value list box user selected , assigns value variable it takes number user selected in listbox , stores in variable. it multiplies value number total finally adds 15% vat total the grand total displayed in alert box however instead of displaying result in alertbox display result in div element on webpage under form. ideas how can accomplish this? my code looks follows: <script type="text/javascript"> function calc() { var total = 0; var course = 0; var nroflessons = 0; var vat = 0; course = number(document.getelementbyid("course").value) nroflessons = number(document.getelementbyid("nroflessons").value) total =(course * nroflessons) vat = total * 0.15 total = total+ vat; window.alert(total) } </script> <form id="booking"> <strong>course: </strong> <select id="course"> <optgroup label="english courses"> <option

javascript - how to extract data from JSON when JSON object is name is not atomic -

the following simple json object created using xstream. valid javascript object. actualy want ask how access first persons information id ,username, password etc.but when view file in browser displayed webpage not showing "21". expect page should display 21. <!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head> <title></title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script> var obj = {"records":[ {"beans.person":[ {"id":21,"name":"name21","username":"username21","password":"password21","age":41,"sex":true}, {"id":22,"name":"name22","username":"username22","password":"password22",&q

Javascript-PHP - assing a concatenated string to a variable -

i want include variable between 2 strings , assign new variable. tried var row="<tr><td>".$i."</td></tr>"; and var row="<tr><td>"$i"</td></tr>"; and var row="<tr><td>$i</td></tr>"; and var row=$("<tr><td>$i</td></tr>"); and var row=$("<tr><td>"$i"</td></tr>"); and var row=$("<tr><td>".$i."</td></tr>"); but none of previous works. there way that? you mixing js & php. php: $row = "<tr><td>" . $i . "</td></tr>"; or $row = "<tr><td>$i</td></tr>"; javascript: var row = "<tr><td>" + + "</td></tr>";

Android - Drawable filter color on alpha channel -

i got drawables android resources , want change there colors , alpha channel solid (the images have opacity). tried use setfiltercolor change color , alpha channel still half transparent. how can change opacity too? i found class colormatrixcolorfilter

Only available via iframe -

is there way of making webpage available through iframe? if go directly iframe source wouldn't able see content, if view site through iframe would able see content. a jquery or javascript solution perfect, , do have power edit source. try adding in head of webpage <script type="text/javascript"> if (top === self) { alert('sorry ! webpage accesible via iframe') //if current window topmost window window.close(); } else { alert('well done'); } </script> self means current window , top means browser's topmost window

vb.net - Unintelligent textboxes in VS2008 -

i have winform in vb.net application. has between 4 , 7 multiline textboxes. want able copy , paste information or out of textboxes appears impossible. there no right-click cut copy or paste available , keyboard shortcuts not work either. the properties of textboxes enabled, visible , have shortcuts enabled can please? create first contextmenustrip. add new menuitem: 'paste', set menuitem's shortcutkeys property ctrl+v. set (rich)textbox -> contextmenustrip property created menu control. handle 'paste' menuitem click event. try result.

associations - how to set foreign key through the controller in rails? -

i've got address form nested user form cant foreign key fill. i've seen people suggest using hidden field, seems bad idea security standpoint. how set foreign key using controller? right i'm getting address user can't blank error when try submit mvc below user\new.html.erb <div> <%= form_for(@user) |f| %> <%= render 'shared/error_messages' %> <%= f.label :rank %> <%= f.text_field :rank %> <%= f.label :firstname, "first name" %> <%= f.text_field :firstname %> <%= f.label :lastname, "last name" %> <%= f.text_field :lastname %> <%= f.label :middleinitial, "middle initial" %> <%= f.text_field :middleinitial %> <%= fields_for :address |a| %> <%= a.label :address %> <%= a.text_field :address %> <%= a.la

iphone - UILabel with dynamic height not working for same string in iOS -

i using below code in application dynamic height uilabel. cgsize maximumlabelsize = cgsizemake(231, flt_max); cgsize expectedlabelsize = [labelstring sizewithfont:self.verblabel.font constrainedtosize:maximumlabelsize linebreakmode:self.verblabel.linebreakmode]; //adjust label the new height. cgrect newframe = self.verblabel.frame; newframe.size.height = expectedlabelsize.height; self.verblabel.frame = newframe; return newframe; my labelstring if asked controversial public figure? ideas might he/she suggest? i'm able show whole string cut text. how can solve ... please me , let me know if doing wrong. set numberoflines 0 allow number of lines. label.numberoflines = 0;

javascript - Handlebars precompilation via nodejs fails on Cloud9 -

i using handlebars template precompiler express ( https://github.com/diffsky/hbsc ) precompile templates in nodejs. it works great when localy when try in cloud9 ide ( https://c9.io ) works first time , exceptions. this configuration app.js var hbsc = require('hbsc'); hbsc.compile({ dir: __dirname + '/views/public', outfile: __dirname + '/public/javascripts/compiled-templates.js', extensions: ['hbs', 'handlebars'] }); this simple template <b>all users</b> <div> {{#each this}} <li>{{email}}</li> {{/each}} </div> and exception getting /var/lib/stickshift/5168822b4382ec505c0000ba/app-root/data/471704/views/public/listusers.handlebars:1 (function (exports, require, module, __filename, __dirname) { <b>all users</b> ^ syntaxerror: unexpected token < @ module._compile (module.js:437:25) @ object.module._ex

hadoop - How to configure hbase using cygwin? -

Image
i have configured hadoop in cygwin m trying configure hbase have made changes in hbase-evn.sh as: export java_home=c:\\java\\jre export hbase_classpath=c:\\cygwin\\usr\\local\\hbase\\lib\\zookeeper-3.3.2 export hbase_regionservers=c:\\cygwin\\usr\\local\\hbase\\conf\\regionservers export hbase_manages_zk=true and changes in hbase-site.xml <property> <name>hbase.rootdir</name> <value>hdfs://localhost:9100/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.zookeeper.quorum</name> <value>localhost</value> </property> <property> <name>dfs.replication</name> <value>1</value> </property> now when m stating hbase services using command bin/start-hbase.sh output as: can u me resolve problem .

facebook - How to pass variables in PHP page to another page without using form? -

my project using related facebook. when user login $user variable in page know variable other page no. want know how pass variables using php without form? trying declare session not possible because it's in if condition <?php if ($user): echo 'name:'. $user_profile['id']."<br />"; echo 'name:'. $user_profile['name']."<br />"; else: ?> $user_profile['id'] want pass other page. try apc .. use 1 on first page <?php $bar = $user_profile['id']; apc_store('foo', $bar); ?> and on other pages <?php apc_fetch('foo'); ?> use alternative php catch .reduce 50% time sessions apc functions apc_store — cache variable in data store apc_fetch — fetch stored variable cache

seo - putting javascript after </html> tag -

gtmetrix showing me defer parsing of javascript seo purpose of website for searched forums, google etc., got should placed after tag in template head.php file but if cut , paste javascript file call head.php file , if unpublished specific module load or not? and there many javascript files in modules loading on specific condition checking , if put files default in head.php, cause problem? and i'm using joomla 1.5 framework please me, i'm stucking on problems since many days not getting proper solution. thanks, rahul seo crawlers don't care place javascript. looks trough whole page information. lots of people add javascript in head it's located in same place. the best place putting javascript @ end of file, because of users visit page. browser can render page while javascript still not needed(most of pages). javascript should put in own file, because browser can cache .js file request. way page loads faster , uses less bandwidth.

navigation - ASP.NET Back Button for multiple forms -

i trying track navigation between number of web forms in asp.net. i've tried client side navigation using following: <asp:button id="backbutton" runat="server" text="back" onclientclick="javascript:window.history.back(1);return false;" /> unfortunately not work scenario due postbacks going on. scenario has number of web forms: page1.1 page1.2 page2 page3 navigating forward through pages works wizard. there 2 starting points - page1.1 , page1.2. page1.1 -> page2 -> page3 page1.2 -> page2 -> page3 so clicking buttons have following navigation: page3 -> page2 page2 -> page1.1 page2 -> page1.2 there additional parameters passed between pages need maintained. i looking @ maintaining in session maintain current call stack works however, getting build of referrer urls. @ minute trying conceptualise this. i running in sharepoint application pages, each page asp.net page sake

design patterns - Where to put the logic for delete queries -

i have seperated model logic "entity", "mapper" , "service". started of putting database delete queries in mapper, more think it, feels service. i'm unsure though, mayby there other layer don't know of make more sense. precisely place logic physical changes database depends entirely on particulars of design. if have update , insert statements in "mapper", having delete entirely appropriate. conversely, if they're in service, having them there entirely appropriate. what's important software makes sense, not adheres else's stated model. (although, fwiw, expect "entity" classes unaware of physical database, "mapper" classes translate db result sets , entity classes, , "service" classes contain actual db code, select , update insert , delete.)

algorithm - How can I divide a rectangular area into smaller rectangles that represent a percentage of the total area? -

Image
basically i'm trying "nice" image small rectangles add big rectangle, kind like: *later edit clarify things: i want able draw in piece of software. so, need closer algorithm. all need rectangles. don't need them have predefined proportions rectangle. between square , 3:1 width/height (or height/width) fine. extremely naive approach divide width of enclosing rectangle percentage enclosed rectangles have create thin slices , of smaller percentage rectangles drop bellow 1px. i need find way split rectangles on multiple rows. *second edit: problem solved . looking treemap algorithm (as pointed out phpdna ). once had keyword able find couple of python implementations satisfied requirements. treemap algorithm can pack smaller rectangles map. can recursively subdivide plane smaller tiles example splitting plane along 2 axis , save result tree.

PHP - Dynamic URL -

i have link live video stream. http://xxx.xxx.xxx.xxx:xxx/live/stream.m3u8 i need make dynamic link changes can hide / secure ip users of web page. i see suggestions making hash out of secret word , users ip this: $token = somehash($ip_address . $timestamp . $secret); $url = 'http://site/' . $token . '/' . $timestamp . '/filename'; my question is... how link work? you end link not point resource. http://mysite.com/hash-code/time-stamp/filename that link wont work because not valid url. any tips? thanks understand this, need considerably complex logic routing part. might advisable implement php framework handle custom routing you, such fuelphp or laravel 4 . in laravel 4, example, define route this: route::get('streams/{token}', 'streamcontroller@showstream'); then define controller app/controllers/streamcontroller.php action this: [..] class streamcontroller extends basecontroller { [..] public f

html5 - How to programmatically change the text of an anchor tag in a JSP -

i able change text of anchor tag based on value of status field. on pageload student-status set ajax request. after check status , see if active, hyperlink should "deactivate" otherwise activate. below doing test hardcoding status field active. use value in id =student-status. there way set status variable similar $("#student-status).text() example here below: <tr> <td>status</td> <td id="student-status"></td> <c:set var ="status" scope="session" value="active" /> <!-- want value td --> <c:choose> <c:when test = "$(status == 'active')"> <td class="new-student-status"><a id="activate-deactivate-student" href="#">deactivate</a></td> </c:when> <c:when test = "$(status== 'inactive')"> <td class="new-student-status"><a id="activate-de

linkedin - Addthis linked is pop up window not working -

i trying implement add code site , open facebook,twitter,linkedin , email windows pop when 1 click on buttons . using cutomized buttons here . other except linked in works perfect , linked not opening in pop window instead opens seperate tab window. how can solve ? please see code here <html> <head></head> <body> <!-- addthis smart layers begin --> <!-- go http://www.addthis.com/get/smart-layers customize --> <script type="text/javascript" src="//s7.addthis.com/js/30 /addthis_widget.js#pubid=sunilkumarpkerala"></script> <!-- addthis smart layers end --> <div class="addthis_toolbox addthis_default_style"> <a class="addthis_button_facebook"><img src="http://mysite.com/workshop/shareimages/facebook.png" width="32" height="32" border="0" alt="facebook" /></a> <a class="addthis_button_twitter"

c# - Using a generic type argument in place of an argument of type System.Type. Is it a smell? -

i see (in many mocking libraries example) methods generic type argument used in place of argument of type system.type . talking cases generic type being used in typeof(t) operation (i.e. no instance of type t being used anywhere within method, , t not being used either return type or other arguments). for example consider following method: public string gettypename(system.type type) { return type.fullname; } this method accompanied generic version: public string gettypename<t>() { return gettypename(typeof(t)); } questions bad practice or practice? syntactic sugar or there more it? i see misusing language feature abbreviate call method accepts argument of type system.type would consider smell? should avoided? or practice (to provide generic method shortcut avoid typing typeof() ). here practical issues using pattern can think of: if argument of non system.type type added - method might need rewritten (if order of arguments semantically significant)

java - Selenium and Chrome Console -

we creating animation product in html5/css. animation connect node.js server , reply event animations based on event id sent node. now, testing purposes, pass in event id animation while not connected node. so example, open chrome console , enter "test.sendevent(1024)" replies event 1024 on animation. how can use selenium send "test.sendevent(1024)" message through console animation?? cheers regards j what need javascriptexecutor object, can driver you're using. se more info: http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/javascriptexecutor.html

websphere - Maven 3 archetypes for WAS 8 or Liberty -

are there maven archetypes websphere 8 , webshpere liberty. i want started on jax-rs war? there archetypes 855 , liberty 855, none jax-rs yet. to use them, need add the following repository , example, in settings.xml file. to use archetypes rad 9 or wdt 855, can open new maven project wizard , archetypes should listed in second page of wizard, if select correct catalog. most of archetypes include 1 dependency in pom.xml <dependency> <groupid>com.ibm.tools.target</groupid> <artifactid>was</artifactid> <version>8.5.5</version> <type>pom</type> <scope>provided</scope> </dependency> this dependency groups runtime libraries. if want manage runtime dependencies yourself, can remove dependency above. if have not followed steps described in link , find lot of dependencies cannot found during build because of dependency mentioned above: note: if using liberty archetypes, inst

flash - One focus event listener for all input text field in ActionScript? -

i finished of andreas. add more code default text value of targeted text field. helps me set text of targeted field default when focus out. "andreas". import flash.events.focusevent; import flash.text.textfield; input1.addeventlistener(focusevent.focus_in,inhand); input1.addeventlistener(focusevent.focus_out,outhand); //add other text input references did below... input2.addeventlistener(focusevent.focus_in, inhand); input2.addeventlistener(focusevent.focus_out, outhand); var def1:string = input1.text; var def2:string = input2.text; function inhand(evt:focusevent):void { var textfield:textfield = textfield(evt.target); textfield.text = ""; } function outhand(evt:focusevent):void { var textfield:textfield = textfield(evt.target); if(textfield.text == "") { switch(textfield.name) { case "input1": textfield.text = def1; break; case "input2": textfield.text = def2;

php - Count Rows MySQL -

[i know mysqli new standard , in process of updating, have questions old standard.] i trying count number of rows match query, add number it. $findtypes = "select * _products product_type = '$producttype'"; $querytypes = mysql_query($findtypes, $db_products); $numtypes = mysql_num_rows($querytypes); $productid = $numtypes + 100; if there existing product-type in database, there should return result of 101, if there 2 102, etc. as stands doesn't work... not sure why. thanks, your query wrong, have no from statement... try: select * _products product_type = '$producttype'

javascript - Creating a FB Notification for my app -

i'm trying create notification app when user added list item. i want post message such as: "you have been added item on app" however, cant seem work out api request make , can see how send app invites. the below code implementation return how many notifications have fbappnotification: function (user){ for(var = 0; < user.length; i++){ fb.api('/' + user[i] + '/notifications', function(response) { console.log(response); if(response.success === true){ alert('yay'); } }); } } you making call in wrong way, have provide other parameters such app access token, template etc. , app should canvas app for more details go through notifications api tutorial on developers site, have elaborated how use api example (quite simple) also making request (which default) instead of post (for have mention method explicitly) that's why instead of posting gettin

jpa - Android Studio Cloud Endpoint project Maven enhance goal fails with command line too long -

using android studio, have created android project cloud endpoint backend (tools > google cloud endpoints > generate appengine backend). initial setup works , able have android app see exposed cloud endpoints. however after adding more components appengine project (more entities, endpoints, servlets, etc) the appengine build fails during maven goal appengine-maven-plugin:enhance command line long error . upon researching this, appears goal delegates datanucleus-maven-plugin:enhance goal (please see maven mojo source code here ). when run goal command line using maven's -x option, see enhancer attempts run on classes (servlets, non-entities, etc) , command line length exceeds window's limit. the solution appears specifying specific entities enhanced. post describes how maven plugin can configured that. this seems fair enough, attempts configure plugin pom.xml have no effect. executing command line, see message datanucleus enhance goal configured it's defau