Posts

Showing posts from June, 2014

c++ - calling static function from constructor of same class -

can call static function constructor of same class. class a{ static void fun(); a() {fun();} }; it giving error while linking code. using visual studio c++, 2010. yes can - long provide function definition static function well.

jquery - JQqery ajax call with parameter not working -

i made jquery ajax call calling static page method . working fine wihtout parameter. if put parameter not call page method. have below code. javascript $.ajax({ type: 'post', url: 'itemmaster.aspx/uploadfile', contenttype: 'application/json; charset=utf-8', data: {'path':'mydata'}, datatype: 'json', success: function (msg) { alert(msg.d); } }); page method [webmethod] public static string uploadfile(string path) { return "success"; } is there datatype mismatching happened?. warm google time without success. please help.. your data object needs json string. try var datatosend = json.stringify({'path':'mydata'}); $.ajax({ type: 'post', url: 'itemmaster.aspx/uploadfile', contenttype: 'application/json; charset=utf-8', data: datatosend, dataty...

sql server - Is this SQL line saying previous day or the next day? -

we have old sql script looks data previous day. in our table have dateplaced column, want able records time ran til previous day. help. where datediff(day,[dateplaced],getdate()) = 1 ugh, don't way. applying function column means index relatively useless. data yesterday (or range, matter), try: declare @today date = sysdatetime(); ... dateplaced >= dateadd(day, -1, @today) , dateplaced < @today; if on old version sql server 2005, instead: declare @today datetime; set @today = datediff(day, 0, getdate()); ... dateplaced >= dateadd(day, -1, @today) , dateplaced < @today;

git - GitHub "Failed connect to github" No Error -

Image
i'm pretty new git, i've been using gitbash commits, pushing , pulling week or 2 now. working fine, day or 2 ago when started getting error everytime tried interact remote repositories. fatal: unable access '....': failed connect github.com:443; no error i've done googling , come across similar stackoverflow posts , articles. that, i've tried number of things, including testing ssh connection across different ports (22 , 443). looks port 443 (for https connections) blocked, while port 22 seems open. from understand of this, looks me might need change port git using 443 22. i've tried changing ~/.git/config file , i've tried git remote set-url command try this, no joy. any information on original error or on how change git port appreciated. any reason why use git via http? i'd suggest using ssh instead. git clone git@github.com:greenvalley/githubsandbox.git

javascript - Jquery mobile ''pagebeforeshow' not executing after pressing back -

i have implemented logic inside $(document).on('pagebeforeshow', '#mainpage', function(){ } but doesnt load when user eitehr presses key go specific page containg js or when calling history.back(-1); return false; to manually go previous page. it gets executed if refresh or directly go page using href<> any sugestions? cheers since you're using multi-files template, need fetch previous url history document.referrer . demo $('.selector').on('click', function (e) { e.preventdefault(); var page = document.referrer; $.mobile.changepage(page, { transition: 'flip', reloadpage: true, // optional, force page reload. reverse: true }); });

javascript - JS - Can't send php to js variable -

this question has answer here: pass php array javascript function [duplicate] 4 answers i'm working on gchart organization. in php able , echo text db. here have problem on how pass text db js. in here, have text db ( $data[nama] , $data[parnama] ), want use in js=> ['$data[nama]', '$data[parnama]', null], how can that? big help. update <?php $host="localhost"; $user="root"; $pass=""; $dbnama="skripsi"; mysql_connect($host, $user, $pass) or die ("database tidak dapat di akses"); mysql_select_db($dbnama); $query="select * tblarya"; $hasil=mysql_query($query); if($hasil === false) { die(mysql_error()); } while ($data=mysql_fetch_array($hasil)){ echo "<l...

c# - Dynamically adding columns to DataGridView as it gets expanded -

i'm working on ms office add-in has datagridview 5 columns. possible have many columns shown can fit sidebar, user re-sizes add-in sidebar add more or take away columns there becomes room them? u can use resize event of datagridview , add , remove (or set visibilty) of rows unwanted. i guess columns have given size , not sized automatically. in case u can: int columnstoshow = (int)(datagridview.size.width / columnwidth); now add enough rows match wanted number / remove rows or set visibility

java - How to differentiate between server errors and integrity constraint exceptions when using RPC? -

i have method on server side talking communicating client side code through rpc. @override public void registerstudent(param1, param2...) throws illegalargumentexception { //some code here try { //some code here } catch (constrainterrorviolationexception e) { throw new registerfailedexception(); } } i have chunk of code handling failures. @override public void onfailure(throwable caught) { displayerrorbox("could not register user", caught.getmessage()); } currently, onfailure() function not differentiate between random exceptions , specific exception looking deal , handle, registerfailedexception . how can handle 2 different sort of errors properly? so exception public class registerfailedexception extends runtimeexception { public registerfailedexception () { super(); } } and method throws exception throws new registerfailedexception(); then in onfailure() check if (caught instanc...

sql - Select a row from the group of row on a particular column value -

i want write query achieve following. have table xyz in there multiple row same column value(1) in column a. i want find in column b doesn't have particular value set of rows value 1 in column a. table xyz --------- b 1 te 1 1 re 2 te 2 re 3 ge 4 re so want find if column b not have value 'te' set of values column a when select xyz b <> 'te' group i 1,2,3 , 4 both result. but want result should contain 1 , 2. please help. select xyz (b<>'te') , ((a=1) or (a=2)) or variant select xyz (b<>'te') , (a in (1, 2))

csv - Python 2: IndexError: list index out of range -

i have "asin.txt" document: in,huawei1,de out,huawei2,uk out,huawei3,none in,huawei4,fr in,huawei5,none in,huawei6,none out,huawei7,it i'm opening file , make ordereddict : from collections import ordereddict reader = csv.reader(open('asin.txt','r'),delimiter=',') reader1 = csv.reader(open('asin.txt','r'),delimiter=',') d = ordereddict((row[0], row[1].strip()) row in reader) d1 = ordereddict((row[1], row[2].strip()) row in reader1) then want create variables (a,b,c,d) if take first line of asin.txt should like: a = in ; b = huawei1 ; c = huawei1 ; d = de . i'm using "for" loop: from itertools import izip (a, b), (c, d) in izip(d.items(), d1.items()): # here try: ....... it worked before, now, reason, prints error: d = ordereddict((row[0], row[1].strip()) row in reader) indexerror: list index out of range how fix that? probably have row in textfile not have @ least 2 f...

c++ - Invoking OLE in C# through OleCreateFromFile does not work for pdf files -

i trying embed pdf files open xml document. requires creating *.bin files. dont want use automation. approach ive taken this question works file types ive tested except *.pdf. for reason pdf files result olecreatefromfile(..) 0x80004005 , pole null. i new on field of invoking , ole. reason approach not working pdf? (i have newest adobe reader, win8, invoking ole32.dll, projects build target x86 , ive test call couninitialize() , coinitializeex((system.intptr)null, ole32.coinit.apartmentthreaded), able embed pdf files in msword application). here function use it: public static string exportolefile(string _inputfilename, string oleoutputfilename, string emfoutputfilename) { stringbuilder resultstring = new stringbuilder(); string newinput = multibytetounicodenetonly(_inputfilename, 1252); microsoft.visualstudio.ole.interop.istorage storage; var result = ole32.stgcreatestorageex(oleoutputfilename, ...

search variable and corresponding value in bash -

i have below sample file: jul 16 00:01:24 abc postfix/smtp[28719]: 51aeqwqwq06: to=<simon.naish@xyz.com>, relay=none, delay=0.17, delays=0.17/0/0/0, dsn=4.4.1, status=deferred (connect 127.0.0.1[127.0.0.1]:10026: connection refused) jul 16 00:01:36 abc postfix/smtp[28655]: e444qw002: to=<r-ff001101082d5bf235740884e558eea95@comms.frong.com>, relay=in.emailct.com[63.20.111.76]:25, delay=39, delays=0.06/0/0.92/38, dsn=2.1.5, status=deliverable (250 2.1.5 r-ff001101082d5bf2355ff8740884e558eea95@comms.thrwwsixtyabc.com ) jul 16 00:01:43 abc postfix/smtp[28815]: f19dwq003: to=<sullcrom@em1.sulivancromwell.com>, relay=em1.sullivancromwell.com[223.222.222.2]:25, delay=162708, delays=162705/0.3/1.6/0.62, dsn=4.2.2, status=deferred (host em1.sullivancromwell.com[223.222.222.2] said: 452 4.2.2 mailbox full (in reply rcpt command)) i want display highest integer value of "delay=" , corresponding line file. sample output: longest delay was: **162708** on ,...

ios - How to make the scrolling animation on a view -

so have uiscrollerview... each time 5 seconds passes scrollview should move up. setcontentoffset working doesnt have animation. should move slowly. my code below cgpoint bottomoffset = cgpointmake(0, newylocationforscrollview); [scroll setcontentoffset:bottomoffset animated:yes]; thanks in advance [uiview animationwithduration0.3f ^(void) { // code transition }]; uiview reference [scrollview setcontentoffset:offset animated:yes]; uiscrollview reference

Compile PIC assembly with NASM -

i'm looking compile asm file on netbook ubuntu 12.04 , nasm. try use following command hex: nasm -f elf myfile.asm . asm file pic16f628a. here content of myfile.asm : http://pastebin.com/rmaqhuv0 and there, part of errors got... zerokey.asm:6: error: parser: instruction expected zerokey.asm:7: error: label or instruction expected @ start of line zerokey.asm:8: error: parser: instruction expected zerokey.asm:14: error: parser: instruction expected zerokey.asm:15: error: parser: instruction expected zerokey.asm:16: error: symbol `de' redefined zerokey.asm:16: error: parser: instruction expected zerokey.asm:17: error: symbol `de' redefined zerokey.asm:17: error: parser: instruction expected zerokey.asm:18: error: symbol `de' redefined zerokey.asm:18: error: parser: instruction expected zerokey.asm:19: error: symbol `de' redefined zerokey.asm:19: error: parser: instruction expected zerokey.asm:20: error: symbol `de' redefined zerokey.asm:20: error:...

powershell - How to run a blinking text code in background -

i found code on internet ,working code of function blink text. using function in pwershell application . want blinking code run in background. function $function = { function blink-message { param([string]$message,[int]$delay,[int]$count,[consolecolor[]]$colors) $startcolor = [console]::foregroundcolor $startleft = [console]::cursorleft $starttop = [console]::cursortop $colorcount = $colors.length $line = "$message" for($i = 0; $i -lt $count; $i++) { [console]::cursorleft = $startleft [console]::cursortop = $starttop [console]::foregroundcolor = $colors[$($i % $colorcount)] [console]::writeline($message) start-sleep -milliseconds $delay } [console]::foregroundcolor = $startcolor } } # set-alias blink blink-message #write-host -nonewline "hello "; blink-message "blink" 1000 15 "red,black" | receive-job write-host -nonewline "hello1 "; start-job -...

eclipse - Unable to find stash/apply functionalitit in EGit -

Image
i'm working eclipse kepler , egit 3.0.0. can find git stash/apply functionality. i cannot find stash in package explorer team pop-up nor anywhere in team synchronizing perspective. after found it, hidden in "git repository view":

android - How can i enter in my application through notification? -

this code of notification. want onclick application starts. right nothing happen private void checknoti(){ notificationcompat.builder notificationbuilder = new notificationcompat.builder( service.this); notificationbuilder.setcontenttitle("title"); notificationbuilder.setcontenttext("context"); notificationbuilder.setticker("tickertext"); notificationbuilder.setwhen(system.currenttimemillis()); notificationbuilder.setsmallicon(r.drawable.ic_stat_icon); intent notificationintent = new intent(this, service.class); pendingintent contentintent = pendingintent.getactivity(this, 0, notificationintent, 0); notificationbuilder.setcontentintent(contentintent); notificationbuilder.setdefaults(notification.default_sound ...

How can I install Java on Ubuntu? -

how can install version on ubuntu. tried this: sudo apt-get install openjdk-7-jdk have tried syntax? sudo apt-get install openjdk-7-jdk=7u17-2.3.8-1ubuntu1 just careful exact version, should compatible os , should research specific configuration before copying , pasting 1 put. other dependency errors have check...

Application with libpcap can only capture all the packets when tcpdump is opened, or only can capture few packets,how to resolve it?thanks -

i have written application, uses libpcap capture packets. application can capture few packets, traffic several kbps. captured traffic on 10mbps if tcpdump opened. when tcpdump closed, captured traffic dropped several kbps again. anyone know why? thank much. if you're calling pcap_open_live() , you're passing 0 ''promisc'' argument. if you're calling pcap_create() , pcap_activate() , you're not calling pcap_set_promisc() between calls (or passing pcap_set_promisc() ''promisc'' argument of 0). i.e., you're not turning promiscuous mode on, machine capturing traffic , machine, not other traffic on network. tcpdump, default, turns promiscuous mode on, so, while it's running, adapter on you're capturing, same adapter 1 on tcpdump capturing, in promiscuous mode, , you'll see other traffic on network.

vb.net - How do i link Visual Studio applications over LAN -

i have created vs application , have installed copy on computer , wish link them via lan if settings canged in 1 , others setings saved . for example setting i created new name in sttings , call "adminin" , set type integer , scope user , set value 0 dim ai new .mysettings private sub button1_click(sender object, e eventargs) handles button1.click ai.adminin = ai.adminin + 1 ai.save() end sub now how can ai updated in other application on other computer . how connect via lan , accomplish ? i found link provides example code modify application-scoped variables my.settings might useful. i've tested out simple form timer , label showing me current value of adminin setting, , seems work. timer updates label on every instance of form checking reloaded my.settings value. variable need application scoped in order accessible users on machine may run executable. http://www.codeproject.com/articles/19211/changing-application-scoped-s...

php - Get openssl certificate expiration date -

i've parsed openssl certificate openssl_x509_parse() function , got array result. now need expiration time of certificate. in parsed array have validto_time_t element contains valid unix timestamp. how determine timezone timestamp belongs for? so can't real expiration time because timestamp because means deifferent dates on different timezones. php formats field using it's default timezone. can using http://docs.php.net/date_default_timezone_get function and once know timezone can convert utc or whatever need

node.js - emit socket.io and sailsjs (Twitter API) -

i got twits, i'm printing of them ok in console, send data view , don't know how can using socketio. any idea? var twittercontroller = { 'index': function(req,res) { var twitter = require('ntwitter'); var twit = new twitter({ consumer_key: '...', consumer_secret: '...', access_token_key: '...', access_token_secret: '...' }); twit.stream('statuses/filter', { track: ['dublin', 'spain']} , function(stream) { stream.on('data', function (data) { console.log(data.user.screen_name + ': ' + data.text); req.socket.emit('tweet', { user: data.user.screen_name, text: data.text }); }); }); res.view(); }, }; module.exports = twittercontroller; and in view i'm trying print twits <ul class="tw"></ul> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></scr...

sql server 2008 - SQL returning all rows in one table where a column valule is equal to matching column value joined to another table -

for example lets have table info contains columns: id - name - address have second table purchases contains columns: region - name - purchases multiple people can in same region, each person has 1 id. i want write query will, based on given id in info table, return rows in purchases of people live in same region person specified id. have done inner join on name 2 tables can't figure out best way write query. edit: main problem there no region column in info. way region joining purchases table. need results of rows containing region. i not sure if want twik bit better fit needs: select purchasse purchasse inner join info on info.name = purchasse.name info.id = yourid this should give purchasse given id name match 2 columns.

How Cassandra stores multicolumn primary key (CQL) -

i have little misunderstanding composite row keys cql in cassandra. let's have following cqlsh:testcql> create table note ( ... key int, ... user text, ... name text ... , primary key (key, user) ... ); cqlsh:testcql> insert note (key, user, name) values (1, 'user1', 'name1'); cqlsh:testcql> insert note (key, user, name) values (1, 'user2', 'name1'); cqlsh:testcql> cqlsh:testcql> select * note; key | user | name -----+-------+------- 1 | user1 | name1 1 | user2 | name1 how data stored? there 2 rows or one. if 2 how possible have more 1 row same key? if 1 having records key=1 , user "user1" "user1000" mean have 1 row key=1 , 1000 columns containing names each user? can explain what's going on on background? thanks. so, after diging bit more , reading article suggested lyuben todorov (thank you) found answer question. cassandr...

php - Make Chrome display pages even on 500 or 404 codes (behave like Firefox) -

we're developing new site in symfony. when symfony encounters error, such "no route found", , debug set true, not outputs 404 code, shows error on page. firefox displays server returned, chrome not. for no route found example: firefox shows this: http://i.imgur.com/myf85sl.png chrome shows this: http://i.imgur.com/hex19in.png is there way chrome behave firefox under these conditions? edit: there seems questioning of what's happening. don't know what's causing this, otherwise fix it. here's see in chrome network inspector (note image 500 error, same happens 404's): http://i.imgur.com/viowgry.png notice content length of zero. if go exact same url through firefox (same server, everything), shows actual symfony error. under monolog config in config_dev.yml, remove firephp/chromephp sections.

php - Having trouble with openssl_x509_parse() function -

i'm having trouble openssl_x509_parse() function $parsed_cert = openssl_x509_parse(file_get_contents('/home/my_location/aaa010101aaa__csd_01.cer')); the function returning false , i'm unsure reasons. maybe certificate file must in .pem or .crt ? edit: code ok, format of file issue, had transform .crt .cer original. after seeing example manual page , code seems fine. problem may in file_get_contents. please try following , check if file valid. $file = file_get_contents('/home/my_location/aaa010101aaa__csd_01.cer'); $parsed_cert = openssl_x509_parse($file); now check file. exists or valid certificate file?

Using EMF outside an Eclipse/RCP application? -

we have j2ee application deploy eg. tomcat. use magicdraw model , generate our modelcode. looking @ alternatives magicdraw. i have used emf: http://www.eclipse.org/modeling/emf/ but inside rcp application (handling dependencies through p2, maven/tycho). just quick glance @ mvnrepository not give many results (of course upload necessary dependencies manually our own ) http://mvnrepository.com/search.html?query=emf how emf work in non rcp/osgi application , there examples out there started? a few resources found: http://www.fosslc.org/drupal/content/emf-large-scale-modeling-outside-eclipse http://www.eclipsezone.com/eclipse/forums/t57389.html it's not entirely clear if asking way define models outside of rcp app or if want work generated models. it's relatively easy work emf regular java or java ee application. if keyword 'standalone' in emf faq find useful information.

asp.net mvc - Rdlc to PDF rendering slow -

we've been doing timing on of our slow pdf reports on our asp.net mvc3 web app, one in particular kinda blew our mind... sql - returned in few nundred milliseconds rdlc processing - few hundred miliseconds pdf generation - on 4 min i've found this: http://social.msdn.microsoft.com/forums/sqlserver/en-us/ca45fcc4-be69-410f-aaed-19b65f279330/reporting-services-sp1-slow-on-pdf-render and this: msdn page 2 explaining how address optimizing rdlc, wanted make sure wasn't doing stupid in c# code. here section takes rdlc , renders pdf, looks pretty simple, doing in optimal way? following best practices? // build byte stream answerbytes = localviewer.render( args.reporttype, args.deviceinfoxml, out mimetype, out encoding, out fnameext, out streamids, out warnings ); // send out vars client. args.minetype = mimetype; args.fnameext = fnameext; // dispose of local viewer when complete localviewer.dispose(); netloghdl.t...

awesome wm - Resizing Window Vertically -

i'm trying map awesome wm shortcuts similar tmux. tmux's alt+arrow combination resize pane in either dimension. i'm aware awesome's awful.tag.incmwfact() function work vertically or horizontally depending on layout. however, i'd function resizes in other dimension under same layout well. useful maximizing 1 of smaller windows vertically without invading space of largest window on other half of screen: +----------+----------+ | | | | | ^ | | +-----|----+ | | v | | | | +----------+----------+ i found awful.client.moveresize() function well, seems work in floating layout. know doable since can resize windows mouse, in tiling layouts. don't know function mouse hooks into. figured out, posting answer others need functionality well: awful.key({ modkey, "mod1" }, "right", function () awful.tag.incmwfact( 0.01) end), awful.key({ modkey, "m...

Why does Dictionary in C# Have a .Distinct() Extension? -

as title says, why dictionary collection in c# contain .distinct() extension if it's possible dictionary contain non-distinct keys? there legitimate reasoning behind or reading far it? dictionary<tkey, tvalue> implements ienumerable<keyvaluepair<tkey, tvalue>> has distinct extension. dictionary class doesn't have implementation of distinct calling distinct translated call static extension method: enueramble.distinct(ienumerable<t> source) which unneccesary dictionary since keys distinct (and hence key/value pairs distinct) technically there's nothing wrong it.

database design - One Form with Fields from two Tables -

i new access 2007 , trying create 1 form has multiple tabs on it. 4 of tabs represent information 1 table , 2 of tabs represent information second table. there relationship between 2 tables: enrollment table!id has lookup relationship medical info!id lookup. if there new record created using form, automatically assignes , id client record in enrollment table, corresponding record automaticaly created in medical info table. the problem having if create new client form, , move medical info table on form, can display id lookup results, however, no record created in medical info table unless enter data 1 field first. if makes sense, there way write record medical info table @ point client id created, establish relationship between "client id" , "id lookup" without having enter field first? without getting deep db or form, i'd venture guess @ doing need so: in form, @ point of entry of client id, use (after_update) trigger check see if new ...

Trying to read JSON file in Objective-C -

i trying read in json file in objective-c application, unfortunately getting runtimeexception. exact error is: *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'data parameter nil' my json file called "transactions.json [{ "transaction": "300001", "date": "1/1/11", "type": "abc", "status": "state1" }, { "transaction": "300002", "date": "2/2/12", "type": "xyz", "status": "state2" }, { "transaction": "300003", "date": "3/3/13", "type": "abc", "status": "state3" }, { "transaction": "300004", "date": "2/2/12", "type": "xyz", "status": "state2" }, { "transaction": "300005", "date...

sql server - how set value depending on a column value select statement t-sql. Like if 0 set 3, if less than 4 set 2 and so on -

i have column named photos, photos column of type tinyint , vary 0 8. want apply rank column when selecting data table. values want are: if record has 4 or more photos, receives rank of 1. because fair amount of photos 5, 6, 7 , 8. if record has between 1 , 3 set rank of 2, medium rank, , if has no photos set 3. , can sort records based on number of photos , make appliation consistent. sure, use case statement in order by. this: select * table order case when photos >= 4 1 when photos >= 1 2 else 3 end or if wanted actual column on table, add computed column: alter table mytable add rank case when photos >= 4 1 when photos >= 1 2 else 3 end

time - Groovy code gets faster and slower when using "@CompileStatic" -

i have following snipet of groovy code class test { // @groovy.transform.compilestatic static main(args) { long start = system.currenttimemillis() def x = "3967" println x ==~ /[0-9]+([1379])$/ println system.currenttimemillis()-start } } which supposed test weather x number ending in 1,3,7,or 9 i'm using groovy plugin eclipse, when want run code have few options, can either run groovy script, or java application. here runtimes. groovy script: 93ms java application: 125ms but when enable static compilation, happens groovy script: 0ms java application: 312ms i'm confused, 1. thought compiling java application supposed faster running groovy script. 2. why groovy script option gets faster static compilation, , java 1 gets longer?

mysql - #2002 - No connection could be made because the target machine actively refused it -

i realise seen duplicate have looked @ other responses , didn't fix problem me. i have installed zend studio , zend server mysql plugin on windows 7. i not qualified server administrator neither incompetent; have dedicated day trying local development 'server' cut down on upload/download times. when server/machine mean home computer i have come grinding halt trying mysql work zend server. the error keep receiving (or verbose): #2002 cannot log in mysql server or (if change 'config' authentication type) #2002 - no connection made because target machine actively refused it. server not responding (or local server's socket not correctly configured). i have tried: change $cfg['servers'][$i]['host'] 'localhost' '127.0.0.1' add/remove $cfg['servers'][$i]['socket'] = ''; change cookie config auth type reinstall server , mysql disable firewalls restarting machine zend's approach ...

asp.net mvc 3 - How to set the culture of all ValueProviderResult used in model binding to a given value? -

it turns out mvc's defaultmodelbinder uses different cultures in order parse values (e.g. double , datetime , etc.) post vs requests. here more info. i see controlled culture property of valueproviderresult objects, returned ivalueprovider.getvalue() . my question is: how can globally make sure value cultureinfo.invariantculture. i know can implement custom value providers , way. i know can implement custom model binders , way. i know can set culture in thread, unfortunately not option in case. what looking way set default model binder , existing value providers able parse in culture invariant way, irrespective of thread culture set to. as far know, there no way match criteria. will have 1 of things know can (i'd proper way custom value provider). reason: default valueproviders hardcoded use either cultureinfo.invariantculture or cultureinfo.currentculture . here, specifically, way formvalueprovider it: internal formvalueprovider( ...

mysql - What is the best data structure for "saved search" feature with daily email notifications? -

the feature works following way: website has users , users can have number of searches saved (e.g. jobs in ny, php jobs, etc). there lot of parameters involved virtually impossible index (i using mysql). every day number of new jobs posted website every 24 hours take jobs posted within last 24 hours , match them against existing job searches , email users matching jobs. the problem here is high-traffic website , optimistic case (few new jobs posted), takes 10 minutes run search query. there classical solutions problem? we've been using sphinx search-intensive places can't apply here because sphinx won't return results, cut them off eventually. best thing come have search.matched_job_ids column , whenever job posted, match against existing searches , record job id in matched_job_ids column of matched searches. @ end of day email users , truncate column. technically doesn't offer performance improvement spreads load on time executing many smaller search querie...

facebook - No option to create 'custom apps/tabs' in business page? -

this question has answer here: creating , managing facebook app business account [closed] 2 answers i'm trying add page tab, or referred custom app/tab our facebook business page when log our account can't find option anywhere. i logged in "manager" role, account page. i can log own personal facebook account , create apps pages manage no problem, difference want create tabs/app pages business page i'm working on. please appreciated, can't believe how hard find information on this. not sure if of in case try following, replace "your_app_id" , "your_url" id , url of app want add tab. " http://www.facebook.com/dialog/pagetab?app_id=your_app_id&next=your_url " source. http://developers.facebook.com/docs/appsonfacebook/pagetabs/ example http://www.facebook.com/dialog/pagetab?app_id=10245212...

web services - ServiceStack localized message text -

is there way set culture of error messages coming ss via incoming request client? can set culture of jsonservice client in fashion , have ss respond message text in culture. yes, can set current culture per request in pre-request filter: host.prerequestfilters.add((httpreq, httpresp) => { thread.currentthread.currentuiculture = defaultculture; if (httpreq.headers.allkeys.contains(httpheaderkeys.acceptlanguage)) { var cinfo = new cultureinfo(httpreq.headers[httpheaderkeys.acceptlanguage]); if (new resourcemanager(typeof(resourcefile)).getresourceset(cinfo, false, false) != null) thread.currentthread.currentuiculture = cinfo; } });

How to redirect users to a specific url after registration in django registration? -

so using django-registration app implement user registration page site. used django's backends.simple views allows users login after registration. question how redirect them other app's page located in same directory project. here main urls.py looks like: from django.conf.urls import patterns, include, url # uncomment next 2 lines enable admin: # django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', url(r'^accounts/', include('registration.backends.simple.urls')), url(r'^upload/', include('mysite.fileupload.urls')), # examples: # url(r'^$', 'mysite.views.home', name='home'), # url(r'^mysite/', include('mysite.foo.urls')), # uncomment admin/doc line below enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # uncomment next line enable admin: # url(r'^admin/', inclu...

python - pip not installing to site-packages directory from within virtualenv when I use a requirements.txt -

i'm relatively new running python virtualenv might easy fix, can't life of me figure out what's going on. i'm running windows 7 professional x64 python 2.7.5 installed have installed pip , virtualenv. have django project i'm attempting work on have cloned heroku repository. when attempt set virtualenv , install requirements of project i'm running strange error can't figure out. have setup follows: django project placed in c:\users\xxx\pythonprojects\myproject i open command prompt, cd myproject folder , execute following command: c:\users\xxx\pythonprojects\myproject> virtualenv --no-site-packages env this should create nice clean virtual environment project, go ahead , activate follows: c:\users\xxx\pythonprojects\myproject> scripts\activate the prompt changes indicate virtualenv has become active double check "where"ing python , pip: (env) c:\users\xxx\pythonprojects\myproject> python c:\users\xxx\pythonprojects\myp...

javascript - How to prevent default on form submit? -

if can prevent default on form submit fine: document.getelementbyid('my-form').onsubmit(function(e) { e.preventdefault(); // }); but since organizing code in modular way handling events this: document.getelementbyid('my-form').addeventlistener('onsubmit', my_func); var my_func = function() { // how prevent default here??? // } how can prevent default now? the same way, actually! demo some html <form id="panda" method="post"> <input type="submit" value="the panda says..."/> </form> your javascript // function var my_func = function(event) { alert("me , relatives owned china"); event.preventdefault(); }; // form var form = document.getelementbyid("panda"); // attach event listener form.addeventlistener("submit", my_func, true); note: when using .addeventlistener should use submit not onsubmit . note 2: because of w...

webstorm + typescript "unresolved variable" after adding reference path -

Image
i'm using latest webstorm eap 7 130.958. i have had buggy behavior since version 6 came out typescript support. problem in below example code applies "unresolved variable" baseclass in extendedclass.ts moment add ... ///<reference path="./interfaces.ts"/> if remove reference path error goes away. happens time extend class imported node module when reference path exists. how did make way through 6 7? interfaces.ts interface ibaseclass { str:string; } baseclass.ts ///<reference path="./interfaces.ts"/> export class baseclass implements ibaseclass{ constructor(public str:string){ return str+str; } } extendedclass.ts ///<reference path="./interfaces.ts"/> import baseclassmodule = module("./baseclass"); class extendedclass extends baseclassmodule.baseclass{ constructor(public str:string){ super(str); } } var extendedclass:extendedclass = new extendedclass(...

javascript - large amount of data into indexedDB in Firefox OS -

i have large amount of data want insert indexeddb database. the size of data 5mb. and more 77,000 row. and converted database "all.js" file this:- const alldata = [ { id: 1, en: "10th", ar: "arabic word" }, { id: 2, en: "1st", ar: "arabic word" }, { id: 3, en: "2nd", ar: "arabic word" }, { id: 4, en: "3rd", ar: "arabic word" }, { id: 5, en: "4th", ar: "arabic word" }, { id: 6, en: "5th", ar: "arabic word" }, { id: 7, en: "6th", ar: "arabic word" }, { id: 8, en: "7th", ar: "arabic word" }, { id: 9, en: "8th", ar: "arabic word" }, 77,000 ]; and code in html , javascript <!doctype html> <html> <head> <meta charset="utf-8"> <script src="all.js" type="text/javascript"></script> <script type="text/javascript...

FlowPlayer on Android Emulator not visible -

so i've made html works fine on laptop browser streams audio , tried making webview view flowplayer. i've enabled javascript, turned set plugin state on , installed flash player .apk on emulator. reason can't view audio player on webview. missing something? try using actual device. times apps don't work on emulator, work great on device.

file - Binary Safety redis -

in redis protocol specification, mentions that: "status replies not binary safe , can't include newlines." mean string/file binary safe? , why can't status replies in redis binary safe? a binary safe string parser accounts possible values 0 - 255 in single character within string, string not null terminated (it's length known otherwise). if string parser isn't binary safe, it's expecting null terminated string (a binary 0 @ of string). usually, string parser not binary safe. many parses expect normal printable characters , 0 @ end of string. if there not 0 @ end of kind of string, there segmentation fault. binary safe parsers parsing arbitrary data (may text or else). edit: "what mean string/file binary safe?" it's text parser binary safe, not string/file itself. however, if string called binary safe, suspect means null-terminated string standard ascii characters. "and why can't status replies in redi...

php - Issue with Doctrine/Symdony2.2.1 uploading files -

i've been working symfony project , i've been experiencing issues uploading files, wondered if point me in right direction? here's controller: <?php namespace file\irbundle\controller; use symfony\component\httpfoundation\request; use symfony\bundle\frameworkbundle\controller\controller; use file\irbundle\entity\file; use sensio\bundle\frameworkextrabundle\configuration\template; class defaultcontroller extends controller { public function indexaction() { return $this->render('fileirbundle:default:index.html.twig', array('name' => $name)); } public function upload() { if (null === $this->getfile()) { return; } $this->getfile()->move( $this->getuploadrootdir(), $this->getfile()->getclientoriginalname() ); $this->path = $this->getfile()->getclientoriginalname(); $this->file = null; } /** * @template() */ public function uploadaction(reque...