Posts

Php - Delimiter must not be alphanumeric or backslash -

this question has answer here: delimiter must not alphanumeric or backslash , preg_match 5 answers this question has been asked don't know how fix problem in situation. getting following php errror: php message: php warning: preg_match(): delimiter must not alphanumeric or backslash in... on line 227 line 227 following: if (preg_match($match, $_server['http_user_agent'])) and function: $oslist = array ( 'windows 3.11' => 'win16', 'windows 95' => '(windows 95)|(win95)|(windows_95)', 'windows 98' => '(windows 98)|(win98)', 'windows 2000' => '(windows nt 5.0)|(windows 2000)', 'windows xp' => '(windows nt 5.1)|(windows xp)', 'windows server 2003' => '(windows nt 5.2)', 'windows vista' => '(windows nt 6.0)', 'w...

autotools - How can I use gettext before install? -

to use gettext, need call bindtextdomain(), providing patch installed .mo files. instance: bindtextdomain("myappname", "/opt/gnome/share/locale"); of course, use defines there, set autotools build files. however, i'd use gettext before running "make install", because want use translations in "make check" tests. the path bindtextdomain() contain .mo files in structure this: de/lc_messages/myappname.mo fr/lc_messages/myappname.mo is there easy way create structure of generated files in local build, can pass local path bindtextdomain() during "make check"?

algorithm - Generate unique 12 letter alphanumeric string from two primary keys of table in php -

i have 2 tables: category(cat_id type int,cat_name) , books(book_id type int,cat_id) . when assign book user book code . want form book code containing 12 alphanumeric characters , must originated cat_id , book_id . should able decode code cat_id , book_id . idea?. ok here go... this can handle max signed integer types. , produces no more 12 characters. $firstid = "2147483646"; $secondid = "2147483646"; $firstbinary = str_pad(base_convert($firstid, 10, 2), 31, "0", str_pad_left); $secondbinary = str_pad(base_convert($secondid, 10, 2), 31, "0", str_pad_left); $finalbase36 = str_pad(base_convert($firstbinary.$secondbinary, 2, 36), 12, "0", str_pad_left); var_dump($finalbase36); update: sorry made mistake.. should trik updated code.

jquery - using a css3 animation to load a website -

i came across website other day , wondering how create same page load effect. jquery? or css3 animations using sprites? http://www.adhamdannaway.com/ after inspecting site found loading logo made of sprite image (black logo next grey logo). effect creates logo being "filled up" page loads (linear effect going up) have feeling overlaying black logo grey 1 , fading grey logo out in linear direction either using jquery , css3, or both. thanks in advance then need use ajax call content, , while content getting loaded, can show animation. when content loaded can make ajax animation in screen. the animations page site, might done jquery well. i did similar ajax myself. try out.

facebook - PHP $POST If statement -

okay, issue having have simple textarea should sent entered page, should 'thanks' when submitted, , should prompt entry if nothing entered, however, when enter nothing still says 'thanks' im sure simple enough. here code index.php <form method="post" action="translate.php"> <name="status" cols="50" rows="5"> what's on mind? </textarea><br> <input type="submit" value="translate status" /> and translate.php <?php $status = $_post['status']; if($status == ""){ echo "please enter status."; } else { echo "thanks"; } ?> i have tried using above code in index.php got error 'status' variable. while asking, how go having popup error on main page rather redirecting translate.php 1.you forgot write textarea . <textarea name="status" cols="50" rows="5"> what's ...

java - What is the purpose of the {} outside of any methods? -

this question has answer here: why java code in curly braces ({}) outside of method? 3 answers java empty block scope 3 answers i accidently made pair of {} outside of method , worked. public static void main(string[] args) { system.out.println("ddd"); } { system.out.println("ttt"); } of course if run code result "ddd" , writes "ttt" if create new instance of it. and if make static {system.out.println("ttt");} works designed , result "ttt" "ddd" is there practical use of this? why use contructor or without written constructor? my impressions are: seems working, smells bad , strange practice. right? is there practical use of this? there 1 "idiom" makes use of insta...

ASP.NET UpdateProgress not disappearing after redirect to another page -

i have page updatapanel , updateprogress on it. in page redirect download page responsible downloading generated file. redirecting download page occurs in updatepanel via 1 of controls click event. problem after downloading file updateprogress not disappear. (i set contenttype of download page proper mime type) i found way download file in 1 of events in update panel. used frame this. onclick event add inline iframe page address of file. var script = @" var iframe = document.createelement(""iframe""); iframe.src = '{0}'; iframe.style.display = ""none""; document.body.appendchild(iframe);"; scriptmanager.registerstartupscript(string.format(script, url)); this solved problem.

java - converting blob to an image stream and assign it to jLabel -

i trying convert blob string in database byte array , after converting convert buffered image , assign label here's code package ims.project; import java.sql.*; import javax.swing.*; import java.awt.*; import java.awt.image.bufferedimage; import java.io.bytearrayinputstream; import javax.imageio.imageio; public class readingdata extends jframe { readingdata() { jpanel pane = new jpanel(); jlabel label1 = new jlabel("help"); jlabel label2 = new jlabel("33"); pane.add(label1); pane.add(label2); setvisible(true); add(pane); try { class.forname("com.mysql.jdbc.driver"); connection con = drivermanager.getconnection("jdbc:mysql://localhost:3306/ims1", "root", "root"); statement st = con.createstatement(); string ss = "select pic supplier supplier_id= '" + label2.gettext() + "'...

ios - Start playing an audio file when application goes in background -

it's "google maps" navigate in background. i have added "app plays audio" "required background modes" already, doesn't work. what's wrong it? here sample source code: -(void)applicationdidenterbackground:(uiapplication *)application { uidevice* device = [uidevice currentdevice]; bool backgroundsupported = no; if ([device respondstoselector:@selector(ismultitaskingsupported)]) { backgroundsupported = device.multitaskingsupported; } if (backgroundsupported && _bgtask==uibackgroundtaskinvalid ) { uiapplication* app = [uiapplication sharedapplication]; dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ while (app.applicationstate==uiapplicationstatebackground && _bgtask!=uibackgroundtaskinvalid) { [nsthread sleepfortimeinterval:3]; [self playaudio]; } [app endbackgroundtask:_bgtask]; _bgtask = uibackgroundtaski...

jquery ui - Dynamically change the handle option in the stop event -

all,i knew how use handle in jquery ui draggable , sortable. , knew can modify dragged item html content , css style in stop event. don't know if there possibility dynamically add handle selector drag item in stop event? please review below code . thanks. $( ".selector" ).draggable({ connecttosortable : '.sortablediv', stop: function( event, ui ) { //do nothing } }); $(".sortablediv").sortable({ stop:function(event,ui){ $(ui.item).prependto( $('<div>drag handler</div>').addclass('draghandler'));//append elements //next want make div.draghandler drag handle . } }); i found way make it. add handle option no matter whether selector can retrieve elements it. if doesn't find element there no handle drag . otherwise works. please review code. thanks. $(".sortablediv").sortable({ stop:function(event,ui){ $(ui.item).prependto( $('<div>drag ...

sql - How to scope with "where", "having" and "or" -

i understand possible do scope :public_visible, where("(status = ?) or (end_date > ?)", :published, date.today) but want combining following 2 scopes or scope :succeeded, having("sum(orders.sum) >= goal") scope :ongoing, where("end_date >= ?", date.today) is possible? either in sql or activerecord ways. thanks everyone. not perfect solution ended doing scope :succeeded_or_ongoing, where("id in (?) or id in (?)", project.succeeded.map(&:id), project.ongoing.map(&:id))

javascript - Nicedit editor image upload -

i using "niceedit" editor in website anyhow working charm massage when trying "upload" image editor. "there error uploading image (sending image imageshack failed." i , found has change niceuplod file , must api key . so change way in calling editor following : bklib.ondomloaded(function() { niceditors.alltextareas(new niceditor({maxheight : 250}).panelinstance('contect')); }); $('form').submit(function(){ niceditors.findeditor('contect').savecontent(); //console.log(niceditors.findeditor('contect').getcontent()); }); 1 bklib.ondomloaded(function() { new niceditor({ buttonlist : ['bold','italic','underline','upload'], iconspath:'niceditoricons.gif', uploaduri : 'nicupload.php', }).panelinstance('contect'); }); got following error top.nicuploadbutton undefined , in console followin...

cruisecontrol.net - CCNet AsseblyInfo update is not working. is there an issue with my config? -

below config using though force build doing check-in, version number of assemblies not updated. probably missing thing. note: new build servers , first. have lot of assemblyinfo.cs files, under different projects. do need use msbuildtaks around this? if can example. <cruisecontrol xmlns:cb="urn:ccnet.config.builder" xmlns="http://thoughtworks.org/ccnet/1/8"> <!-- preprocessor settings --> <cb:define artifactsdir="\artifacts" /> <cb:define productnamecompanysvnpath = "d:\companysvn\trunk\source\"/> <cb:define tortoisesvnexe = "c:\program files\tortoisesvn\bin\svn.exe"/> <cb:define svnpathtobuild = "http://dummy.mummy.com/svn/company/branches/branch-meau/" /> <cb:define nantexecutablepath = "c:\program files\nant\bin\nant.exe"/> <cb:define branchnameci="_br_meau_ci"/> <cb:define buildmode = "release"/> <cb:define platformc...