Posts

Showing posts from June, 2015

ruby - Capistrano deployment error Can't activate jruby-openssl-0.9.5-java -

i have developed new rails (4.1.4) app in jruby (1.7.10) , trying deploy capistrano v3 on remote vps. error getting looks like: info[551a80fb] running ~/.rvm/bin/rvm default bundle install --binstubs /home/deployer/apps/appname/shared/bin --path /home/deployer/apps/appname/shared/bundle --without development test on example.net debug[551a80fb] command: cd /home/deployer/apps/appname/releases/20140919052426 && ~/.rvm/bin/rvm default bundle install --binstubs /home/deployer/apps/appname/shared/bin --path /home/deployer/apps/appname/shared/bundle --without development test debug[551a80fb] gem::loaderror: can't activate jruby-openssl-0.9.5-java, activated jruby-openssl-0.9.3 debug[551a80fb] debug[551a80fb] raise_if_conflicts @ /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/specification.rb:1988 debug[551a80fb] debug[551a80fb] activate @ /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/specification.rb

3dsmax - 3ds max script make group by parents -

hy! not experienced max script, have written/modified exporter can export single meshes, groups using built in obj exporter. now want select parents(usually theese not 3dobjects) in hierarchy , convert them groups parrents, , have no idea how exatly should it. suggestions maybe script code know? thanks in advanced you can parent of object in scene using myparent = $myobject.parent and can use following line of parent's children: myparent.children so in combination select , group methods, can following: myparent = $myobject.parent select myparent selectmore myparent.children group (getcurrentselection() array) name:"mygroup" and have group named mygroup containing parent object , of children. little tinkering can turn method , iterate through every object in scene. hope helps you.

c - EXC_BAD_ACCESS error message in Xcode -

i'm writing project in xcode, , can't seem solve error. i'm aware i'm trying access released/un-initialised object somewhere, or perhaps passing data objet doesn't understand, can't find cause of issue (i.e. line doing this). i've tried debugging using nszombies, , didn't work. int main(int argc, const char * argv[1]) { const int time_quantum = atoi(argv[2]); int totaltime = 0; int blockedtime = 0; int blocktime[100]; int exittime[100]; int reltime[100]; int spawntime[100]; int processid[100]; char state[100][32]; int microseconds = totaltime * 1000; int currentsector = ((int)((microseconds/1000000.0) * sectors_per_sec)) % disk_sectors; int runningtest; file *fp; fp = fopen(argv[1], "r"); char row[bufsiz]; while (fgets (row, sizeof(row), fp) != null) //error returned here { int time; char eventtype[32];

java - Using channel attributes in different context handlers -

i'm working on application server part of based on netty 4.0. however, ran problem of shared variables channel. have read use such variables in other context handlers need use context.channel().attr(key).set() instead of just context.attr(key).set() to attach variable current channel. here: public class hadlepackets extends channelinboundhandleradapter { private static final logger log = loggerfactory.getlogger(hadlepackets.class); public attributekey<integer> clientidattrkey = new attributekey<integer> ("clientid"); @override public void channelread(channelhandlercontext ctx, object message) throws exception { ... ctx.channel().attr(clientidattrkey).set(idnum); //bind id channel ... } } but, how retrieve value of variable in context handler? attribute key still needed , cant grab handler attached variable. public class storagehandler extends channelinboundhandleradapter{ private static final logger log = loggerfactory.getlogger(s

iOS8 : Saving array into user defaults makes app "pause" -

this bug 1 hour old, recent ios8 update. basically, we're saving array of dictionaries in nsuserdefault preferences , working fine before, , isn't now. symptoms : app reads line , stops without crashing or error. no message of kind. nothing logs after several minutes. no idea why or how, suggestion welcome. if of help, line crashes : [[nsuserdefaults standarduserdefaults] setobject:credentialslist forkey:config_credentials]; this array contains 1 dictionary per user credentials. okay, found workaround issue. i've read nsuserdefaults issue many people ( here example ) in case : saving nsmutablearray in nsuserdefaults now noticed saving arrays works fine, mutable ones caused problems ( reason unkown, see comments above ). created array , initiated mutable one, , saved array instead of mutable one. like : //my mutable array called credentialslist nsarray *temp = [[nsarray alloc]initwitharray:credentialslist]; [[nsuserdefaults standarduserdefa

javascript - Continuously Loading Markers from database depending on last loaded timestamp -

i have marker locations saved in database lat, lng, type, , timestamp. current code loads markers (displaying different icons depending on type), when use setinterval function reload again. 1 solution suggested me add variable checks timestamp on first successful load , updates each time, when function triggered again load markers added after time. i'm not sure how go adding in current code. help/suggestions appreciated. setinterval(function(){ //load markers xml file $.get("json-data-locations_2.php", function(data) { $(data).find("marker").each(function() { var type = $(this).attr('type'); var point = new google.maps.latlng(parsefloat($(this).attr('lat')), parsefloat($(this).attr('lng'))); var icons; if (type === 'drink') { icons = 'newmarkers/blue.png'; } else if (type === 'food') { icons = 'newmarkers/orange.png';

jquery - Android - Keyboard compresses my View -

Image
i'm working on android/ios application. when keyboard opens login (username , password) gets shrinked , looks this: normaly should not compressed. should move up, , give me clear view on i'm typing. yes, don't know, do. tried work percentages in whole app (width/height) - maybe reason, why view gets not moved shrinked? i looked around here @ stack , found suggestions like: <activity ... android:windowsoftinputmode="adjustpan"> </activity> or adjustresize instead, nothing of worked me. on ios works fine. want view moves bit up, , nothing gets resized. i hope can me , if need more information, please let me know, i'll update or comment question then. cordova 3.5 jquery/jquery-mobile plugins: camera/console/device/dialogs/file-transfer/file/inappbrowser/splashscreen/statusbar/vibration/geolocation/network-information eclipse genymotion emulator devices: galaxy note 10.1, 4.4.2; xperia z2 4.4.2 this androidmanifest

How to create a dynamic list in Perl -

i've seen several examples online show how use array static size , manipulate information. i'm curious how create list in perl in list's size can dynamic , items can add, e.g. append() . as side note, of tutorials i've found on google seem bit dated, if have suggestion on can learn simple stuff asked in question, please let me know. thanks. specifically, i'm looking build list of strings, can later reference list's size , iterate through values. arrays are dynamic in perl. my @lines = ('line one', 'line two'); push @lines, 'line three'; print $_, "\n" @lines; output: line 1 line 2 line 3

html - Div inside another div with some padding -

i planning place div inside div padding . face problem top position remains same. how can solve issue <style type="text/css"> #outdiv { margin: 20px auto 20px auto; width: 1100px; height: 630px; max-height: 100%; background: #1c4675; font-size: 14px; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; position:relative; } #outdiv_inner { margin: 10px 5px 10px 5px; width: 1090px; height: 620px; background: #e8e8e8; font-size: 14px; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; } </style> <html> <div id="outdiv"> <div id="outdiv_inner"></div> </div> </html> if wanted blue div appear behind gray one, believe confusing padding margin . set padding, same values on #outdiv : #outdiv { margin: 20px auto 20p

mercurial - How do I stop getting a parse error when setting up a Hg Subrepo? -

i'm having difficulties creating hg-subrepo local hg repository. i've created "core" repository subrepository inside repo. i'm able clone "core" repo inside target when go create/checkin .hgsub file, parse error prohibits me committing file. ps c:\temp\subrepo_experiments\target01> hg status ps c:\temp\subrepo_experiments\target01> hg clone c:\temp\subrepo_experiments\core destination directory: core updating branch default resolving manifests getting core_001.txt getting core_002.txt getting core_003.txt 3 files updated, 0 files merged, 0 files removed, 0 files unresolved ps c:\temp\subrepo_experiments\target01> echo core = c:\temp\subrepo_experiments\core > .hgsub ps c:\temp\subrepo_experiments\target01> hg status ? .hgsub ps c:\temp\subrepo_experiments\target01> hg add .hgsub adding .hgsub ps c:\temp\subrepo_experiments\target01> hg commit hg: parse error @ .hgsub:1:  ■c o r e ps c:\temp\subrepo_experiments\target01>

java - Spring: run code before a persistence context is loaded -

i have spring based multimodule application. , in dao module db (embedded derby) started , created class implements applicationlistener. problem in logs huge stacktrace spring there no db(couldn't connection). still, application works without problems. stacktrace appeared before applicationlistener invoked , db created. actually, see when starting application first time on machine, because db created time, used. so question whow avoid exception in logs? maybe there spring or hibenate setup not connect db before application context loaded? or invoke code creates db other listener? well here way : root context contains datasource, dao, service , transaction manager. in xml config, declaration of database : <bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource" p:url="jdbc:derby:/path/to/database;create=true" p:username="user" p:password="pwd" p:driverclassna

java - Round DateTime by a given DateTimeFieldType -

i use org.joda.time . i have datetime , datetimefieldtype given. what want round datetime (up) nearest datetime after mine, integer number of given field. for example: for (datetime = 20/10/2013 14:20:31.200, datetimefiledtype = datetimefieldtype.dayofmonth()) i get: 21/10/2013 00:00:00.000 . did similar? you can use: datetime.now().dayofmonth().roundfloorcopy() or datetime.now().dayofmonth().roundceilingcopy() take @ datetime.property class more information on this. edit: as krayo mentioned, can pass property directly as: datetime.now().property(datetimefieldtype.secondofday()).roundfloorcopy();

Rails range validation with data from another model -

i have ticket , event model in relationship event has many tickets. ticket model has columns serial starting value , serial ending value denotes range of valid serial nubers event. i want validate ticket on creation if ticket created serial number beyond range, system spew out errors saying range in invalid. what have in ticket model validation validation show valid serial number events between 140000 , 149999 validates :serial_number, presence: true, numericality: { only_integer: true, :greater_than_or_equal_to => 140000, :less_than => 149999, :message => "is invalid" }, :uniqueness => { :message => "%{value} has been taken" } i need data event model , place ticket validation. rails allow in model? should in controller? definitely in model. use custom validations it: validate :serial_number_valid def serial_number_valid u

Nginx and Apache on same domain -

i running vps ubuntu on it. on server, have nginx server hosts wordpress website @ port 80. trying figure out how can create subdomain on website host apache svn server @ example url like: https://svn.example.com wordpress site located @ http://www.example.com i have searched around quite lot, , either missing basic tutorials or there aren't any. could explain basic process me? run apache on 443 port (pure https), add virthost , add svn it, using any manual net

fortran90 - Some questions about a piece of Fortran code, new to Fortran -

i ran piece of fortran code rather difficult understand. 1. name of structure of code / (i1,i1=0,nn-1) / ? how can print directly in code see content? 2. i'm looking ways change value of nn without re-compiling, how should this? nn supposed length of array omega . 3. how should setup length of omega in case of changeable nn ? mean when i'll have no parameter (nn=20) anymore. program test_20140919 ! test implicit none integer nn parameter (nn=20) real omega(nn) call test_real(nn, 2.0, 4.0, omega) print *, omega end program test_20140919 !c === subroutine test_real(nn, o1, o2, omega) integer nn real o1, o2 real omega(nn) print *, nn omega = o1 + (o2*o1)*(/ (i1,i1=0,nn-1) /)/real(nn-1) print *, real(nn) return end i've compiled line gfortran test.f -ffree-form -o test in terminal. upd revised version of code due answers vladimir f: module subs implicit none contains

php - Extraneous option field in Symfony2 form -

i'm using symfony version 2.5.4 , have builder looks this. $builder->add('licensed', 'choice', array( 'choices' => array( 'n/a' => '--', 'yes' => 'yes', 'no' => 'no' ), 'required' => false, 'label' => 'somelabel', 'label_attr' => array('class' => 'font-bold'), 'attr' => array('class' => 'rounded') ) ); when render form get: <select id="companyotherinformation_licensed" name="companyotherinformation[licensed]" class="rounded"> <option value=""></option> <-- not sure coming from. <option value="n/a">--</option> <option value="yes">yes</option> <option value="no">no</option> </select> t

c - Syntax error in method signature in .h file -

i'm trying write c concordance program reads words in file, strips them of non-alphanumeric characters, counts number of times occur, , prints them out, sorted , formatted, file containing word , it's corresponding count in text. i'm running compiler error , cannot figure out issue is, since has no problem node *top in previous method signature... the error i'm getting is: proj1f.h:12: error: syntax error before "file" .h file: #ifndef proj1f_h #define proj1f_h typedef struct node { char *data; struct node *left; struct node *right; } node; void insert(char *x, node *top, int count); void print(node *top, file *file, int *count, int index); #endif functions .c file #include "proj1f.h" #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> void insert(char *x, node *top, int count){ if(top == null){ //place insert node *p = malloc(sizeof(node)); p ->

java - Jackson serializer for primitive types -

i writing custom serializer convert double values strings in json objects. code far: public string tojson(object obj) throws ioexception { objectmapper mapper = new objectmapper(); simplemodule module = new simplemodule("doubleserializer", new version(1, 0, 0, "")); module.addserializer(double.class, new doubleserializer()); mapper.registermodule(module); return mapper.writevalueasstring(obj); } public class doubleserializer extends jsonserializer<double> { @override public void serialize(double value, jsongenerator jgen, serializerprovider provider) throws ioexception, jsonprocessingexception { string realstring = new bigdecimal(value).toplainstring(); jgen.writestring(realstring); } } this works fine double (class members) not work double (primitive type) members. example, public void test() throws ioexception { jsonmaker pr = new jsonmaker(); testclass cl

select - Executing extremely slow MySQL query -

Image
this query has multiple join including aggregate functions executing query approximately 6000 users took 20 seconds. is there other method run query faster? select users.id, sum(orders.totalcost) bought, count(comment.id) commentscount, count(topics.id) topicscount, count(users_login.id) logincount, count(users_download.id) downloadscount users left join orders on users.id=orders.userid , orders.status=1 left join comment on users.id=comment.userid left join topics on users.id=topics.userid left join users_login on users.id=users_login.userid left join users_download on users.id=users_download.userid users.id='$userid' group users.id order `bought` desc the result of running explain the explain output shows doing full-table scans on except users . need create secondary (non-unique) indexes on userid on other tables in join. speed queries on individual users. however, if you're going process users in 1 pass single select without where user

java - AspectJ Decompilation -

i have following class: package ajia.messaging; public class messagecommunicator { public void deliver(string message) { system.out.println(message); } public void deliver(string person, string message) { system.out.println(person + ", " + message); } } and following advice: package ajia.security; import ajia.messaging.messagecommunicator; public aspect securityaspect { private authenticator authenticator = new authenticator(); pointcut secureaccess() : execution(* messagecommunicator.deliver(..)); before() : secureaccess() { system.out.println("checking , authenticating user"); authenticator.authenticate(); } } i compile - ajc -source 5 ajia\messaging\messagecommunicator.java ajia\security\securityaspect.aj as understand resulting messagecommunicator.class have aspect code included. wandering if standard java decompilers decompile class correctly? decompilers wor

xaml - Show border control on hover -

i new xaml , programming in windows store applications, please bare me =) i've got border control, holds image control. basicly want show border control if image control hovered. similar css :hover effect. whats easiest way achieve this? there so many ways achieve this, , depends on setup is. is 1 isolated image, or want able reuse functionality elsewhere? is image inside datatemplate listview or other items control? would ok writing code-behind achieve this, or preferably xaml-only solution? (hopefully latter.) etc. if it's 1 image, handle pointerentered , pointerexited events on image control set border's borderbrush color yellow (for example) , transparent, respectively. since said you're new xaml, "easiest" solution can offer. maybe else can suggest other simple alternatives. unfortunately, there no ":hover"-like styling out of box. have write functionality yourself. my preferred solution bundle functionality k

android - Actitvity going to freez state -

i launching activity on running android app using adb command (first launch android app using adb command start activity). activity starts after finish freezes previous running application. adb command: adb shell start -n com.example.a/com.example.a.mainactivity`enter code here` java code: public class mainactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); intent = new intent("com.ex.intentdemo.action_myown"); startactivity(i); setcontentview(r.layout.activity_main); finish(); } } try onpause(); instead of finish();,because finish(); ends activity. see android lifecycle.but still tell mainactivity must running open second activity.

java - Use Regex to accept a string as long as it contains alphabet -

i want accept string long contains alphabetical letters, example: string teststr = "hello world 1. ?" i using this: teststr.matches("^[a-za-z\\s]+") , won't accept strings have characters outside of alphabet. so wondering how use regex in situation. could use lookahead check if string contains @ least 1 [a-z] (?i)^(?=.*[a-z]).* or without i-caseless modifier : ^(?=.*[a-za-z]).* / check only: ^(?=.*[a-za-z]) test @ regex101

plot - R add loess line to subset of data in scatterplot -

i trying fit separate loess lines 2 sets of data in scatterplot distinguished factor. data mydf <- data.frame(var1 = sample(c('type1', 'type2'), 12, replace = t), var2=sample(1:10, 12, replace = true), var3 =c(rnorm(12))) scatterplot 2 groups of datapoints separately: par(mfrow=c(1,1), mar=c(4,4,0.5,0.5), mgp = c(1.5, 0.3, 0), tck = -0.01) plot(var3 ~ var2, data=mydf[mydf$var1=="type1",], xlim = c(0, 12), ylim = c(-2, 2), xlab = "x axis", ylab = "y axis", pch = 21, col = "red") points(var3 ~ var2, data=mydf[mydf$var1=="type2",], xlim = c(0, 12), ylim = c(-2, 2), xlab = "x axis", ylab = "y axis", pch = 21, col = "slateblue") now problem. not sure how tell r use points var1 = type2 #? loess_fit <- loess(var3 ~ var2, data=mydf[mydf$var1=="type2",]) lines(mydf$var2, predict(loess_fit), col = "blue")

sockets - Using NSHost in iOS -

i'm trying make socket server application in swift ios. found great example: let addr = "127.0.0.1" let port = 4000 var host :nshost = nshost(address: addr) var inp :nsinputstream? var out :nsoutputstream? nsstream.getstreamstohost(host, port: port, inputstream: &inp, outputstream: &out) let inputstream = inp! let outputstream = out! inputstream.open() outputstream.open() var readbyte :uint8 = 0 while inputstream.hasbytesavailable { inputstream.read(&readbyte, maxlength: 1) } // buffer uint8 array containing bytes of string "jonathan yaniv.". outputstream.write("hello", maxlength: "hello".length) i tried run code in xcode , said nshost didn't exist. googled , found nshost wasn't able ios. can use instead? edit i'm using cocoa async socket socket connections. can find here cocoaasyncscket change getstreamstohost getstreamstohos

php - Phabricator SSL certificate not trusted -

i have problem arc install-certificate instruction configuration : linux mint 16 (petra) what did : i have put public key phabricator web (i can git instructions no problem) i have downloaded custom.pem certificate , put libphutil/resources/ssl directory. i have followed instructions in readme file (it in same dir) , modified line in php.ini file : curl.cainfo = /home/ilongin/job/tools/arcanist/libphutil/resources/ssl/custom.pem but still when run arc install-certificate inside project dir : trying connect server... usage exception: failed connect server: [curl/60] (our-phab-server-url) there error verifying ssl certificate authority while negotiating ssl connection. indicates using self-signed certificate have not added ca ca bundle. see instructions in "libphutil/resources/ssl/readme". does knows wrong?

storage - how to read data from sd card and display spinner of another activity in android -

i save file in sd card not retrieve data of sd card text file , display on spinner of activity.when click on read button data display on spinner of activity when click on read button txt file item display on spinner mainactivity.java btnwritesdfile = (button) findviewbyid(r.id.write); btnwritesdfile.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { jour = display.gettext().tostring(); // write on sd card file data in text box try { file myfile = new file("/sdcard/mysdfile.txt"); myfile.createnewfile(); fileoutputstream fout = new fileoutputstream(myfile); outputstreamwriter myoutwriter = new outputstreamwriter(fout); myoutwriter.append(display.gettext()); myoutwriter.close(); fout.close(); toast.maketext(getbasecontext(), "done writing sd 'mysdfile.txt'", toast.length_short).show(); } ca

android - how to display scrollView already scrolled 20% on startup of activity -

Image
i have made android activity in have put scrollview,now want when open activity,it should alreay scrolled 20% ,but should scrolled down after that,i have tried many links , refrences that,but failed that,can please me how can it,my xml code below scrollview,i have put image,i want scrollview show scrolled fixed height on startup of activity. main.xml <scrollview android:id="@+id/scr_profile" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillviewport="true" android:scrolly="200dp" android:scrollbars="none" > <relativelayout android:layout_width="fill_parent" android:layout_height="fill_parent" > ...... </scrollview> have try runnable? final scrollview scroll = (scrollview) this.findviewbyid(r.id.scr_profile); scroll.post(new runnable() {

Update Database if Application Close unexpectedly in c# winforms -

i developing desktop based winform in c#. application may closed unexpectedly (power failure or debug mode off). in closing condition need update database . i.e. need change online status 1 0 how this? the best way know whether application has died not try think of way update database when application closes; rather, create "session" record whenever application opened; "ping" record (i.e. there's lastpingutc column) every minute. if application closes whatever reason, lastpingutc value on 1 minute ago , therefore can assume application / session dead. actually, i'd assume given session dead after 5 minutes updating column may delayed.

php - What is the precidency and associtivity for increment operator and assignment operator for the block of code -

what precidency , associtivity increment operator , assignment operator block of code $a=array(1,2,3); $b=array(4,5,6); $c=1; $a[$c++]=$b[$c++]; print_r($a); as per execution outputs array ( [0] => 1 [1] => 6 [2] => 3 ) but not able understand how array $a index 1 holds value of array $b index 2 value. can explain scenario how execution happens? php (once again) different other languages in left part of assignment evaluates first. simple proof: $a[print 1] = $b[print 2]; // print? according http://3v4l.org/ , code: $a = array(); $b = array(); $c = 1; $a[$c++]=$b[$c++]; generated following opcodes: compiled vars: !0 = $a, !1 = $b, !2 = $c line # * op fetch ext return operands --------------------------------------------------------------------------------- 2 0 > init_array ~0 1 assign

php - Google Plus Share Error -

Image
i trying integrate google plus sharing on php site first time , getting strange error seems reference include statement, makes worse not view entire error. when clicking google plus share image following dialog: if hover on error tooltip displays same message error trailing off after 'to'. why happening? here link using: <a href="https://plus.google.com/share?url={http://www.example.com/mikey/dopeclothing/index.php}" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=1200,width=1200');return false;"><img src="https://www.gstatic.com/images/icons/gplus-32.png" alt="share on google+"/></a></div> i wondering if there maybe needs taken account when sharing php file ??

loops - No such file or directory OR TypeError: coercing to Unicode: need string or buffer, list found -

in python 2.6: i haven't been able implement of responses other posts error , make work need direct here code. know basics of python , i'm trying write own script open folder list files in folder open files 1 one , count in each file unique entries. i create dictionary each entry stored key , values being total number of times each entry present. ask print length of dictionary know how many unique entries there are. dictionary works loop through folder doesn't. tells me there not such file or directory or error below: #!/usr/bin/python import sys import os # takes files in folder , counts unique records in each file, returns number of each record followed name of file ##usage: perl countunique.py folder folder = (sys.argv[1]) list = open(os.listdir(folder), "ru") filename in list: count = {} gene in filename: if not gene in count : count[gene]=1 else

r - Why does sourcing a script not print out to stdout? -

in r session, source simple r script content is: x = c(1,2) x as source('my.r') i wonder why running in r session doesn't show output? (i find can use print() show value of x .) thanks. it way source configured. can change options echo , print.eval : echo logical; if true, each expression printed after parsing, before evaluation. print.eval logical; if true, result of eval(i) printed each expression i; defaults value of echo. so try source("my.r", print.eval=true)

c# - EF, WinForms. Bind navigation property to DataGrid -

i'm following tutorial http://msdn.microsoft.com/pl-pl/data/jj682076 . want load particular category context, create datagrid , bind products property of category. want able add, edit, , remove products on datagrid have been trying code: context.cetegories.where(c => c.categoryid == _category.categoryid ).select(c => c.products).load(); this.productsbindingsource.datasource = _context.categories.local.tobindinglist(); where productsbindingsource binding source , datagrid generated designer binding source datasource. how can achieve this? thought load products straight context , bind them datagrid _context.products.where(c => c.categoryid == _category.categoryid).load(); but when want add new product category straight grid there problem fk, because don't know how set new item. i solved problem myself. earlier code load products category correct. problem code returns object of category type , obtain products navigation property had use binding sou

php - Not clause for Twig templates -

how do not clause in twig template similar php's ! ? given sick values of either true or false , tried following, throws error. {% if !sick %} kenny not sick. {% elseif dead %} killed kenny! bastard!!! {% else %} kenny looks okay --- far {% endif %} you should use not keyword negation. {% if not sick %} kenny not sick. {% elseif dead %} killed kenny! bastard!!! {% else %} kenny looks okay --- far {% endif %} following documentation page , answear .

regex - Find a file in a directory using python by partial name -

i have directory several hundred thousand files in it. they follow format: datetime_fileid_metadata_collect.txt a specific example looks : 201405052359559_0002230255_35702088_collect88.txt i trying write script pulls out , copies individual files when provide list of file ids. for example have text document fileids.txt constains this fileids.txt 0002230255 0001627237 0001023000 this example script have written far. file1 result keeps returning [] import os import re, glob, shutil base_dir = 'c:/stuff/tub_0_data/' destination = 'c:/files_goes_here' os.chdir(base_dir) text_file = open('c:/stuff/fileids.txt', 'r') file_ids = text_file.readlines() #file_ids = [stripped stripped in (line.strip() line in text_file.readlines()) if stripped] ids in file_ids: id1 = ids.rstrip() print 'file id = ',str(id1) file1 = glob.glob('*' + str(id1) + '*') print str(file1) if file1 != []: shutil.copy(b

sql - How to get summary values from ranked rows? -

given data, how can write sql return 1 row each department showing summaries , counts ranked rows? with data_row ( select '123' emp_id, 'aaa' dept_id, 'm' emp_gender, 'a' seqno, 400 score dual union select '123' emp_id, 'aaa' dept_id, 'm' emp_gender,'b' seqno, 500 score dual union select '123' emp_id, 'aaa' dept_id, 'm' emp_gender,'c' seqno, 300 score dual union select '345' emp_id, 'aaa' dept_id, 'f' emp_gender,'a' seqno, 600 score dual union select '345' emp_id, 'aaa' dept_id, 'f' emp_gender,'b' seqno, 700 score dual union select '222' emp_id, 'bbb' dept_id, 'f' emp_gender,'a' seqno, 200 score dual union select '222' emp_id, 'bbb' dept_id, 'f' emp_gender,'b' seqno, 800 score dual ) select dept_id, sum(score) on ( partition dept_id) rn

How to get current url in Google App Engine python with jinja templating -

i'm using google app engine python jinja2 templating. there template tag url of current page. or have pass url variable template view code? {{ request.url }} gives current url. need full url, or path relative root? for example, using flask, can have {{ request.url }} {{ request.base_url }} {{ request.url_root }} {{ request.host_url }} {{ request.path }} etc.

r - Adjust geom position along discrete scale -

i'm trying position text annotations on plot has both facets , discrete axis. can tie position of annotations points using aes() , i'd budge them little keep points readable. fine if nudge on numeric scale: data <- data.frame( category = c("blue", "yellow", "red", "green"), rating = 1:4) gp <- ggplot(data) + geom_point(aes(x = category, y = rating)) + geom_text(aes(label = "i have label!", x = category, y = rating + 0.5)) but if try on non-numeric scale (in case, character) fails: gp <- ggplot(data) + geom_point(aes(x = category, y = rating)) + geom_text(aes(label = "i have label!", x = category + 0.5, y = rating)) gp error in unit(x, default.units) : 'x' , 'units' must have length > 0 in addition: warning messages: 1: in ops.factor(category, 0.5) : + not meaningful factors 2: removed 4 rows containing missing values (geom_text). i use hjust , vjust move them

Option for row_number and partition by in SQL Server 2000? -

here table student_grade : id studentname subcode,grade stdid ----------------------------------- 1 pinky 1 1 2 archana 2 1 3 leena 1 1 4 leena 2 1 5 leena 3 b 1 6 rupali 1 2 7 megha 1 2 8 smita 1 1 grade d.i want show record once when grade same same stid,does not matter subcode , studentname.for perticular subcode,appropriate studentname come when stid , grade specidy.if grade different same stid,show both record. here want show i applied row_numer() working in sql server 2005 not working in sql server 2000. how in 2000? query is: select stdid, subcode, studentname, grade, subjectname (select stdid, subcode, studentname, grade, subjects.subjectname subjectname, row_number() over(partition cast(stdid varchar) +' - '+ grade order subcode desc,studentname desc) rn student_grade inn

android - JPEG compress same size as original -

i'm stuck issue since 2 days : want compress bitmap (jpeg). i found useful information here , on google none work fine. my jpeg file in assets. can read without problem, retrieve info. when compress it, byte[] array fine, decodebytearray, size same original. here code inputstream in = assets.open(filename); config config = bitmap.config.rgb_565; options options = new options(); options.inpreferredconfig = config; bitmap bitmap = bitmapfactory.decodestream(in, null, options); bytearrayoutputstream out = new bytearrayoutputstream(); bitmap.compress(bitmap.compressformat.jpeg, 50, out); bitmap = bitmapfactory.decodestream(new bytearrayinputstream(out.tobytearray()),null,options); i don't know do. thank in advance time decoding reverse of compression: turns raw pixel data. compression useful reducing file size storage , transmission, when image gets displayed, gets decompressed in memory same size when started. if want make raw pixel data smaller, ne

mysql - Selecting column alias filled with NULLs with Zend_Db -

is there way can select null column zend_db. make clear, write query: select id, name, age, null ssn dummy_table; the result have 4 columns id, name, age , ssn(filled null). there way in zend_db. guess was: $columns = [ 'id' => 'id', 'name' => 'name', 'age' => 'age', null => 'ssn' ]; $select = $this->_db->select(); $select ->from('dummy_table', $columns) but won't work generate: select `dummy_table`.`id` `id`, `dummy_table`.`name` `name`, `dummy_table`.`age` `age`, `dummy_table`.`ssn` `` `dummy_table`; this query fail. there way using zend_db ($this->_db->query('') not option)? have tried using new zend_db_expr('null') ? you : $null = new zend_db_expr('null'); $columns = [ 'id' => 'id', 'name' => 'name', 'age' => 'age', $null => 'ssn'

facebook - Like gate gone, user_likes review -

im building simple facebook promotion app, have problem gate gone - still catch page likes if can. so thinking use user_likes permission, when use logs in app check if likes page , if no try convince him like. of course there "skip" button, users can choose , not page , still other content... since don't have experience review process, such use of user_likes permission approved facebook or how should it? thanks information!

html - Disappearing divs and odd positioning when using float -

i have 2 problems , wondering if me? have been looking around yesterday , today on internet , found examples didn't work me. wondering if of guys know how fix problem. i'm quit new html & css maybe that's problem. thanks looking it! problem 1: have made 2 div's 1 on left side , other on right side using "float" img on top , text under it. if copy same thing under again image overruled , text don't show up. did give margin-bottom: 50px don't work. problem 2: in div box-text give in css margin-top text not go down. visit problem here html: <body> <div id="content"> <div class="head-text">my latest work</div> <div class="b1"> </div> <div class="b2"> </div> <div class="b3"><p><h3>aangenaamklassiek</h3> hello fellers how doing? in

java - Converting timestamp String in a unique Primary Key -

i'd transform string (from xml file) db primary key using java 7. in particular, make sure values unique , positive , respect db primary key specification is: number(20). the string try transform have characterization: pdr_20140909150001 obviously can ignore first part of string (because same file), have transform timestamp string 20140909150001 in int value must unique , have maximum 20 digit of lenght. any idea? how can do? you can convert string int using integer.parseint(), assume 20140909150001 unique enough. hope :)

iphone - How Indoor Navigation works in iOS using iBeacon or wi-fi? -

i working on project has requirement of indoor navigations. have been searching lot, found paid sdk's , other tools. want know how indoor navigation works , architecture used? want know how ibeacon can used indoor navigation. implementation of indoor navigations required ios device. please let me know. in advance!! indoor navigation beacons or wifi complex task must willing lots of custom programming , surveying. 3 main approaches used. the state of art approach signal fingerprinting number of wifi or bluetooth sources placed in area. fingerprint specifies expected signal level each source @ every possible point in area. these fingerprints, software model of room must generated allows code find best matching coordinates in map measured signal level each source. performing survey time consuming , must redone if transmitters moved or if room rearranged. reason, automation tools must built make practical. several companies specialize in doing work , have proprie

c# - Animation in WPF MVVM -

i'm trying simple animation. want animate rectangle. found following code xaml <window x:class="wpfapplication2.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid> <rectangle height="56" horizontalalignment="left" margin="204,104,0,0" name="rectangle1" stroke="black" verticalalignment="top" width="200" fill="#fffa0000" /> <button content="button" height="23" horizontalalignment="left" margin="21,276,0,0" name="button1" verticalalignment="top" width="75" click="rotate" /> </grid> </window> c# private void rotate(object sender, routedeventargs

c# - How store a JSON array with ServiceStack? -

i know how stored simple json message in table, how can store data in same table if generate json array? ex: [{"id":0,"data1":123,"data2":"string1","timestamp":"/date(-62135596800000-0000)/"},{"id":0,"data1":456,"data2":"string2","timestamp":"/date(-62135596800000-0000)/"}] i tried it doesn't work doesn't compile: public class table1 { public list<table1> table1list{ get; set; } [autoincrement] public int id { get; set; } public int data1{ get; set; } public string data2{ get; set; } public datetime timestamp { get; set; } } // add table1 via post [route("/table1add", verbs = "post")] public class table1 add { public int id { get; set; } public int data1{ get; set; } public string data2{ get; set; } public datetime timestamp { get; set; } } // add multi table1 via post [route

html - Django Grapelli not styling a few pages -

i working on project using django grapelli style admin interface. admin.css working style of site except couple pages none of styling coming through. have suggestions begin? thinking pages not getting styling must not have admin.css referenced in template. pretty new django , grapelli understanding.

lambda - Java 8 method reference unhandled exception -

i'm working on project java 8 , found 1 situation can't understand. i have code this: void deleteentity(node node) throws someexception { (childnode child: node.getchildren()) { deletechild(child); } } void deletechild(object child) throws someexception { //some code } this code working fine, can rewrite method reference: void deleteentity(node node) throws someexception { node.getchildren().foreach(this::deletechild); } and code doesn't compile, giving error incompatible thrown types *someexception* in method reference . also idea gave me error unhandled exception . so, question why? why code compiles each loop , doesn't compile lambda? if @ consumer<t> interface, accept method (which method reference using) isn't declared throw checked exceptions - therefore can't use method reference is declared throw checked exception. enhanced loop okay, because there you're in context someexception can throw