Daily Archives

Articles indexed Tuesday November 29 2011

Page 9/15 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Regex to get rid of everything past the first sentence in a string in php

    - by andufo
    I need to get rid of everything after the first dot (if there is more than 1 sentence), but at the same time, cases like e.g. have to be omited. Some line e.g., when people do something. Extra content. Some line (some parenthesis). Extra content. I need to get rid of the "Extra content.". The returning value should be: Some line e.g., when people do something. Some line (some parenthesis). So far I've come with this regex taken from other threads, but it only finds the dots and split the string into an array. preg_replace('/(?<!\.)\.(?!(\s|$|\,|\w\.))/','',$text); Any ideas? Thanks.

    Read the article

  • Beginning Haskell: "not in scope" Unprecedented error

    - by user1071838
    So I just started learning Haskell, and this (http://learnyouahaskell.com) nifty book is giving a lot of help. So yesterday I wrote in a text file doubleMe x = x + x and saved it as double.hs. So after saving that I open up my command prompt, CD to the right folder, type in "ghci" to get haskell started, and then type in >doubleMe 5 10 and everything seems to work. Now today, I do the same thing and this happens (actual copy paste from command line) . . . C:\Users\myName\haskell>ghci GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude> :l double.hs [1 of 1] Compiling Main ( double.hs, interpreted ) Ok, modules loaded: Main. *Main> doubleMe 5 <interactive>:1:1: Not in scope: `doubleMe' So basically, everything was working fine, but now haskell can't find the function I wrote in double.hs. Can anyone tell what is going on? I'm pretty lost and confused. This is just a guess but does it have to do with *Main at all? Thanks for the help.

    Read the article

  • Splitview with multiple detail views using storyboarding. Seen an example/tutorial?

    - by That Guy
    I'm trying to track down an example like Apple's MultipleDetailViews sample for UISplitViewController, but using storyboards. Their sample code provides functionality similar to what I'm after, I'm just having trouble getting it to work in my app that uses storyboards. It's driving me nuts! Anyone seen an example/tutorial? This is Apple's non storyboard version: http://developer.apple.com/library/ios/#samplecode/MultipleDetailViews/Introduction/Intro.html

    Read the article

  • How to modify/replace option set file when building from command line?

    - by Heinrich Ulbricht
    I build packages from a batch file using commands like: msbuild ..\lib\Package.dproj /target:Build /p:config=%1 The packages' settings are dependent on an option set: <Import Project="..\optionsets\COND_Defined.optset" Condition="'$(Base)'!='' And Exists('..\optionsets\COND_Defined.optset')"/> This option set defines a conditional symbol many of my packages depend on. The file looks like this: <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <DCC_Define>CONDITION;$(DCC_Define)</DCC_Define> </PropertyGroup> <ProjectExtensions> <Borland.Personality>Delphi.Personality.12</Borland.Personality> <Borland.ProjectType>OptionSet</Borland.ProjectType> <BorlandProject> <Delphi.Personality/> </BorlandProject> <ProjectFileVersion>12</ProjectFileVersion> </ProjectExtensions> </Project> Now I need two builds: one with the condition defined and one without. My attack vector would be the option set file. I have some ideas on what to do: write a program which modifies the option set file, run this before batch build fiddle with the project files and modify the option set path to contain an environment variable, then have different option sets in different locations But before starting to reinvent the wheel I'd like to ask how you would tackle this task? Maybe there are already means meant to support such a case (like certain command line switches, things I could configure in Delphi or batch file magic).

    Read the article

  • How to change last letter of filename to lowercase if it is a letter?

    - by Robert Buckley
    I have been given data which cannot be interpreted by my software unless it has a lowercase letter at the end. The data was delivered with an uppercase letter at the end. Somehow I need to first recursively loop through all folders and find whether the filename ends with a letter and then change it to lowercase. I think python could do this, but I don´t know how,. Any help would be great! yours, Rob

    Read the article

  • Passing get values mangles my urls

    - by SibLiant
    Just upgraded from 1.3 to 2.0.3 and I'm trying to migrate all the changes. I'm noticing that the following line echo $this->Html->link('Quote', array('controller'=>'crm_quotes', 'action'=>'index', $lead['id'].'/'.$crmContact['CrmContact']['id']), null); builds the url "/crm_quotes/index/15/21". When I click the link I'm taken to url: "/crm_quotes/index/15%2F212 so it's replacing the characters with the html # but it's ultimately breaking the link. When I manually edit the URL to the correct one: "/crm_quotes/index/15/21" the page loads. Can someone enlighten me? Should I be using the url function rather than link? I have a lot of pages that need multiple parameters passed in the url. I was using named parameters but after reading some comments by Mark Story I decided to stop the named parameters as he hinted at their possible removal from future versions.

    Read the article

  • Get the current location of the Gps? Showing the default one

    - by Gagandeep
    Need help Urgent!!!!! Did changes with help but still unsuccessful... I have to request location updates, but I am unsuccessful in implementing that... i modified the code but need help so that i can see the current location. PLEASE look through my code and help please.. I am learning this and new to this concept and android.. any help would be appreciated here is my code: package com.GoogleMaps; import java.util.List; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.Overlay; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Point; import android.graphics.drawable.Drawable; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.widget.Toast; public class MapsActivity extends MapActivity { /** Called when the activity is first created. */ private MapView mapView; private LocationManager lm; private LocationListener ll; private MapController mc; GeoPoint p = null; Drawable defaultMarker = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mapView = (MapView)findViewById(R.id.mapview); //show zoom in/out buttons mapView.setBuiltInZoomControls(true); //Standard view of the map(map/sat) mapView.setSatellite(false); // get zoom tool mapView.setBuiltInZoomControls(true); //get controller of the map for zooming in/out mc = mapView.getController(); // Zoom Level mc.setZoom(18); lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); ll = new MyLocationListener(); lm.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, ll); //Get the current location in start-up lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); ll = new MyLocationListener(); lm.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, ll); //Get the current location in start-up if (lm.getLastKnownLocation(LocationManager.GPS_PROVIDER) != null){ GeoPoint p = new GeoPoint( (int)(lm.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLatitude()*1000000), (int)(lm.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLongitude()*1000000)); mc.animateTo(p); } MyLocationOverlay myLocationOverlay = new MyLocationOverlay(); List<Overlay> list = mapView.getOverlays(); list.add(myLocationOverlay); } protected class MyLocationOverlay extends com.google.android.maps.Overlay { @Override public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { Paint paint = new Paint(); super.draw(canvas, mapView, shadow); GeoPoint p = null; // Converts lat/lng-Point to OUR coordinates on the screen. Point myScreenCoords = new Point(); mapView.getProjection().toPixels(p, myScreenCoords); paint.setStrokeWidth(1); paint.setARGB(255, 255, 255, 255); paint.setStyle(Paint.Style.STROKE); Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); canvas.drawBitmap(bmp, myScreenCoords.x, myScreenCoords.y, paint); canvas.drawText("I am here...", myScreenCoords.x, myScreenCoords.y, paint); return true; } } private class MyLocationListener implements LocationListener{ public void onLocationChanged(Location argLocation) { // TODO Auto-generated method stub p = new GeoPoint((int)(argLocation.getLatitude()*1000000), (int)(argLocation.getLongitude()*1000000)); Toast.makeText(getBaseContext(), "New location latitude [" +argLocation.getLatitude() + "] longitude [" + argLocation.getLongitude()+"]", Toast.LENGTH_SHORT).show(); mc.animateTo(p); mapView.invalidate(); // call this so UI of map was updated } public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } } protected boolean isRouteDisplayed() { return false; } } catlog: 11-29 17:40:42.699: D/dalvikvm(371): GC_FOR_MALLOC freed 6074 objects / 369952 bytes in 74ms 11-29 17:40:42.970: I/MapActivity(371): Handling network change notification:CONNECTED 11-29 17:40:42.980: E/MapActivity(371): Couldn't get connection factory client 11-29 17:40:43.190: D/AndroidRuntime(371): Shutting down VM 11-29 17:40:43.190: W/dalvikvm(371): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 11-29 17:40:43.280: E/AndroidRuntime(371): FATAL EXCEPTION: main 11-29 17:40:43.280: E/AndroidRuntime(371): java.lang.NullPointerException 11-29 17:40:43.280: E/AndroidRuntime(371): at com.google.android.maps.PixelConverter.toPixels(PixelConverter.java:71) 11-29 17:40:43.280: E/AndroidRuntime(371): at com.google.android.maps.PixelConverter.toPixels(PixelConverter.java:61) 11-29 17:40:43.280: E/AndroidRuntime(371): at com.GoogleMaps.MapsActivity$MyLocationOverlay.draw(MapsActivity.java:106) 11-29 17:40:43.280: E/AndroidRuntime(371): at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:42) 11-29 17:40:43.280: E/AndroidRuntime(371): at com.google.android.maps.MapView.onDraw(MapView.java:494) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.View.draw(View.java:6740) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.ViewGroup.drawChild(ViewGroup.java:1640) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.ViewGroup.drawChild(ViewGroup.java:1638) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.View.draw(View.java:6743) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.widget.FrameLayout.draw(FrameLayout.java:352) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.ViewGroup.drawChild(ViewGroup.java:1640) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.ViewGroup.drawChild(ViewGroup.java:1638) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.View.draw(View.java:6743) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.widget.FrameLayout.draw(FrameLayout.java:352) 11-29 17:40:43.280: E/AndroidRuntime(371): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1842) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.ViewRoot.draw(ViewRoot.java:1407) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.ViewRoot.performTraversals(ViewRoot.java:1163) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.os.Handler.dispatchMessage(Handler.java:99) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.os.Looper.loop(Looper.java:123) 11-29 17:40:43.280: E/AndroidRuntime(371): at android.app.ActivityThread.main(ActivityThread.java:4627) 11-29 17:40:43.280: E/AndroidRuntime(371): at java.lang.reflect.Method.invokeNative(Native Method) 11-29 17:40:43.280: E/AndroidRuntime(371): at java.lang.reflect.Method.invoke(Method.java:521) 11-29 17:40:43.280: E/AndroidRuntime(371): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 11-29 17:40:43.280: E/AndroidRuntime(371): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 11-29 17:40:43.280: E/AndroidRuntime(371): at dalvik.system.NativeStart.main(Native Method) 11-29 17:40:45.779: D/dalvikvm(371): GC_FOR_MALLOC freed 5970 objects / 506624 bytes in 1179ms 11-29 17:40:45.779: I/dalvikvm-heap(371): Grow heap (frag case) to 3.147MB for 17858-byte allocation 11-29 17:40:45.870: D/dalvikvm(371): GC_FOR_MALLOC freed 56 objects / 2304 bytes in 92ms 11-29 17:40:45.960: D/dalvikvm(371): GC_EXPLICIT freed 3459 objects / 196432 bytes in 74ms 11-29 17:40:48.310: D/dalvikvm(371): GC_EXPLICIT freed 116 objects / 41448 bytes in 68ms 11-29 17:40:49.540: I/Process(371): Sending signal. PID: 371 SIG: 9

    Read the article

  • ios 4.1 doesn't call Phonegap API

    - by Johannes Klauß
    I'm working on a cross platform app for Android 2.2 and iOS 4.1 (dev devices). On Android everything works fine (accelerometer and geolocation) even if it's a little laggy. On iOS it's way more smooth, but he doesn't call the Phonegap functions. That's my JS code: var watchID = null; var shaking = { left: false, right: true }; function startWatch() { // Update acceleration every 100 ms var options = { frequency : 100 }; watchID = navigator.accelerometer.watchAcceleration(function(acceleration) { if(acceleration.x < -8) { shaking.left = true; } else if(acceleration.x > 8) { shaking.right = true; } if(shaking.left && shaking.right) { navigator.notification.vibrate(500); shaking.left = false; shaking.right = false; stopWatch(); } }, null, options); } I just call it with <a href="" onclick="startWatch();">start Accel</a> But iOS doesn't react at all. Is there any special call you need to do in iOS?

    Read the article

  • max file upload size change in web.config

    - by Christopher Johnson
    using .net mvc 3 and trying to increase the allowable file upload size. This is what I've added to web.config: <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules runAllManagedModulesForAllRequests="true"> <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" /> <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" /> <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" /> </modules> <handlers> <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" /> </handlers> <security> <requestFiltering> <requestLimits maxAllowedContentLength="104857600"/> </requestFiltering> </security> *ignore the elmah stuff. it's still not allowing file sizes larger than 50MB and this should allow up to 100MB no? any ideas?

    Read the article

  • Converting excel files to python to frequency

    - by Jacob
    Essentially I've got an excel files with voltage in the first column, and time in the second. I want to find the period of the voltages, as it returns a graph of voltage in y axis and time in x axis with a periodicity, looking similar to a sine function. To find the frequency I have uploaded my excel file to python as I think this will make it easier- there may be something I've missed that will simplify this. So far in python I have: import xlrd import numpy as N import numpy.fft as F import matplotlib.pyplot as P wb = xlrd.open_workbook('temp7.xls') #LOADING EXCEL FILE wb.sheet_names() sh = wb.sheet_by_index(0) first_column = sh.col_values(1) #VALUES FROM EXCEL second_column = sh.col_values(2) #VALUES FROM EXCEL Now how do I find the frequency from this? Huge thanks to anyone who can help! Jacob

    Read the article

  • Prevent unauthorised write access to a part of filesystem or partition

    - by gaurav
    Hello all I have some very important system files which I want to protect from accidental deletion even by root user. I can create a new partition for that and mount it with readonly access but the problem is that I want my application which handles those system files to have write access to that part and be able to modify them. Is that possible using VFS? As VFS handles access to the files I could have a module inserted in the VFS layer which can see if there is a write access to that part then see the authorization and allow it or otherwise reject it. If not please provide me suggestions regarding how can such a system be implemented what would I need in that case. If there exists a system like this please suggest about them also. I am using linux and want to implement this in C, I think it would be possible in C only. Edit: There are such kind of programs implemented in windows which can restrict access to administrator even, to some important folders, would that be possible in linux?

    Read the article

  • What's wrong with this iCalendar event?

    - by rihallix
    I'm generating iCalendar events using PHP. They pass the validation checkers but won't add to Google Calendar or iCalendar. Help - what am I doing wrong? When I attempt to import I get "iCal can't read this calendar file. No events have been added to your calendar. Google just appears to import the calendar but it's not there. BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Foobar Name//NONSGML Foobar Name//EN BEGIN:VEVENT UID:20111129T103025-268Z@foobar DTSTAMP:20111210T103025Z DTSTART:20111210T210000Z DTEND:20111210T230000Z TRANSP: TRANSPARENT SUMMARY:Foobar - Book Fair - text DESCRIPTION: Foobar: Book Fair - text END:VEVENT END:VCALENDAR Should I addslashes or not write colons in my summary or description text? Here are the headers I'm writing out... header("Content-Type: text/Calendar"); header('Content-Disposition: inline; filename="calendar.ics"'); echo "BEGIN:VCALENDAR</br>"; echo "VERSION:2.0</br>"; echo "PRODID:-//$orgname//NONSGML $orgname//EN</br>"; echo "METHOD:REQUEST</p>"; // required by Outlook The file I'm generating has the extension .php (not .ics). Thanks for any insight into what I might be doing wrong. rihallix (PHP5.2 / Windows)

    Read the article

  • why OAuth request_token using openid4java is missing in the google's response?

    - by user454322
    I have succeed using openID and OAuth separately, but I can't make them work together. Am I doing something incorrect: String userSuppliedString = "https://www.google.com/accounts/o8/id"; ConsumerManager manager = new ConsumerManager(); String returnToUrl = "http://example.com:8080/isr-calendar-test-1.0-SNAPSHOT/GAuthorize"; List<DiscoveryInformation> discoveries = manager.discover(userSuppliedString); DiscoveryInformation discovered = manager.associate(discoveries); AuthRequest authReq = manager.authenticate(discovered, returnToUrl); session.put("openID-discoveries", discovered); FetchRequest fetch = FetchRequest.createFetchRequest(); fetch.addAttribute("email","http://schema.openid.net/contact/email",true); fetch.addAttribute("oauth", "http://specs.openid.net/extensions/oauth/1.0",true); fetch.addAttribute("consumer","example.com" ,true); fetch.addAttribute("scope","http://www.google.com/calendar/feeds/" ,true); authReq.addExtension(fetch); destinationUrl = authReq.getDestinationUrl(true); then destinationUrl is https://www.google.com/accounts/o8/ud?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.return_to=http%3A%2F%2Fexample.com%3A8080%2FgoogleTest%2Fauthorize&openid.realm=http%3A%2F%2Fexample.com%3A8080%2FgoogleTest%2Fauthorize&openid.assoc_handle=AMlYA9WVkS_oVNWtczp3zr3sS8lxR4DlnDS0fe-zMIhmepQsByLqvGnc8qeJwypiRQAuQvdw&openid.mode=checkid_setup&openid.ns.ext1=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0&openid.ext1.mode=fetch_request&openid.ext1.type.email=http%3A%2F%2Fschema.openid.net%2Fcontact%2Femail&openid.ext1.type.oauth=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Foauth%2F1.0&openid.ext1.type.consumer=example.com&openid.ext1.type.scope=http%3A%2F%2Fwww.google.com%2Fcalendar%2Ffeeds%2F&openid.ext1.required=email%2Coauth%2Cconsumer%2Cscope" but in the response from google request_token is missing http://example.com:8080/googleTest/authorize?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fud&openid.response_nonce=2011-11-29T17%3A38%3A39ZEU2iBVXr_zQG5Q&openid.return_to=http%3A%2F%2Fexample.com%3A8080%2FgoogleTest%2Fauthorize&openid.assoc_handle=AMlYA9WVkS_oVNWtczp3zr3sS8lxR4DlnDS0fe-zMIhmepQsByLqvGnc8qeJwypiRQAuQvdw&openid.signed=op_endpoint%2Cclaimed_id%2Cidentity%2Creturn_to%2Cresponse_nonce%2Cassoc_handle%2Cns.ext1%2Cext1.mode%2Cext1.type.email%2Cext1.value.email&openid.sig=5jUnS1jT16hIDCAjv%2BwAL1jopo6YHgfZ3nUUgFpeXlw%3D&openid.identity=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawk8YPjBcnQrqXW8tzK3aFVop63E7q-JrCE&openid.claimed_id=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawk8YPjBcnQrqXW8tzK3aFVop63E7q-JrCE&openid.ns.ext1=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0&openid.ext1.mode=fetch_response&openid.ext1.type.email=http%3A%2F%2Fschema.openid.net%2Fcontact%2Femail&openid.ext1.value.email=boxiencosi%40gmail.com why?

    Read the article

  • Silverlight 4 Default Button Service

    - by Mark Cooper
    For a few months I have been successfully using David Justices Default Button example in my SL 3 app. This approach is based on an attached property. After upgrading to SL4, the approach no longer works, and I get a XAML exception: "Unknown parser error: Scanner 2148474880" Has anyone succesfully used this (or any other) default button attached behaviours in SL4? Is there any other way to achieve default button behaviour in SL4 with the new classes that are available? Thanks, Mark

    Read the article

  • PHP is there a true() function?

    - by Gremo
    I'm writing a function to check all elements inside an array, returning a single boolean value. is there a true() function? function all($f, array $arr) { return empty($arr) ? false : array_reduce($arr, function($v1, $v2) use ($f) { return $f($v1) && $f($v2); }, true); } $test = array(1, 6, 2); $gte0 = function($v) { return $v >= 0; } var_dump(all($gte0, $test)); // True $test = array(true, true, false); $id = function($v) { return $v; } // <-- this is what i would avoid var_dump(all($id, $test)); // False all(true, $test); // NOT WORKING because true is not a function

    Read the article

  • Table not created by Hibernate

    - by User1
    I annotated a bunch of POJO's so JPA can use them to create tables in Hibernate. It appears that all of the tables are created except one very central table called "Revision". The Revision class has an @Entity(name="RevisionT") annotation so it will be renamed to RevisionT so there is not a conflict with any reserved words in MySQL (the target database). I delete the entire database, recreate it and basically open and close a JPA session. All the tables seem to get recreated without a problem. Why would a single table be missing from the created schema? What instrumentation can be used to see what Hibernate is producing and which errors? Thanks. UPDATE: I tried to create as a Derby DB and it was successful. However, one of the fields has a a name of "index". I use @org.hibernate.annotations.IndexColumn to specify the name to something other than a reserved word. However, the column is always called "index" when it is created. Here's a sample of the suspect annotations. @ManyToOne @JoinColumn(name="MasterTopID") @IndexColumn(name="Cx3tHApe") protected MasterTop masterTop; Instead of creating MasterTop.Cx3tHApe as a field, it creates MasterTop.Index. Why is the name ignored?

    Read the article

  • Specifying schema for temporary tables

    - by Tom Hunter
    I'm used to seeing temporary tables created with just the hash/number symbol, like this: CREATE TABLE #Test ( [Id] INT ) However, I've recently come across stored procedure code that specifies the schema name when creating temporary tables, for example: CREATE TABLE [dbo].[#Test] ( [Id] INT ) Is there any reason why you would want to do this? If you're only specifying the user's default schema, does it make any difference? Does this refer to the [dbo] schema in the local database or the tempdb database?

    Read the article

  • CakePHP. How can i make a model test in a table with another primary key?

    - by Marcelo
    I have this table CREATE TABLE myexamples.problems ( id INT, name VARCHAR(45) NULL , pk_id INT AUTO_INCREMENT PRIMARY KEY ); But when I try test a model in cakephp, it fails because the table has two autoincrement attributes. The following query CREATE TABLE `test_suite_problems` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) DEFAULT NULL, `pk_id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`pk_id`) ) DEFAULT CHARSET=latin1, COLLATE=latin1_swedish_ci, ENGINE=InnoDB; raise this error: "1075: Incorrect table definition; there can be only one auto column and it must be defined as a key" I have in the model class <?php class Problem extends AppModel { var $name = 'Problem'; var $displayField = 'name'; var $primaryKey='problems'; } ?> But I don't know how to make the field ID not having an autoincrement attribute, and I can't change the table structure.

    Read the article

  • How do I select the number of distinct days in a date range?

    - by isme
    I'm trying to use the T-SQL function DATEDIFF to select the number of distinct dates in a time period. The following query: SELECT DATEDIFF(DAY, '2012-01-01 01:23:45', '2012-01-02 01:23:45') selects 1, which is one less than I want. There are two distinct dates in the range: 2012-01-01 and 2012-01-02. It is not correct to add one to the result in the general case. The following query: SELECT DATEDIFF(DAY, '2012-01-01 00:00:00', '2012-01-02 00:00:00') selects 1, which is correct, because there is only one distinct date in the range. I'm sure there is a simple bit of arithmetic that I'm missing to calculate this. Can someone help me?

    Read the article

  • JQuery in ASP.NET - Form Validation Issue

    - by user1026288
    It's not working at all and I'm not sure why. Ideally I'd like to have all the errors pop up in a modal dialog box. But right now I can't even get it to work normally. Any help would be appreciated. Thanks. HTML <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script> <script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js" type="text/javascript"></script> <script src="../Scripts/Frame.js" type="text/javascript"></script> </head> <body runat="server" id="bodyLogin"> <div runat="server" id="frameLogin"> <form runat="server" id="formLogin"> <asp:CheckBox runat="server" ID="checkboxRemember" /> <div><span id="un">Username</span><div id="forgotUsername">?</div><br /> <asp:TextBox runat="server" ID="textUsername" Name="username" /></div> <div><span id="pw">Password</span><div id="forgotPassword">?</div><br /> <asp:TextBox runat="server" ID="textPassword" Name="password" TextMode="Password" /></div> <asp:Button runat="server" ID="buttonLogin" Text="L" /> <asp:Button runat="server" ID="buttonRegister" Text="R" /> </form> </div> <div id="dialog" title="Errors" style="display:none;"><ul></ul></div> </body> </html> JQuery <script type="text/javascript"> $(function () { $("#formLogin").validate({ rules: { username: { required:true, minlength:3, maxlength:15 }, password: { required:true, minlength:6, maxlength:15 }, }, messages: { username: { required: "Username is required.", minlength: "Username minimum length is 3 characters.", maxlength: "Username maxumum length is 15 characters." }, password: { required: "Password is required.", minlength: "Password minumum length is 6 characters.", maxlength: "Password maximum length is 15 characters." } } }); }); </script>

    Read the article

  • Sending http headers with python

    - by Niklas R
    I've set up a little script that should feed a client with html. import socket sock = socket.socket() sock.bind(('', 8080)) sock.listen(5) client, adress = sock.accept() print "Incoming:", adress print client.recv(1024) print client.send("Content-Type: text/html\n\n") client.send('<html><body></body></html>') print "Answering ..." print "Finished." import os os.system("pause") But it is shown as plain text in the browser. Can you please tell what I need to do ? I just can't find something in google that helps me.. Thanks.

    Read the article

  • How to handle downgrade subscription for SaaS application

    - by user635800
    I am currently launching a SaaS web application. I want to have subscription packages such as: Premium: 5 users, 20 widgets, 20 MB storage Basic: 2 users, 10 widgets, 50 MB storage I want to allow companies to upgrade and downgrade packages at any time. The problem I am having is what if the company is on the premium package and has 5 users, 20 widgets, and wants to downgrade to the "basic" package. How do I handle that? Do I flag an error and say "You cannot downgrade" or do I take them to a page to remove the "extra" users and widgets? Any advice or examples of how other companies do it would be great!!

    Read the article

  • SL: Showcase

    - by xamlnotes
    One of the sites I go to frequently is www.silverlight.net/showcase. Theres always new stuff showing up here and it gives me tons of ideas. The business section is also awesome because it has tons of samples of great applications that should really jog your brain for ideas. One of the great things about SL and WPF is how we can break the mold of application design and come up with truly great new applications for our   users. That’s one are where the showcase can help to get new ideas on things you can do.

    Read the article

  • SL: Silverlight 5

    - by xamlnotes
    Check out this new demo from MIX11. http://code.msdn.microsoft.com/silverlight/3D-Housebuilder-demo-from-def4af04 SL 5 is the next big step for great apps in SL. This new release is adding more features to an already great technology.  You can find out more about this release at http://www.microsoft.com/silverlight/future/ . I particularly like the new features for business applications such as the next text improvements and making the combo box type ahead right out of the box. Plus there are more enhancements for databinding too.  And the list goes on and on with features such as performance and “trusted application”. Where is Sl 5 now? its in Release Candidate now so the final bits should not be far down the road.

    Read the article

  • 250k connections for comet with node.js

    - by Nenad
    How to implement node.js to be able to handle 250k connections as comet server (client side we use socket.io)? Would the use of nginx as proxy/loadbalancer be the right solution? Or will HA-Proxy be the better way? Has anyone real world experience with 100k+ connections and can share his setup? Would a setup like this be the right one (Quad core CPU per server - start 4 Instances of node.js per Server?): nginx (as proxy / load balancing server) / | \ / | \ / | \ / | \ node server #1 node server #2 node server #3 4 instances 4 instances 4 instances

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15  | Next Page >