Posts

Showing posts from May, 2015

php - Facebook app not running? -

i bought script facebook app, , seems not loading page @ if part of code added. if remove it, app won't request user send invites. essential me. if ($user) { $fbid = $user; $log -> log_install($fbid); } log_install function: function log_install($facebookid) { $country = $this->getcountry(); $ip = $this->ipaddress(); $datestamp = date("y-m-d"); $date = date_create(); $timestamp = date_timestamp_get($date); // first check , abort logging if facebookid exists; if($this->check_id($facebookid) != 1) { mysql_query("insert installs (facebookid, country, ip, datestamp, timestamp) values ('$facebookid', '$country', '$ip', '$datestamp', '$timestamp')"); } } how approach this? can provide further info if not enough. have basic php knowledge it's not enough troubleshoot this

Beginning JavaScript - create table -

i have create array using loop produce numbers 0-24. print these numbers in order in 5x5 "table" using loop. the output should be: 0 1 2 3 4 x 5 6 7 8 9 x 10 11 12 13 14 x... 20 21 22 23 24 i can't figure out how create table. here code: // calculate numbers 0-24 var numbers = []; (var 0; < 25; i++) { numbers[i] = i; } // create table (var row = 0; row < 4; row++) { document.write('<tr>'); (var col = 0; col < 4; col++) { document.write('<td>' + numbers + '</td>'); } document.write('</tr>'); } the problem accessing array without index. try instead: var numbers = []; ( var 0; i<25; i++) { numbers[i]= i; } //create table var = 0; var table = "<table>"; (var row=0; row<5; row++) //changed 4 5 { table += "<tr>"; (var col=0; col<5; col++) //changed 4 5 { table += "<td>" + numbers[

Git root - accidentally created a branch? -

can tell me how main git root directory? command prompt pointing to c:/sites but now, command prompt pointing to: c/sites (new_branch) not sure how got there suspect must have accidentally created new branch. tried "git branch" returned no results. tried "git checkout master" got error: "pathspec master did not match file(s) known git." i'm on windows 7. thanks! since, not see ls -l .git/refs/heads , implies no longer have master branch (may deleted master branch unknowingly said above weren't sure when accidentally created branch. to go original master branch, check git log when created new branch. once obtain commit sha , recreate master branch "git checkout -b master ". take default prompt.

javascript - Drawing circles to canvas using functions -

<div> <canvas id="canvas" width="250px" height="400px" style="border: 1px solid black" onload="drawcircle()"></canvas> </div> <script type="text/javascript" src="canvasjs.js"></script> </body> </html> var canv = document.getelementbyid("canvas"); var ctx = canv.getcontext("2d"); function drawcircle(){ ctx.fillstyle="blue"; ctx.beginpath(); ctx.arc(50,50,50,0,math.pi*2); ctx.closepath(); ctx.fill(); } just wondering if can tell me why not draw canvas. if remove code function works. you did not invoke function. please append code below codes; drawcircle();

C splitting char array based on a delimiter, but it is failing with consecutive delimiters -

i trying split char array in c using strtok. have working @ moment, have realised when there 2 consecutive delimiters concept gets offset. i parsing char array structure (i cannot post exact code because assignment, post similar code assignment specifics changed) based on thier index, e.g. struct test_struct{ int index_1; int index_2; int index_3; int index_4; int index_5; }test_struct; i use counter populate information, every time delimiter reached increment counter , assign data index, e.g: char c_array[50] = "hello,this,is,an,example" counter = 0; token = strtok (c_array,","); while (token != null) { switch(counter){ case 0: test_struct.index_1 = token; break; case 1: test_struct.index_2 = token; break; //repeat step other indexes } counter++; token = strtok (null, ","); } i know case swi

c# - Substitute grid's background when changing VisualState in Windows Store App -

my windows store app has few visualstates, , each of them have different picture in background (which related orientaton of device, size of screen etc.) i've found in internet, 1 option use storyboard, can find examples related changing colour of background (which not suitable me, have image in background , not plain colour brush.) i thought this: <storyboard> <coloranimation storyboard.targetname="buttonbrush" storyboard.targetproperty="color" to="red" /> </storyboard> but there no substitute coloranimation use image. there known xaml/c# solution, or standard way background image source substitution different visual states (maybe using visual studio or blend?) to use different backgrounds different visual states 1 needs have multiple images spread in background, 1 of them visible each visual state (and rest of images collapsed.) may important change zindexes of elements set them "on top" of

ios - How and where to do dynamic height resize of UITextView inside a custom TableCellView, built in storyboard? -

going crazy...read dozens of "this how it..." answers, differ 1 another, , none work in case. i've messed uitextview frame, bounds, contentsize, etc. , though see these change via nslog, final output reverts original size set in storyboard. using storyboard placed read-only uitextview in subclassed tableviewcell, named groupchatviewcell. i load handful of text strings uitextview through controller's viewdidload. strings word wrapped , longer can fit in defined uitextview frame. i resize tableview cell (which works) in tableview:heightforrowatindexpath delegate , trying resize uitextview (does not work) in tableview:cellforrowatindexpath delegate. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"groupchatviewcell"; groupchatviewcell *cell = (groupchatviewcell *)[tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[

java - why is .setColor(,,,) saying unable to find symbol in this program? -

when run program code g2.setcolor(fillcolor) has cannot find symbol error. legacy issue? improper code? i typed code in verbatim page165 of book "big java" cay horstmann import java.applet.applet; import java.awt.color; import java.awt.graphics; import java.awt.graphics2d; import java.awt.rectangle; import javax.swing.joptionpane; /** * applet lets user choose color specifying fractions of * red, green, , blue. */ public class colorapplet extends applet { public colorapplet() { string input; //ask user red, green, blue values input = joptionpane.showinputdialog("red: "); float red = float.parsefloat(input); input = joptionpane.showinputdialog("green: "); float green = float.parsefloat(input); input = joptionpane.showinputdialog("blue :"); float blue = float.parsefloat(input);

jquery - jsonp failing gives 404 -

to understanding, happens: jsonp wraps json in function. when using jsonp, have specify name of function used in (1) receive data normal josn is understanding right ? please correct me if im wrong if im correct, why doesnt code work? im trying access small local jsonp file givs me 404 (function ($) { var url = 'dummy.jsonp?callback=?'; $.ajax({ type: 'get', url: url, async: false, jsonpcallback: 'wrapper', contenttype: "application/json", datatype: 'jsonp', success: function (json) { alert(json); }, error: function (e) { console.log(e.message); } }); })(jquery); dummy.jsonp: wrapper([ { "id":1, "name":"clark" }, { "id":2, "description":"kent" } ]) edit: turns out @xdazz right, when uploaded file on public ser

python - Smooth Data and Find Maximum -

Image
i have dataset (see below) of 2 variables, x , y. want find value of x, maximum in y occur. current approach x gives me maximum y. not ideal data quite noisy, perform sort of smoothing first, , find max. so far, have tried use r smooth data npreg (kernel regression) np package obtain curve: but i'm not sure how find max. i solution following in python: 1) smooth data (doesn't kernel regression) 2) find value of x max in y occurs using smoothed data x y -20 0.006561733 -19 -4.48e-08 -18 -4.48e-08 -17 -4.48e-08 -16 0.003281305 -15 0.00164063 -14 0.003280565 -13 0.003282537 -12 -4.48e-08 -11 0.003281286 -10 0.004921239 -9 0.00491897 -8 -1.52e-06 -7 0.004925867 -6 -1.27e-06 -5 0.009839438 -4 0.001643726 -3 -4.48e-08 -2 2.09e-06 -1 -0.001640027 0 0.006559627 1 0.001636958 2 2.36e-06 3 0.003281469 4 0.011481469 5 0.004922279 6 0.018044207 7 0.011483134 8 0.014765087 9 0.008201379 10 0.00492497 11 0.006560482 12 0.009844796 13

debugging - Macro VBA script -

can me problem. have code doesn't work. wrong says "sub or function not define". sub macro1() ' ' macro1 macro ' dim x integer, result string x = 2 ' 1st row while cells(x, 4).value = 1 if cells(x, 3).value <= cells(x, 2).value , not cells(x, 4).value < cells(x, 1).value result = "pass" else result = "fail" end if cell(x, 5).value = result x = x + 1 loop end sub change cell cells , work. excel wasn't being helpful enough error message. select text cell when have editor open , try run it. sub macro1() ' ' macro1 macro ' dim x integer, result string x = 2 ' 1st row while cells(x, 4).value = 1 if cells(x, 3).value <= cells(x, 2).value , not cells(x, 4).value < cells(x, 1).value result = "pass" else result = "fail" end if cells(x, 5).value = result x = x + 1 loop end sub

Create iOS7 Icon in Images.xcassets with Xcode5 -

Image
how can 1 create ios7 icon in images.xcassets xcode5? i've searched many places, did not find required icon sizes were. my app ios7+. here screenshot: i've added icons below in appicon.appiconset folder in mac. need add in xcode side bar? required sizes appicon.appiconset folder? this easy & in-fact self explanable. need not have think name of icons. thing need worry sizes. here how infer sizes out of screen. basic rule : multiply 1x or 2x shown in empty box pt value under it. when there 2 boxes 1x & 2x same pt value, let's 40pt , means have provide both sizes of images. 40x40 & 80x80 . make sure if app universal or device specific. based on that, need provide icons. point noted images.xcassets doesn't sizes files. catalog add files of specific sizes. now let's have myicon.png file of bigger size (its better create app icon size of 1024x1024, if not @ least 512x512). open images.xcassets & read each empty

Is it possible to extract emails from an email list -

so university has email list in form of: students@lists.university.edu if send email students@lists.university.edu send email people in list. question is, how extract emails individually giving me: email1@university.edu email2@university.edu email3@university.edu email4@university.edu email5@university.edu email6@university.edu email7@university.edu

meteor - Efficiency of storing information on dom or make simple mongodb query? -

i have linked-list, thinking of storing parent's information on dom clutter html tad-bit, simple mongodb call information. know marginal computational resource difference , storing information on dom more efficient, best inference can make mongodb because have subscribed information, have access , making mongodb query takes little resource. i suppose @ end of day, approach better? its may better take mongodb, because you're sure have latest data , wont need additional code updating dom. the concept in meteor dom can have data context can use find mongodb data without having store in dom. concept removes need store data within dom elements. for example have html {{#with data}} dom {{/with}} template template.mytemplate.data = function() { return { data: xx} } this way can have dynamic/reactive data without having update dom. with new meteor ui (blaze release) set 0.8.0 pass down data template {{>mytemplate okenabled=false}}

Error!: could not find driver PHP Mysql -

i having issue connection mysql server fails above message . have made sure extension folder = ext enabled, the extension=php_pdo_mysql.dll enabled in extension directory dll present. i must mention - have manually downloaded , configured php , apache2 , mysql. although can run phpinfo correctly , not sure if have enable else make db connections work although if run test if (!defined('pdo::attr_driver_name')) { echo 'pdo unavailable'; } else echo('pdo available'); i message pdo available. when researching error came across php code test pdo available? question wherein happened above code fragment. any appreciated. thanks

hibernate - Java hashmap mapping in database -

my entity class @entity public class student_enroll implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.auto) private long id; private int level_num; private int term; private string student_session; private hashmap<string,integer>mark_value; @onetoone private student student; public string getstudent_session() { return student_session; } public void setstudent_session(string student_session) { this.student_session = student_session; } public int getlevel_num() { return level_num; } public void setlevel_num(int level_num) { this.level_num = level_num; } public int getterm() { return term; } public void setterm(int term) { this.term = term; } public student getstudent() { return student; } public void setstudent(student student) { this.student = student; } public hashmap<string, integer> getmark_value() { return mark_value; } public void setmark_value

How to transfer tables in Outlook 2010 emails to Excel 2010 -

Image
i have around 2000 emails sent me in zip file. emails have following structure: http://social.msdn.microsoft.com/forums/getfile/429285 all mails have same subject. can seen screenshot, each mail has multiple tables. these tables have varying number of rows each mail. task of these multiple tables contained in 2000 mails excel form graphs , charts. can please me how go through automation. tried few solutions available found nothing transfer tables within outlook emails excel. have deadline task , prompt appreciated. in advance! this worked me. add reference microsoft html object library in vba project (under tools >> references in vb editor) assumes outlook open, , mails stored in path msg_path . sub tester() const msg_path string = "c:\_stuff\test\mails\" dim ol, m, t, r, c dim doc new mshtml.htmldocument dim rng range, rw object dim f set ol = getobject(, "outlook.application") set rng = activesheet.range("b2")

c# - Ajax not posting data to controller -

i posting data through ajax action, problem not able data posted through ajax in controller action. while debugging, call gets transferred action dont in data not 'null'. here ajax call, $.ajax({ type: 'post', url:' @url.action("postamount", "deal")', data: { country: 2, amount: 4.02 }, datatype:json, success: function (data) { alert("hiiii"+data); } }); and action, [httppost] public jsonresult postamount(int country,double amount) { allocationviewmodel mod = new allocationviewmodel(); return json(mod); } try this: var datatopost = "{ country:'" + 2 + "', amount:" + 4.02 + "}"; $.ajax({ url: @url.action("postamount", "deal")', type: "post", datatype: 'json', data: datato

Is there a way to fetch the names of refs from a remote in Git without fetching any objects associated with those refs? -

i'm writing script acts on local repo remote repo large, slow, , has many branches divergent histories. typical user cares small number of these branches, i'd save bandwidth not fetching objects branches won't use. to that, i'd able fetch names of refs remote without fetching actual objects associated refs. (once have names of refs, plan present list user , allow them select branches want, can programmatically build narrow refspec includes branches interesting them.) is there way in git query remote repo of ref names (in case, few kb) without also incurring cost of fetching of objects (in case, several gb)? (fwiw, users may using either ssh or https urls.) as far know, git show remote origin or git ls-remote can achieve extent. might need filtering or matching want. the following shown example: $ git remote show origin * remote origin fetch url: git@10.88.1.128:test push url: git@10.88.1.128:test head branch: master remote branches

java - Spring Web service throws com.sun.xml.internal.messaging.saaj.soap.ver1_1.BodyElement1_1Impl cannot be cast to org.jdom.Element -

i totally new spring , started self studying begining want develop spring-ws based web service. have created schemas.xsd, spring-ws-servlet.xml , web.xml files in web-inf folder. implemented endpoint annotated @endpoint . in scehmas.xsd have below element <xsd:element name="simplerequest"> <xsd:complextype> <xsd:sequence> <xsd:element name="rename" type="xsd:string" /> </xsd:sequence> </xsd:complextype> </xsd:element> and in web.xml specify spring-ws message dispatcher servlet below. <servlet> <servlet-name>spring-ws</servlet-name> <servlet-class>org.springframework.ws.transport.http.messagedispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/spring-ws-se

visual studio - Inspecting C# project in VS Package -

is there way inspect active project in vs package? currently using filecodemodel, has basic support code inspection, needs api limited. somehow link on c# compiler , read expression trees, there in roslyn project. in case else wonders how inspect hosted c# project , references, here link i've found. it seems c# compiled result never exposed directly through api (i guess, roslyn).

python - Error sending Email (Gmail) from crontab but works from Java class -

i got following code working if launch java class python script script /usr/bin/python /home/tripwire/email/notify.py java class public static void main(string[] args) { string = user_name; string pass = password; string[] = { recipient }; // list of recipient email addresses string subject = "hotspots area detected"; string body = "bla bla bla..."; sendfromgmail(from, pass, to, subject, body); } private static void sendfromgmail(string from, string pass, string[] to, string subject, string body) { properties props = system.getproperties(); string host = "smtp.gmail.com"; props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", host); props.put("mail.smtp.user", from); props.put("mail.smtp.password", pass); props.put("mail.smtp.port", "587");

operating system - How to build Stanford Dune OS? -

i trying build standford dune os with: git clone http://dune.scs.stanford.edu/dune.git make -c kern but following errors: make[1]: entering directory `/home/think/desktop/build/dune/kern' mkdir -p /home/think/desktop/build/dune/kern/tmp/.tmp_versions make -c /lib/modules/3.11.0-12-generic/build m=/home/think/desktop/build/dune/kern modverdir=/home/think/desktop/build/dune/kern/tmp/.tmp_versions modules make[2]: entering directory `/usr/src/linux-headers-3.11.0-12-generic' cc [m] /home/think/desktop/build/dune/kern/vmx.o /home/think/desktop/build/dune/kern/vmx.c: in function ‘vmx_setup_initial_guest_state’: /home/think/desktop/build/dune/kern/vmx.c:793:10: error: ‘x86_cr4_rdwrgsfs’ undeclared (first use in function) cr4 |= x86_cr4_rdwrgsfs; ^ /home/think/desktop/build/dune/kern/vmx.c:793:10: note: each undeclared identifier reported once each function appears in /home/think/desktop/build/dune/kern/vmx.c: in function ‘vmx_enable’: /home/think/desktop/bui

rotation - how to merge the mp4 videos using mp4parser which are taken from both front and back camera alternatively -

i developing app merge n number of videos using mp4parser.the videos merged taken in both front camera , camera. if merge these videos single , merging videos fine, alternative videos taken via front camera merged inverted. can do. please 1 me. this code merge videos: try { string f1,f2,f3; f1 = environment.getexternalstoragedirectory() + "/dcim/testvideo1.mp4";// video took via camera f2 = environment.getexternalstoragedirectory() + "/dcim/testvideo2.mp4";// video took via front camera f3 = environment.getexternalstoragedirectory() + "/dcim/testvideo3.mp4";// video took via front camera movie[] inmovies = new movie[] { moviecreator.build(f1), moviecreator.build(f2), moviecreator.build(f3) }; list<track> videotracks = new linkedlist<track>(); list<track> audiotracks = new linkedlist<track>(); (movie m : inmovies) {

iphone - App icon disappearing on iOS -

my company having issue our ios app's icon disappearing when switching languages. (settings - general - international - language - , change language.) also, there seems situation app icon disappears after updating app appstore. rebooting device recovers issue , icon becomes available again, have users reporting issue negative reviews on app store. it occurs on ios6 , ios7 (more on ios7). icons graphical format set png(32bit rgba), , what's written on apple's technical q&a, qa1686, has been implemented. has experienced similar issue? please advise.

android - TimeoutException in MediaRecorder.finalize() after 10 seconds -

stacktrace0=java.util.concurrent.timeoutexception: android.media.mediarecorder.finalize() timed out after 10 seconds @ android.media.mediarecorder.native_finalize(native method) @ android.media.mediarecorder.finalize(mediarecorder.java:1200) @ java.lang.daemons$finalizerdaemon.dofinalize(daemons.java:187) @ java.lang.daemons$finalizerdaemon.run(daemons.java:170) @ java.lang.thread.run(thread.java:841) if (isdirectoryexists) { mediarecorder recorder= new mediarecorder(); recorder.reset(); recorder.setaudiosource(mediarecorder.audiosource.mic); recorder.setoutputformat(mediarecorder.outputformat.raw_amr); recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb); recorder.setoutputfile(path); recorder.setmaxduration(30*60*1000); if(recorder!=null) { recorder.prepare(); } try { if(recorder!=null) { recorder.start(); isrecordingstarted=true; } } catch (illegalstateexception ilse) { try { if(recorder!=null)

python - attributes of Mainwindow from childWindow -

how can make childwindow access and/or modify attribute mainwindow? i have mainwindow opens different childwindows, dependeing on pressed button on mainwindow. i of childwindows able modify attributes of mainwindow, cannot way access them. when defining widget or window (your window possibly qwidget), specify it's parent in init -method (just pass parent-widget). after that, use parentwdiget-method or set "link" parent-widget in attribute of child-window. see http://srinikom.github.io/pyside-docs/pyside/qtgui/qwidget.html

css - Error JQuery on Font Awesome Icon -

i creating jquery sliding navigation using font awesome (see: http://fortawesome.github.io/font-awesome/ ) now upon adding css since third party web fonts icons wonder how can apply own code using + , - icon. used image icons before planning integrate web icons. my jquery code is. $("#toggle > li > div").click(function(){ if(false == $(this).next().is(':visible')) { $('#toggle ul').slideup(); $("span.minus-btn").removeclass('minus-btn'); } $(this).next().slidetoggle(); }); $("#toggle > li > div").click(function() { $("#toggle > li > div").removeclass("active"); $(this).addclass('active'); if($(this).hasclass("active")){ $("span.plus-btn", this).toggleclass('minus-btn'); } }); now stock don't know how fix sizes of icons. please help. here's jquery fiddle link: http://jsfidd

android - TabSpec SetContent to Fragment -

i using tabhost inside fragment create tabs. problem run tabspec's setcontent() . need set nests fragment under <framelayout> . do uses getchildfragmentmanager() this? how do so? xml layout: <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <tabwidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" android:orientation="horizontal" /> <framelayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="0dp"/> <framelayout android:id="@+id/following" android:layout_w

ios - NSMutableArray arrayWithCapacity issue -

i sorry if stupid question. if please leave comment , remove here code below: numberedarray = [nsmutablearray arraywithcapacity:50]; nsuinteger randomnumber = arc4random() % [numberedarray count]; (int = 0; i<randomnumber; i++) { // run code } } now error of: thread 1: exc_arithmetic (code=exc_i386_div, subcode=0x0) so best guess machine getting confused because telling array has capacity of 50 , pick 1 of slots randomly , perform code long loop less randomly picked number. but want have computer run code based on randomly picked time interval. this game code performs enemy moving left right based on randomly picked time interval. right approach? , if not should try instead? thanks. capacity 50 doesn't mean array contains 50 elements. count 0. perform division 0 , that's why crashes. forget using arraywithcapacity: or initwithcapacity: because doesn't mean practically helpful. update: if need random number in range of 50 why not use jus

javascript - Input file validation -

i validating form using jquery . working fine not file uploading. here there file upload button accept images use jquery follow, $(document).ready(function(){ $('#create_teacher').validate({ rules: { teacherid: { required: true }, teachername: { minlength: 6, required: true }, education: { required: true, minlength: 6 }, experience: { required: true, minlength: 6 }, prevdetails:{ required: true, minlength: 6 }, email: { required: true, email: true }, highlight: function(element) { $(element).closest('.control-group').removeclass('success').addclass('error'); }, success: function(element) { element .text('ok!').addclass('valid') .closest('.co

mysql - how to commit a single query in a transaction -

i'm debugging complex complex stored procedure. need insert prepared queries , results in debugging table whole of procedure in enclosed between begin transactin , commit nothing stored in logging tables until commit. can not find cause of problem if raises error , rollbacks. unfortunately mysql doesn't have autonomous transactions, log tables can use myisam storage engine. myisam doesn't have transactions, in case of rollback data inserted in myisam log table isn't "lost".

Sharepoint hide ribbon for standard users -

is possible hide te ribbon standard users in sharepoint ? want see ribbon when administrator, want people can add document , not edit in ribbon. sharepoint has no standard way (configuration) hide ribbon selected users. can use javascript, maybe jquery it. ribbon rendered <div id="ribboncontainer">. you can info current user via javascript client object model. see msdn .

c++ - Learning OOP: Overloading the + or = operator error -

i thought edit else sees it. have fixed answers of guys. error because of having delete pointer in both constructors stupid reason lol. removed them both , compiles fine :d hi have been working extensively past few days learning more on classes , operator overloading, copy constructors etc. using ivor hortons visual c++ 2012. i have created class same concept time tried make code clearer output showing objects created when , happens whenever, pretty experimenting getting used flow of execution , not. now in class made, keep getting access violation after adding operator overload "+" , "=" in class. have looked @ previous classes have wrote , cannot see how have done different time. code have been working with: #include <iostream> #include <string> using namespace std; class game { public: static int countobj; explicit game(char* title = "default title", int difficulty = 10, int players = 4) { delete [] mp_title; mp_title

javascript - How can I position text at a certain height according to another text aside -

Image
i'm new js, , don't know whether try doable. guys told me "try javascript", , google can't me because it's specific. ok so, firstly have huge text in center of page. far good. call "main text" then, on side of main text, there has column containing more text blocs. time, these blocs have align height of specific words found in main text. you understand better picture : any idea how ? ! use css , html, there no need javascript. in css can use top:; vertically align element, e.g. .text { top: 40%; } this align element class "text" 40% of pages height top. use % units make text align correctly no matter size window is.

python - Importing data with multiple IDs -

i need import data onto server. problem have data isn't quite in right format. put simply, looks this: items_direc id | co-ordinate 1 | 648 2 | 25 2 | 305 2 | 307 2 | 569 3 | 354 3 | 450 3 | 573 4 | 293 4 | 449 5 | 25 5 | 73 i want more this: 1 | 648 2 | 25, 305, 307, 569, 3 | 354, 450, 573, 4 | 293, 449 5 | 25, 73 this code have alter (this code assumes each id unique, no multiples above): class item: def __init__(self, iid, name): self.iid = iid self.name = name class data: def __str__(self): return "item[iid=%s,name=%s]" % (self.iid, self.name) def __init__(self): self._items = {} self._items_file = "%s/%s" % (data_direc, items_direc) def add_item(self, item): self._items[item.iid] = item def __init_items(self): f = open(self._items_file, 'r') line in f: data = line.rstrip('\r\n').split("|")

javascript - Angular js - LocationProvider HTML5mode() and urls -

i've enabled locationprovider.html5mode(true); then putted on top of index.html : <html ng-app="app"> <head> <base href="/projects/www/#/" /> so if browse site using internal links example(#/users) works , urls re-writed projects/www/#/users projects/www/users but if go directly browser projects/www/users page not found. the 1 direct url works : projects/www/ what be? ok fixed add server side htaccess code: rewriteengine on rewritebase /projects/www # don't rewrite files or directories rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -d rewriterule ^ - [l] # rewrite else index.html allow html5 state links rewriterule ^ index.html [l]

Excel Unique values finder vba macro leaves out 2 values -

i'm using vba macro find unique values in column this: function fillinverantwoordelijken(sheet string) thisworkbook.sheets("worksheet").range("b2:b65000").advancedfilter action:=xlfiltercopy, copytorange:=thisworkbook.sheets(sheet).range("a4"), unique:=true end function as far know should work data have @ moment (with every column try needs calculation) skips 2 values there reason. example, should have output of 5 values 3. any idea? wrong way of doing it? found out did remove row couple of times , forgot that. when removed lines solved. so, vba macro works fine!

c++ - Generating Random Numbers with CUDA via rejection method. Performance problems -

i'm running monte carlo code particle simulation, written in cuda. basically, in each step calculate velocity of each particle , update position. velocity directly proportional path length. given material, path length has distribution. know probability density function of path length. try sample random numbers according function via rejection method. describe cuda knowledge limited. understood, preferable create large chunks of random numbers @ once instead of multiple small chunks. however, rejection method, generate 2 random numbers, check condition , repeat procedure in case of failure. therefore generate random numbers on kernel. using profiler / nvvp noticed, 50% of time spend during rejection method. here question: there ways optimize rejection methods? i appreciate every answer. code here rejection method. __global__ void rejectsamplepathlength(float* p, curandstate* globalstate, int numparticles, float sigma, int timestep,curandstate state) { int = bloc

jquery - Saving data with Ajax in Yii -

i've created ajax action in controller in order save specific data in post. dont need render view. my jquery script doing following $("#buttonextend<?php echo $this->post_row;?>").click(function(e){ $.ajax({ type: "post", url: "<?php echo yii::app()->createurl('post/extend', array('id' => $data['id'])); ?>", }); }); and action extend contains following protected function actionextend($id) { $model=$this->loadmodel($id); if(yii::app()->request->isajaxrequest) { $model->todate = '10/10/2013'; $model->save(); } } when checked record in mysql, to_date field not filled. even though updated field, updated in beforevalidate function in model updated. where mistake? thank in avdance help i think should check data type of field 't

java - The "inverse" method of getParameter() -

one way of sending user parameters appending them url: urladdress+="?param1=value1+param2=value2" how else can send user parameters server? these params read httpservletrequest method getparameter(param1); on receiver's end. i tried setrequestproperty("param1","value1"); of httpurlconnection . however, getparameter() couldn't find them on request. i trying send them outside th url won`t visible. you have 2 possibilities: either append them url in case of request, visible, or write them body in case of post request: /** * convert map query string. * @param values map values * <code>null</code> encoded empty string, other * objects converted * string calling <code>tostring()</code> method. * @return e.g. "key1=value&key2=&email=max%40example.com" */ public static string querystring(map<string, object> values) { stringb

java - Precedence of properties: system vs. deployment descriptor vs. properties file -

if have system property pass container (e.g. tomcat) following: -dmy.property=myvalueone and property same key defined in web.xml: <context-param> <param-name>my.property</param-name> <param-value>myvaluetwo</param-value> </context-param> ... , property same key defined in 1 of config*.properties files: my.property=myvaluethree which value property have? myvalueone , myvaluetwo or myvaluethree ? if have several properties same key, there hierarchy defines kind of property overwrites other kind of property? simply said 3 available , can use spel obtain value of each. #{systemproperties['my.property']} // myvalueone #{servletcontextinitparams['my.property'] // myvaluetwo the properties depend on how loading them (a @propertysource or ` however want know happens if use placeholder , have situation have. <property name="myproperty" value="${my.property}" /> assum

java - Failure running spring application : NoSuchBeanDefinitionException -

i have trouble running java spring application : main component fr.sgcib.cva.accounting.computation inside accounting.jar . i trying command : java -cp spring/*:./*:spring-core-3.1.1.release.jar:spring-context-3.1.1.release.jar:spring-beans-3.1.1.release.jar:log4j-1.2.16.jar:commons-lang3-3.1.jar:commons-logging-1.1.1.jar:spring-asm-3.1.1.release.jar:spring-expression-3.1.1.release.jar:.:accounting.jar fr.sgcib.cva.accounting.computation 3 the applicationcontext.xml file located in spring/ , , looks : <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xmlns:security="http://www.springframework.org/schema/security" xmlns:context="http://www.springframework.org/schema/context" xmln

java - Amount of executors in Storm -

i'm playing around storm. topology i'm using: builder.setspout("word", new randomsentencespout(), 3); builder.setbolt("exclaim1", new exclamationbolt(), 6).shufflegrouping("word"); i thought storm spawn 9 executors (3 spouts + 6 bolts) topology, when run it, can see 11 executors running. what 2 executors? they acker bolts responsible managing acknowledgment mechanism. there 2 acker in topology , each bolt task 1 executor default. storm uses acker bolt task (executor) , if don't set number of ackers, run of them in topology. if want manage number of executors, use following : config conf = new config(); conf.setnumackers(1);

java - int cannot be dereferenced compilation error -

i getting error when try compile code saying int cannot dereferenced what causing it? here code using: class { public static void main(string str[]) { int system=22; system.out.println(system); } } by writing int system = 22; you hiding class java.lang.system . when try do system.out.println(... the compiler thinks want have access varilable out of int doesn't have primitive type. you write int system = 22; system.out.println(system); variable names should start lowercase anyways.

The argument taken order of curried functions in OCaml -

normally, write function let abs_diff x y = abs (x-y) also can have curried version : let abs_diff = fun x -> fun y -> abs(x-y) i write question here want confirm understand currying correctly. here understanding: let abs_diff = fun x -> fun y -> abs(x-y) returns function 1 parameter fun y -> abs (x-y) , inside it, x parameter so, when apply abs_diff 5 6 , firsts takes first argument 5 , returns function fun y -> abs (5-y) , continue apply argument 6 , final result (fun y -> abs (5-y)) 6 am correct? furthermore, deal function application, ocaml interpreter utop, ocaml doing point 2 above? first of all, 2 writing let abs_diff x y = abs (x-y) let abs_diff = fun x -> fun y -> abs(x-y) are equivalent. both define same function of type val abs_diff : int -> int -> int = <fun> an uncurried version have been # let abs_diff (x,y) = abs(x-y);; val abs_diff : int * int -> int = <fun> that function ta

r - Specify custom Date format for colClasses argument in read.table/read.csv -

Image
question: is there way specify date format when using colclasses argument in read.table/read.csv? (i realise can convert after importing, many date columns this, easier in import step) example: i have .csv date columns in format %d/%m/%y . dataimport <- read.csv("data.csv", colclasses = c("factor","factor","date")) this gets conversion wrong. example, 15/07/2008 becomes 0015-07-20 . reproducible code: data <- structure(list(func_loc = structure(c(1l, 2l, 3l, 3l, 3l, 3l, 3l, 4l, 4l, 5l), .label = c("3076wag0003", "3076wag0004", "3076wag0007", "3076wag0009", "3076wag0010"), class = "factor"), order_type = structure(c(3l, 3l, 1l, 1l, 1l, 1l, 2l, 2l, 3l, 1l), .label = c("pm01", "pm02", "pm03"), class = "factor"), actual_finish = structure(c(4l, 6l, 1l, 2l, 3l, 7l, 1l, 8l, 1l, 5l), .label = c("", "11/0

php - Remove an Item from the shopping cart on dropdown change event -

i building e-commence system user can select item category dropdown list. want user add 1 item each category , when change item category must remove 1 exist in cart. every categories items have same item id user cannot add 2 or more items same category. i can add items shopping cart, i'm struggling make sure if item same category exists in cart must deleted first. e.g if user want add sony chase cart , lg chase in cart, lg chase must replaced sony because belong same category chassis . don't know if i'm clear <form method="post" action="" class="jcart"> <fieldset> <input type="hidden" name="my-item-url" value="" /> <input type="hidden" name="my-item-qty" value="1"/> <table> <tr><td width="180"> <select name="chasis" id="chasis" onchange="grabinfo(this.value)" class="styled-