Posts

Showing posts from July, 2011

jquery - parse this JSON and create a new div for each object -

i json php script, , i'm @ point code. do, each object, insert response div. for example insert "sentences" div id="sentences" , title div id="title", , prepend, or create new 1 each new response. any tips on how proceed? <script type="text/javascript"> $(document).ready(function() { console.log("warming up..."); $.getjson("response.php", function( data ) { console.log("got json"); (var = 0; < data.length; i++) { var obj = data[i]; console.log(obj.title); } }); }); </script> here json response: { "sentences" : [ "the big irony behind scorched-earth republican offensive against president obama’s health-care law expansion of coverage uninsured benefit house districts represented republicans as represented democrats.", "regardless of other provisions consider harmful, posture unavoidably means house r

c++ - Null pointer while trying to read xml with boost -

i stumbled upon interesting problem. have managed reduce problem following code: boost::property_tree::ptree properties; boost::property_tree::read_xml("additional dependencies\\properties.xml", properties); xml: <properties> <picturegenerator> <miniatureheight>4</miniatureheight> <miniaturewidth>4</miniaturewidth> <imageheight>8</imageheight> <imagewidth>8</imagewidth> <imagepath>additional dependencies\</imagepath> <miniatures> <image>0.bmp</image> <image>1.bmp</image> <!--<image>2.bmp</image> <image>3.bmp</image> <image>4.bmp</image>--> </miniatures> </picturegenerator> </properties> when build project in release mode, runs perfectly. in debug mode following error: unhandled exception @ 0x779e8e19 in my_project.exe: 0xc0000005: access

c# - How to set value of thr root element in XML file using LinQ? -

my xml file of form: "<testfile fileext="c:\testfiles\testfile2.txt"> </testfile>" here root element "testfile". task create new xml of form query using is: xdocument doc = new xdocument( new xdeclaration("1.0", "utf-8", "yes"), new xcomment("this medtata file of file " + args[0]), new xelement("testfile",path)); but instead of "<testfile fileext="c:\testfiles\testfile2.txt"> </testfile>" , output "<testfile>c:\testfiles\testfile2.txt</testfile>" how can desired output? try this xdocument doc = new xdocument( new xdeclaration("1.0", "utf-8", "yes"), new xcomment("this medtata file of file " + args[0]), new xelement("testfile",new xattribute("filetext", path))); if wanna add value inside ad

python - How to add a way to receive a score and return a string based on the score to a function? -

thanks answers. code works fine this. def rate_score(selection): if selection < 1000: return "nothing proud of!" elif selection >= 1000 , selection < 10000: return "not bad." elif selection >= 10000: return "nice!" def main(): print "let's rate score." while true: selection = int(raw_input('please enter score: ')) break print 'you entered [ %s ] score' % selection score = rate_score(selection) print score main() however need set parameter of rate_score(selection) 0 default , add call rate_score(selection) in pass no value function. have revised code this: def rate_score(selection): if selection < 1000: return "nothing proud of!" elif selection >= 1000 , selection < 10000: return "not bad." elif selection >= 10000: return "nice!" else: sele

asp.net mvc - Handling hidden field in multiple forms in Mvc 4.0 -

i having multiple forms in 1 page , page inherits 1 single model.every form submission requires common value. so, common value stored in hidden field. hidden field kept global i.e outside of forms problem whenever submit form, hidden field coming empty.the hidden field @html.hiddenfieldfor(m=>m.fkid) , fkid of string type proprty in model i.e public string fkid{get;set;} .can please guide me how handle situation. if keep hidden field in 1 of forms , coming in controller form submission have kept it. want property set once , can use in form submissions.please me. how can sort out problem some related code <div id="tabs"> <ul> <li><a href="#tabs-1">nunc tincidunt</a></li> <li><a href="#tabs-2">proin dolor</a></li> <li><a href="#tabs-3">aenean lacinia</a></li> </ul> <div id="tabs-1"> @usi

PHP addslashes using array -

i attempting update multiple records using 1 form, have run problem in attempting use addslashes function. the form looks this: <form name="form1" method="post" action="editnewscategorysubmit.php"> <table width="405"> <tr> <td width="246"><span class="link1">news category </span></td> <td width="146" colspan="2"><span class="link1">delete?</span></td> </tr> <tr> <td> <input type='text' name='title[]' value='$title' style='width:700px;'> <input type='hidden' name='id[]' value='$id'> </td> <td> <div style='padding-left:8px;'><a onclick='return confirmsubmit()' href='deletenewscategory.php?id=$id'><img src='images/delete.jpg' border='0'></a></div> </td> &l

java - Replacing oracle's "OracleTypes.CURSOR" to an equivalent in mysql when using registerOutParameter function -

dear stackoverflow community i trying upgrade system developed in java using oracle db mysql db. i got point make use of storaged procedure java code makes use of specific oracle structure - oracletypes.cursor . please see code below. private int getuserid(string username) { int userid = -1; callablestatement cs = null; resultset rs = null; try { con = this.getconnection(); cs = con.preparecall("{call getuserid(?,?)}"); cs.setstring(1, username); cs.registeroutparameter(2, oracletypes.cursor); cs.execute(); rs = (resultset) cs.getobject(2); if (rs.next()) { userid = rs.getint(1); } } catch (exception e) { e.printstacktrace(); } { try { cs.close(); rs.close(); } catch (sqlexception ex) { logger.getlogger(dbconnector.class.getname()).log(level.severe, null, ex); } closeconnection(); ret

c++ - boost::ptr_vector and pointers -

i this: typedef x* x_pointer; boost::ptr_vector<x_pointer> myvec; x_pointer x = new x(); myvec.push_back(x); in want objects referred pointer copy constructor never invoked , want ptr_vector control memory management when whole vector goes out of scope. however, compiler complaining last line. think because i'm storing x* , not x . x contains primitive types in case asks. how can use ptr_vector store x* ? edit: error : no instance of overloaded function "boost::ptr_vector<t, cloneallocator, allocator>::push_back [with t=x_ptr, cloneallocator=boost::heap_clone_allocator, allocator=std::allocator<void *>]" matches argument list argument types are: (x_ptr) object type is: boost::ptr_vector<x_ptr, boost::heap_clone_allocator, std::allocator<void *>> myvec.push_back(x); ^ boost::ptr_vector takes class, not pointer template parameter. should create way: boost::ptr_vector<x> myvec;

Error in C for Array: error variably modified -

i error when run code: "error: invariably modified 'square_toys' @ file scope. there variable defined globally @ top of code called numoftoys , , define array toy* square_toys[numoftoys] following after. numoftoys dependent on user inputs cannot define size of array beforehand :( . have suggestions how can rid of error? int numoftoys; <------- entered through user running programin terminal struct toy * square_toys[numoftoys]; you can't use direct array in case. variable length arrays can declared in local scope. i.e. if array size run-time value, cannot declare such array in file scope. arrays static storage duration shall have compile-time sizes. there's no way around it. if array has declared in file scope (btw, why?), have use pointer instead , allocate memory manually using malloc , in int numoftoys; struct toy **square_toys; int main() { ... /* when value of `numoftoys` known */ square_toys = malloc(numoftoys * sizeof *squar

c - Converting proc/uptime to DD:HH:MM:SS -

i've read value of /proc/uptime (which time in seconds since last boot), , i'm trying convert into: dd:hh:mm:ss. , keep getting error: "lvalue required left operand of assignment make: * this code: /** * method retrieves time since system last booted [dd:hh:mm:ss] */ int kerstat_get_boot_info(sys_uptime_info *s) { /* initialize values zero's */ memset(s, 0, sizeof(sys_uptime_info)); /* open file & test failure */ file *fp = fopen("/proc/uptime", "r"); if(!fp) { return -1; } /* intilaize variables */ char buf[256]; size_t bytes_read; /* read entire file buffer */ bytes_read = fread(buf, 1, sizeof(buf), fp); /* close file */ fclose(fp); /* test if read failed or if buffer isn't big enough */ if(bytes_read == 0 || bytes_read == sizeof(buf)) return -1; /* null terminate text */ buf[bytes_read] = '\0'; sscanf(buf, "%d", &s->boot_t

java - Trying to get the final URL in Gridner using Jython script -

i working on grinder tool load testing. in script, have url follows multiple redirects , lands on particular url. want final url of request after multiple redirects using jython script grinder. doing test1 = test(1, "request resource") request1 = httprequest() test1.record(request1) class testrunner: def __call__(self): result = request1.get("https://internal.autodesk360beta.com/") result2 = result.geteffectiveuri().tostring() print result2 i getting final uri same 1 instead of long final url looks https://accounts.autodesk.com/logon?returnurl=%2fauthorize%3f .. , on.. appreciated. by default, grinder follows redirects automatically. however, can disable behavior , explicitly follow each redirect in jython code. approach you'll have access each url in redirect chain.

asp.net - C# ASP .NET; Get the NetworkCredential Object for the logged in user? -

i have implement following scenario: asp .net webapp 1. user logs in 2. logged in user's credentials have download files sharepoint site; environment: - right web.config set impersonation on, , windows auth. on, have work basic authentication - use system.net.webclient download sharepoint files using sharepoint site's web services, , webclient needs credential object, that's why need networkcredential object. p.s: credentialcache.defaultcredentials , credentialcache.defaultnetworkcredentials returns credential empty username , pw, cannot use acccessing sharpeoint site. not suitable system.security.principal.windowsidentity.getcurrent() or system.web.httpcontext.current.user.identity, because can username way, , instantiating networkcredential need uname , pw. fyi, think i've managed solve issue; i'm using impersonation context, , use credentialcache.defaultnetworkcredentials , , set webclient 's usedefaultcredentials true, , seems working far.

seo - Redirect multiple sites to one -

i in situation there many sites being merged one. want redirect former web sites new 1 worried search engine penalisation. redirects many pages bit different content , renks 1 new. what solution visitors new site , transfer rank too? addition: there 5 websites links 1 organization differs information. concrete, boy scouts, each website cowers age group within organization. same information same (addresses, names, etc.) differs. creation times different first 2001, last 1 2011. on variety of domains , subdomains. different authors, use wordpress, oldest 1 static. the new website not copy pages 1:1 merge ignores. as long redirects relevant web pages, isn't going hurt , website not going penalized google. if share more details history of old websites being redirected, , new website, can tell if that's going hurt. good solution 1:1 redirect pages instead of redirecting pages root domain.

What is the benefit by using ASP.NET MVC if I have already done webform -

i have learned asp .net webform , have created projects college on discovered asp.net mvc. tried learn seems way different in terms of how build application , there's steeper learning curve. if have done asp.net, need learn mvc taking in account future real life projects might have do? thanks. you can build web application using asp forms. mvc great, don't need learn it, if enjoy better web forms because closer how web works. believe in few years more popular regular asp forms. mvc razor gives more control on rendered html, on downside if don't know html , css easier drop asp controls. one other advantage of mvc 4, adding web api services. learning mvc must know how write these useful services.

java - JScrollPane not working with JInternalFrame -

i'm trying use jscrollpane in program. need see horizontal , vertical scroll bar when change position of internal frame. i write code (by drag , drop) below: package test; public class test2 extends javax.swing.jframe { public test2() { initcomponents(); } @suppresswarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="generated code"> private void initcomponents() { jpanel1 = new javax.swing.jpanel(); jscrollpane1 = new javax.swing.jscrollpane(); jdesktoppane1 = new javax.swing.jdesktoppane(); jinternalframe1 = new javax.swing.jinternalframe(); setdefaultcloseoperation(javax.swing.windowconstants.exit_on_close); jscrollpane1.setautoscrolls(true); jinternalframe1.setclosable(true); jinternalframe1.setmaximizable(true); jinternalframe1.setresizable(true); jinternalframe1.setvisible(true); javax.swing.g

function - reload only elements of the certain class on click - jquery -

i have function reloads page on click: $('#reload').click(function () { location.reload(); }); what should put instead of location.reload(); in order reload elements aaa class? tried $('.aaa').reload(); - doesn't work. you can use .load load contents element, i.e provided have url returns html loaded element. cannot reload element old state because html stateless unless manage state manually. $('#reload').click(function () { $('.aaa').load(url); //url returns content of html. }); or other way storing previous state of element in localstorage/cookie/data cache etc , populate on click. an example second way is: $('#reload').click(function () { $('.aaa').replacewith($('.aaa').data('cache')); //just replace 1 in data cache }); $('.aaa').data('cache', $('.aaa').clone(true)); //on load of page save current element in data cache, later use fiddle

Python v3 ( Random password generator ) -

my question is: how generate random password length varies (8 12 characters) each time generated. this code: import string import random def randompassword(): chars=string.ascii_uppercase + string.ascii_lowercase + string.digits size=8 return ''.join(random.choice(chars) x in range(size,12)) print(randompassword()) size = 8; range(size, 12) returns array [8,9,10,11] , password of length 4. instead, determine size of particular password using randint ahead of time: import string import random def randompassword(): chars = string.ascii_uppercase + string.ascii_lowercase + string.digits size = random.randint(8, 12) return ''.join(random.choice(chars) x in range(size))

python - Tweepy 2.1: Add member to a list -

using tweepy2.1, trying add member ( people ) of twitter account list ( testlist ) with: import tweepy ... api = tweepy.api(auth) api.add_list_member(testlist, people) i following error: tweeperror: [{'message': 'you must specify either list id or slug , owner', 'code': 112}] i have tried other ways of calling add_list_member function, nothing worked. also, have difficulties incomplete tweepy documentation. anyone have solution issue? you're specifying 'slug' or text label/name of list. work need provide account list owned by. can specify owner keyword arguments. api.add_list_member(screen_name='@usertoadd', slug='testlist', owner_screen_name='@mytwittername')

linux kernel - Getting the Chip Name of sensors being used in Android -

i need modify sensors driver code in android linux kernel. able logical name of sensors present in phone getevent or "sys" file system "gyro","lighsenors" etc. how can actual chip name of sensors (mxt224_ts) maps these logical names. when looked in linux driver directory, found has separate files each chip many chip can implement functionality single sensor. therefore unable identify actual file being used in device(phone). the sysfs directory has entry named name .

c# - What is the best practice for caching user data in asp.net -

when user signs in website, want cache data email, confirmation status, mobile confirmation status, etc. because don't want fetch data in each page request. requirement user must confirm email , mobile before anything. using code this: public static class cacheddata { public static bool isemailconfirmed { { if (httpcontext.current.session["isemailconfirmed"] == null) initialize(); return convert.toboolean(httpcontext.current.session["isemailconfirmed"]); } set { httpcontext.current.session["isemailconfirmed"] = value; } } public static bool ismobileconfirmed { { if (httpcontext.current.session["ismobileconfirmed"] == null) initialize(); return convert.toboolean(httpcontext.current.session["ismobileconfirmed"]); } set {

javascript - Creating links for all letters of the alphabet -

i want put alphabet on top of page. when clicks on letter, small json file containing words starting letter loaded. how create letters seperate id's on top of page, without manually typing 26 of them? i've found this code in php want achieve: for ($i = 65; $i <= 90; $i++) { printf('<a href="%1$s.html" class="myclass">%1$s</a> ', chr($i)); } how 1 in javascript? in javascript use fromcharcode var html = '', chr = ''; (var = 65; <= 90; i++) { chr = string.fromcharcode(i); html+= '<a href="'+ chr +'.html" class="myclass">'+ chr +'</a> '; }

javascript - Converting JS output to PHP variable -

here code using... (javascript injection) date.prototype.getweek = function() { var onejan = new date(this.getfullyear(),0,1); return math.ceil((((this - onejan) / 86400000) + onejan.getday()+1)/7); } var imglist = [ 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1.jpg', 'img/1

for loop - Verify the palindrome in Java. Can you help me to find what's the issue with this code -

can me find bug in code. when test string not palindrome, message palindrome. import java.util.*; public class main{ public static void main(string args[]){ string input = ""; system.out.println("enter string verify palindrome"); scanner scan = new scanner(system.in); input = scan.nextline(); main m = new main(); if(m.palindrome(input)) system.out.println(" string " + input + " palindrome "); else system.out.println(" string " + input + " not palindrome "); } private boolean palindrome(string input){ string reverse = input; int j; for(int i=0;i<=reverse.length()-1;i++){ for( j=reverse.length()-1;j>=0;){ if(reverse.charat(i)== reverse.charat(j)){ return true; } else{ return false; }

javascript - Delaying loading of resources -

my question is, there way first let website display , load heavy resources using javascript whilst preserving functionality in case javascript not available? my reason: i'm trying optimize joomla template. there pretty heavy resources oversized background images. test case features 4000px*3000px 3.01mb .png picture. although showed me this solution, cannot use since plan use background-image if there no javascript. plus have come myself... it make things lot easier if give me solid proof internet users use javascript... i'm talking 99.999%. regardless, has impact on total time until website displayed. there resource i'd use technique on, php script run joomla plugin taking 1 second respond, impacting total time. ultimately i'd control when specific resources loaded. my own attempt: thought of removing background-image style of related elements, timeline still didn't change. renders lot quicker since browser has less work do, still picture being lo

How the scala programing language run internally? -

how scala programming language run internally ? advantage of using scala on java? scala compiled java bytecode, executed same jvm runs java programs, using same jdk class library plus small scala runtime library. the advantages programmer.

ruby - Calling a method in the view controller Rails -

to generalize problem, using api returns iterable object. within id each object. controller looks this: class searchcontroller < applicationcontroller def index @search = api.find(params[:query]) end end my view this: <% @search.each |thing| %> <h2><%= thing.attr2 if thing.attr1 %></h2> <%= api.list(thing.attr2) %> <% end %> i have tried adding method class searchcontroller < applicationcontroller def index @search = api.find(params[:query]) def getlist(attr2) api.list(thing.attr2) end end end and adding index , self before definition (ex: self.getlist(attr2)) , calling in variations in view: <%= getlist(thing.attr2) %> i wondering going wrong here. have additionally tried add in helper_method line read in few docs not recognize it. also, correct way go style-wise? having hard time finding references makes me think isn&#

java - javac not working in CMD -

i'm having issue compiling java command prompt. @ first saying javac isn't recognised internal or external command , reading see need change path , thats did to... variable name: path variable value:%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;%path%;c:\program files\java\jre7\bin; i closed commpand prompt , attempted again same issue came up. i tried echo %path% , entire path line echoed(entire line in terms of variable value) i have tried "for %i in (javac.exe) @echo %~$path:i" , returns echo on. i'm quite stumped , confused now. javafile in , named main.java trying compile whilst in javawork folder in cmd c:\users\myname\documents\javawork thanks, you want path jdk , not jre, in system path. jre doesn't come compiler (javac).

data binding - How to bind a DoubleProperty to an expression? -

i have doubleproperty ( price ) , want second doubleproperty ( discountedprice ) bound price - 25% . so thought use multiply method not seem work expected: doubleproperty price = new simpledoubleproperty(); doubleproperty pctdiscount = new simpledoubleproperty(); pctdiscount.bind(price.multiply(0.75)); price.set(100); system.out.println(pctdiscount); i expecting program output 75 output is: doubleproperty [bound, invalid] doubleproperty wrapper class. actual value system.out.println(pctdiscount.getvalue()); or system.out.println(pctdiscount.get());

facebook fql - How to filter FQL queries with fields that are not indexable -

the fql query below results in noindexfunctionexception because 'current_location' not indexable. https://graph.facebook.com/fql?q=select%20uid,%20name,%20current_location%20from%20user%20where%20uid=me()%20or%20uid%20and%20current_location%20in%20(select%20uid2%20from%20friend%20where%20uid1=me())&access_token=ccaac... are there alternatives filtering non indexable fields? there no alternatives filtering non indexable fields, ibrahim faour, facebook employee has explained technical reasoning behind indexes in post .

android app install:Re-installation failed due to different application signatures -

i build app @ 1 pc , copy another, run device, tip: re-installation failed due different application signatures. actually, did not sign app . unfortunately apk have send user , them update automatically (app check version , download , call install), them failed install when update. my questions: i did not sign apk, between 2 computers, them sign automatically? how fix when copy code between pcs? i have done following post: enter link description here copy debug keystore of 1 pc in other solve problem.

javascript - changing position of background image which appears after a hover html/css -

edit: background-position change position of background image. realized actual problem facing else, can seen on thread: background image disappears when changing background-position? okay have set of links (a href's) inside unordered list, , when user hovers on them, want black background image show on top of link , change links color black. have background image shows photoshoped. here did far li:hover { color: white; background: url(../images/lihover.png); } now, problem image doesn't show want show. want link in center of image. image 3 pixels below want be. same ever link hover over, image 3 pixels below want be. there way change position of image shows , way move image few pixels above supposed be? (even if cannot css, if can write javascript function can accomplished, great). the list <ul> <li>item1</li> <li>item2</li> <li>item3</li> </ul> i think mean: li:hover { color: white; bac

How to use cookies in JavaScript to remember if user has clicked 'don't show me this again' -

Image
i have created pop dialog box prompts users either visit our facebook, twitter or click 'don't show me again' i implementing short period of time doesn't become annoying, don't want pop every time refresh page. i have looked @ cookies javascript can't seem work code. my js code looks this: function popup(div){ document.getelementbyid(div).style.display='block'; return false; } function hide(div){ document.getelementbyid(div).style.display='none'; return false; } and html looks this: <body onload="return popup('pop')"> <div id="pop" class="disablebackground"> <div id="popup"> <h1 title="social">you can find here</h1> <div class="arrow-down"></div> <br /> <a class="btn-connect-option facebook badge-facebook-connect" href="http://facebook.com" targe

android - Separating the words after the last integer in a large String -

i've seen many people similar in order last word of string: string test = "this sentence"; string lastword = test.substring(test.lastindexof(" ")+1); i similar last few words after last int, can't hard coded number , amount of words after last int unlimited. i'm wondering whether there simple way want avoid using patterns , matchers again due using them earlier on in method receive similar effect. thanks in advance. i last few words after last int.... number , amount of words after last int unlimited. here's possible suggestion. using array#split string str = "this 1 , 2 , 3 more words .... foo bar baz"; string[] parts = str.split("\\d+(?!.*\\d)\\s+"); and parts[1] holds words after last number in string. some more words .... foo bar baz

c# - WPF with MVVM and DataAnnotations, Validation Errors in a UserControl -

i have usercontrol reused throughout application developing. using framework based on mvvmlight. for sake of simplicity lets user control contains 1 textbox , exposes 1 dependency property named "quantity". textbox on user control databound dependency property "quantity". when user control used on view, "quantity" dependency property of usercontrol databound property in viewmodel. (this viewmodel datacontext of our view way of mvvmlight viewmodellocator). this works great! bindings work, properties set expect. until comes validation. we using dataannotations decorate our viewmodel properties. viewmodel contains custom implementation of inotifydataerrorinfo. have implemented custom styles input controls show red border around control, , message next control displaying validation error message. of works great in normal case (eg. textbox on view bound property in view model). when attempt same approach using user control, end red border ar

php - How to get an URL parameter with value `/` (slash) - Magento -

how url parameter value / because have value $encrypted = "dwe/oaisud"; www.test.com/test/test/index/encrypted/dwe/oaisud then want controller getparam('encrypted'); but in controller value $encrypted = "dwe"; how fix that? on magento way. $encrypted = urlencode("dwe/oaisud");

In image processing, why is it recommended to loop over Y first and then X second? -

i've read in few places when processing pixels of image, recommended loop on y , x pixels because more memory efficient. why so? a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4 d1 d2 d3 d4 supposing that's image (and sort of coordinates it's points), stored in memory in string, like: a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4 d1 d2 d3 d4. let's simulate options: for x , y: a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 a4 b4 c4 d4 now check on string, how messy access (just random reads, right?) nor, y , x a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4 d1 d2 d3 d4 see? straight forward read! that's why.

cookies - Drupal 7 access denied to admin panel -

migrated fully-functioning drupal 7 site , corresponding database new server. unable login admin side. error message is: “access denied. not authorized access page.” username , password has been verified. i looked @ /admin/reports/dblog, error log shows 2 entries per login. 1 entry shows session opened correct username, , other entry shows access denied , user ‘anonymous.’ assumption drupal not able validate user assigning user anonymous. i read many forum topics on similar issues. commented out ‘$cookie_domain’ in ‘settings.php’, still nothing. looked @ functioning site , saw 2 cookies generated: ‘has_js’ , session id cookie. in new site, ‘has_js’ cookie generated (using both firefox , chrome browsers). have verified session id being saved session table in database. i have looked modifying ‘php.ini’ (etc/php5/apache2/php.ini) have not found solution saves session id cookie. drupal 7 linux server ubuntu 12.04 apache 2.2.22 mysql 14.14 php 5.3.10 uncomment line 340

Trying to add PHP to Joomla website crashed -

i've never done php coding before, i'm using forum extension chronoforums , i'm trying add php forums if user logged in display welcome: $user , if not display link login/register. here code tried, crashed forum page. <?php $user = jfactory::getuser(); $status = $user->guest; if($status == 1) { $url = "/forum/login"; echo "<a href=\"$url\">login/register</a>"; } else { echo "<p>welcome: {$user->username}</p>"; } ?> error: fatal error: class 'gcore\extensions\chronoforums\helpers\jfactory' not found in d:\wamp\www\administrator\components\com_chronoforums\extensions\chronoforums\helpers\elements.php on line 72 call stack # time memory function location 1 0.0008 687992 {main}( ) ..\index.php:0 2 0.1207 9311448 jsite->dispatch( ) ..\index.php:52 3 0.1248 9382296 jcomponenthelper::rendercomponent( ) ..\application.php:

iphone - UITableViewCell is frozen (not rerendering with new data). How to fix? -

Image
having issues tableviewcell freezing. have table view cell list of exercises. when add new exercise on viewcontroller, pop tableviewcontroller lists exercises, respective cell gets frozen (see screenshot). then, if call [self.tablecell reloaddata] , cell never refreshes. it's weird because if offending cell is, say, index #4, , change data source have 2 items, 4th cell still frozen. (the first 2 render correctly, 3rd blank, 4th offending cell) list of exercises: when change data in tableview data source, cell still frozen: if put breakpoint , inspect tableview, doesn't frozen cell: not sure go here :( seems happen when insert row different viewcontroller pop one. any thoughts? so help! you keeping reference cell. bad idea. contradicts whole pattern of datasource , recycling of table cells. kinds of wacky bugs inevitable result. instead, should make sure datasource methods return correct number of sections , rows, , appropriate cells , reload t

android - eclipse not recognising jtwitter -

Image
i learning android. in statusactivity.java file , getting below error : twitter twitter = new twitter("username", "password"); i have imported latest jtwitter jar jtwitter-2.9.0.zip , imported same project build path. i not sure why not getting option import required class it seems using zipped file instead of jtwitter jar . why jtwitter library classes aren't accessible. remove jtwitter-2.9.0.zip - yamba > unzip file > extract jtwitter.jar > add jar project. winterwell.jtwitter.twitter should available now.

vb.net - Disable tab in .NET -

Image
i cannot disable tab in vb.net tab container. any 1 knows how disable tab :/ i want this: i think need. dim itotaltabs = me.tabcontrol1.tabcount() dim x integer x = 0 itotaltabs - 1 me.tabcontrol1.tabpages(x) .enabled = false if .name = "tabpage2" or .name = "tabpage4" .enabled = true end if end next if not working feel free ask more. regards.

java - Convert Arraylist<subclass> to ArrayList<parent> -

i have 2 arraylists contain parent , child class child extents parent , second extends first public first(arraylist<parent> parents) { // parent class's constructor } second class's constructor public second(arraylist<child> child) { super(child); // child class's constructor take arraylist<child> } is possible cast arraylist<child> arraylist<parent> ? this way cast parent child public static void main(string[] args) { arraylist<foo> parentarray = new arraylist<foo>(); parentarray.add(new foo("toolazy")); parentarray.add(new foo("tooadd")); parentarray.add(new foo("toomorefields")); arraylist<boo> childarray = (arraylist<boo>) ((arraylist<?>) parentarray); } and way cast child parent //boo extends foo btw public static void main(string[] args) { arraylist<boo> parentarray = new arraylist<boo>(); paren

c++ - What does short(expression) mean? -

this question has answer here: what difference between (type)value , type(value)? 5 answers what difference between following expressions? (short)(l_angle/l_msb * dividend) and short(l_angle/l_msb * divident) i guess first 1 type casting short type second expression do? if typecasting, how different first? it's same thing... there's no difference. c style cast: (int)x c++ style cast: static_cast<int>(x) constructor syntax cast: int(x)

Java Generics Comparator -

i coding java generics. want define binary tree class generically able take in class , , guarantee that class has comparator method compare(t o1, t o2) see whether need follow right or left subtree insert binary tree. public class treedb <t implements comparator> { //define binary tree methods } that best estimation of how force implement comparator method, compile throws error , don't know enough know wants. try this class treedb <t extends comparator<t>> { ...

iphone - UIPickerView interactive area for tapping cut off in iOS 7 -

when make long picker multiple components, components near center react tap-to-select feature. for example, if want pick next row under selected row, should able tap make animate selection area. feature still exists ios 7, area in uipicker accept tap small window, no larger 200px. is there way expand tap-able area include entire uipickerview, time tap row becomes selection? edit here code, it's pretty standard... - (void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component{ nslog(@"picked %i %i" , component , row); } - (nsinteger)numberofcomponentsinpickerview:(uipickerview *)pickerview { return 4; } - (nsinteger)pickerview:(uipickerview *)pickerview numberofrowsincomponent:(nsinteger)component { return 15; } - (nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component{ return @""; } - (uiview *)pickerview:(uipickerview *)pick

c - Simple calculator with rpcgen -

i new in programming in c. try create small , simple program addition of 2 integers file calculs.x here, contents of file calculs.x /* calculs.x*/ struct data_in { int arg1; int arg2; }; typedef struct data_in data_in; struct result_int { int result; int errno; }; struct result_float { int result; int errno; }; typedef struct result_int result_int; typedef struct result_float result_float; program calculs{ version version_un{ void calculs_null(void) = 0; result_int add (data_in) = 1; result_int sub(data_in) = 2; result_int mul(data_in) = 3; result_float div (data_in) = 4; } = 1; } = 0x20000001; for first time, created file calculs.c client: #include <rpc/rpc.h> #include "calculs.h" int main(int argc, char *argv[]) { int buffer[256]; struct data_in input; struct result_int *output; client *cl; if (argc != 2) { printf("usage: client hostname_of_serve

SQLite database + Jquery Mobile -

im studying jquery mobile , ive been looking tutorials on making sqlite database on mobile app using jquery , html ive been encountering tutorials phonegap on them.is possible not use phone gap.i dont want use phone gap im wondering if mandatory use phone gap make sqlite data base.and if have tutorials available please post thank you this might helps you... http://docs.phonegap.com/en/3.1.0/cordova_storage_storage.md.html#storage and http://tejasrpatel.wordpress.com/2011/12/29/create-sqlite-off-line-database-and-insertupdatedeletedrop-operations-in-sqlite-using-jquery-html5-inputs/ .

javascript - Why datepicker show same month when change month on a first time on autoOpening second datepicker -

click on first field; select day; (then automatic opening second datepicker) click next month button showing datepicker has flash, month not change after this, next month button (and prev month button) have work. whyyyyyyy ????? fiddel demo $(".from_date").datepicker({ mindate: 'd', dateformat: "dd/mm/yy", defaultdate: "+1w", numberofmonths: 2, onclose: function(selecteddate) { $(".to_date").datepicker("option", "mindate", selecteddate); $(this).parents('.span2').next().children().find('.to_date').focus(); } }); $(".to_date").datepicker({ mindate: '+1d', dateformat: "dd/mm/yy", defaultdate: "+1w", numberofmonths: 2 }); i can confirm bug, has opening second datepicker onclose function, adding 0 delay timeout seems work though: onclose: function(selecteddate) { var $todate =

c# - How to insert Serial Number to Unpivoted Column -

i have table in db contains date , time separately in columns time table displaying single 1 in front end had joined date , time column , inserted temporary table , unpivoted it,but pk_id same both unpivoted columns in front end in drop down box when select item in index @ 6 in ddl after postback occur return index 1 in ddl.so,is there way put serial number unpivoted columns, unpivot query is, select * ( select pk_bid,no_of_batches,batch1,batch2,batch3,batch4, #tempbatch ) p unpivot(batchname [batches] in([batch1],[batch2],[batch3],[batch4])) unpvt in above query pk_bid & no_of_batches same if put rownumber() partition pk_bid order pk_bid or rownumber() partition no_of_batches order no_of_batches gives 1,1 same. i had solved above problem this, i had created temporary table , created serial number column in table differant values query had done is, create table #tempbatch2 ( pk_bid int, no_of_batches int, batchnam

jquery - Get value from one click event to other event in JavaScript -

i have code written other this. <button onclick="javascript:confirm("are sure?");" id="confirm_button"/> now, add more functionality button attaching 1 click event same button $("#confirm_button").live("click",function(event){ //need value confirm box. //code goes here. }); how value first event in event listener? need if code work. 1 way have move confirm box click event listener, requirements don't allow me. thanks you can declare global variable , store value ion that,so can used in other functions somewhat this <script> //global variable here var testvariable; function1 { //initalize value here } function2 { //use here } </script>

css - Relative positioned content wrapper not scaling to fit contents -

in following fiddle expectation element "#wrap" scale vertically fit it's contents. not case. can suggest simple modification cause "#wrap" automatically scale fit it's contents (i.e. not static height). fiddle code: #wrap{ display:block; position:relative; border:5px solid blue; } .inner{ display:block; position:absolute; border:1px solid black; left:5px; } #id1{ top:0px; height:50px; width:50px; background-color:green; } #id2{ top:50px; height:50px; width:50px; background:red; } #id3{ top:100px; height:50px; width:50px; background:yellow; } <div id="wrap"> <div class="inner" id="id1">hi</div> <div class="inner" id="id2"></div> <div class="inner" id="id3"></div> </div> because .inner div elements have position of absolute

java - How to parallelize Multiple Requests to mongoDb? -

i using single standalone mongo db server no special topology replication or sharding etc. have issue mongo db not support more 500 parallel requests. note using 1 instance of mongoclient , remaining threads used inserts. using java executor framework create threads , these threads used insert data collection [all insert in same collection] you should queue requests before issue them towards database. there no use requesting 500 things database in parallel. remember single request comes costs memory wise, locking wise , on. wasting resources asking database @ once - remember mean request wise not data wise. so use queue (or more) , pool requests. pool feed worker threads (lets 5 or 10 enough) , that's it. take @ future interface in concurrent package of java. using asynchrone processing here looks thing highest throughput , lowest resource impact. but check mongodb driver first. not surprised if have implemented way. if case have limit using queue have lets 10 o

android - How to call scanned barcode history from zxing -

i scanning barcodes using zxing in application have button called history onclick should display scanned barcode history dont know how call history zxing. if zxing, mean using library (not zxing client app) scan qr codes have implement history related functionality on own. save items in database base each time have scanned something. take @ implementation of history feature in sample zxing android client. https://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/history/historymanager.java

ios - [UIView _forgetDependentConstraint:]: message sent to deallocated instance -

i tried using nszobie , others. still face issues. can't able find app crashed. please help. in advance. *** -[uiview _forgetdependentconstraint:]: message sent deallocated instance 0x208e0010 (lldb) bt * thread #1: tid = 0x2503, 0x342b3468 corefoundation`___forwarding___ + 192, stop reason = exc_breakpoint (code=exc_arm_b`enter code here`reakpoint, subcode=0xdefe) frame #0: 0x342b3468 corefoundation`___forwarding___ + 192 frame #1: 0x3420af68 corefoundation`__forwarding_prep_0___ + 24 frame #2: 0x364f24ba uikit`_updateviewdependenciesforconstraint + 202 frame #3: 0x364f9a2c uikit`__72-[uiview(additionallayoutsupport) _removerelevantconstraintsfromengine:]_block_invoke_0 + 264 frame #4: 0x34c65882 foundation`-[nsisengine withautomaticoptimizationdisabled:] + 166 frame #5: 0x364f98ee uikit`-[uiview(additionallayoutsupport) _removerelevantconstraintsfromengine:] + 94 frame #6: 0x3629f4a0 uikit`__uiviewwillberemovedfromsuperview + 588 frame #7: 0