Posts

Showing posts from January, 2013

vbscript - Getting VB Script Error on my redirect script -

i getting vb compilation error on redirect script. placed redirect script @ root of server. <% if instr(request.servervariables("olddomain"),"www") = 0 response.status="301 moved permanently" response.addheader "location","http://www." & request.servervariables("http_host") & request.servervariables("request_uri") response.end response.redirect("newdomain") end if %> and error getting microsoft vbscript compilation error '800a0400' expected statement /default.asp, line 5 & request.servervariables("http_host") ^ i not familiar vb. appreciate it. thanks line continuation in vbscript done _. sample: dim atests : atests = array(_ array("5-foo, 10 bar", 15) _ , array("11 baz", 11) _ , array("bad,string", 0) _ , array("hello,123,100, 100 ,xxx", 323) _ , array(...

c - Address space for shared libraries loaded multiple times in the same process -

first off, i've found a few references might answer question. while plan on reading them (i.e. after work), i'm still asking here in case answer trivial , not require supplementary knowledge. here situation: writing shared library (let's call liba.so) needs maintain coherent internal (as in, static variables declared in .c file) state within same process. library used program p (i.e. p compiled -la ). if understand far, address space p this: ______________ | program p | | < | | variables, | | functions | | p | | > | | | | < | | liba: | | variables, | | functions | | loaded (ie | | *copied*) | | shared | | object | | > | | < | | stuff | | other | | libraries | | > | |______________| now p call dlopen("libq.so", ...) . libq.so uses liba.so (i.e. compiled -la ). since happens within same process, need liba som...

php - Check value of textbox is blank or not when form submit using yii framework -

i new in yii framework.i doing search search operation using yii framework.my requirement check textbox value null or not in controller.i can print textbox value in variable '$experience'.but cant check blank or not.controler name sitecontroller.php,view search.php , model job.php my controller sitecontroller.php <?php class sitecontroller extends controller { public function actionsearch() { $user_id = trim($_get['id']); $model = new job ; if(isset($_post['job'])) { if(yii::app()->getrequest()->getisajaxrequest()) { echo cactiveform::validate(array($jobprofilem2)); yii::app()->end(); } $model->attributes=$_post['job']; if($model->validate()) { $title=$_post['job']['title']; $experience=$_post['job']['experience']; echo "data".$experience=trim(...

c++ - Iterate through a list of objects and point to the node that matches a certain criteria -

i using custom data structure 'block' , have stored several blocks in list: list openlist<block> i need iterate through each block, access data member 'f' (an integer) , check has lowest f cost. my logic have pointer pointing best block value, rather each time copying best blocks values. here's code: for (std::list<block>::iterator openi = openlist.begin(); openi != openlist.end(); openi++){ if ((*openi).f < bestfcost){ bestfcost = (*openi).f; // here's need help.... } } i don't think i'm asking of iterator possible. wish set block * q to data iterator points to, need entire object not data members. edit: simple solution! initilised q typo (q* instead of *q)! block * q = 0; then in part of loop commented: q = &(*openi) :) *openi of type block , right? can take address of that: block * q = &*openi; the &* might seem redundant, * operat...

java - jbpm6 - build.xml:508: jboss did not start within 5 minutes -

i new jbpm , trying learn jbpm 6, downloaded , following steps provided document.i trying demo using ant install.demo working upto install jbpm modular. i set environment of system is note : using windows 7 - 64 bit. java -version 1.7 ant -version 1.9.3 java_home=c:\program files\java\jdk1.7.0_45 ant_home=d:\ant path=%java_home%\bin;%ant_home%\bin; i install demo using command in command prompt ant install.demo starting demo using ant start.demo then getting error as: build failed c:\jbpm-installer\build.xml:508: jboss application server did not start within 5 minutes to avoid did things, read things google, increasing time out ful in build.xml when jbpm 6 @ line number 504. i change port number in build.xml avoid conflicts. even though following above conditions again repeating same error. can 1 ? solutions under jbpm 6 version............ in advance i had same problem. solution reinstalling java version. moreover...

Is it possible to add custom functionality to a delphi component to be triggered if a specific key is pressed? -

on application have several tdblookup components , on of them have add procedure closes , open again lookup query, on key press event. so wondering: how can customize descendent of tdblookup component, in order have boolean property available on object inspector, can enable accomplish this? if set true, focus on tdblookup , pressing f5 key, closes , open lookup query again. is possible? derive new component tdblookup , add desired property, , override virtual keypress() method @ property , act accordingly.

java - Android studio stuck at the splash screen -

Image
i downloaded android studio , setup, i.e. environment variable. studio not opening, android studio logo there in desktop even after hours, it's still same. the environment variable setup system variable jdk_home c:\program files\java\jdk1.7.0_02 android studio still in access version , can subject lot of problems. bug gradle caused build fail reason seemed unlinked. i'm pointing out using android studio not risk-free. imho, should @ least backup project as can avoid problem. back question, have updated android studio recently? first thing can try reinstall android studio. make sure backup sdk in case gets deleted (i'm using mac , sdk in app package's content. i'm not sure on windows, can try in installation folder). if doesn't work, fill bug report here , ask guide https://groups.google.com/forum/#!forum/adt-dev

java - Eager fetching blobs in Ebean under certain cases -

is there way make ebean eagerly fetch blobs under cases using ebean query api? know discarding @lob annotation make ebean fetch blobs fetch blobs under cases not want. after looking bit @ javadoc of ebean query api. found out how using: query.select("*"); will make ebean fetch columns of table including blobs. alternatively if want fetch blob use: query.select("blobpropertyname");

android - Custom seekbar has a gap between thumb and progress -

i have created own custom styling vertical seekbar, there small gap between thumb , progress part of seekbar shown here: http://i.imgur.com/gngnupb.png?1 even more interesting though further drag thumb smaller gap becomes until 50% - 60% full when disappears: http://i.imgur.com/6r0e2kz.png?1 everything done using xml , shapes, no pngs. idea causing this? i've tried messing around different paddings , thumb offset must missing something. below xml seekbar, progress drawable , thumb drawable. <seekbar android:layout_width="320dp" android:layout_height="wrap_content" android:background="@drawable/volume_shading" android:id="@+id/volume" android:rotation="270" android:progressdrawable="@drawable/blue_slider" android:paddingtop="20dp" android:paddingbottom="20dp" android:paddingleft="20dp" android:paddingrigh...

c# client-server List of objects cast error -

i developing client server application in c#. i sending server client list of students objects serialize on server side , deserialize on client side. serialization , deserialization follows : // server side serialization. list<student> ordbymedgen = repo.ordbymedgen(); binaryformatter binaryformatter = new binaryformatter(); binaryformatter.serialize(writer.basestream, ordbymedgen); // client side deserialization. binaryformatter bin = new binaryformatter(); list<student> list = (list<student>)bin.deserialize(receive.basestream); console.writeline(list.count); // print list using method succesfully send list of strings server side , printed on client side. when tried student class got following error [a]system.collections.generic.list 1[serverclient.student] cannot cast [b]system.collections.generic.list 1[serverclient.student]. type originates 'mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' in context ...

Perl regex to match only if not followed by both patterns -

i trying write pattern match match when string not followed both following patterns. right have pattern i've tried manipulate can't seem match correctly. current pattern: /(address|alias|parents|members|notes|host|name)(?!(\t{5}|\s+))/ i trying match when string not spaced correctly not if part of larger word. for example want match, host \t{4} but not, hostgroup \t{5} in above example match hostgroup , end separating 2 separate words "host" , "group" match: notes \t{4} but not, notes_url \t{5} using pattern ends turning into: notes \t{5} _url hopefully makes bit more sense. i'm not @ clear want, word boundaries ask. does work you? /\b(address|alias|parents|members|notes|host|name)\b(?!\t{5})/ update having understood problem better, want? /\b(address|alias|parents|members|notes|host|name)\b(?!\t{5}(?!\t))/

javascript - AngularJS string is not a function -

to shorten post info needed problem, made button gives +1 rating , button -1 rating when clicked , html code, <p> <strong>rating: </strong> {{ album.rating }} <button class="btn btn-small" ng-click="upvoterating(album)">+</button> <button class="btn btn-small" ng-click="downvoterating(album)">-</button> </p> nothing unusual, heres angularjs code using scope , function button. $scope. upvoterating = 'upvoterating'; $scope. downvoterating = 'downvoterating'; function upvoterating(album) { album.rating++; } function downvoterating(album) { if (album.rating > 0) album.rating--; } so theres no problem code guessings everytime click button on page, says on console: "typeerror: string not function @ http://localhost:1234/lib/angular/angular.min.js:168:37 @ http://localhost:1234/lib/angular/angular.min.js:186:167 @ g.$eval (http://localhost:1234/lib/angular/angula...

r - Can't match data.frames correctly -

what doing wrong here? date "5" not in final data.frame.. why that? date1 <- c(1,2,3,4,5,6,7,8,9) ret <- c(1.2,2.2,-0.5,0.98,0.73,-1.3,-0.02,0.3,1.1) df <- data.frame(date1,ret) date2 <- c(1,2,3,5,6,8) q <- c(3,2,1,4,5,7) ev <- data.frame(date2,q) matched <- ev[which(is.na(match(df[["date1"]], ev[["date2"]])) == f),] matched # date2 q # 1 1 3 # 2 2 2 # 3 3 1 # 5 6 5 # 6 8 7 # na na na for example above think want ev[ev$date2 %in% df$date1 , ] . have created example new data dates quite different row numbers. date1 <- 10:18 ret <- c(1.2,2.2,-0.5,0.98,0.73,-1.3,-0.02,0.3,1.1) df <- data.frame(date1,ret) date2 <- c(10:13,20,17) q <- c(3,2,1,4,5,7) ev <- data.frame(date2,q) @ vectors want match df$date1 #[1] 10 11 12 13 14 15 16 17 18 ev$date2 # [1] 10 11 12 13 20 17 # 1 of ev$date2 in df$date1 (ie. ev$date2 = 20) match date values first @ %in% ope...

python sphinx - Embed configuration options into reStructuredText? -

official docs show how configure rst reading/conversion external ini-like file. is possible include options rst source file directive? for example instead of passing --math-output=mathml write somethig like: .. config: html4css1 writer :math_output: mathml

Rails display formatted date in words -

i have date in format 2014-04-05 gotten @post.date want convert format "saturday apr 5" in view. , if date today, want use format "today apr 6" have <% if @post.date === date.today.strftime("%y-%m-%d") %> <p> today month(short form) day(number) </p> <% else %> <p> day(word) month(short form) day(number) </p> <% end %> how go formatting dates? in advance. use this: <% if @post.date === date.today %> <%= @post.date.strftime("today %b %d") %> <% else %> <%= @post.date.strftime("%a %b %d") %> <% end %> refer complete list of format directives available strftime .

html - CSS get second element by className without JS -

i want headings title titanic 20px high. can accomplish applying css-rule: h1[title="titanic"] {font-size:20px;} now want second heading class red. if every heading had same parent (thus in same div), done this: h1[title="titanic"]:nth-of-child {color:red;} however, when headings not in same parent, don't know how select second heading. want know css-rule need color second heading red in following example: <h1 title="titanic">heading one</h1> <span><h1 title="titanic">heading two</h1></span> css doesn't have way select nth element document-wide. have rely on structure determine whether or not select second h1 . for example, can choose when first h1 comes before span present, (ignoring appropriateness of having h1 within span in example...): h1[title="titanic"] + span > h1[title="titanic"] or if have set of these, see if top-level h1 elements , s...

vb.net - IF statement in background image in a Picture box -

i have 2 images in project's resources , want make if statement see if picture box has one, if happens, want change image. have not work: if pic1.backgroundimage global.images.my.resources.ima1 pic1.backgroundimage = global.images.my.resources.ima2 end if am right? or else can that? if pic1.backgroundimage = global.images.my.resources.ima1 pic1.backgroundimage = global.images.my.resources.ima2 end if

login - Wordpress OpenID doesn't work with StackOverflow -

to login on stackoverflow, being logged wordpress, select wordpress, inform wordpress id stackoverflow openid login system: myopenid - , logged in. today first time strange message appears: you not own identity. i followed these steps, problem persists: you not own identity. i tried same steps on osx , linux, using firefox, google chrome , safari... nothing changed. some others got stuck same problem: https://meta.stackexchange.com/questions/83715/cant-login-with-wordpress-openid-anymore-receive-you-do-not-own-that-identity so, wrong wordpress openid? , how working again? or should proceed recovering lost account ? all comments , highly welcome. to clean problem not allowing logged through wordpress openid, solution wordpress , deleted site url there: dashboard > settings > openid > url [x]. delete when tried again login again, asked me give permission, , worked. i noticed wordpress openid works little bit better stackexchange stacko...

java - How can I draw a rectangle into pdf file and fill it with text? -

Image
i've started work on simple android project recently, have collect data database , put them pdf file. i'd put these data rectangles, this: i've read rectangles on this post , , think it's gonna work in android too. thing can't how fill data rectangle. could give me suggestion, please? thank in advance... i have similar code used table , set value.it may provide hint: private static font blackfont = new font(font.fontfamily.times_roman, 10, font.bold); private void createseg_table(document document)throws documentexception,ioexception{ pdfptable table = new pdfptable(1); table.setwidthpercentage(100); try{ pdfpcell c1 = new pdfpcell(new paragraph("text want show",blackfont)); c1.setverticalalignment(element.align_left); c1.setborder(rectangle.box); table.addcell(c1); document.add(table); } ...

Project Euler 3 in c,code processing for too long for large numbers? -

it taking forever give answer,it seems processing answer? have seen similar questions please tell me wrong code? #include<stdio.h> main() { int flag=0; unsigned long long int j,z,ino,i; scanf("%llu",&ino); for(i=2;i<=ino/2;i++) { flag=0; if(ino%i==0) { for(j=2;j<=i/2;j++) { if(i%j==0) { flag=1; } } if(flag==0) { z=i; } } } printf("%llu",z); } here's problem: the prime factors of 13195 5, 7, 13 , 29. largest prime factor of number 600851475143 ? it's not code wrong in incorrect, it's wrong in inefficient. let's @ code tests if number prime: for(j=2;j<=i/2;j++) { if(i%j==0) { flag=1; } } if...

activate app in background on button click android -

i have button in android app activate or deactivate app button.i want when user clicks button app should activate if deactivated , vice versa. , when app on activate mode should run in background , work on power or home button click , or shaking mobile , gps location , send message. beginner please explain code file.

jquery - css is not applied to the appended html elements -

i googled css should applied new loaded elements automatically, not able figure out what's wrong codes. [my web:][1] when scroll down bottom, load new post(s). new loaded element closed posts, there "closed" class in div#pin , , opacity (or filter ) should applied doesn't. your newly created element has opacity: 1; in inline style. because inline style overwrites class defined style rules, opacity of 1 result, , not opacity of 0.5 defined rule class. if not possible: try modifying view.css rule .closed { opacity: 0.5 !important; } by adding !important increase priority of rule.

c# - Notify when the binding of Dependency Property is changed -

i need debug binding setup of given dependency property. @ beginning, set binding dependency property given source instance, following code: var binding = new binding(path); binding.source = source; binding.mode = twoway ? bindingmode.twoway : bindingmode.oneway; binding.updatesourcetrigger = updatesourcetrigger.propertychanged; binding.converter = valueconverter; var bindingresult = bindingoperations.setbinding(this, modelvalueproperty, binding); var bindingexpression = bindingoperations.getbindingexpression(this, modelvalueproperty); bindingexpression not null , status of binding active. after view manipulations, when try bindingexpression null. how catch binding replacement or change on given dependency property ? edit: in way, want know how notified when bindingexpression changes status active detached you need set property: binding.notifyonsourceupdated = true and register sourceupdat...

Django sessions abandoned in first tab when clicking link in second -

don't know if specific django, site 1 i've experienced with, , don't think i'm doing special session data (just using old-school database backend). when user logs in (in tab a) , opens new tab (tab b) on same domain, cookie carries on second tab. however, if user clicks link in tab b, either refreshes tab or clicks link in tab, he's instantly logged out. i've been googling around issue ages have had no luck, appreciate anyone's help. apologies if fundamental thing. middleware_classes = ( 'django.middleware.cache.updatecachemiddleware', 'bambu.sites.middleware.domainredirectmiddleware', 'nymbol.utils.middleware.requirehttpsmiddleware', 'django.middleware.common.commonmiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.locale.localemiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.auth...

c# - Error when trying to write then read a XML file in Windows Phone 8 app -

edited : adding informations gathered since posted this. hi stackers ! i'm trying first time metro style windows phone 8 app using visual studio 2013 , wp8 sdk. this app should able store few data users in xml files stored in app folder. here should : the user use app normal way, , saves data. want add in datafile.xml file created xml declaration line , root element. then, if user want see saved, app should data in xml file , display it. here basic xml file: <?xml version="1.0" encoding="utf-8" ?> <itemlist> </itemlist> and code write data : (modifications edit here) var isofilestream = new isolatedstoragefilestream("saves\\itemlist.xml", filemode.openorcreate, fileaccess.readwrite, store); //where store definition of isolatedstoragefile var xdoc = xdocument.load(isofilestream); var newitem = new xelement("item", new xelement("name", itemname.text...

Move the file position without fseek in C -

how can move file position x bytes in c? i don't want use fseek() , because i'm reading lines of file open(fd, buf, buflength) , not fopen() . i'd avoid reading entire file memory. what want basically: read x + = y bytes. do first x bytes. move file pointer backwards bytes. read y bytes there. i know how except step 3. know how? according http://rabbit.eng.miami.edu/info/functions/unixio.html use lseek: int lseek(int fd, int position, int startpoint) include: <unistd.h> sets file position effective next read or write operation. fd = file descriptor returned open position = position within file: number of bytes between startpoint , desired position, may negative. startpoint = location in file position relative to, 1 of: seek_set position number of bytes beginning of file seek_end position number of bytes after end of file seek_cur position number of bytes after current position returns <...

vb.net - Problems when calling a public sub -

i'm facing deadend when trying call sub : public sub backblue(byval frm form, byval boxname string) = 1 3 ctype(frm.controls(boxname & i.tostring()), textbox).backcolor = color.lightblue next end sub with button click event : private sub button1_click , bla bla.... backblue(me, "txb1_") end sub can show me suggestion fix code. it throws "object referrence not set instance bla bla" error for information textbox names : txb1_1 , txb1_2 , txb1_3 (these of many textboxes in form want bakcolor changed) and these 3 textboxes created through designer, not execution. i did check textboxes names , there's nothing wrong. the form class public. try this.... public sub backblue(byval frm form, byval prefix string) = 1 3 dim bxname string = prefix & i.tostring() dim bx textbox = ctype(frm.controls(bxname), textbox) if bx nothing msgbox("unab...

excel - Pivot Table - De-nesting Columns -

Image
i need simple thing on excel pivot table, can't see how this. i have pivot table lines list of activities, columns months , values number of days taken each activities on each month. want add new column "goal value" in days each activity. have column these goals, if try add table, nested under months... so, how can add column without nesting it? example: i have table: i want add collumn without nesting it:

php - Checking for server availability -

trying take address database , written in array, says bad, servers available. include('config.php'); $query_select = "select `ip` `server`"; $result_select = mysql_query($query_select); $host=array(); while($row = mysql_fetch_array($result_select,mysql_assoc)) { foreach ($row $r){ $host[$r] = $r; } } foreach ($host $h){ $waittimeoutinseconds = 1; if($fp = fsockopen($h,$waittimeoutinseconds)){ echo 'good'; } else { echo 'bad'; } fclose($fp); }

ios - “GooglePlus/GooglePlus.h file not found” when trying to build my project -

i error googleplus/googleplus.h file not found when try build project. added google plus framework project, , after that, tried import framework in app delegate.m file, i’m getting error. i think have remove current framework , bundle google plus , download latest 1 framework google plus https://developers.google.com/+/mobile/ios/sdk/google-plus-ios-sdk-1.5.1.zip & add them project's build_settings>build_phases. this way have solved problem, may u can it. thanks k.d

php - phalconphp routing and add postfix to action -

i'd add phalconphp routing rule. when method post call controller x, action x+post postfix + params $router->addpost('/:action/:params',['controller'=>'print','action'=>1."post",'params'=>2]); and $router->addpost('/:action/:params',['controller'=>'print','action'=>str_replace(1,1.'post',1),'params'=>2]); but not work. idea on solve? just clear look: in router: $router->add('/:action/:params', ['controller'=>'controllername', 'action'=>1, 'pa‌​rams'=>2]) ->via(['post']) ->convert('action', function($action){ return $action.'post'; }); more information @docs: http://docs.phalconphp.com/en/latest/reference/routing.html#http-method-restrictions ...

How can I be sure an email address is unique? -

there's pub in town whereby, if sign newsletter using website , provide "unique" email address, free drink. on whim, decided sign second time using myemail+one@gmail.com . let me. i'm sitting on nice comfy pile of free drink vouchers. this got me thinking system have here, email address considered unique identifier. checking code, sure enough, if offering vouchers in our business, else sitting pretty. the basic, stab-in-the-dark, fix check "+" character , ignore after (up @ ), , compare using that. unsure if intent + character. work? secondly, there other caveats allow user sign multiple times seemingly different email address, end in same mailbox? this question language-agnostic. while using plus sign e-mail address alias known feature of gmail, other mailers either not allow or use minus sign instead. '+' legitimate character used part of email address according rfc. the use of '.' gray area. john.doe@gmail.c...

c# - Turn ON radio using wlan api -

i have requirement turn off wireless radio using wlanapi in c# . iam able turn off radio not able turn on. here code: wlan_phy_radio_state wlan_intf_opcode_radio_state = new wlan_phy_radio_state(); wlan_intf_opcode_radio_state.dwphyindex = 0; // todo : can change ??? wlan_intf_opcode_radio_state.dot11hardwareradiostate = dot11_radio_state.dot11_radio_state_on;// ignored in fact, according http://msdn.microsoft.com/en-us/library/windows/desktop/ms706791(v=vs.85).aspx wlan_intf_opcode_radio_state.dot11softwareradiostate = dot11_radio_state.dot11_radio_state_on; radiostateptr = marshal.allochglobal(marshal.sizeof(wlan_intf_opcode_radio_state)); marshal.structuretoptr(wlan_intf_opcode_radio_state, radiostateptr, false); if (wlanenuminterfaces(handle, intptr.zero, out ppinterfacelist) == error_success) { interfacelist = new wlan_interface_info_list(ppinterfacelist); (int = 0; < interfacelist.dwnumberofitems; i++) { guid pinterfaceguid = ((wl...

java - Create a sample Jasper report manually -

i trying learn jasperreports. far, have figured out jasperreports can integrated netbeans , that, used several tutorials not able correct code. want create report manually . i have created sample application , contains code: import java.util.hashmap; import net.sf.jasperreports.engine.jremptydatasource; import net.sf.jasperreports.engine.jrexception; import net.sf.jasperreports.engine.jaspercompilemanager; import net.sf.jasperreports.engine.jasperexportmanager; import net.sf.jasperreports.engine.jasperfillmanager; import net.sf.jasperreports.engine.jasperprint; import net.sf.jasperreports.engine.jasperreport; import net.sf.jasperreports.view.jasperviewer; public class javaapplication7 { /** * @param args command line arguments */ public static void main(string[] args) { // todo code application logic here string reportsource = "./report.temp.result/newxmldocument.xml"; string reportdest = "./report.template/helloreportworld.html"; hashma...

excel vba - Auto filter method of range class failed with Criteria -

Image
set rmdvsheet = activeworkbook.sheets(11) rmdvsheet.range("a1:k103").autofilter field:=10, criteria1:= _ "d7u l462-l494 17my" here on 2nd line geting error saying "auto filter method of range class failed". make sure have correct worksheet. make sure data in sheet cells have no double quotes. like:

What is the minimum X86 assembly needed for a spinlock -

to implement spinlock in assembly. here post solution came with. correct? know shorter one? lock: mov ecx, 0 .loop: xchg [eax], ecx cmp ecx, 0 je .loop release: lock dec dword [eax] eax initialized -1 (which means lock free). should work many threads (not 2). shortest be: acquire: lock bts [eax],0 jc acquire release: mov [eax],0 for performance, it's best use "test, test , set" approach, , use pause , this: acquire: lock bts [eax],0 ;optimistic first attempt jnc l2 ;success if acquired l1: pause test [eax],1 jne l1 ;don't attempt again unless there's chance lock bts [eax],0 ;attempt acquire jc l1 ;wait again if failed l2: release: mov [eax],0 for debugging, can add data make easier detect problems, this: acquire: lock bts [eax],31 ;optimistic first attempt jnc l2 ;success if ac...

ruby on rails - Heroku resque/clockwork 'No job defined for class' -

trying run background job on heroku using resque/clockwork. locally, jobs queued clockwork , executed resque expected. on heroku, sometimes works... of time clockwork queues job expected, , when executed resque failed job error 'no job defined class'. exact error shows through resque admin panel is: worker 960f8a1b-cce9-497a-a7ab-9b40c166a600:2+1 on featured_catalog_items_cache @ 27 minutes ago retry or remove class nil arguments nil exception error error no job defined class 'workers::featuredcatalogitemscacheworker' code looks like: /app/models/workers/featured_catalog_items_cache_worker.rb class workers::featuredcatalogitemscacheworker @queue = :featured_catalog_items_cache def self.perform p 'do work' # there more code here edited brevity end end /lib/clock.rb require file.expand_path('../../config/boot', __file__) require file.expand_path('../../config/environment', __file__) require 'c...

PHP functions with MySQL queries -

i'm making simple basketball stats plugin wordpress, , i'm using dropdown list lot. wanted make function don't know how pass arguments mysql. here's code: function dropdown($tab, $option, $text){ $result = mysqli_query($con,'select * tab'); while($row = mysqli_fetch_array($result)){ echo "<option value=\""; echo $row['option'] . "\">" . $row['text']; echo "</option><br>"; } } and use this: dropdown("team", "team_id", "name"); i tried different quotation marks, dots etc doesn't seem work. @edit know php syntax (some of it) , know how use it, don't know how pass $variables mysql query, , that's main problem. try function dropdown($team, $team_id, $name) { // use both 3 var want $result = mysqli_query($con,'select * team'); echo "<select>"; while($row = ...

ruby on rails - Undefined method 'paypal_url' from a partial -

good evening all, i've been trying solve while, i'm positive simple i'm missing... i have web store, allows customers add products cart, allows customers pay via paypal. there no problems if attempt pay 'within' cart, e.g http://localhost:3000/carts/1 however, i've created partial shows cart items (this partial shows within drop-down navigation bar), , within drop-down customer should able click 'checkout'. aim works in same way going cart; should take them straight paypal pay. partial below. _display_cart.htlm.erb <% current_cart.line_items.each |item| %> <li> <%= item.product.title %> <%= number_to_currency item.product.price , :unit =>"&pound" %> &times; <%= item.quantity %> </li> <% end %> <div align="right"> <%= number_to_currency(current_cart.grand_total, :unit => "&pound;") %>&nbsp; </div> </ul> <%= li...

php - How Atomic are Mysql Transactions given multiple connections? -

i checked related questions, answer kinda "yes, atomic". but im going more specific, because questions not specific , answers: mysql/innodb several connections @ "same" time a transaction writing same tables (even more, same queries). only 1 database no lock table done @ all . no nested transactions no memcache or othe similar system, simple possible. i believe using "serializable isoloation, not low level" in scenario, garanteed mysql engine data integrity mantained, or going specific cases: those "at same time " writings queued? rollback in fact work spected. readings @ "the same time" find consistency int state writings? my simple concerns if "commits" , "rollbacks" inside transcations of different connections atomic or make mess :-) thanks. the "commit" end transaction. it's transaction isolation level determines whether all statements executed in con...

Typescript 1.0 RequireJS Plugin -

i'm looking requirejs plugin supports loading typescript 1.0 code. i found https://github.com/iammerrick/require-ts , seems work older version of typescript , has not been updated in long time. please don't. run js in browser. reason: import dep = require('./something'); is easier + more typesafe than: define(['ts!./something'], function(dep) { // dep compiled js @ point. }); perhaps unaware of typescript external modules.

arrays - How to find longest constrained subsequence -

given array contains n different integers, find longest subsequence satisfies: the start element of subsequence smallest of subsequence. the end element of subsequence largest of subsequence. eg: 8,1,9,4,7. answer 1,4,7. 2,6,5,4,9,8. answer 2,6,5,4,9 or 2,6,5,4,8. here o(n^2) algorithm: let x array of numbers. iterate on x . suppose @ index i . let y array y[j] number of elements in (j, i] smaller x[j]. let z number of elements in [j, i] smaller x[i]. if x[j] smaller x[i], can subsequence of length z-y[j] satisfies constrains. set z 1 . loop j i-1 down 0 . if x[j] < x[i]: z++; ans = max(ans, z - y[j]); else y[j]++; can better? think there should o(nlogn) algorithm find max length. let me redo explanation of o(n log n) algorithm. interpret elements of input sequence points in 2d, x-coordinate index, , y-coordinate value. we're looking rectangle containing input points, subject constraint lower left corner , upper right corner ...

css - Android: How to style for a link in file string.xml? -

i have created custom dialog information app. 1 of them hyperlink text string.xml file, content this: <string name="copyright">bản quyền © 2014 thuộc <a href="https://www.facebook.com/nguyen.ngochoang.758" style="text- decoration:none;">nguyễn ngọc hoàng</a></string> it work ok, hyperlink has underline. so, how can style link css above, in code. hi use given below formatted lines <string name="copyright">bản quyền © 2014 thuộc <a href="https://www.facebook.com/nguyen.ngochoang.758" style="text-decoration:none;">nguyễn ngọc hoàng</a></string> i checked @ http://www.w3schools.com/html/tryit.asp?filename=tryhtml_linknoline , working fine, please copy given lines , paste @ given web link , check, work fine!!

css - How to fix increasing Scrollbar thumb size while scroll of a div in iPad -

Image
the scroll-bar thumb size keeps increasing when scroll 'overflow-y:scroll' div in ipad. idea how fix design break?? position: absolute; max-height: 200px; overflow-y: scroll; overflow-x: hidden; the above basic style set element. this how looks in ipad scrolled bottom of div. this expected behaviour : try use native scrolling with: -webkit-overflow-scrolling: touch; safari developer library reference i tried reproduce behaviour ipad simulator http://codepen.io/anon/pen/kapkb the problem variable height.

javascript - Only refresh parent page -

i using modal show shopping cart. users can delete items in modal. want after delete item, parent page refreshed , modal should still show up. right now, after click on "delete button" in modal, parent page refreshed modal closes up. my code: $(function(){ $('.delete').click(function(){ $.ajax({ url:'/polls/cart__delete/'+$(this).attr('data-id'), success: function(data){ $('.modal-body').html(data); parent.location.reload(true); }, }); }); }); $(function(){ $('.delete').click(function(e){ $.ajax({ url:'/polls/cart__delete/'+$(this).attr('data-id'), success: function(data){ $('.modal-body').html(data); parent.location.reload(true); }, error: function (xmlhttprequest, textstatus, errorthrown) {alert('loading failed!!'); } }); e.preventdefault(); ...

.htaccess - hot to prevent a mobile rewrite rule to be applied to a specific folder -

i have rules in htaccess rewriteengine on rewritecond %{http_host} !^m\my site\.it$ rewritecond %{http_user_agent} "android|blackberry|iphone|ipod|ipad|iemobile|opera mobile|palmos|webos|googlebot-mobile" [nc] rewritecond %{http_cookie} !mobilecookie=true rewriterule ^(.*)$ http://m.my site.it%{request_uri} [l,r=302] i want rule not apply folder admin , it's content. think should work if placed right below line rewriteengine on rewritecond %{request_uri} !^/admin/ rewriterule ^.*$ - [nc,l] but not. appreciated. thanks you can use: rewriteengine on rewritecond %{request_uri} !^/admin/ rewritecond %{http_host} !^m\. rewritecond %{http_user_agent} "android|blackberry|iphone|ipod|ipad|iemobile|opera mobile|palmos|webos|googlebot-mobile" [nc] rewritecond %{http_cookie} !mobilecookie=true rewriterule ^(.*)$ http://m.my.site.it%{request_uri} [l,r=302]

How to catch "Exception" error when a filter-rule isn't defined? -

i'd catch "exception" error when filter-rule isn't defined. i think dangerous "exception" error doesn't occur. example: - filter.php no filter rule - route.php route::get('sample', ['before' => 'mycsrf', function(){ return 'csrf verified page.'; }]); please me.

email - How can the smtp/pop3 client reads the [error] message that the smtp/pop3 server has send to them (in delphi)? -

my server side smtp , pop3 events send [error] messages asender : tidcommand : asender.reply.setreply(ok, 'message send'); or asender.reply.setreply(err, 'error message send'); so question how can message read smtp/pop3 client ? sounds need learn how exceptions work. if connect() fails, exception raised. several different exception types possible, including eidsocketerror , contains socket error code. if pop3/smtp command fails, eidrfcreplyerror exception raised. exception contains server's response code , message. information available in component's lastcmdresult.code , lastcmdresult.numericcode , , lastcmdresult.text properties.

python - Django Datetime Issue -

what trying isn't difficult, isn't working. cannot see error is. in abstract user model have is_donator method not work. @property def is_donator(self): if(self.donator >= datetime.now()): return true else: return false some reason not return anything, looks alright me though, ideas? you have 2 related issues. first using wrong comparison. if(self.donator >= datetime.now()): this means donor must become donor @ point in future. change if(self.donator <= datetime.now()): this ensure became donor in past. the other issue have using auto_now : automatically set field every time object saved . useful “last-modified” timestamps. note current date used; it’s not default value can override. this, then, relates first issue. every time user field updated - if don't explicitly set field - defaults now. update based on comments : checking if donator not null , ensure exists. if doesn't exist, dete...

batch file - .bat Wildcard for a Folder -

how use wildcards in folder? 7z x -os:\technology\feftp\* s:\technology\feftp\*.zip ren s:\technology\feftp\export_job9_04-08-2014_16-24(wildcardthis) testfolderrename ren s:\technology\feftp\testfolderrename\*.csv test1.csv move s:\technology\feftp\testfolderrename\*.csv s:\technology\feftp\test what best way go this? need wildcard replace export_job9_04-08-2014_16-24. thing in folder not need specific. tried *e, e?, did not work. proper method use? for /d %%a in ("s:\technology\feftp\export*") ren "%%~fa" testfolderrename obviously, work if (as stated) have 1 export* folder (you can not rename 2 folders same name), , if testfolderrename not exist (name collision).

Get method which is undefined in interface in java -

i have interface "messenger", defines 4 methods. in "messengereng" class, inherit "messenger" interface , add 1 undefined method "msgexample". question: how access "msgexample" method (which not defined in "messenger" interface) ? you cast desired type. example: messenger msg = new messengereng(); ((messengereng) msg).methodnotinterface(); this unsafe cast though, use if @ all.

android - How do I deselect/uncheck all checkbox buttons when one is selected? -

i have toggle set in java code button in xml. code follows: @override public void onclick(final view view) { switch (view.getid()) { case r.id.selectable_text: if(view instanceof checkedtextview){ categorycheckablerow checkablerow = ((checkedtextview)view).getcategorycheckablerow(); togglecategoryrow(view, checkablerow); log.d("newsdash","i toggling in dash onclick"); if (!mcategoriesset.add(checkablerow)) { mcategoriesset.remove(checkablerow); } mdonebutton.setenabled(!mcategoriesset.isempty()); } return; case r.id.button_done: sendcategoriestoactivity(); ((dashboardmanagenewscategoriesactivity) getactivity()).updatecategoriesmap(mcategoriesset); break; default: } } i planning uncheck other "checks" when currect chec...

java - Effective way how to handle ModelMap between Controllers, using forwarding in Spring MVC -

what elegant/effective way, how handle model between controllers in spring mvc 3.2. redirecting controller use forward method, there not necessary new instance of request , model data should accessible (if not wrong). there way how catch model, added in first controller? (i know redirectattributes, may better/easier method) example: @controller public class webpagecontroller{ @requestmapping( value = { "/{code}" } ) public string handlefirstlevel(@pathvariable string code, modelmap modelmap) throws pagenotfoundeception{ final webpage webpage = getwebpage(code); modelmap.put(webpage_model_key, preparemodel(webpage)); return "forward:some-url"; } private map<string, object> preparemodel(webpage webpage){ map<string, object> model = new hashmap<string, object>(); model.put("webpage", webpage); return model; } ...

Access a parameter from an interface (Fortran) -

i using parameter fix precision of used types. works fine until try use same type within interface. consider small example: module hello implicit none save integer, parameter :: k = selected_real_kind(10) contains subroutine dosomething(fun) real(k) :: foo interface function fun(bar) real(k) :: bar real(k) :: fun end function fun end interface end subroutine end module here, foo of desired type, whereas compiler (gfortran) complains 'bar' , 'fun'. the error is error: parameter 'k' @ (1) has not been declared or variable, not reduce constant expression is there way working? (for now, writing selected_real_kind(10) everywhere not elegant @ all) thank you! the easiest way add import inside interface. of misdesign definitions of module outside scope of interface. plain import import everything. .... subroutine dosomething...

php - Many to Many Eloquent Relation -

i trying create many many relationship using laravel 4.1 , eloquent model. have 3 tables - songs, artists , song_artist: ---- songs -- id -- title -- genre ---- artists - id - name ---- song_artist - id - song_id - artist_id since each song can have multiple artists , each artist can have multiple songs, assumed need use morphtomany() method instead of hasmany() or hasmanythrough() methods. how set relation access artists related song $song->artists() , access songs related aritst using $artist->songs() ? i've looked other questions on such this one , this one , this one . any appreciated. rename song_artist artist_song , use belongstomany . if don't want rename table, set manually: // in artist return $this->belongstomany('song', 'song_artist'); // in song return $this->belongstomany('artist', 'song_artist');

JavaScript input element syntax error -

hey guys facing strange issue working code looks fine me still getting syntax error $('input#checkmecustomer').add($('input#checkmencustomer')).live('click',function(e) { /* retrive current id event object */ var target = e.target || e.srcelement; if($('input#'+target.id).is(':checked')) { $('input.'+target.id).each(function() { this.checked = true; }); }else{ $('input.'+target.id).each(function() { this.checked = false; }); } }) }); i uncaught error: syntax error, unrecognized expression: input# in consloe edit hey guys , specially benjamin figured out $(document.body).on('click','#checkmecustomer,#checkmencustomer',function(e) { if($('#'+e.target.id).is(':checked')) { $('.'+e.target.id).each(function() { this.checked = tr...

php - Security error accessing url in MXML -

i calling http service flex ... <mx:httpservice id="personrequest" url="http://111.111.1.11/idesk/user.php/userinfo" useproxy="false" resultformat="text" result="personjson(event)" fault="anothermethod(event)" method="post"> <mx:request xmlns=""> <getperson>"true"</getperson> </mx:request> </mx:httpservice> and getting following error: security error accessing url i have placed cross-domain policy file in server-script folder didnt solve problem. any appreciated. in advance. try use charles see of flash trying load. show if swf accessed crossdomain.xml server , correct path.

java - Android: Json is not able to retrieve any files from mysql database it is empty -

i new android , using mysql database linking php file connection working fine code not displaying showing background color black instead of displaying data database public class homefragment extends fragment { gridview gv; @suppresslint("newapi") @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.home, container, false); strictmode.enabledefaults(); gv = (gridview) rootview.findviewbyid(r.id.gridview_home); getdata(); return rootview; } public void getdata(){ string result = ""; inputstream isr = null; try{ httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://192.168.1.2/android/app/getcu.php"); //your php script address httpresponse response = httpclient.execute(httppost); httpentity entity = response.getentity(); isr = entity.get...