Sunday, 15 March 2015

google fusion tables - Javascript and Wordpress -



google fusion tables - Javascript and Wordpress -

two related questions:

is there documentation on fusion tables javascript api? i've found list of methods, little info on homecoming values, semantics, or usage idioms.

is there guidance (or suggested plugins or idioms) integrating ft javascript api locally hosted wordpress site?

there documentation here:

https://developers.google.com/fusiontables/docs/v1/getting_started#js

but didn't find useful. example, in context of google maps api found useful new api 1.0

https://googledrive.com/host/0b5kvz6j1ohn_q3zqvkfgsgz2cee/custom%20markers%20code/customicons_viaapi.html

you'll need view , save source. if search ft tag jsonp find many examples using old pre 1.0 api concepts same, ajax end point has changed , need apikey.

the basic thought ft query homecoming json object both columns , rows members, much csv response.

as illustration above shows:

function ondatafetched(data) { var rows = data.rows; var cols = data.cols; ... }

wordpress google-fusion-tables

Java Date object from String not working properly -



Java Date object from String not working properly -

i have run stubborn problem cannot seem solve. have looked solutions @ stackoverflow , have found lot of posts java date formatting, nil specific problem have.

basically, have situation need convert date strings java.util.date objects. using date , simpledateformat classes. dates encountering, works fine. dates, works changes actual date. 2 illustration dates :

fri feb 24 16:45:40 pst 2012 --> gets changed --> fri jan 06 16:45:40 pst 2012

wed jun 13 10:00:42 pdt 2012 --> gets changed --> wed jan 04 09:00:42 pst 2012

any thought why dates getting changed? way avoid or in different way? code copied below. can seek see talking about.

thanks in advance!

you can seek next jsp code:

<%@ page import="java.util.*" %> <%@ page import="java.net.*" %> <%@ page import="java.io.*" %> <%@ page import="java.text.*" %> <% string datestr = ""; date tmpdate = null; dateformat formatter = new simpledateformat("eee mmm dd hh:mm:ss z yyyy"); system.out.println("first test ---------------"); datestr = "fri feb 24 16:45:40 pst 2012"; tmpdate = (date) formatter.parse(datestr); system.out.println("original:"+datestr+":"); system.out.println("date obj:"+tmpdate.tostring()+":"); system.out.println("second test --------------"); datestr = "wed jun 13 10:00:42 pdt 2012"; tmpdate = (date) formatter.parse(datestr); system.out.println("original:"+datestr+":"); system.out.println("date obj:"+tmpdate.tostring()+":"); %>

i getting next output:

first test ------------ original:fri feb 24 16:45:40 pst 2012: date obj:fri jan 06 16:45:40 pst 2012: sec test ----------- original:wed jun 13 10:00:42 pdt 2012: date obj:wed jan 04 09:00:42 pst 2012:

use yyyy not yyyy in format string.

yyyy special thing, calendar week year.

see simpledateformat documentation more info.

java string date simpledateformat

Haskell inheritance: What's inherity about it? -



Haskell inheritance: What's inherity about it? -

here http://en.wikibooks.org/wiki/haskell/classes_and_types in section class inheritance, read "a class can inherit several other classes: set ancestor classes in parentheses before =>."

i puzzled when "(...)=>" described "inheritance". far can see, it's class constraint. simply says newly defined class (in example: real) applies types members (have instances for) listed classes (num , ord).

in short, "(...)=>" seems me deed filter qualities required of types instances of class may created, , not deed augment either class or instances.

am missing something? there sense in "(...)=>" passes along "parent" "child"?

in practice, means members of subclass provide methods of superclass.

so, in linked example, can write method requires eq, give ord constraint, , eq methods implied us.

(note inheritance terrible term this, because carries lot of associations don't create sense in our context. nonetheless, figured might explain it.)

haskell inheritance

MySQL UNION COUNT -



MySQL UNION COUNT -

first allow me show tables info , explain problem.

mysql tables structure

create table more_tags ( tag_id int unsigned not null auto_increment, more_id int unsigned not null, user_id int unsigned not null, tag_name varchar(255) not null, primary key (tag_id), unique key (more_id, user_id, tag_name) ); create table tags( tag_id int unsigned not null auto_increment, another_id int unsigned not null, user_id int unsigned not null, tag_name varchar(255) not null, primary key (tag_id), unique key (another_id, user_id, tag_name) );

more_tads table data

tag_id tag_name 10 apple 192 apple 197 apple 203 apple 207 apple 217 news 190 bff 196 cape

tags table data

tag_id tag_name 1 apple 2 time 3 bff

okay asked similar question earlier. reason can't query count tags both tables counts tags 1 table in illustration below

current ouput

tag_id tag_name num 1 apple 5 2 bff 1 3 cape 1 4 time 1

but want grouping similar tags , count how many times found in tables in illustration below

desired output

tag_id tag_name num 1 apple 6 2 bff 2 3 cape 1 4 time 1

current mysql query

select * from(select `more_tags`.`tag_id`, `more_tags`.`tag_name`, count(`more_tags`.`tag_name`) 'num' `more_tags` inner bring together `users` on `more_tags`.`user_id` = `users`.`user_id` `users`.`active` null , `users`.`deletion` = '0' grouping `more_tags`.`tag_name` union( select `tags`.`tag_id`, `tags`.`tag_name`, count(`tags`.`tag_name`) 'num' `tags` inner bring together `users` on `tags`.`user_id` = `users`.`user_id` `users`.`active` null , `users`.`deletion` = '0' grouping `tags`.`tag_name`)) table_1 grouping `tag_name` order `tag_name` asc

considering counting on both parts of union, can sum both of these. grouping tag_name, do.

select *, sum('num') 'big_num' from( select `more_tags`.`tag_id`, `more_tags`.`tag_name`, count(`more_tags`.`tag_name`) 'num' ...same... grouping `more_tags`.`tag_name` union( select `tags`.`tag_id`, `tags`.`tag_name`, count(`tags`.`tag_name`) 'num' ...same... grouping `tags`.`tag_name` )# union 2nd part )# union table table_1 grouping `tag_name` # doing order `tag_name` asc

mysql count group-by union

css - Custom search bar and responsive grid -



css - Custom search bar and responsive grid -

i've found cool article http://www.tripwiremagazine.com/2012/01/how-to-create-a-seach-bar-in-photoshop.html recently. don't know how handle background images within responsive grid. how create such search bar using zurb foundation grid? possible?

thanks!

the search bar in design styled css , wouldn't have utilize background images @ all. here few main points of code create work:

html:

<div class="input-container"> <input type="text" /> <button>search</button> </div>

the text input:

input[type="text"] { box-shadow: inset 0 1px 3px rgba(0,0,0,.3); border-radius: 5px; background-color: #fff; }

the button:

button { margin-left: -10%; background-image: -webkit-linear-gradient(top, #117a03 0%,#287c15 100%); border-radius: 0 5px 5px 0; height: 32px; padding: 0 5px; border: 1px solid #bbb; box-shadow: inset 0 1px 2px rgba(0,0,0,.3), 0 1px #fff; color: #074f03; text-shadow: 0px 1px #ccc; font-weight: bold; }

you need add together vendor prefixes css3 properties, pretty basic starting point , should give need. here's fiddle working: http://jsfiddle.net/j6dvz/

css responsive-design zurb-foundation

wordpress - I have installed "share this" to my blog and when the I click the facebook like button only a part of it shows up on screen. How do I fix this? -



wordpress - I have installed "share this" to my blog and when the I click the facebook like button only a part of it shows up on screen. How do I fix this? -

i emailed back upwards , replied saying add together code css.

**span.st_fblike_hcount span div.fb-like span iframe#f249dba5d33c086.fb_ltr { height: 234px !important; max-width: 634% !important; }**

i new programming , not know should add together code. can 1 please instruct me on how right problem.

my url my blog

thanks

it looks though need go plugin folder , modify css file. in sharthis folder file called sharthis.css

open file in text editor , add together next code gave you.

span.st_fblike_hcount span div.fb-like span iframe#f249dba5d33c086.fb_ltr { height: 234px !important; max-width: 634% !important; }

save , refresh page , should work

facebook wordpress facebook-like

string - Split GST Command using Shell Script -



string - Split GST Command using Shell Script -

i'd split next gst command 2 halves using shell script.

/gstpipeline:pipeline0/gstudpsink:udpsink0.gstpad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)h264, sprop-parameter-sets=(string)\"z0kahukbqhpcaaah0aab1mai\\,am48ga\\=\\=\", payload=(int)96, ssrc=(uint)2416890621, clock-base=(uint)518578781, seqnum-base=(uint)24075

the split has occur @ caps = 2 new lines should stored in 2 variables $var1 , $var2

$var1 should contain /gstpipeline:pipeline0/gstudpsink:udpsink0.gstpad:sink:

and $var2 should contain application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)h264, sprop-parameter-sets=(string)\"z0kahukbqhpcaaah0aab1mai\\,am48ga\\=\\=\", payload=(int)96, ssrc=(uint)2416890621, clock-base=(uint)518578781, seqnum-base=(uint)24075

remember there 2 backslashes in input string. doing echo give 1 backslash.

use shell parameter expansion:

$ cmd='/gstpipeline:pipeline0/gstudpsink:udpsink0.gstpad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)h264, sprop-parameter-sets=(string)\"z0kahukbqhpcaaah0aab1mai\\,am48ga\\=\\=\", payload=(int)96, ssrc=(uint)2416890621, clock-base=(uint)518578781, seqnum-base=(uint)24075' $ first=${cmd% caps = *}; echo ">>$first<<" >>/gstpipeline:pipeline0/gstudpsink:udpsink0.gstpad:sink:<< $ second=${cmd#* caps = }; echo ">>$second<<" >>application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)h264, sprop-parameter-sets=(string)\"z0kahukbqhpcaaah0aab1mai\\,am48ga\\=\\=\", payload=(int)96, ssrc=(uint)2416890621, clock-base=(uint)518578781, seqnum-base=(uint)24075<<

string shell split gstreamer

Error exporting symbol when cross-compiling ICU for Windows. -



Error exporting symbol when cross-compiling ICU for Windows. -

i attempting utilize mingw-w64's 32-bit compiler (the i686-w64-mingw32 toolchain) cross-compile icu library windows. host ubuntu 12.10 64-bit.

the steps have taken this:

grab latest source code archive here , extract it.

make 2 copies of source/ directory - 1 host , 1 target.

for host build:

./configure ; make

for target build:

./configure --host=i686-w64-mingw32 --with-cross-build=<host_source_dir>

...where <host_source_dir> directory previous step.

when run make in target source directory, compilation proceeds without errors few moments , throws error:

i686-w64-mingw32-g++ -o2 -w -wall -pedantic -wpointer-arith -wwrite-strings -wno-long-long -mthreads -o ../../bin/uconv.exe uconv.o uwmsg.o -l../../lib -licuin50 -l../../lib -licuuc50 -l../../stubdata -licudt50 -lm uconvmsg/uconvmsg.a uconv.o:uconv.cpp:(.text+0x2f): undefined reference `_uconvmsg_dat'

what causing error? backed few lines , noticed this:

pkgdata: i686-w64-mingw32-gcc -o2 -wall -std=c99 -pedantic -wshadow -wpointer-arith -wmissing-prototypes -wwrite-strings -mthreads -shared -wl,-bsymbolic -wl,--enable-auto-import -wl,--out-implib=./all.lib -o ../lib/icudt50.dll ./out/tmp/icudt50l_dat.o cannot export icudt50_dat: symbol not found collect2: ld returned 1 exit status -- homecoming status = 256 error generating library file. failed command: i686-w64-mingw32-gcc -o2 -wall -std=c99 -pedantic -wshadow -wpointer-arith -wmissing-prototypes -wwrite-strings -mthreads -shared -wl,-bsymbolic -wl,--enable-auto-import -wl,--out-implib=./all.lib -o ../lib/icudt50.dll ./out/tmp/icudt50l_dat.o error generating assembly code data.

what doing wrong?

in order debug symbol problem provide flag -wl,--trace-symbol=_uconvmsg_dat i686-w64-mingw32-g++ follows:

i686-w64-mingw32-g++ -o2 -w -wall -pedantic -wpointer-arith -wwrite-strings -wno-long-long -mthreads -o ../../bin/uconv.exe uconv.o uwmsg.o -l../../lib -licuin50 -l../../lib -licuuc50 -l../../stubdata -licudt50 -lm uconvmsg/uconvmsg.a -wl,--trace-symbol=_uconvmsg_dat

windows cross-compiling icu

android - How to retrieve image from particular folder on sdcard to drawable folder in andriod at runtime? -



android - How to retrieve image from particular folder on sdcard to drawable folder in andriod at runtime? -

how can retrieve or re-create images particular folder in sdcard drawable folder @ run time in android. want show slideshow same in given link problem retrieving images drawable folder , want retrieve sdcard folder. beginner in android please help me.

here link : http://www.edumobile.org/android/android-development/image-gallery-example-in-android/

resources in res/drawable folder compiled , optimized. please take @ http://www.linuxtopia.org/online_books/android/devguide/guide/topics/resources/android_resources-i18n_creatingresources.html.

if want utilize images on sdcard have load them file. simple illustration be:

bitmap bitmap = bitmapfactory.decodefile(imagefile.getabsolutepath()); jpgview.setimagedrawable(bitmap);

in short. drawable folder treated in special way.

argument imagefile object of class file. http://developer.android.com/reference/java/io/file.html

variable jpgview instance of class imageview. example. http://developer.android.com/reference/android/widget/imageview.html

as far loop goes have iterate through files in folder. please consult documentation that.

android

php - Mongo, match array of arrays -



php - Mongo, match array of arrays -

i have object has array of sub objects on it:

_id: "9", clients: [ { id: 677, enabled: true, updated: 0, created: 1352416600 }, { id: 668, enabled: true, updated: 0, created: 1352416600 } ], cloud: false, name: "love", }

the user makes request images client id 677, above object returned

the user makes request images client ids 677 , 668, image above returned

the user makes request images client ids 677, 668, 690, above image isn't returned

im using php , mongo db. mysql query used powerfulness used utilize count , sub query.

i have no thought start tackling in mongo.

any help appreciated.

to search documents within arrays, can utilize dot notation , "$and" operator.

syntax:

db.coll.find({"$and": [{"clients.id": <id1>}, {"clients.id": <id2>}, ... ]});

for samples:

1) user makes request images client id 677 (for 1 item, there no need of "$and", can utilize anyway):

db.coll.find({"clients.id": 677});

or

db.coll.find({"$and": [{"clients.id": 677}]});

2) user makes request images client ids 677 , 668:

db.coll.find({"$and": [{"clients.id": 677}, {"clients.id": 668}]});

3) user makes request images client ids 677, 668, 690:

db.coll.find({"$and": [{"clients.id": 677}, {"clients.id": 668}, {"clients.id": 690}]});

php mongodb

java - Tried to apply Spring security on struts2 but it does not work -



java - Tried to apply Spring security on struts2 but it does not work -

i have next code apply spring security on struts2 allows user see secured page although have not implement datasource part (because not know how) yet not expect enable unauthorized users open page.

web.xml

<?xml version="1.0" encoding="utf-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <context-param> <param-name>contextconfiglocation</param-name> <param-value> /web-inf/spring/*-context.xml </param-value> </context-param> <filter> <filter-name>springsecurityfilterchain</filter-name> <filter-class> org.springframework.web.filter.delegatingfilterproxy </filter-class> </filter> <context-param> <param-name>org.apache.tiles.impl.basictilescontainer.definitions_config</param-name> <param-value>/web-inf/tiles.xml</param-value> </context-param> <listener> <listener-class>org.apache.struts2.tiles.strutstileslistener</listener-class> </listener> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>

my jsp

<%@taglib uri="/struts-tags" prefix="s"%> <sec:authorize ifallgranted="role_admin"> <a href="<s:url namespace ="/profile" action="view.action"/>" >profile</a> </sec:authorize>

my secured method

import org.apache.struts2.convention.annotation.action; import org.springframework.security.access.annotation.secured; @action public class profile{ @secured ({"role_admin"}) public string view(){ system.out.println("view"); homecoming "view"; }

security-context.xml

<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:security="http://www.springframework.org/schema/security" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <security:global-method-security secured-annotations="enabled" /> <security:http auto-config="true"> <!-- restrict urls based on role --> <security:intercept-url pattern="/index*" access="is_authenticated_anonymously" /> <security:intercept-url pattern="/logoutsuccess*" access="is_authenticated_anonymously" /> <security:intercept-url pattern="/css/main.css" access="is_authenticated_anonymously" /> <security:intercept-url pattern="/resources/**" access="is_authenticated_anonymously" /> <security:intercept-url pattern="/**" access="role_user" /> <!-- override default login , logout pages --> <security:form-login login-page="/login.html" login-processing-url="/loginprocess" default-target-url="/index.jsp" authentication-failure-url="/login.html?login_error=1" /> <security:logout logout-url="/logout" logout-success-url="/logoutsuccess.html" /> </security:http> <security:authentication-manager> <security:authentication-provider > <security:jdbc-user-service data-source-ref="datasource" /> </security:authentication-provider> </security:authentication-manager> </beans>

in order protect struts application urls need ensure have springsecurityfilterchain before struts2 . configuration have posted not appear have springsecurityfilterchain @ all. in short, update configuration follows:

<filter> <filter-name>springsecurityfilterchain</filter-name> <filter-class> org.springframework.web.filter.delegatingfilterproxy </filter-class> </filter> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter</filter-class> </filter> <!-- order of filter-mapping of import springsecurityfilterchain should first! --> <filter-mapping> <filter-name>springsecurityfilterchain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

the above setup protect application using url based security. however, in order secure application method based security need ensure allowing spring create objects annotated @secured. this, ensure have followed instructions on integrating spring , struts provided within reference.

java struts2 spring-security

Automated testing to check the value in a table cell - Django. -



Automated testing to check the value in a table cell - Django. -

my django app in need of automated testing.

many of views produce tabular info (from generic list view). have created fixtures test of more complex cases have been causing subtle bugs.

what should using test value in specific table cell (or column)?

there seems lot of testing tools / libraries out there django-test client, selenium, nose. lot of things seem aimed @ unit testing (while not finding many bugs @ level). looking more integration testing. reading documentation libraries going take while find want.

so can advise libraries / tools should utilize check final output values in list view's tabular output? give url, , confirm page returned has value in particular row / column equal expected value.

there seems lot of testing tools / libraries out there django-test client, selenium, nose. lot of things seem aimed @ unit testing (while not finding many bugs @ level). looking more integration testing.

it works integration testing. maybe have found out if had tried ? maybe it's time (re?) read right hacker attitude

also, i've been having loads of fun ghost.py

reading documentation libraries going take while find want.

it's work research well. believe or not took me 5 hours check solutions yesterday , decide go ghost.py , work nicely django (hence gist upload !).

but yeah, if don't want larn new you're stuck @ "not knowing out integration testing". if want larn "how create integration testing" have research. there's no secret friend :)

django testing integration

css - How to arrange a under two others? -



css - How to arrange a <div> under two others? -

i'm trying implement <div> has 3 sub <div>'s (see image)

div1 has image within it, , it's height fixed .css like

.image_inside_div1 { height:6em; } .div1 { float:left; /* fits image */ } .div2 { width:50%; /* not great solution. how fill rest (remaining div1) of outerdiv's width? */ } .div3 { /*this primary question. how implement div3 ?*/ width:100%; position: ??? bottom: 0 ??? height: ??? }

thanks!

.div3 { /*this primary question. how implement div3 ?*/ width:100%; float: left; clear:both; }

css html alignment

Print HTTP request in Python Django -



Print HTTP request in Python Django -

i want print entire request object comes server. need see of parameters request carries client since don't have clients's code (it's android client). i'm in view.py file, , i'm using function

def index(request): homecoming httpresponse("test params")

to print request object

please suggest code. improve if can print request in browser , not in console.

you can utilize django debug toolbar allows view lot of debugging info including request , session.

from documentation:

currently, next panels have been written , working:

django version request timer a list of settings in settings.py common http headers get/post/cookie/session variable display templates , context used, , template paths sql queries including time execute , links explain each query list of signals, args , receivers logging output via python's built-in logging, or via logbook module

python django

duplicate vector into matrix r -



duplicate vector into matrix r -

wondering how duplicate vector matrix in r. example

v = 1:10 dup = duplicate(v,2)

where dup looks rbind(1:10,1:10). thanks

i think you're looking replicate.

t(replicate(2, v))

r vector matrix

ios - how get data from c language -



ios - how get data from c language -

below c method getting notetype , notenumber want show on label. playing midi file below method homecoming midi file info in clang method want show on label.

static void mymidireadproc(const midipacketlist *pktlist, void *refcon, void *connrefcon) { audiounit *player = (audiounit*) refcon; midipacket *packet = (midipacket *)pktlist->packet; (int i=0; < pktlist->numpackets; i++) { byte midistatus = packet->data[0]; byte midicommand = midistatus >> 4; if (midicommand == 0x09) { byte note = packet->data[1] & 0x7f; byte velocity = packet->data[2] & 0x7f; int notenumber = ((int) note) % 12; nsstring *notetype; switch (notenumber) { case 0: notetype = @"c"; break; case 1: notetype = @"c#"; break; case 2: notetype = @"d"; break; case 3: notetype = @"d#"; break; case 4: notetype = @"e"; break; case 5: notetype = @"f"; break; case 6: notetype = @"f#"; break; case 7: notetype = @"g"; break; case 8: notetype = @"g#"; break; case 9: notetype = @"a"; break; case 10: notetype = @"bb"; break; case 11: notetype = @"b"; break; default: break; } nslog(@"notetype : notenumber %@",[notetype stringbyappendingformat:[nsstring stringwithformat:@": %i", notenumber]]); viewcontroller* sound = (__bridge viewcontroller*)refcon; [audio.self.notedisplaylabel settext:@"sdasd"]; audio.test_messages = @"sdsadsa"; [audio labeltext:@"asdasdas"]; nslog(@"%@", audio.test_messages); osstatus result = noerr; // result = musicdevicemidievent (player, midistatus, note, velocity, 0); } packet = midipacketnext(packet); } }

are nslog messages working? looks if should be.

it not practice (and may have problems) setting view midi read proc, realtime callback , don't want spend time writing ui in place.

better if force events somewhere (like array) , send notification view controller (with array object) @ end function. want homecoming function.

ios clang midi

Error at print statement in Python 3 -



Error at print statement in Python 3 -

all questions find on here don't quite reply question.

i'm doing tutorial on python , using older version of it. (pre 3.0)

right showing string indexing however, syntax changed in python code invalid, here is:

s = '<any string>' print s[0]

it suppose print < syntax error. here error.

print name[0] ^ syntaxerror: invalid syntax

i have tried know cannot seem work.

can explain find right reply or tell me.

the problem not indexing, print statement.

print function in python 3, whereas in python 2, statement. need utilize such:

print(s[0])

python

CSS how to position element in half height (vertical 50%) -



CSS how to position element in half height (vertical 50%) -

i'm looking forwards build tooltip positioned next element. it's easy set on , under in center of element. there way vertically?

for purpose, height of element known & height of tooltip not. , tooltip can kid of element.

but, i'm curious how when both heights unknown.

using css & jquery-

css .div{ top:50% } jquery var divheight = $(.div).height() / 2; $(.div).attr('style','margin-top:-'+divheight+'px;');

css height vertical-alignment

javascript - How to ensure my Ajax call is finished before calling a new function inside window.onload? -



javascript - How to ensure my Ajax call is finished before calling a new function inside window.onload? -

i not utilize json or jquery @ point - plain vanilla javascript answers please (i've found bunch of answers problem on se, include jquery or json).

i have 2 functions within window.onload=function(){... event handler. first function fillarray(from,to) ajax phone call of form:

function fillarray(from,to){ request = createrequest(); if (request == null) { return; } var url= "ajax_retrievenames.php?indexfrom=" + + "&indexto=" + to; request.open("get", url, true); request.onreadystatechange = populatearray; request.send(null); } function populatearray(){ var xmlfrag=null; if (request.readystate == 4) { if (request.status == 200) { xmlfrag = request.responsexml; for(var i=indexfrom; i<=indexto; i++){ fcarray[i]=new array(); var f=xmlfrag.getelementsbytagname("first")[i].childnodes[0].nodevalue; var l=xmlfrag.getelementsbytagname("last")[i].childnodes[0].nodevalue; fcarray[i][0]=f; fcarray[i][1]=l; } }else{ return; } }else{ return; } }

the sec function shownextname() deals formatting , displaying elements of next (in case first) sub-array. @ point, var arrayindex set 0:

function shownextname(){ displayquestion() // deals page formatting document.getelementbyid('firstname').innerhtml=fcarray[arrayindex][0]; document.getelementbyid('lastname').innerhtml=fcarray[arrayindex][1]; updatearrayindex(); // counter increments variable arrayindex }

my problem script goes sec function, shownextname(), before completing ajax phone call , populating array. can recolve incorporating timer between 2 functions that's clumsy. there improve way create sure not shownextname() or leave window.onload until ajax phone call completed , array populated?

call shownextname in success callback (populatearray). since ajax asynchronous, need exectute logic depending on when readystate 4 did in populatearray function.

function populatearray(){ var xmlfrag=null; if (request.readystate == 4) { if (request.status == 200) { xmlfrag = request.responsexml; for(var i=indexfrom; i<=indexto; i++){ fcarray[i]=new array(); var f=xmlfrag.getelementsbytagname("first")[i].childnodes[0].nodevalue; var l=xmlfrag.getelementsbytagname("last")[i].childnodes[0].nodevalue; fcarray[i][0]=f; fcarray[i][1]=l; } shownextname(); }else{ return; } }else{ return; } }

javascript ajax

android - searchable activity -



android - searchable activity -

here utilize searchable activity , connect database. code done without error forcefulness close error. here code

private void filllist(string query) { // if used fts3 (http://j.mp/aqsyqn), utilize match instead of // // we're not here show advanced sqlite usage dbopenhelper dbopenhelper = new dbopenhelper(getapplicationcontext()); sqlitedatabase db = dbopenhelper.getreadabledatabase(); cursor cr = db.query(dbopenhelper.table_name, null, null,null, null, null, null); string [] = {dbopenhelper.key_position,dbopenhelper.key_file}; int [] = {r.id.textview1,r.id.textview2}; listview lv = (listview) findviewbyid(r.id.lv); listadapter adapter = new simplecursoradapter(getapplicationcontext(), r.layout.simple_list_item_1, cr, from, to); lv.setadapter(adapter); }

and here database dbopenhelper.java

public class dbopenhelper extends sqliteopenhelper { public static final int database_version = 2; public static final string database_name = "player"; public static final string key_position = "position"; public static final string key_file = "file"; public static final string table_name = "tracklist"; public static final string table_create = "create table "+table_name+" ("+key_position+" text, "+key_file+" text);"; dbopenhelper(context context) { super(context, database_name, null, database_version); } @override public void oncreate(sqlitedatabase db) { db.execsql(table_create); } @override public void onupgrade(sqlitedatabase db, int arg1, int arg2) { db.execsql("drop table if exists " + table_name); oncreate(db); }

pls help me. thanx

android

css - Text appears in Chrome but not firefox? -



css - Text appears in Chrome but not firefox? -

i have css text correctly showing in google chrome , ie; not firefox. cannot figure out why.

input[type="text"] { width: 274px; border: 1px solid #333; background-color: #181818; padding-top: 9px; color: #777; height: 13px; padding-left: 4px; padding-bottom: 8px;} input[type="password"] { width: 274px; border: 1px solid #333; background-color: #181818; padding-top: 9px; color: #777; height: 13px; padding-left: 4px; padding-bottom: 8px; }

can recommend ways show?

html:

<form method="post" action="checkcredentials.php"> fellow member login <br> username: <br><input type="text" name="username"> <br><br> password: <br><input type="password" name="password"> <br><br> <input type="submit" name="login" value="login!"> </form>

screenies

firefox:

chrome:

the problem specified height, if remove height parameter input problem solved.

alternative (better imo) solution: problem box-sizing property (http://www.w3schools.com/cssref/css3_pr_box-sizing.asp)

it set border-box calculates padding within specified height , width , 13 < 9+8 (top , bottom padding) there wasn't space actual content(text). if need utilize specified height best solution use:

box-sizing:content-box; -moz-box-sizing:content-box; /* firefox */ -webkit-box-sizing:content-box; /* safari */

this calculate padding of element outside of specified height actual height of input 13+9+8px.

css cross-browser

actionscript 3 - Flex: how to call titlewindow when changing tab, before tab's UI components are built -



actionscript 3 - Flex: how to call titlewindow when changing tab, before tab's UI components are built -

my flex4 app uses tab bar follows:

<s:tabbar id="tabs"/> <mx:viewstack id="vs" height="100%" width="100%"> <s:navigatorcontent label="tab 1" width="100%" height="100%"> ... </s:navigatorcontent> <s:navigatorcontent label="tab 2" width="100%" height="100%"> ... </s:navigatorcontent> <s:navigatorcontent label="tab 3" width="100%" height="100%"> ... </s:navigatorcontent> </mx:viewstack> </s:tabbar>

the app opens tab 1 default. tab 2 not built yet.

the problem is, when alter tabs tab 2, flex takes long time build tab 2 ui components , display tab contents. app freezes during process. need provide indication user he/she needs wait several seconds.

i've tried using cursor manager create busy mouse icon. didn't work (e.g. cursor changes when tab 2 completes building).

i'd display title window while tab builds. but, don't know how launch when switch tab, such title window appears before , while tab 2 building.

i know mx viewstack can have change="" property, when utilize title window doesn't appear until tab 2 completes loading.

i'm not sure how implement calllater() function in below scenario.

can help me figure out how trigger title window appears before , while tab 2 builds?

references:

how implement "please wait ...." screen in flex when app busy

flex: looking design pattern display busy cursor while app "busy"

update 1:

with createdeferredcontent comment david below , settimeout comment weltraumpirat in previous post linked above, able hack solution resulting in busy cursor displayed while content in tab 2 loads. here's did:

create tab 2 component implementing following:

<s:vgroup ... preinitialize="preinit" creationcomplete="start1"> private function preinit():void { mx.managers.cursormanager.setbusycursor(); } private function start1():void { settimeout(start2,100); } private function start2():void { // create mxml components mybc.createdeferredcontent(); // place required actionscript code here mx.managers.cursormanager.removebusycursor(); } ... <s:bordercontainer id="mybc" creationpolicy="none"> <!--- place mxml code here create layout --> </s:bordercontainer> </s:vgroup>

a few notes:

(1) while busy cursor display before tab 2 completes building, app still freezes , when user moves mouse busy cursor stays set on screen while default mouse icon (the arrow) moves around screen controlled user until tab 2 completes building , gets displayed. not ideal, @ to the lowest degree busy cursor indicates app doing something. if wanted to, replace busy cursor titlewindow indicating busy, etc.

(2) changing timeout 100 ms 50 ms still produces results. reducing 10 ms causes busy cursor appear when components built , displayed. it's expected reducing timeout below threshold cause such behavior. wonder if threshold timeout value (e.g. somewhere between 10 , 50 ms) depends on client computer? or, if used 100 ms, safely cover client machines? (how know will?)

(3) have expected replacing settimeout(start2,100); calllater(start2); , deleting creationpolicy="none" should produce similar result, doesn't (e.g. busy cursor never appears , app freezes few seconds until tab 2 gets displayed). i've never used calllater() before, maybe did wrong (?).

in case have heavy calculations during tab2 initializaition can split them little chunks , execute them consecutively using calllater mechanism.

here simplified example:

<?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minwidth="955" minheight="600"> <fx:script> <![cdata[ import mx.core.flexglobals; import mx.events.flexevent; import mx.managers.cursormanager; private var i:int = 0; protected function nc2_initializehandler(event:flexevent):void { flexglobals.toplevelapplication.enabled = false; cursormanager.setbusycursor(); calllater(inittab2); } protected function inittab2():void { var j:int; //part of calculations (j=0; j< 10000; j++) { i++; } //check if completed if (i<1000000) { //if not phone call 1 time again calllater(inittab2); } else { //finished cursormanager.removebusycursor(); flexglobals.toplevelapplication.enabled = true; } } ]]> </fx:script> <fx:declarations> <!-- place non-visual elements (e.g., services, value objects) here --> </fx:declarations> <s:vgroup gap="10" top="10" left="10"> <s:tabbar id="tabs" dataprovider="{vs}"/> <mx:viewstack id="vs" width="100%" > <s:navigatorcontent label="tab 1" width="100%" height="100%" > <s:label text="tab1 content"/> </s:navigatorcontent> <s:navigatorcontent id="nc2" label="tab 2" width="100%" height="100%"> <s:label text="tab2 content" initialize="nc2_initializehandler(event)"/> </s:navigatorcontent> <s:navigatorcontent label="tab 3" width="100%" height="100%"> <s:label text="tab3 content"/> </s:navigatorcontent> </mx:viewstack> </s:vgroup>

actionscript-3 flex

java - PushPlugin source issue in Android -- attempting PhoneGap push notifications -



java - PushPlugin source issue in Android -- attempting PhoneGap push notifications -

i'm trying plug pushplugin plugin (http://goo.gl/xn8z4) in android phonegap application.

i'm getting stuck @ point here http://goo.gl/b03fs. i'm 80-93% confident have java source in right place.

java's trying import org.apache.cordova.example.r can't seem find it. i'm suspicious starts importing it, i'm golden.

i'm working cordova 2.2 jar/classes.

here's i'm seeing bundle import failure: http://goo.gl/u3vli

this code trying talk object bundle that's failing load http://goo.gl/ljblb

it feels simple solution, again, skull appears excessively thick afternoon.

thanks taking look.

boy, how wish had attempted earlier: solution 1 update cordova(phonegap) library v 2.3.

there's bloody spot on head , nearby wall hope post can help else sidestep.

java android eclipse cordova

php - Duplicate entries appending from json object -



php - Duplicate entries appending from json object -

i have searched stackoverflow , implemented next jquery code, json object php , append li tags, appending 3 instances of 1 value. sample code is:

var $childs = $('.childs'); $.getjson('common/db/fetchuniversity.php', function(data) { $(data).each(function() { var $element = $childs.clone().removeclass('childs').appendto('#colleges'); $element.attr('id', this.id+"u"); $element.html("<a href='#' class='img'><strong><img alt='image' src='images/mit.jpg' style='height:40px; width:40px;' /></strong></a><div style='padding-right: 30px;'><h4 style='display:inline; margin:1px;'>"+this.name+"</h4><p style='display:inline;'>"+this.description+"</p></div><p style='margin:2px;'><a href='#' style='text-decoration: none;'><span class='ui-icon ui-icon-circle-plus' style='display:inline-block; vertical-align:middle;'></span>follow</a></p><ul class='actions'><li class='remove'><a href='javascript:removeme('#"+this.id+"u')'><span class='ui-icon ui-icon-closethick'>close</span></a></li></ul>"); }); }); $.getjson('common/db/fetchpeople.php', function(data1) { $(data1).each(function() { var $element = $childs.clone().removeclass('childs').appendto('#people'); $element.attr('id', this.id+"p"); $element.html("<a href='#' class='img'><strong><img alt='image' src='"+btoa(this.pic)+"' style='height:40px; width:40px;' /></strong></a><div style='padding-right: 30px;'><h4 style='display:inline; margin:1px;'>"+this.name+"</h4><p style='display:inline;'>"+this.job_desc+","+this.location+"</p></div><p style='margin:2px;'><a href='#' style='text-decoration: none;'><span class='ui-icon ui-icon-circle-plus' style='display:inline-block; vertical-align:middle;'></span>follow</a></p><ul class='actions'><li class='remove'><a href='javascript:removeme('#"+this.id+"p')'><span class='ui-icon ui-icon-closethick'>close</span></a></li></ul>"); }); }); $.getjson('common/db/fetchgroups.php', function(data) { $(data2).each(function() { var $element = $childs.clone().removeclass('childs').appendto('#groups'); $element.attr('id', this.id+"g"); $element.html("<a href='#' class='img'><strong><img alt='image' src='images/groups/hbr.jpg' style='height:40px; width:40px;' /></strong></a><div style='padding-right: 30px;'><h4 style='display:inline; margin:1px;'>"+this.name+"</h4><p style='display:inline;'>"+this.job_desc+","+this.location+"</p></div><p style='margin:2px;'><a href='#' style='text-decoration: none;'><span class='ui-icon ui-icon-circle-plus' style='display:inline-block; vertical-align:middle;'></span>follow</a></p><ul class='actions'><li class='remove'><a href='javascript:removeme('#"+this.id+"g')'><span class='ui-icon ui-icon-closethick'>close</span></a></li></ul>"); }); });

the above code fetching 3 json objects, , appending li tags, above adding 3 instances of single value. li tags within of jquery accordion.

when nail json php file, returning correct, guess jquery code doing wrong me. please allow me know going wrong.

json object, when entered in browser:-

[{"id":1,"name":"stanford university","description":"one of best university in world"},{"id":2,"name":"princeton university","description":"one of best university in world"},{"id":3,"name":"yale university","description":"one of best university in world"},{"id":4,"name":"california university","description":"one of best university in world"},{"id":5,"name":"yale university","description":"one of best university in world"},{"id":6,"name":"california university","description":"one of best university in world"},{"id":7,"name":"princeton university","description":"one of best university in world"},{"id":8,"name":"stanford university","description":"one of best university in world"},{"id":9,"name":"california university","description":"one of best university in world"},{"id":10,"name":"princeton university","description":"one of best university in world"},{"id":11,"name":"yale university","description":"one of best university in world"}]

the above id:1 values appending 3 times, happening values.

maybe there more 1 elements class childs in dom.

php jquery json

php - Yii radioButtonList - JUI Buttonset - Hidden input field -



php - Yii radioButtonList - JUI Buttonset - Hidden input field -

i new yii.

if generate radiobuttonlist using yii form builder next code

echo $form->radiobuttonlist($person,'gender_code',array('m'=>'male','f'=>'female'));

it outputs next html

<input id="ytperson_gender_code" type="hidden" value="" name="person[gender_code]" /> <input id="person_gender_code_0" value="m" type="radio" name="person[gender_code]" /> <label for="person_gender_code_0">male</label><br/> <input id="person_gender_code_1" value="f" type="radio" name="person[gender_code]" /> <label for="person_gender_code_1">female</label>

why hidden input field generated? purpose serve.? there way can remove it?

i trying convert radio buttons jquery ui buttonset hidden input field has same name radio buttons , because of that, jquery ui buttonset breaks.

any help appreciated. thanks.

according yii documentation, can still value if radiobutton unchecked. there should htmloption tell not show. try: radiobuttonlist($person,'gender_code',array('m'=>'male','f'=>'female'),array('uncheckvalue'=>null))

php jquery-ui yii

javascript - Looking up Address field on Custom Entity in CRM 2011 -



javascript - Looking up Address field on Custom Entity in CRM 2011 -

i have entity called client site store site information. site create devices (another custom entity). have created relevent address fields of address entity in client site entity , trying (based on account) fill site fields of selected address account.

i referred article doing so, http://xrmexpertz.com/2012/01/24/lookup-address-for-custom-entities-in-crm-2011/

i've altered javascript , xml provided in link reflect entities , web resource.

my problem when click button should execute javascript nothing, , if seek save site without business relationship sends me , error.

this java script.

function customlookup() { 'use strict'; var aoitems = getfieldvalue("kez_siteinfo_accountid"); if (aoitems == null) { alert(“account not selected”); return; } var _object = openstddlg(“ / sfa / quotes / dlg_lookupaddress.aspx ? headerform = 1 & parenttype = 1 & parentid = ” + aoitems[0].id + “ & willcall = 0″, “lookupaddress”, 500, 330, true); if (object) { setfieldvalue(“kez_address1_name”, object.address.name); setfieldvalue(“kez_address1_line1″, object.address.line1); setfieldvalue(“kez_address1_line2″, object.address.line2); setfieldvalue(“kez_address1_line3″, object.address.line3); setfieldvalue(“kez_address1_city”, object.address.city); setfieldvalue(“kez_address1_province”, object.address.stateorprovince); setfieldvalue(“kez_address1_postalcode”, object.address.postalcode); setfieldvalue(“kez_address1_country”, object.address.country); } } function setfieldvalue(fieldname, fieldvalue) { xrm.page.getattribute(fieldname).setvalue(fieldvalue); }

this error gives

microsoft dynamics crm error study contents <crmscripterrorreport> <reportversion>1.0</reportversion> <scripterrordetails> <message>uncaught syntaxerror: unexpected token illegal</message> <line>7</line> <url>/%7b634962800260003236%7d/webresources/kez_getlocation</url> <pageurl>/userdefined/edit.aspx?_gridtype=10018&etc=10018&id=%7b1f8e02f0-766c-e211-934e- 00155d018211%7d&pagemode=iframe&preloadcache=1360684076423&rskey=69426415</pageurl> <function></function> <callstack> </callstack> </scripterrordetails> <clientinformation> <browseruseragent>mozilla/5.0 (windows nt 6.2) applewebkit/537.30 (khtml, gecko) chrome/26.0.1403.0 safari/537.30</browseruseragent> <browserlanguage>undefined</browserlanguage> <systemlanguage>undefined</systemlanguage> <userlanguage>undefined</userlanguage> <screenresolution>1366x768</screenresolution> <clientname>web</clientname> <clienttime>2013-02-12t10:47:58</clienttime> </clientinformation> <serverinformation> <orglanguage>1033</orglanguage> <orgculture>1033</orgculture> <userlanguage>1033</userlanguage> <userculture>1033</userculture> <orgid>{bc278bc1-eeea-4d24-b5c6-f0720b343a1f}</orgid> <userid>{d76eea89-d760-e211-921f-00155d018211}</userid> <crmversion>5.0.9690.3236</crmversion> </serverinformation> </crmscripterrorreport>

i ended solving problem, 1 source listed uses quotes not recognized crm. next had utilize xrm.getattribute instead of getfieldvalue.

the final , working code below:

function customlookup() { 'use strict'; var aoitems = xrm.page.getattribute('kez_siteinfo_accountid').getvalue(); if (aoitems == null) { alert("account not selected"); return; } var _object = openstddlg("/sfa/quotes/dlg_lookupaddress.aspx?headerform=1&parenttype=1&parentid=" + aoitems[0].id + "&willcall=0", "lookupaddress", 500, 330, true); if (object) { setfieldvalue("kez_address1_name", object.address.name); setfieldvalue("kez_address1_line1", object.address.line1); setfieldvalue("kez_address1_line2", object.address.line2); setfieldvalue("kez_address1_line3", object.address.line3); setfieldvalue("kez_address1_city", object.address.city); setfieldvalue("kez_address1_province", object.address.stateorprovince); setfieldvalue("kez_address1_postalcode", object.address.postalcode); setfieldvalue("kez_address1_country", object.address.country); } } function setfieldvalue(fieldname, fieldvalue) { xrm.page.getattribute(fieldname).setvalue(fieldvalue); }

javascript dynamics-crm-2011 dynamics-crm lookup

c# - How to find list of events using Debugger (VS Professional 2012)? -



c# - How to find list of events using Debugger (VS Professional 2012)? -

okay, can't find help question , stackoverflow doesn't seem have either, or didn't know how (please right me, if i'm wrong , close question).

in program, have grid has few events definded in code:

public grid _grid = new grid(); _grid.mouseleftbuttondown += new mousebuttoneventhandler(mymethod); //and few more events...

now during programme run, saw weird behaviour can come events, set breakpoint , stopped programme utilize debugger.

is there list can find somewhere lists defined events of fellow member _grid can check no unwanted events have not yet been removed?

update 2

unfortunately, events in wpf (i.e. on uielement) implemented manually implementing add/remove means event fellow member can on left hand side of -= or += operator (i.e. can't "read"). internals such each event "delegated" collection of events , collection contains elements assigned events (e.g. if there's single mouseleftbuttondownevent += somehandler; collection of events have 1 entry. unfortunately, collection of events stores represent handler internal construction have able instantiate query collection. unable instantiate instance of construction (routedeventhandlerinfo, fwiw) in order query collection (uielement.eventhandlersstore._entries, fwiw). e.g. if you, query handler particular event such in quickwatch window:

grid.eventhandlersstore._entries[ new routedeventhandlerinfo(uielement.mouseleftbuttondownevent, false)]

but, debugger not allow invoke internal constructor.

there isn't lists just events. can see members of instance in debugger (watch, quickwatch, etc.) , events have distinct icon. can expand each 1 of these see method assigned event. example:

as can see, myevent has been "assigned" method t_myevent particular instance.

update: if have more 1 event handler assigned event, debugger show lastly assigned method in top-level of event in quick watch. see all methods assigned, you'll need drill-down invocation list. example:

.. shows both t_myevent , t_myevent2 in invocation list myevent. if hace no handlers, value myevent null.

c# wpf debugging events visual-studio-2012

javascript - getting error in casperjs as "resource not found" for this ur? -



javascript - getting error in casperjs as "resource not found" for this ur? -

i trying fetch html url "https://stage.hiiro.co/auth/login" next coffeescript file code casperjs

casper.start "https://stage.hiiro.co/auth/login", -> @echo @gethtml()

it gives me error resource not found function works fine other urls seek access https://www.facebook.com/, https://www.gmail.com/.

can guess why not working?

and yes url "https://stage.hiiro.co/auth/login" works fine browsers

you have ssl error domain. passing --ignore-ssl-errors=yes alternative makes script work fine.

javascript jasmine phantomjs casperjs

entity framework - How to apply a reusable linq expression to a EF navigation property -



entity framework - How to apply a reusable linq expression to a EF navigation property -

i have next look (simplified):

from p in providers select new { p.name, p.accounts.count(a => a.state == 2) };

this works fine, want create reusable look so:

expression<func<account, bool>> mypredicate() { homecoming => a.state == 2; }

and utilize so:

from p in providers select new { p.name, p.accounts.count(mypredicate()) }

this unfortunately doesn't work because navigation property (accounts) ilist or icollection in ef. what's pattern here? happy alter things around little, note i'm not after dynamic expressions reusable ones.

linq entity-framework

c# - Using MAPI to access the Exchange Server from a Service -



c# - Using MAPI to access the Exchange Server from a Service -

i tasked building application check email using mapi. made utilize of wrapper class coded in cpp, accessed c#. realize combining managed , unmanaged code not best path, work.

after getting working, asked create application service, run when scheme not logged in.

the client requires utilize mapi, , using outlook 2007, compatible both x86 , x64 architecture. separate programme running on several workstations allowed send mail service using single email address. service monitor account, watching new email exchange saying message not delivered. when happens, create note in database future correction.

my understanding of how extended mapi works uses profile of person logged in access exchange server. question whether exchange server can accessed through mapi when nobody logged system? if not possible, oom allow access specific email business relationship (or profile) when no user logged in? 1 method improve other when predominantly using c#?

below brief sample of how wrapper class logs in. added sec method, never did log in profile other of current user's.

bool cmapiex::login(lpctstr szprofilename, bool binitasservice) { dword dwflags=mapi_extended | mapi_use_default | mapi_new_session; if(binitasservice) dwflags|=mapi_explicit_profile | mapi_nt_service; homecoming (mapilogonex(null, (lptstr)szprofilename, null, dwflags, &m_psession)==s_ok); } bool cmapiex::login(lpctstr szprofilename, lpctstr szprofilepassword, bool binitasservice) { dword dwflags=mapi_extended | mapi_explicit_profile | mapi_new_session; if(binitasservice) dwflags|= mapi_nt_service; homecoming (mapilogonex(null, (lptstr)szprofilename, (lptstr)szprofilepassword, dwflags, &m_psession)==s_ok); }

thank suggestions.

you can dynamically create temporary profile msems service , configure it. see http://support.microsoft.com/kb/306962?wa=wsignin1.0 , scroll "use mapi iprofadmin interface" create sure service runs under identity of mailbox owner.

c# exchange-server mapi outlook-object-model

asp.net - Is it possible to deep link Ajax accordion contents? -



asp.net - Is it possible to deep link Ajax accordion contents? -

i have ajax accordion containing list of faq's, want deep link each faq. possible ? if yes - how? if no - there other way work around this?

asp.net ajax jquery

javascript - How to unit test views in ember.js? -



javascript - How to unit test views in ember.js? -

we in process of learning ember.js. our development tdd, , want ember.js no exception. have experience building backbone.js apps test-driven, familiar testing front-end code using jasmine or mocha/chai.

when figuring out how test views, ran problem when template view uses has #linkto statement. unfortunately unable find test examples , practices. gist our quest answers how decently unit-test ember applications.

when looking @ test linkto in ember.js source code, noticed contains total wiring of ember app back upwards #linkto. mean cannot stub behaviour when testing template?

how create tests ember views using template renders?

here a gist our test , template create test pass, , template create fail.

view_spec.js.coffee

# test made mocha / chai, # chai-jquery , chai-changes extensions describe 'todoitemsview', -> beforeeach -> testserializer = ds.jsonserializer.create primarykey: -> 'id' testadapter = ds.adapter.extend serializer: testserializer teststore = ds.store.extend revision: 11 adapter: testadapter.create() todoitem = ds.model.extend title: ds.attr('string') store = teststore.create() @todoitem = store.createrecord todoitem title: 'do something' @controller = em.arraycontroller.create content: [] @view = em.view.create templatename: 'working_template' controller: @controller @controller.pushobject @todoitem aftereach -> @view.destroy() @controller.destroy() @todoitem.destroy() describe 'amount of todos', -> beforeeach -> # $('#konacha') div gets cleaned between each test em.run => @view.appendto '#konacha' 'is shown', -> $('#konacha .todos-count').should.have.text '1 things do' 'is livebound', -> expect(=> $('#konacha .todos-count').text()).to.change.from('1 things do').to('2 things do').when => em.run => extratodoitem = store.createrecord todoitem, title: 'moar todo' @controller.pushobject extratodoitem

broken_template.handlebars

<div class="todos-count"><span class="todos">{{length}}</span> things do</div> {{#linkto "index"}}home{{/linkto}}

working_template.handlebars

<div class="todos-count"><span class="todos">{{length}}</span> things do</div>

our solution has been load whole application, isolate our test subjects much possible. example,

describe('fooview', function() { beforeeach(function() { this.foo = ember.object.create(); this.subject = app.fooview.create({ foo: this.foo }); this.subject.append(); }); aftereach(function() { this.subject && this.subject.remove(); }); it("renders foo's favoritefood", function() { this.foo.set('favoritefood', 'ramen'); em.run.sync(); expect( this.subject.$().text() ).tomatch( /ramen/ ); }); });

that is, router , other globals available, it's not complete isolation, can send in doubles things closer object under test.

if want isolate router, linkto helper looks controller.router, do

this.router = { generate: jasmine.createspy(...) }; this.subject = app.fooview.create({ controller: { router: this.router }, foo: this.foo });

javascript unit-testing model-view-controller ember.js

redirect - How do you use Fluent Security to Setup SSL Redirection in an ASP.net MVC application? -



redirect - How do you use Fluent Security to Setup SSL Redirection in an ASP.net MVC application? -

what best way utilize fluent security setup ssl redirection on controllers' views within mvc web app?

the best way create custom policy , policy handler. here how completed it:

my custom policy

public class requiresslpolicy : isecuritypolicy { public policyresult enforce(isecuritycontext context) { var req = httpcontext.current.request; if (!req.issecureconnection && !req.islocal) homecoming policyresult.createfailureresult(this, "a secure connection required."); homecoming policyresult.createsuccessresult(this); } }

my custom policy handler

public class requiresslpolicyviolationhandler : ipolicyviolationhandler { public actionresult handle(policyviolationexception exception) { var req = httpcontext.current.request; var url = req.url.tostring().tolower().replace("http:", "https:"); homecoming new redirectresult(url); } }

code add together policy controller or actions within controller

c.for<accountcontroller>().addpolicy<requiresslpolicy>();

and that'it! of course of study need create sure configuring dependency injection correctly , next fluent security naming conventions. 1 time correct, should see code works perfectly!

asp.net-mvc redirect ssl fluent-security

Sql error "Divide by zero error encountered" when the divisor is 0 -



Sql error "Divide by zero error encountered" when the divisor is 0 -

this question has reply here:

how avoid “divide zero” error in sql? 14 answers

i have error coming "divide 0 error encountered." in sql server 2005. understand have few rows are getting divided 0 results in error. wondering if can eliminate error when divisor zero. if divisor 0, should homecoming 0. how can that?

sum(isnull(cast(s.s_amountcollected numeric(10, 2)), 0)) / sum(isnull(cast(s.amountsold numeric(10, 2)), 0))

thank you!

use case statement:

case when sum(isnull(cast(s.amountsold numeric(10, 2)), 0) = 0 0 else sum(isnull(cast(s.s_amountcollected numeric(10, 2)), 0)) / sum(isnull(cast(s.amountsold numeric(10, 2)), 0)) end

sql

c# - NullReferenceException Unhandled (Cannot find the source of the error) -



c# - NullReferenceException Unhandled (Cannot find the source of the error) -

my problem i'm trying create application, , far can see, should pristine , cannot find error @ all.

here code below. comment error hits. form code

namespace techbank { public partial class tech_bank : form { caccount currentaccount = null; cbank mybank = new cbank(); private void displaybalance() { if (lstaccounts.items.count != 0) { txtbalance.text = currentaccount.balance.tostring; //where error hits txtcustomer.text = currentaccount.customername; txtaccounttype.text = convert.tostring(currentaccount.accounttype); } } private void button1_click(object sender, eventargs e) { open_account form = new open_account(); form.showdialog(); if (form.dialogresult == dialogresult.ok) { currentaccount = new caccount(typeaccount.checking, "", 4); if (form.rbtchequing.checked) currentaccount.accounttype = typeaccount.checking; if (form.rbtsavings.checked) currentaccount.accounttype = typeaccount.savings; seek { currentaccount.balance = convert.todouble(form.txtstartingbalance.text); } grab (formatexception) { messagebox.show("please come in valid information", "error in business relationship creation, please double check values correct"); } currentaccount.customername = form.txtcustomername.text; mybank.openaccount(currentaccount); lstaccounts.items.add(currentaccount.accountid); currentaccount = mybank.getaccount(lstaccounts.selectedindex); lstaccounts.selectedindex = lstaccounts.items.count - 1; displaybalance(); } } private void button2_click(object sender, eventargs e) { transaction form = new transaction(currentaccount); form.showdialog(); if (form.dialogresult == dialogresult.ok) { } displaybalance(); } private void button3_click(object sender, eventargs e) { if (lstaccounts.items.count != 0) { mybank.closeaccount(currentaccount); lstaccounts.items.removeat(lstaccounts.selectedindex); txtaccounttype.clear(); txtbalance.clear(); txtcustomer.clear(); } } private void btnexit_click(object sender, eventargs e) { system.environment.exit(0); } private void lstaccounts_selectedindexchanged(object sender, eventargs e) { currentaccount = mybank.getaccount(lstaccounts.selectedindex); displaybalance(); } } }

caccount.cs code below

namespace techbank { public enum typeaccount { checking, savings } public class caccount { private static random randomnumber = new random(); private typeaccount maccounttype; private double mbalance; private string mcustomer; private string mid; public caccount(typeaccount newtype, string newcustomer, double newbalance) { maccounttype = newtype; mcustomer = newcustomer; mbalance = newbalance; mid = convert.tostring(randomnumber.next(1, 9999)); } public typeaccount accounttype { { homecoming maccounttype; } set { maccounttype = value; } } public double balance { { homecoming mbalance; } set { mbalance = value; } } public string customername { { homecoming mcustomer; } set { mcustomer = value; } } public string accountid { { homecoming mid; } } public void deposit(double amount) { if (ispositivenumber(amount, 0)) mbalance += amount; } public bool ispositivenumber(double larger, double smaller) { homecoming (larger >= smaller); } public void withdraw(double amount) { if (ispositivenumber(mbalance, amount)) mbalance -= amount; } } }

please inform me if need more code.

null reference exceptions mean same thing: haven't initialized variable. in case, declare caccount currentaccount = null; class member. if need non-null, needs initialized calling new caccount() time before displaybalance() called. example, if user clicks button2 before clicking button1 you'll null ref. similarly, if mybank.getaccount() returns null you'll null ref. stack trace help narrow downwards of these cause.

c# .net winforms nullreferenceexception

c# - Fix row height of every row in TableLayoutPanel -



c# - Fix row height of every row in TableLayoutPanel -

i'm working on windows c#.

firstly, things can not alter need following:

the size of tablelayoutpanel fixed. the total # of columns fixed.

now, want set prepare height rows increasing rows, if set rowstyle property percent 100.0f works fine 3 4 items, after 4-5 items, command on 1 row overwrites controls on row.

i have searched more i'm not able proper answer. have tried autosize, percent, absolute properties of rowstyle, though not working.

so , how? how can accomplish this?

ultimately, want same datagridview of windows c#.

thanks in advance....

i'm working on winforms...the sample code here..

int cnt = tablelayout.rowcount = mydatatable.rows.count; tablelayout.size = new system.drawing.size(555, 200); (int = 1; <= cnt; i++) { label lblsrno = new label(); lblsrno.text = i.tostring(); textbox txt = new textbox(); txt.text = ""; txt.size = new system.drawing.size(69, 20); tablelayout.controls.add(lblsrno, 0, - 1); tablelayout.controls.add(txt, 1, - 1); } tablelayout.rowstyles.clear(); foreach (rowstyle rs in tablelayout.rowstyles) tablelayout.rowstyles.add(new rowstyle(sizetype.autosize));

the label , textboxes working fine 4-5 #of rows whenever #of row(in case, variable cnt in loop) increases, rows overwriting each other 1 command overwrite another...i had drag-drop tablelayoutpanel command , created 1 row , 2 columns manually.

so please tell me how it.

i'm still new tablelayoutpanels myself, noticed @ bottom of code, you're clearing rowstyles collection, you're trying iterate through them in foreach loop.

you did this:

tablelayout.rowstyles.clear(); //now have 0 rowstyles foreach (rowstyle rs in tablelayout.rowstyles) //this never execute tablelayout.rowstyles.add(new rowstyle(sizetype.autosize));

try instead.

tablelayoutrowstylecollection styles = tablelayout.rowstyles; foreach (rowstyle style in styles){ // set row height 20 pixels. style.sizetype = sizetype.absolute; style.height = 20; }

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

edit: realized adding n rows doesn't add together n rowstyles can iterate through. think what's happening you're adding n rows, none of them have rowstyles.

i suppose can clear() rowstyles, add together n rowstyles similar how you're doing.

c# winforms tablelayoutpanel row-height

performance - How much faster is the native implementation of the native cryptographic hashes on Windows than the .Net Managed version? -



performance - How much faster is the native implementation of the native cryptographic hashes on Windows than the .Net Managed version? -

i'm providing hashes sets of info in order fingerprint info , identify hash - core utilize case fast hashes sha1 , md5.

in .net, there alternative go native or managed implementations of of these hashes (the sha variants, anyway). i'm looking md5 managed implementation, , there doesn't appear 1 in .net framework, wondered if wrapped native csp faster anyway, , if should utilize content there no perf problems using it. top reply why there no managed md5 implementation in .net framework? indicates faster performance reason managed variant doesn't exist.

is true, , if so, how much faster native csp?

unfortunately, wrapped native csp md5 - md5cryptoserviceprovider - slower pure managed implementation. obstinate viewpoint holds native code unequivocally faster managed code: in many cases opposite true. such case, @ to the lowest degree in head-to-head measurements.

using translated reference md5 implementation david anson, constructed quick performance test (source) aims measure big differences in performance between 2 implementations. while little info arrays difference negligible, expected, @ around 16kb native implementation starts show potentially important delay - on order of milliseconds. might not seem much, orders of magnitude slower pure managed implementation. difference maintained size of info beingness hashed increases, , @ largest tested info array - ~250mb - difference in cpu time 8.5 seconds. considering hash used fingerprint big files, delay become noticeable, against much larger delays i/o.

it's not abundantly clear delay comes from, since pure native test not performed (one dispense wrapping of csp , consumption in managed code), given identical shape of graphs on log scale, appear managed , native implementations have same intrinsic performance, native code performance "shifted" downwards in performance due cost of interop between native , managed code @ runtime. performance difference between wrapped native csps , pure managed implementations has been reproduced , documented other investigators.

in add-on answering question "how much faster native implementation" in particular case, hope evidence serves prompt more reflection , investigation when question of native vs. managed arises, breaking long-standing , pernicious reaction similar questions native code faster, , thus, somehow, better. managed code fast, in performance-sensitive domain of mass info hashing.

.net performance md5 native sha

Rails Mongoid "undefined method `[]' for nil:NilClass" on controller index and create -



Rails Mongoid "undefined method `[]' for nil:NilClass" on controller index and create -

i have started using mongoid rails , followed screencast it. have generated scaffold, have generated mongoid.yml, , changed database name. have followed steps prepare mongoid rails in documentation.

however, seem getting on create action

undefined method `[]' nil:nilclass rails.root: /users/ygamayatmiretuta/documents/dev/ruby/ta application trace | framework trace | total trace app/controllers/notes_controller.rb:25:in `create'

and 1 on index action:

undefined method `[]' nil:nilclass extracted source (around line #12): 9: <th></th> 10: </tr> 11: 12: <% @notes.each |note| %> 13: <tr> 14: <td><%= note.title %></td> 15: <td><%= note.description %></td>

am missing config step or something? thanks!

this controller:

class notescontroller < applicationcontroller respond_to :html def index @notes = note.all.entries respond_with @notes end def show @notes = note.find params[:id] respond_with @notes end def new @notes = note.new respond_with @notes end def edit @notes = note.find params[:id] respond_with @notes end def create @notes = note.create params[:notes] respond_with @notes end def update @notes = note.find params[:id] @notes.update_attributes params[:notes] respond_with @notes end def destroy @notes = note.find params[:id] @notes.destroy respond_with @notes end end

here @tasks nil. , trying iterate it. thats why error coming.

ruby-on-rails ruby-on-rails-3 mongodb mongoid

How to avoid Outlook security alert when sending outlook appointment from C# program -



How to avoid Outlook security alert when sending outlook appointment from C# program -

wrote function in order send appointment via microsoft outlook. method works before sending appointment, outlook security alert pops out , inquire if allow/deny access. this code:

class="lang-cs prettyprint-override">public static void sendappointment() { outlook.application oapp = new outlook.application(); outlook.appointmentitem oappointment = oapp.createitem(outlook.olitemtype.olappointmentitem); oappointment.subject = "subject"; oappointment.body = "body"; oappointment.location = "some location"; oappointment.start = datetime.now; oappointment.end = datetime.now.adddays(1); oappointment.importance = outlook.olimportance.olimportancenormal; oappointment.meetingstatus = outlook.olmeetingstatus.olmeeting; outlook.recipient orecip = oappointment.recipients.add("sample@gmail.com"); orecip.resolve(); // not sure if line necessary oappointment.send(); }

i saw somewhere prepare not build new application existing using line:

outlook.mailitem tempitem = globals.thisaddin.application.createitem(outlook.olitemtype.olmailitem);

but not found assembly globals class is.

c#

linux - How to get USB device details in kernel programming? -



linux - How to get USB device details in kernel programming? -

i new kernel programming , have dev_t value of usb device.

i want details of device vendor id, product id, or other attribute vary device device. want in kernel space, , without loading programme external module.

i have came across libusb library, however, far know, used in user space. possible utilize libusb in kernel space also, requirement? if possible, how import , set-up libusb can compile kernel?

it improve write loadable kernel module task. every time find bug have compile module against kernel , load it. there defined framework in kernel usb, utilize apis provided kernel things looking for. except libusb user space library , there no point of using within kernel. in user space can access usb related info using procfs/sysfs also.

linux linux-kernel kernel linux-device-driver libusb

php - phpmysql inserts blank instead of value -



php - phpmysql inserts blank instead of value -

i have next function:

function insert($database, $table, $data_array) { # connect mysql server , select database $mysql_connect = connect_to_database(); mysql_select_db ($database, $mysql_connect); # create column , info values sql command foreach ($data_array $key => $value) { $tmp_col[] = $key; $tmp_dat[] = "'$value'"; } $columns = join(",", $tmp_col); $data = join(",", $tmp_dat); # create , execute sql command $sql = "insert ".$table."(".$columns.")values(". $data.");"; $result = mysql_query($sql, $mysql_connect); # study sql error, if 1 occured, otherwise homecoming result if(mysql_error($mysql_connect)) { echo "mysql update error: ".mysql_error($mysql_connect); $result = ""; } else { homecoming $result; } }

the values in php following:

$content_table = "p_content"; $insert_array['title'] = $title; $insert_array['content'] = $content; $insert_array['url'] = $get_source; $insert_array['video'] = $video; $insert_array['date'] = $date; insert(database, $content_table, $insert_array);

the result of adds row id (key, autoimcrement), url, , date. title, content , video blank. if echo title right result, if var_dump title string(15)"blablablabla", 1 time again correct.

now if hand set $title = "asdf"; getting inserted correctly. same goes content , video.

table structure

id int(8) unsigned no pri null auto_increment

title varchar(1000) yes null

content longtext yes null

video varchar(3000) yes null

url varchar(300) yes null

date date yes null

try adding quotes variables. :-) reason mysql column types set varchar. , inserting info requires surround inserts quotes.

b.t.w. if new code recommend switch mysqli or pdo library.

php mysql insert

matlab - calculating x2 from poisson distributed data -



matlab - calculating x2 from poisson distributed data -

so have table of values

v=0 1 2 3 4 5 6 7 8 9 #times obs.: 5 19 23 21 14 12 3 2 1 0

i supposed calculate chi squared assuming info fits poisson dist. mean u=3. have grouping values >=6 in 1 bin.

i unsure of how plot poisson dist., , of how command goes bin, if makes sense.

i have plotted histogram using histc before..but random numbers normalized. amount in each bin set me. super new...sorry if question sucks.

you utilize bar plot bar graph in matlab.

so do:

v=0:9; f=[5 19 23 21 14 12 3 2 1 0]; fc=f(find(v<6)); % re-create elements v<=6 new array fc(end+1)=sum(f(v=>6)); % append sum of elements v=>6 array figure bar(v(v<=6), fc);

that should trick...

now didn't inquire chi squared calculation. urge not set values of v>6 1 bin calculation, give bad result.

there technique: if utilize hist function, can take bins - , matlab automatically set things exceed limits lastly bin. if observations in array obs, can asked with:

h = hist(obs, 0:6); figure bar(0:6, h)

the advantage have array h available (frequencies) other calculations.

if instead

hist(obs, 0:6)

matlab plot graph in single statement (but don't have values...)

matlab statistics

sql - sending data from Flash to PHP to PHPmyadmin issue -



sql - sending data from Flash to PHP to PHPmyadmin issue -

i've been trying around problem past 18 hours , cant find decent info on web!

here coding flash as3 file ....

import flash.events.mouseevent; import flash.net.urlloader; import flash.net.urlrequest; import flash.net.urlvariables; import flash.net.urlloaderdataformat; import flash.net.urlrequestmethod; import flash.events.event; var variables:urlvariables = new urlvariables(); var varsend:urlrequest = new urlrequest("form_parse.php"); varsend.method = urlrequestmethod.post; varsend.data = variables; var varloader:urlloader = new urlloader; varloader.dataformat = urlloaderdataformat.variables; varloader.addeventlistener(event.complete, completehandler); function completehandler(event:event):void { firstname_txt.text = ""; lastname_txt.text = ""; email_txt.text = ""; number_txt.text = ""; msg_txt.text = ""; } submit_btn.addeventlistener(mouseevent.click, validateandsend); function validateandsend (event:mouseevent):void { if(!firstname_txt.length) { status_txt.text = "please come in first name"; } else if (!lastname_txt.length) { status_txt.text = "please come in lastly name"; } else if (!email_txt.length) { status_txt.text = "please come in email"; } else if (!number_txt.length) { status_txt.text = "please come in phone number"; } else { variables.comtype="dp"; variables.userfname = firstname_txt.text; variables.userlname = lastname_txt.text; variables.useremail = email_txt.text; variables.usernumber = number_txt.text; variables.usermsg = msg_txt.text; varloader.load(varsend); } }

and here code php file...

<?php $username="******"; $password="******"; $database="******"; mysql_connect("*****","$username","$password") or die (mysql_error()); mysql_select_db("$database") or die (mysql_error()); if (@$_post['comtype'] == "dp") { $senderfname = $_post['userfname']; $senderlname = $_post['userlname']; $senderemail = $_post['useremail']; $sendernumber = $_post['usernumber']; $sendermessage = $_post['usermsg']; $sql = "insert form values('$senderfname','$senderlname','$senderemail','$sendernumber','$sendermessage')"; mysql_query($sql) or die (mysql_error()); mysql_free_result($sql); mysql_close(); echo "status_txt=entry has been added $senderfname, thanks!"; exit(); } ?>

can point out coding goes wrong? because checks i've done far coding correct, whenever seek run on local server cant btn send info php file... help right appreciated!

thanks dp

php sql actionscript-3 flash

Twitter Bootstrap's responsive CSS works on resized window, but not on mobile -



Twitter Bootstrap's responsive CSS works on resized window, but not on mobile -

i've used twitter bootstrap framework build newest site. used boostrap.responsive.css create work on mobile devices. doesn't. seems doesn't see css @ all. when ran on android phone, displaying site pc. when resize browser window on pc, works great. can problem? haven't messed bootstrap's css.

when ran alert($(window).width());, returned 980.

make sure include meta viewport element instructed in bootstrap's responsive docs layout scale device width.

<meta name="viewport" content="width=device-width, initial-scale=1.0">

twitter-bootstrap

iphone - How to get a UITextView to dynamically size it's self to it's content -



iphone - How to get a UITextView to dynamically size it's self to it's content -

i'm trying uitextview dynamically size it's self it's content. height of text view 100 700.

everything i've tried far hasn't worked.

i've tried next in viewdidload , in viewdidlayoutsubviews. here's code:

cgrect framedesc = self.descriptiondeal.frame; framedesc.size.height = self.descriptiondeal.contentsize.height; self.descriptiondeal.frame = framedesc; self.descriptiondeal.backgroundcolor = [uicolor redcolor];

i added background color see size of view , it's not sizing content.

i tried:

[self.descriptiondeal sizetofit];

also, not sure if it's affecting anything, in story uitextview laid out size set there. thought code above override it, somethings not working correctly.

thanks help

you should making size changes in text view's delegate's textviewdidchange: method

use http://stackoverflow.com/a/14956351/1311910 appropriate height.

iphone ios objective-c uitextview

webdriver - Xpath select parent element using inner text -



webdriver - Xpath select parent element using inner text -

<div> <input type="checkbox" data-bind="checked: isselected"> select box </input> </div>

hi attempting select checkbox using innertext within xpath no luck far. illustration know next not work: //input[contains(text(), ' select box')]

any suggestions right syntax please? note, needs include innertext.

thanks

your code works (tested xpathpatherizernpp):

//input[contains(text(),"select box")]

xpath webdriver

android - XMl layout file does not recognising string created in strings.xml -



android - XMl layout file does not recognising string created in strings.xml -

i have created new string in strings.xml , saved it. when trying utilize in layout.xml error:

no resource found matches given name (at'text' value '@string/breadth')

the xml code trying utilize strin is:

<textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#2f4f4f" android:text="@string/breadth" android:textappearance="?android:attr/textappearancemedium" />

the string created is:

<string name="breadth ">breadth in cms</string>

please help

you have typo. instead of:

<string name="breadth ">breadth in cms</string>

use:

<string name="breadth">breadth in cms</string>

note removed space ().

android

trying to scan in to a 2-d malloc'd array c programming -



trying to scan in to a 2-d malloc'd array c programming -

i've looked through quite few questions of 2-d malloc'd arrays bascially whatever reason cannot find solution.... google fu sux sorry =(. been using site day syntactual help though helps here! =)

anyways cant seem fscanf work =/ if help me much appreciated because cant see error @ know there 1 because @ point programme crashes.

array1 = (int**)malloc((c)*sizeof(int*)); int = 0, = 0; (a = 0; < c; a++){ array1[a] = (int*)malloc((c+1)*sizeof(int)); } a=0; for(a = 0; < c; a++){ for(i = 0; < c; i++){ fscanf(ifp, "%d", array1[a][i]); } }

where c maximum size of array needed. in case set 3 need variable

when using scanf family of function read value, destination needs pointer. array1[a][i] not pointer, actual value (which scanf treat pointer , entered territory of undefined behavior).

what want &array1[a][i].

ps. should not cast returned value of malloc.

c

php - String comparison regardless of case -



php - String comparison regardless of case -

i'm trying find different variations of "username" or "password" , shown below, in case-insensitive manner:

$unvar1 = "username"; $unvar2 = "user name"; $usernamevariations1 = strcasecmp($unvar1, $unvar2); $unvar3 = "user"; $unvar4 = "id"; $usernamevariations2 = strcasecmp($unvar3, $unvar4); $pwvar1 = "password"; $pwvar2 = "pass"; $passwordvariations1 = strcasecmp($pwvar1, $pwvar2); if ($element->value === $usernamevariations1 || $element->value === $usernamevariations2 || $element->value === $passwordvariations1) { echo "weee!"; } else { echo "boo!"; }

the problem outputs "boo" each element in foreach() output. doing wrong? possible set of these values in array? thanks.

you're making more complicated needs be. if usernames , passwords not case sensitive, create them lowercase when compare them:

if (strtolower($username) === strtolower($element->value)) { // ok }

now if you're allowing spaces added middle, , abbreviations, can seek plan b:

$valid_usernames = array('username', 'username', 'user name', 'use nam'); if (in_array($element->value, $valid_usernames)) { // ok }

keep in mind responsible keeping $valid_usernames complete.

php string-matching case-insensitive

gpu - CUDA Block parallelism -



gpu - CUDA Block parallelism -

i writing code in cuda , little confused run parallel.

say calling kernel function this: kenel_foo<<<a, b>>>. per device query below, can have maximum of 512 threads per block. guaranteed have 512 computations per block every time run kernel_foo<<<a, 512>>>? says here 1 thread runs on 1 cuda core, means can have 96 threads running concurrently @ time? (see device_query below).

i wanted know blocks. every time phone call kernel_foo<<<a, 512>>>, how many computations done in parallel , how? mean done 1 block after other or blocks parallelized too? if yes, how many blocks can run 512 threads each in parallel? says here 1 block run on 1 cuda sm, true 12 blocks can run concurrently? if yes, each block can have maximum of how many threads, 8, 96 or 512 running concurrently when 12 blocks running concurrently? (see device_query below).

another question if a had value ~50, improve launch kernel kernel_foo<<<a, 512>>> or kernel_foo<<<512, a>>>? assuming there no thread syncronization required.

sorry, these might basic questions, it's kind of complicated... possible duplicates: streaming multiprocessors, blocks , threads (cuda) how cuda blocks/warps/threads map onto cuda cores?

thanks

here's device_query:

device 0: "quadro fx 4600" cuda driver version / runtime version 4.2 / 4.2 cuda capability major/minor version number: 1.0 total amount of global memory: 768 mbytes (804978688 bytes) (12) multiprocessors x ( 8) cuda cores/mp: 96 cuda cores gpu clock rate: 1200 mhz (1.20 ghz) memory clock rate: 700 mhz memory bus width: 384-bit max texture dimension size (x,y,z) 1d=(8192), 2d=(65536,32768), 3d=(2048,2048,2048) max layered texture size (dim) x layers 1d=(8192) x 512, 2d=(8192,8192) x 512 total amount of constant memory: 65536 bytes total amount of shared memory per block: 16384 bytes total number of registers available per block: 8192 warp size: 32 maximum number of threads per multiprocessor: 768 maximum number of threads per block: 512 maximum sizes of each dimension of block: 512 x 512 x 64 maximum sizes of each dimension of grid: 65535 x 65535 x 1 maximum memory pitch: 2147483647 bytes texture alignment: 256 bytes concurrent re-create , execution: no 0 re-create engine(s) run time limit on kernels: yes integrated gpu sharing host memory: no back upwards host page-locked memory mapping: no concurrent kernel execution: no alignment requirement surfaces: yes device has ecc back upwards enabled: no device using tcc driver mode: no device supports unified addressing (uva): no device pci bus id / pci location id: 2 / 0

check out this answer first pointers! reply little out of date in talking older gpus compute capability 1.x, matches gpu in case. newer gpus (2.x , 3.x) have different parameters (number of cores per sm , on), 1 time understand concept of threads , blocks , of oversubscribing hide latencies changes easy pick up.

also, take this udacity course or this coursera course going.

cuda gpu nvidia

android - Manually full re-build the titanium project -



android - Manually full re-build the titanium project -

detected alter in tiapp.xml, or assets deleted. forcing total re-build...

this line has been taken console of titanium build after making alter in file tiapp.xml in order re-build app(i-e forcefulness total re-build). possible total re-build titanium app manually.

note: not re-build if clean project project menu

yes can rebuit total app. delete built folder in project. rebuilt every time delete .

android titanium titanium-mobile rebuild