Posts

Showing posts from September, 2013

android - How to download image from facebook Graph API -

i want download image facebook bitmap null. [ private void extractfacebookicon(string id) { bitmap bitmap = null; inputstream in = null; try { strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build(); strictmode.setthreadpolicy( policy ); url imageurl = new url("http://graph.facebook.com/"+id+"/picture?type=large"); in = ( inputstream) imageurl.getcontent(); bitmap = bitmapfactory.decodestream( in ); mfacebookicon = bitmap; } catch(throwable e) { }] when use http://graph.facebook.com/"+id+"/picture?type=large in browser, chrome redirects me on link , picture opening , bitmap can read it. (" https://fbcdn-profile-a.akamaihd.net/hprofile-ak-frc3/t1.0-1/c0.0.1.00.1.00/p100x100/969878_592016040843290_1511913922_t.jpg ) how solve problem , read first link bitmap not null? i think it's because facebook send appli...

mysql - Subdividing a string and using substrings as fraction components -

i'm trying return set of string values mysql query. separate them @ '/' character (which contain). , divide value before '/' character, value follows it. i've tried casting substring int , several decimal variations. gratefully accepted. " cast( cast( substring( customerfeedback.total_score, 0, locate('/', table.column_a-1) )as decimal(6,3) ) / cast( substring( customerfeedback.total_score, locate('/', table.column_a+1), length(table.column_a) )as decimal(6,3) ) decimal(6,3) ) " use substring_index extract numerator , denominator parts , use them in division. example : select @str:='225/12', @n:=substring_index( @str, '/', 1 ) numerator, @d:=sub...

Scala nested arrays flattening -

how flatten array of nested arrays of depth ? for instance val in = array( 1, array(2,3), 4, array(array(5)) ) would flattened onto val out = array(1,2,3,4,5) thanks in advance. if have mixed int , array[int] , not idea begin with, can like in.flatmap{ case i: int => array(i); case ai: array[int] => ai } (it throw exception if you've put else in array). can use basis of recursive function: def flatint(in: array[any]): array[int] = in.flatmap{ case i: int => array(i) case ai: array[int] => ai case x: array[_] => flatint(x.toarray[any]) } if don't know you've got in nested arrays, can replace above int s any , flat array[any] result. (edit: any case needs go last.) (note: not tail-recursive, can overflow stack if arrays nested extremely deeply.)

Compiler Error Message: CS0029: Cannot implicitly convert type 'int' to 'string' in C# .NET 4 -

i need convert string of input of table database integer value in c# .net 4 , tried code inspired link : int i; string entry_level = convert.toint32("2,45"); = convert.toint32(entry_level); but i've error: compiler error message: cs0029: cannot implicitly convert type 'int' 'string' edit solved with: decimal i; string entry_level = "2,45"; = convert.todecimal(entry_level); response.write(i.tostring()); response.end(); in output i've 2,45, many thanks! string entry_level = convert.toint32("2,45"); should be string entry_level = "2,45"; why not go though: int = 2,45; but since not integer, you'll need 1 of built-in decimal types: /* use when precision matters lot, example when unit price or percentage value multiplied big numbers */ decimal = 2.45 /* use when precision isn't important part. it's still precise, can in trouble when deal...

nasm - Assembly x86 append numbers to a variable -

i'm reading input numeric string, iterate character character convert each digit in decimal. now @ every iteration in 1 of register, example al , have single digit, let's say input: 12345678 iteration_1 : 1 iteration_2 : 2 ... iteration_8 : 8 i add these integers dd variable, @ end of iteration have dd variable containing whole number use operation. has sense? how append @ each iteration current number dd variable? zero out register use "result far". top: get character. make sure have valid decimal digit. subtract '0' convert character number. multiply "result far" ten. add in new number. go top. this use... ;-------------------- atoi: ; expects: address of string on stack ; returns: number in eax ; "trashes" ecx , edx ; actually, edx "next character" ; , ecx (cl) "invalid" character ; think of "192.168.0.1"... ; caller cleans stack push ebx mov edx, [esp + 8] ; pointe...

python - Stopping a loop when "items run out" even if it doesn't reach the proper if clause -

i want write code takes list of items , concatenates them (separated commas) long strings, each string not longer predefined length. example, list: colors = ['blue','pink','yellow'] and max len of 10 chars, output of code be: long string 0: blue,pink long string 1: yellow i created following code (below), pitfall cases total length of concatenated items shorter of max len allowed, or creates 1 or more long strings , total len of concatenation of residual items in list shorter max len. what i'm trying ask this: in following code, how "stop" loop when items run out , yet concatenation short "else" clause isn't reached? many :) import pyperclip # theoretical bug: when single item longer max_length. never happen intended use of code. raw_list = pyperclip.paste() split_list = raw_list.split() unique_items_list = list(set(split_list)) # notice set unordered collections, , or...

css - Extend to full width a div inside a contented div -

Image
i have div width set (ex. 980px) , child of div want extend full browser width (without expand parent or overflowing anything). worthy body positioned relative element (and can't change it). i thought using absolute element got in trouble other elements near it. any appreciated. you don't have expand inner div 100% of outer div, if accept things margins , paddings applied usual. take @ example setup you: http://jsfiddle.net/3e4yy/4/ html: <div class="outer"> <div class="inner"> inner div automatically takes available width inside parent container element, outer div in case. inner div automatically takes available width inside parent container element, outer div in case. inner div automatically takes available width inside parent container element, outer div in case. </div> </div> <hr> <div class="outer"> <div class="inner"> inner div ...

linux - Forbidden: cannot access / on server -

i'm transferring clients site on our server, including domain has same url etc. upon transferring files over, , changing .htaccess file match 1 on old server, being greeted error message you don't have permission access / on server , i'm not sure why? few things mention, changing first line options -indexes options +indexes rectifies this, instead of error message greeted index of / page. possibility, switching hosting platform linux windows fix these problems? options -indexes errordocument 500 /error <files ~ "\.pm$"> order allow,deny deny </files> <files ~ "\.template$"> order allow,deny deny </files> <files ~ "\.tmpl$"> order allow,deny deny </files> <files ~ "\.log$"> order allow,deny deny </files> <files ~ "\.revid$"> order allow,deny deny </files> rewriteengine on rewritecond %{request_uri} ^/index.pl rewritec...

mysql - Hibernate: How does native identifier generation strategy work -

hibernate has identifier generation strategy called native selects identity , sequence or hilo depending upon capabilities of underlying database. used mysql hibernate.hbm2ddl.auto=update generated id bigint(20) not null auto_increment id property of long java data type. i trying understand how did hibernate choose auto_increment when used schemaexport tool. auto_increment default primary key generation strategy mysql? could me understand it? hibernate when selecting key generation mechanism in native mode, try choose best mechanism available in database. in case of mysql, auto increment available , hibernate uses instead of sequence, because auto increment mechanism better altough sequences work fine. the reason why it's better it's possible in 1 single jdbc prepared statement, example insert, insert , retrieve generated key without querying database - see here further details. in case of sequences, hibernate has first call sequence @ point , us...

c - Initialize a struct -

i trying initalize struct getting following error msgs in c: error: initializer element not constant error: (near initialization 'resource01.resource.role') for url works, it's role not working. first had pointer on role , assigned address of variable. removed pointer because don't need , can t assign value variable. doing wrong? static char const resource01url[] = "/dummy"; static int const resource01role = 2; static struct restresourcenode_s resource01 = { { resource01url, resource01role, &dummyhandler_call }, null }; static struct restresourcesmanager_s resourcesmanager = { &resource01, &resource01 }; the type restresourcenode_s defined: struct restresourcenode_s { restresource_t resource; struct restresourcenode_s const *next; } and restresource_t: struct restresource_s { char const *url; int const role; retcode_t (*handle)(msg_t *); }; typedef struct restresou...

How to continuously read data from socket in python? -

the problem don't know how bytes receive socket, trying loop. buffer = '' while true: data, addr = sock.recvfrom(1024) buffer += data print buffer as understood recvfrom return specified size of bytes , discards other data, possible somehow continuously read data buffer variable? it wont discard data, return data in next iteration. doing in code correct. the thing change clause break loop: buffer = '' while true: data, addr = sock.recv(1024) if data: buffer += data print buffer else: break an empty string signifies connection has been broken according documentation if code still not work show how setting socket.

ibm mq - wso2esb & WMQ 7.5 -

i've problem: need send messages (only send) ibm mq 7.5. in case have lot of dynamic queues on several managers, isn't possible send messages via jndi (like described in wso2 doc). ibm mq has jms extension can send messages directly queue manager , queue specifying in q name (for example "queue://qm1/qname1"). need specify connection factory these <bean id="mqconnectionfactory" class="com.ibm.mq.jms.mqqueueconnectionfactory"> <property name="port" value="${mq.port}"/> <property name="transporttype" value="${mq.transporttype}"/> <property name="hostname" value="#{props['host']}"/> <property name="queuemanager" value="#{props['mq.manager']}"/> <property name="channel" value="#{props['mq.chanel']}"/> </bean> but doesn't find how can ...

Difference between Windows Phone project and Silverlight Windows Phone project in Visual Studio 2013 -

i updated visual studio 2013 such allows develop windows phone 8.1 applications. now, when create windows phone project, systematically wp 8.1 , can't change target. way found in order develop wp 8.0 apps it's create silverlight windows phone project. whence question : what's concrete difference between windows phone project , silverlight windows phone projet in visual studio 2013 ? thanks answer the windows phone project uses windows runtime apis. lot of windows runtime api introduced in windows phone 8 project common both windows phone 8 , windows 8, making easier write once , share code between apps on both platforms. as expected windows phone silverlight project uses silverlight based apis.

actionscript 3 - Action Script 3 - how to pass variables through multiple scenes -

i using flash cs6 , making game in squares falling down randomly , have wall controlled mouse. every square dodge 10 points added score. if squares touch wall go scene called "the end" scene in scene display score player. want pass score variable scene. have tried googling lot of times couldn't help. hope guys. please help. how go next scene: if (wall.hittestobject(square)) { gotoandstop(1, "the end"); } instead of using flash create games can game maker more efficient. can go website yoyogames.com

jquery - How to manually trigger 'update' in ui-sortable -

i'm using ui sortable in each item delete button. here delete function: $('.delete_item').click(function(){ $(this).closest('.grid_3_b').remove(); initsortable(); $(".sortable").sortable('refresh').trigger('update'); }); the div get's removed want to, there no update data sent php.. script won't save order , deleted item.. here initsortable(); function: function initsortable() { $( ".sortable" ).sortable({ items: '.grid_3_b, .dropable', connectwith: ".sortable", placeholder: "placeholder", remove: function(event, ui) { if(!$('div', this).length) { $(this).next('.dropable').remove(); $(this).remove(); } initmenu(); }, receive: function(event, ui) { if( $(this).hasclass( "dropable" ) ) { if( $(this)...

html - Bootstrap's grid: elements with different heights -

i've been working on application dynamicaly adds elements dom. added elements of 2 types: ones height 50px , ones 100px. displayed in of bootstrap grid system. working example: <div> <div class="col-xs-6" style="height: 100px;">1</div> <div class="col-xs-6" style="height: 50px;">2</div> <div class="col-xs-6" style="height: 50px;">3</div> </div> but when try rearrange, unexpected spaces occur on layouts: <div> <div class="col-xs-6" style="height: 50px;">2</div> <div class="col-xs-6" style="height: 100px;">1</div> <div class="col-xs-6" style="height: 50px;">3</div> </div> between element '1' , '3' there 50px wide gap. there arrangement element '3' placed in gap? why gap occuring? @gaurav correct.. it's happeni...

centering - css background image completion -

please take @ following fiddle: http://jsfiddle.net/urlq2/ <div class="header"> header </div> <div class="navi_wrap"> <div class="navi"> <a href='#'>tab1</a> <a href='#'>tab2</a> </div> </div> <div class="wrapper"> content </div> the background image should have 100% width, header , content should centered. i'm trying achieve missing orange background block left navigation block. what's best approach this? remove margin:0px auto; div.navi , div.wrapper demo

html - IE float hover issue -

hello guys) seems have pretty common issue :hover'ing on floated list elements in ie, though didn't find solution far. ie11 + win7. here html... <!doctype html> ... <ul id="horizontal-menu"> <li><a href="#"></a></li> <li><a href="#"></a></li> <li><a href="#"></a></li> </ul> and have css way... #horizontal-menu { list-style: none; } #horizontal-menu li { display: inline-block; float: left; margin-left: 3px; } #horizontal-menu li { background-color: green; display: inline-block; float: left; height: 30px; width: 30px; } #horizontal-menu li a:hover, #horizontal-menu li a:active { background-color: red; } the problem in ie actual :hover area of list item links has strange left margin, , works fine rest of browsers... though don't have enough reputation post images, here gonna find ...

javascript - Using index to pull items from an object -

if have object items named , ending in sequential numbers: var theobject = { item1:, item2:, item3:, ...etc } this method of extracting objects , used in loop not seem work. should work provided rest of function correct? theobject.item+i you can theobject['item'+i] . can better using jquery foreach can iterate on keys.

Create Neo4j Unique nodes in java class -

i want create nodes , relatioships based on column values in db. node1 values come column "app-name",node2 -> "corresponding_app" & relationship->"interface_name" based on column values "interface_type_name"->incoming/outgoing arrows drawn particular nodes. nodes should unique , if created should not create duplicate one. transaction tx=graphdb.begintx(); connection conn = null; try{{ conn=connectionfactory.getconnection(); statement stat=conn.createstatement(); string sql="select * fade app_int_id < 22"; resultset rs=stat.executequery(sql); string n1 = "",n2="",rel="",type=""; while(rs.next()){ n1=rs.getstring(1); n2=rs.getstring(7); rel=rs.getstring(3); type=rs.getstring(4); node first=graphdb.createnode(); first.setproperty("name", n1); ...

Spring beans config - import order, can we use ref value of bean which is configured later in xml by import? -

i have following spring beans config: <import resource="a1.xml"/> <import resource="a2.xml"/> <import resource="a3.xml"/> can use ref link bean a3.xml in a1.xml? for example in a1.xml: <bean id="someid" class="com.xxxx.yyyy" scope="prototype"> <property name="test" ref="%some_bean_id_from_a3.xml%"/> </bean> is valid? yes, can. following setup work: appconf.xml <bean id="urlpath" class="java.lang.string"> <constructor-arg type="char[]" value="google.com"/> </bean> appconf2.xml <import resource="appconf.xml"/> <bean id="urlbean" class="java.net.url"> <constructor-arg ref="urlpath"/> </bean>

api - What are the best solutions out there for SMS integration? -

we need send , receive large number of transactional sms web application, thousands of sms per hour @ time of day. looking well-functioning, stable , highly reliable sms solution. instant delivery , 100% uptime must. though international coverage needed in near future, targeted country network coverage @ moment india (all major cities in india). what different solutions out there , how 1 better other? please suggest. strikeiron can deliver sms messages through web application using api. can send messages india 200 other countries. api can set either soap or rest giving flexibility. more @ http://offers.strikeiron.com/quick-start-guide-sms-1 or can see how other businesses using sms throughout world, in research report global sms market conducted portio research at: http://offers.strikeiron.com/sms-portio-research-2

javascript - Create full HTML file using partial HTML -

Image
i have main html page (index.html) , need construct page page dynamically combining several html files (custom_header_page.html/ custom_content_page.html/ custom_footer_page.html) . i looking way done without server side scripting invloving. eg: custom_header_page.html custom_body_page.html custom_footer_page.html just tired following in index.html file , yes loads want override <head> </head> content of index.html have added in "custom_header.html" file. index.html <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript"> </script> <title>title</title> </head> <body> <div id="custom_header"></div> <div id="custom_body"></div> <div id="custom_footer"></div> <script> $(function(){ $("#cus...

database - DB4O Insert winery that does not exist -

i'm doing test db4o. trying insert data. problem have is: when insert name of winery , d.o. have insert if not exist in database. how it? this insert code: scanner teclado=new scanner(system.in); try{ objectcontainer db= db4oembedded.openfile("db4o.yap"); system.out.print("name of wine: "); string nomvino = teclado.next(); system.out.print("name of cellar: "); string nombodega = teclado.next(); system.out.print("d.o: "); string = teclado.next(); system.out.print("type of wine: "); string tipovino = teclado.next(); system.out.print("grad: "); float gradosalch = teclado.nextfloat(); system.out.print("year of wine: "); int fecha = teclado.nextint(); teclado.close(); vinos v = new vinos(nomvino,new bodega(nombodega,do),tipovino,gradosalch,fecha); db.store(v)...

angularjs - How to convert date from UTC to local time zone and reverse with Restangular -

i storing date in utc format on node/express server , using restangular , post data on client. possible convert date utc local time , local time utc restangular addresponseinterceptor , addrequestinterceptor methods. this post solution me. works great - change made add tolocal flag, set true on response interceptor, , false on request, used moment appropriate switch.. http://aboutcode.net/2013/07/27/json-date-parsing-angularjs.html function convertdatestringstodates(input, tolocal) { // ignore things aren't objects. if (typeof input !== "object") return input; (var key in input) { if (!input.hasownproperty(key)) continue; var value = input[key]; var match; // check string properties dates. if (typeof value === "string" && (match = value.match(regexiso8601))) { var milliseconds = date.parse(match[0]); if (!isnan(milliseconds)) { if (tolocal) { input[key] = moment.utc(...

javascript - Canvas - Cannot create image url -

i set fiddle 2 images. don't understand why image a) not suitable, me source looks similar source of image b). js fiddle html a)<img src="http://img.ui-portal.de/uim/coop/monster-beratung_140x115.jpg" /> b)<img src="http://i0.gmx.net/images/258/18821258,pd=2,h=250,mxh=600,mxw=800,w=480.jpg" /> <h4> display images above dataurl source: </h4> <div id="converted" ></div> js //create canvas-image a) var imga = new image(); imga.crossorigin = "anonymous"; imga.src = "http://img.ui-portal.de/uim/coop/monster-beratung_140x115.jpg"; imga.onload = function(){ var canvasa = document.createelement('canvas'); canvasa.width = imga.width; canvasa.height = imga.height; var ctxa = canvasa.getcontext('2d'); ctxa.drawimage(imga, 0, 0); var imgurl = canvasa.todataurl(); ...

ios - Detect selected view in a UIScrollView -

i have uiscrollview horizontale scrollable. inside view have added views subviews. how can detect view in middle of screen , selected user? i thought of didselectrowatindexpath: scroll view. thanks you can check contentoffset property of uiscrollview , check view @ cgpoint in scrollview . can refer link shows how uiview cgpoint .

php - Can you use query builder to build a query with a dynamic WHERE clause at runtime in laravel3? -

i know in laravel 4 can create dynamic clause @ runtime following question: can use query builder build query dynamic clause @ runtime in laravel? but can same in laravel 3? if not, option instead create raw sql code in following: $sql = "select * " . $table; $first = 1; foreach($items $key => $val) { if($first) $sql .= " "; else $sql .= " , "; $sql .= $key . " " . $val; $first = 0; } it works pretty exact same way. use $query = db::table('tablename'); in place of first line in related post use rest of example shows.

sql server - Read another's uncommitted session - temp table data -

the thing is.. my sp throws error: string or binary data trunkated. i traced down code snippet sql profiler find line occurs, need data being inserted. i added code insert data temp table , thought able read content session (while session still in progress - not committed) , ... unfortunately select statement hangs nolock hint... under not committed isolation level. generally data rolledback because of error. is possible? how it? temp tables session scoped. if check sys.tables in tempdb, see #t table caled #t__________________________________________________________________________________________________________________000000000006 so, couldn't read session. what's more, temp tables don't survive rollback of transaction. able read data after rollback, use table variable, , after rollback save permanent table can query.

sql server - Case With Datepart For Weekday -

any ideas wrong following code? i trying write case statement returns today's date on monday else takes max date table if today's date inst monday thanks select case [effectivedate] when datepart(weekday,getdate()) = 1 cast(getdate() date) else max ([effectivedate]) end, [arcdal01pr].[arctimeseries].[arc_ts_data].[pricecurvedata] [curvename] = 'g_h_ttf.eur' select case [effectivedate] when datepart(weekday,getdate()) = 2 cast(getdate() date) else max ([effectivedate]) end, [arcdal01pr].[arctimeseries].[arc_ts_data].[pricecurvedata] [curvename] = 'g_h_ttf.eur monday should 2nd day of week. u can try if using sql server 2012 select case [effectivedate] when weekday(getdate(),2) = 1 cast(getdate() date) else max ([effectivedate]) end, [arcdal01pr].[arctimeseries].[arc_ts_data].[pricecurvedata] [curvename] = 'g_h_ttf.eur update select case when datepart(weekday,getdate()) = 2 cast(getdate() date) else max ([effectivedate]) end [eff...

javascript - Angularjs is not able to find my controller -

i using angular-mock inject controller unit testing. failing since keep getting following error. [$injector:unpr] unknown provider: patientrecordscontrollerprovider <- patientrecordscontroller here code setup - (function () { angular.module('patient_profile', ['ngroute']); })(); (function () { var patientrecordscontroller = function () { }; angular.module('patient_profile').controller('patientrecordscontroller', patientrecordscontroller); })(); and test case describe('patientrecordscontroller:unit-testing', function () { beforeeach(module('patient_profile')); it('timeline should array', inject(['patientrecordscontroller', function (controller) { //cant stuff } ])); }); update same procedure works fine services. how come? controller has instantiated using $controller service. isn't below format of test cleaner? descri...

android - How to scale bitmap before showing it on the map? -

i want set icon marker, big want scale down. mapfragment.this.map.addmarker(new markeroptions().position(new latlng(lat, lng)) .icon(bitmapdescriptorfactory.fromresource(r.drawable.guest_icon))); this duplicate question. see: change marker size in google maps api v2 simply put, resize bitmap prior passing markeroptions object you're creating, referencing newly sized image. it's worth noting if it's large resource, might want resizing in asynctask or thread. see thread example: android , createscaledbitmap slow when creating multiple bitmaps

asp.net - Tracing web service calls -

here outline of technologies using our project @ work : -asp.net mvc 4 -visual studio 2012 , visual studio 2010 -entity framework version 4 -umbraco 6.1.6 we invoking web services api belonging third-party company. in order ensure debugging , troubleshooting made easier, want our application create details log trace of calls third-party web service api. vaguely recall previous place of work there way setup kind of configuration in asp.net web.config log trace calls web services api text file. what configuration changes need make? you might need reconfigure system specific data in following xml, place in asp.net web.config, , should create log files showing how application invokes/calls web services <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" type="microsoft.csharp.csharpcodeprovider,system, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" warninglevel="1...

Menu child teaser block module for Drupal 7 -

i looking module same job one: menu child teaser block drupal 7. @ end want have functionality of displaying teaser block of children of each page this: https://drupal.org/files/images/menu_child_teaser_block_0.png thanks help

java - JavaFX - horizontal marquee text -

i trying achieve effect similar marquee - line of long (in case) text moved in horizontal axis. managed work, can't call satisfactory. my controller class looks below: @fxml private text newsfeedtext; (...) @override public void initialize(url url, resourcebundle resourcebundle) { translatetransition transition = translatetransitionbuilder.create() .duration(new duration(7500)) .node(newsfeedtext) .interpolator(interpolator.linear) .cyclecount(timeline.indefinite) .build(); graphicsdevice gd = graphicsenvironment.getlocalgraphicsenvironment().getdefaultscreendevice(); int width = gd.getdisplaymode().getwidth(); transition.setfromx(width); transition.settox(-width); transition.play(); } newsfeedtext binded text source dynamically updated, contains various amount of text. my code has @ least 2 drawbacks: transition goes -width +width ; width monitor's resolution width ...

javascript - How to access Emberjs Model Data inside a Route -

i access data of ( message model value , author properties) inside route or controller, them, , store them html localstorage. however, of examples have seen far use each controller access every model data on handlebars. following pseudo-implementation. app.messagesroute = ember.route.extend({ setupcontroller: function(controller, model) { messages = this.get('store').find('message') //^this returns promisearray can't seem access actual values. //i tried messages.foreach doesn't seem work //... //... //below i'd do, push messages localstorage //therefore i'd `messages` array (var i=0; i<messages.length; i++) localstorage.setitem('messages', json.stringify(messages[i])) } }); i know i'm missing simple here. couldn't find on docs. any appreciated. you need wait promise array fulfill , iterate on this: app.messagesroute = ember.route.extend({ setupcontroller: function...

c# - Put an array in to a column -

i want use ef code first create column table task , array. how? public class task { // presumption code public string[] attempts { get; set; } the attempts has attemptsmetadata---maybe string time ---datatime answered ---bool create property used in code (and mark ignore) , other property used in code. edited public class task { [ignore] public string[] attempts { get; set; } public string attemptsmetadata { { return attempts != null && attempts.any() ? attempts.aggregate((ac, i) => ";" + ac + i).substring(1) : null; } set { attempts = value.split(';'); } } } ps : strategy has 1 flaw. when use repository expressions cannot use ignore property. never find way so.

java - Change jLabel Visibility -

i new netbeans , java , having issue jlabels on jpanels. have jtabbedpane jpanel in it. have jlabel on jpanel. set visibility of jlabel false, not seem work. label still visible when run program. not understand why. label label = new label("jlabel1"); label.setvisible(false); you can set inside initcomponents() ; package my.tt; public class newjframe extends javax.swing.jframe { public newjframe() { initcomponents(); } private void initcomponents() { jtabbedpane1 = new javax.swing.jtabbedpane(); jpanel1 = new javax.swing.jpanel(); label = new javax.swing.jlabel("jlabel1"); label.setvisible(false); javax.swing.grouplayout jpanel1layout = new javax.swing.grouplayout(jpanel1); [...] jtabbedpane1.addtab("tab1", jpanel1); [...] pack(); } public static void main(string args[]) { try { (javax.swing.uimanage...

asp.net - Forms authentication timeout different for IE vs. Chrome/Firefox -

we have asp.net mvc 4 website has been in production several months no problem. until morning, is. of sudden people log in via ie. chrome , firefox both failed. after bit of panicked debugging found log in if set forms timeout from <forms loginurl="~/login" timeout="30" /> to <forms loginurl="~/login" timeout="120" /> can tell me why is? nothing has changed in server configuration, , field hasn't been changed in web.config initial deployment.

android - Set width of custom InfoWindow in Google Maps api v2 -

Image
i created markers on map. when click on them, custom info windows wide screen. i tried setting layout_width="200dp" didn't help. tried setting view.setlayoutparams(new layoutparams(getdipsfrompixel(200), getdipsfrompixel(300))); i can set width of textviews setting snippetui.setwidth(getdipsfrompixel(200)); layout still remains screen wide. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:background="#ffffff" android:layout_marginleft="30dp" android:layout_marginright="30dp" android:padding="10dp" > <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orien...

netlogo - LINK expected input to be a number but got the turtle (turtle 26) instead -

how can assign link variable. there run time error in code when run line let link-who link node2-who this-one node2-who , this-one turtles. and runtime error : link expected input number got turtle (turtle 26) instead. the procedure link takes who numbers of 2 turtles , returns link connecting them. you're getting error because @ least 1 of inputs you're giving turtle, not who number. now, said, recommend avoiding using who numbers @ (except in special circumstances). instead, if want link between current turtle , other turtle, can do link-with other-turtle where other-turtle other turtle (it called node2 in case).

javascript - jQuery - Replace text with text plus html element -

i have text wish replce using jquery. problem is, text not within it's own element, content dynamic , can not access html markup make things easier. i can detect , replace text in question, have managed replace new text node, therefore treats html tags text , not markup demo http://jsfiddle.net/xvtgp/ $('div.mydiv').contents().filter(function () { return this.nodetype == 3 }).each(function () { this.textcontent = this.textcontent.replace('my old text no in own element', '<div class="newclass">my new text</div>'); var mynewnode = this.textcontent; return }); current output text <div class="newclass">my new text</div> just replace textnode div using replacewith() $($('div.mydiv div').get(0).nextsibling).replacewith('<div class="newclass">my new text</div>'); fiddle

prolog - How to generate negative examples in inductive logic programming? -

i trying learn rules of puzzles , board games observing human using inductive logic programming. use progol program ilp written in prolog. while games able correctly give me rules, others doesn't due lack of negative examples. for example, in towers of hanoi puzzle, 1 of rules larger block not placed on top of smaller block. negative rule. since during training event doesn't occur there no explicit negative example rule can learnt. in short, how 1 generate negative examples in ilp? i think can learn positive data in progol? http://link.springer.com/chapter/10.1007/3-540-63494-0_65 muggleton, stephen. "learning positive data." inductive logic programming. springer berlin heidelberg, 1997. 358-376. set learning positive data mode on doing in progol: |- set(posonly)?

Bootstrap for a print design (not printable)? -

i need build new website, replicate of old website. old website stays same (no layout/content movement) when browser window shrinks , grows. old website looks same on devices, looks lot smaller on smartphone. i need build new website , have make behave old one. want use bootstrap framework new website. understand bootstrap great tool building mobile-friendly websites. not sure whether choice or there benefits of using bootstrap in situation. if bootstrap (v3) choice project, use (or not use) in situation? thanks , regards. honestly, bootstrap specializes in helping create responsive websites, not sounds want. if insist on using it: remove <meta name="viewport" content="width=device-width, initial-scale=1"> <head> . don't use grid elements use make responsive layouts.

c++ - struct output with cout, and function call struct parameters -

so, problem several errors @ compile time. readmoviedata(string* title, string* director) cannot convert movieinfo string* displaymoviedata(string title, string director) cannot convert movieinfo string no operator found takes right-hand operand of type 'movieinfo' (or there no acceptable conversion. the bottom error happens twice in displaymoviedata() wrote once simplicity sake. the readmoviedata function should accept structure pointer reference variable , displaymoviedata function should accept movieinfo structure variable. the main function creates array of 2 movieinfo struct variables , other functions should called on element of array. the code have finished below. #include <stdafx.h> #include <string> #include <iomanip> #include <iostream> using namespace std; //prototypes int readmoviedata(string* title, string* director); int displaymoviedata(string title, string director); struct movieinfo { string title, director; }; ...

three.js - Lighting up object on mouse over -

i'm trying highlight meshes (animated characters etc) in game on mouse-over event. have multiple textures , skin. i thought wrap them shadermaterial , on hit-test change uniforms brighten fragment shader. to this, can somehow manipulate regular shading? can mix multiple materials, making shader take color values standard shader , tweak them? or need whole separate render pass , blend composer? or maybe else entirely, ambient light applied 1 object/shader? thanks suggestions. repost, see comments details/discussion: "you change whole material/shader on mouse over, although guess performance intensive, depending on number of switches user , rest of app doing. used once emissive color of regular phong material material.emissive.setrgb() example. give nice effects, too".

c# - ASP.net MVC 4 Creating new controller issue 'unable to retrieve metadata' -

i'm trying add new controller in project got error : unable retrieve metadata 'mvcapplication1.models.region" object reference not set instance of object. and this's connection string: <`add name="entitiesregion" connectionstring="metadata=res://*/models.region.csdl|res://*/models.region.ssdl|res://*/models.region.msl;provider=oracle.dataaccess.client;provider connection string=&quot;data source=localhost:1521;password=1234;user id=test&quot;" providername="system.data.entityclient" />` and her's content of region.context.cs : namespace mvcapplication1.models { using system; using system.data.entity; using system.data.entity.infrastructure; public partial class entitiesregion : dbcontext { public entitiesregion() : base("name=entitiesregion") { } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { ...

sql - Triggers on sqlite android does not work -

the goal of trigger insert new record in table column giorni_sett date when update or insert value greater 1 in table shifts column shift, can not run trigger, wrong not know , log have no errors, trigger not work, can me, thank you. public class dbhelper extends sqliteopenhelper { static string database_name="turnidb.db"; public static final string turni="turni"; public static final string turni_id="idturno"; public static final string turno="turno"; public static final string giorni_sett="giorni"; public static final string giorni_id="giorni_id"; public static final string giorni="giorni"; public static final string data="data"; public dbhelper(context context) { super(context, database_name, null, 1); } @override public void oncreate(sqlitedatabase db) { string create_table="create table "+turni+" ("+turni_id+" integer primary key autoincrement,"+turno+"...

Not sure if I should use a cursor in Microsoft SQL Server 2008 R2 -

i have problem here. thing have table called mostep , in table there's column called moid . need check repeated values, mean example, in table there these values: 10, 9, 8, 6, 9, 5, 2 10 i need check values of moid in table , 2 things, details of conditions rather irrelevant questions i'll omit them: if value appears once, each of them. if value appears more once, else each of them. i know how check repeated , not repeated values using count(moid) however don't know how check in same query , make efficient. i thinking in using 2 cursors, 1 stores repeated values , fetch each row, , same thing non repeated values. i've heard cursors not best option i thinking in doing if or case conditions within select i'm not sure how of it. if me i'll appreciate it doesn't sound there's reason use cursor this. can use count() over() , case efficiently: ;with cte (select *,count(moid) over(partition moid) moid_ct ...

python - Flask - Post a file with accompying JSON -

is possible post file flask app has both file , json data accompanying it? in initial development, doing via 2 api endpoints, , seems clunky. i'd able accomplish using 1 post, instead of two. is possible? yes, can post file json data accompanying it. example: import requests open(path_to_file, 'rb') my_file: files = {'file': my_file} payload = {'data1': 'foo', 'data2': 'bar'} r = requests.post(data=payload, files=files) there lot of useful information regarding flask , requests (a nice http lib) here: http://flask.pocoo.org/docs/0.10/quickstart/#quickstart http://docs.python-requests.org/en/latest/user/quickstart/

php - joomla exceptions are not being logged -

i have joomla site, running 3.0.2* , have noticed exceptions caught joomla not being logged anywhere. using built-in database logging, initialized following code, placed within onafterinitialise function of custom plugin. // initialize logging. jimport('joomla.log.log'); $config = jfactory::getconfig(); jlog::addlogger(array( 'logger' => 'database', 'db_driver' => $config->get('dbtype'), 'db_host' => $config->get('host'), 'db_user' => $config->get('user'), 'db_pass' => $config->get('password'), 'db_prefix' => $config->get('dbprefix'), 'db_database' => ctasettings::get('logging.db'), jlog::all, '' )); ctasettings::get class method retrieves name of database used logging. can verify works correctly , ...

jquery - Changing span content with javascript -

i'm quite new jasascript , jquery , i'm trying create pop-up appear when user have reach achivement. pop-up have user name , tittle of achivement. here's html <div class="popup"> <img src="" alt="avatar" id="imgpop"/> <h3 class="nomuser"><span></span></h3> <p class="popatteint">a atteint l'objectif:</p> <p class="objatteint"><span></span></p> </div> and javascript function afficher(nom,objectif){ if(!$(".nomuser").length){ $(".nomuser").append("<span></span>"); } if(!$(".objatteint").length){ $(".objatteint").append("<span></span>"); } $(".nomuser span").append(nom); $(".objatteint span").append(objectif); $(".popup").animate({opacity:100},100...

objective c - Getting access to objects in other parts of the object graph in iOS -

i'm using ios problem. i have following class structure: schedulevc (with uicollectionview ) owns schedulecell (uicollectionviewcell) owns scheduledaytvc (uitableviewcontroller) owns scheduledaycell (uitableviewcell) owns orderdetailview ( view , subview of contentview) there action in 5( orderdetailview ) needs call 1( schedulevc ). there 1 schedulevc quick , dirty solution create singleton class gets me quick access. is best way solve this? didn't think passing down pointer of 1 5 clean. i looked @ kvo , seemed needed reference both observer , 'being observed' objects don't have anywhere. edit: top level vc owns uicollectionview has layout similar passbook or reminders. on each cell there tableview it's own controller. each uitableviewcell in tableview has view( 5 ) added it's contentview. view has button when pressed needs contact 1. what need call? method perform business logic or update ui? in first case (business l...

javascript - Text Slideshow is not working -

i trying make "slideshow" change div s text inside. when last div being shown, next div shown should first one. if first div being shown, , click see previous one, slideshow should show last div . isn't working. here code: html: <div name="div-default" class="div-default"> <?php echo "$name"; ?> </div> <div id="div01" class="title-result active"> <?php echo "seu número de personalidade é: $numerologia[0]"; ?> </div> <div id="div02" class="title-result"> <?php echo "seu número de destino é: $numerologia[1]"; ?> </div> <div id="div03" class="title-result"> <?php echo "seu número de lição de vida é: $numerologia[2]"; ?> </div> <div id="div04" class="title-result"> <?php ...

sql - MySQL source command contacting remote host -

sorry if has been asked before and/or dead stupid, couldn't find looking for. i want populate fresh, empty mysql db using .sql scripts. log mysql, switch desired db , use source /path/to/script.sql in order load sql script db. works fine, if mysql server on same machine scripts, i'm having problems if hosts different. so, there parameter source command issue remote host? or wise option scp .sql file in question db host? ps: know can mysql -h host -u user -p somedb < /path/to/script.sql prefer source method, in past did not output mysql when using option compared source . thanks lot. there's no option in source reference remote host. it's reference relative local system. so, yes scp file remote host. either that, or you'd need remote file system mounted (e.g. nfs, or mapped drive letter in windows) appears local file system.

ios - How to debug bad access code 2 error -

Image
my ios app crashing @ point in application. can reproduce crash every time. cannot figure out why crashing. ran profiler , checked zombies - none found. it crashes in 2 places first place method: -(void)toolbarhidden:(bool)hidden { self.toolbar.clipstobounds = yes; if (!hidden){ self.toolbar.hidden = no; self.toolbarheightcontraint.constant = 35; self.toolbarbottomcontraint.constant = 0; [uiview animatewithduration:0.5 delay:0 usingspringwithdamping:0.5 initialspringvelocity:0.5 options:0 animations:^{ [self.view layoutsubviews]; } completion:nil]; }else { self.toolbar.hidden = yes; self.toolbarheightcontraint.constant = 1; self.toolbarbottomcontraint.constant = 0; [uiview animatewithduration:0.5 delay:0 ...